diff --git a/.changelog/en.md b/.changelog/en.md index 17942d6faa..6c5e373965 100644 --- a/.changelog/en.md +++ b/.changelog/en.md @@ -1,15 +1,27 @@ -# v2.0.22 +# v2.1.0 -2026-04-13 +2026-06-23 + +**🆕 New Features** + +- **@visactor/vchart**: markLine expandDistancesupport callback. close#4568 +- **@visactor/vchart**: support function type for `maxRow` / `maxCol` of the discrete legend, evaluated during layout against the legend's allocated rect, so the row / column count can adapt to the available space **🐛 Bug Fixes** -- **@visactor/vchart**: correct stacked bar corner clipping when barMinHeight is applied (Issue #4543) -- **@visactor/vchart**: relayout api not work bug. fix#4537 -- **@visactor/vchart**: custom mark not release after update spec. fix#4537 -- **@visactor/vchart**: map error when roam or drag canvas. fix#4547 -- **@visactor/vchart**: handle sankey tooltip labels when source index is 0 (Issue #4488) +- **@visactor/vchart**: waterfall lead line bug. fix#4580 +- **@visactor/vchart**: preserve discrete legend filtering after updateSpec when `legends.data` is a callback (Issue #4566) +- **@visactor/vchart**: re-nice the cartesian linear axis with the real plot-area length after layout when `tick.tickCount` is a function, so the length-based tick count and nice ceiling match the final plot area instead of the pre-layout chart viewRect +- **@visactor/vchart**: vchart relayout api not work bug. fix#4537 +- **@visactor/vchart**: label not follow when drag. fix#4547 +- **@visactor/vchart**: prcoess render error. fix#4578 + +**🔨 Chores** + +- **@visactor/vchart**: update changes for 009-fix-map-roam-pointer-drag: This plan fixes a map roam drag bug where mobile browsers lose stable vertical dragging after supportsTouchEvents is forced to false +- **@visactor/vchart**: introduce scoped updateSpec effects to make chart, component, series, data, layout, render, and animation update ranges explicit; local component updates such as marker exit, title text, legend appearance, axis appearance, mark style, field, label, animation, and layout-related series changes now avoid unnecessary chart remake/recompile paths when the existing chart model can be updated in place +- **@visactor/vchart**: align VChart with the VRender 1.1.0 app-scoped runtime, state resolver, and animation contracts while keeping standard VChart spec usage compatible; consolidate mark shared-state handling, glyph sub-graphic state isolation, word-cloud scaleIn initialization, and interaction-state behavior for Sankey, brush, legend textures, marker rich text, and circular progress tick masks -**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.20...v2.0.22 +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.20...v2.1.0 -[more detail about v2.0.22](https://github.com/VisActor/VChart/releases/tag/v2.0.22) +[more detail about v2.1.0](https://github.com/VisActor/VChart/releases/tag/v2.1.0) diff --git a/.changelog/harmony.md b/.changelog/harmony.md index 17942d6faa..6c5e373965 100644 --- a/.changelog/harmony.md +++ b/.changelog/harmony.md @@ -1,15 +1,27 @@ -# v2.0.22 +# v2.1.0 -2026-04-13 +2026-06-23 + +**🆕 New Features** + +- **@visactor/vchart**: markLine expandDistancesupport callback. close#4568 +- **@visactor/vchart**: support function type for `maxRow` / `maxCol` of the discrete legend, evaluated during layout against the legend's allocated rect, so the row / column count can adapt to the available space **🐛 Bug Fixes** -- **@visactor/vchart**: correct stacked bar corner clipping when barMinHeight is applied (Issue #4543) -- **@visactor/vchart**: relayout api not work bug. fix#4537 -- **@visactor/vchart**: custom mark not release after update spec. fix#4537 -- **@visactor/vchart**: map error when roam or drag canvas. fix#4547 -- **@visactor/vchart**: handle sankey tooltip labels when source index is 0 (Issue #4488) +- **@visactor/vchart**: waterfall lead line bug. fix#4580 +- **@visactor/vchart**: preserve discrete legend filtering after updateSpec when `legends.data` is a callback (Issue #4566) +- **@visactor/vchart**: re-nice the cartesian linear axis with the real plot-area length after layout when `tick.tickCount` is a function, so the length-based tick count and nice ceiling match the final plot area instead of the pre-layout chart viewRect +- **@visactor/vchart**: vchart relayout api not work bug. fix#4537 +- **@visactor/vchart**: label not follow when drag. fix#4547 +- **@visactor/vchart**: prcoess render error. fix#4578 + +**🔨 Chores** + +- **@visactor/vchart**: update changes for 009-fix-map-roam-pointer-drag: This plan fixes a map roam drag bug where mobile browsers lose stable vertical dragging after supportsTouchEvents is forced to false +- **@visactor/vchart**: introduce scoped updateSpec effects to make chart, component, series, data, layout, render, and animation update ranges explicit; local component updates such as marker exit, title text, legend appearance, axis appearance, mark style, field, label, animation, and layout-related series changes now avoid unnecessary chart remake/recompile paths when the existing chart model can be updated in place +- **@visactor/vchart**: align VChart with the VRender 1.1.0 app-scoped runtime, state resolver, and animation contracts while keeping standard VChart spec usage compatible; consolidate mark shared-state handling, glyph sub-graphic state isolation, word-cloud scaleIn initialization, and interaction-state behavior for Sankey, brush, legend textures, marker rich text, and circular progress tick masks -**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.20...v2.0.22 +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.20...v2.1.0 -[more detail about v2.0.22](https://github.com/VisActor/VChart/releases/tag/v2.0.22) +[more detail about v2.1.0](https://github.com/VisActor/VChart/releases/tag/v2.1.0) diff --git a/.changelog/zh.md b/.changelog/zh.md index 1d23a8650d..dd802e9c0d 100644 --- a/.changelog/zh.md +++ b/.changelog/zh.md @@ -1,15 +1,27 @@ -# v2.0.22 +# v2.1.0 -2026-04-13 +2026-06-23 + +**🆕 新增功能** + +- **@visactor/vchart**: markLine expandDistancesupport callback. close#4568 +- **@visactor/vchart**: 支持 function type for `maxRow` / `maxCol` of the discrete 图例, evaluated during layout against the 图例's allocated rect, so the row / column count can adapt the available space **🐛 问题修复** -- **@visactor/vchart**: correct stacked bar corner clipping when barMinHeight is applied (问题 #4543) -- **@visactor/vchart**: relayout api not work 问题. fix#4537 -- **@visactor/vchart**: custom mark not release after update spec. fix#4537 -- **@visactor/vchart**: map error when roam or drag canvas. fix#4547 -- **@visactor/vchart**: handle sankey Tooltip labels when source index is 0 (问题 #4488) +- **@visactor/vchart**: waterfall lead line 问题. fix#4580 +- **@visactor/vchart**: preserve discrete 图例 filtering after updateSpec when `legends.data` is a callback (问题 #4566) +- **@visactor/vchart**: re-nice the cartesian 线性坐标轴 with the real plot-area length after layout when `tick.tickCount` is a function, so the length-based tick count and nice ceiling match the final plot area instead of the pre-layout chart viewRect +- **@visactor/vchart**: vchart relayout api not work 问题. fix#4537 +- **@visactor/vchart**: label not follow when drag. fix#4547 +- **@visactor/vchart**: prcoess render error. fix#4578 + +**🔨 维护与杂项** + +- **@visactor/vchart**: 更新 changes for 009-fix-map-roam-pointer-drag: This plan fixes a map roam drag 问题 where mobile browsers lose stable vertical dragging after supportsTouchEvents is forced false +- **@visactor/vchart**: introduce scoped updateSpec effects make chart, component, series, data, layout, render, and animation update ranges explicit; local component updates such as marker exit, title text, 图例 appearance, axis appearance, mark style, field, label, animation, and layout-related series changes now avoid unnecessary chart remake/recompile paths when the existing chart model can be updated in place +- **@visactor/vchart**: align VChart with the VRender 1.1.0 app-scoped runtime, state resolver, and animation contracts while keeping standard VChart spec usage compatible; consolidate mark shared-state handling, glyph sub-graphic state isolation, word-cloud scaleIn initialization, and interaction-state behavior for Sankey, brush, 图例 textures, marker rich text, and circular progress tick masks -**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.20...v2.0.22 +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.20...v2.1.0 -[更多详情请查看 v2.0.22](https://github.com/VisActor/VChart/releases/tag/v2.0.22) +[更多详情请查看 v2.1.0](https://github.com/VisActor/VChart/releases/tag/v2.1.0) diff --git a/common/changes/@visactor/vchart/009-fix-map-roam-pointer-drag_2026-03-19-08-23.json b/common/changes/@visactor/vchart/009-fix-map-roam-pointer-drag_2026-03-19-08-23.json deleted file mode 100644 index e48d4b4bb6..0000000000 --- a/common/changes/@visactor/vchart/009-fix-map-roam-pointer-drag_2026-03-19-08-23.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "update changes for 009-fix-map-roam-pointer-drag: This plan fixes a map roam drag bug where mobile browsers lose stable vertical dragging after supportsTouchEvents is forced to false", - "type": "none", - "packageName": "@visactor/vchart" - } - ], - "packageName": "@visactor/vchart", - "email": "lixuef1313@163.com" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/develop_2026-04-22-10-05.json b/common/changes/@visactor/vchart/develop_2026-04-22-10-05.json deleted file mode 100644 index 207b53038f..0000000000 --- a/common/changes/@visactor/vchart/develop_2026-04-22-10-05.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "feat: markLine expandDistancesupport callback. close#4568", - "type": "none" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/develop_2026-05-12-07-05.json b/common/changes/@visactor/vchart/develop_2026-05-12-07-05.json deleted file mode 100644 index 4ab01d2014..0000000000 --- a/common/changes/@visactor/vchart/develop_2026-05-12-07-05.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "fix: waterfall lead line bug. fix#4580", - "type": "none" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/feat-discrete-legend-maxrow-maxcol-fn_2026-06-19-00-47.json b/common/changes/@visactor/vchart/feat-discrete-legend-maxrow-maxcol-fn_2026-06-19-00-47.json deleted file mode 100644 index f290803977..0000000000 --- a/common/changes/@visactor/vchart/feat-discrete-legend-maxrow-maxcol-fn_2026-06-19-00-47.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "feat: support function type for `maxRow` / `maxCol` of the discrete legend, evaluated during layout against the legend's allocated rect, so the row / column count can adapt to the available space", - "type": "minor", - "packageName": "@visactor/vchart" - } - ], - "packageName": "@visactor/vchart", - "email": "chendaxin.tk@bytedance.com" -} diff --git a/common/changes/@visactor/vchart/fix-legend-filter-after-updatespec_20260421.json b/common/changes/@visactor/vchart/fix-legend-filter-after-updatespec_20260421.json deleted file mode 100644 index 05cfdb91f7..0000000000 --- a/common/changes/@visactor/vchart/fix-legend-filter-after-updatespec_20260421.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "fix: preserve discrete legend filtering after updateSpec when `legends.data` is a callback (Issue #4566)", - "type": "patch" - } - ], - "packageName": "@visactor/vchart", - "email": "openai@example.com" -} diff --git a/common/changes/@visactor/vchart/fix-linear-axis-relayout-nice_2026-06-12-08-00.json b/common/changes/@visactor/vchart/fix-linear-axis-relayout-nice_2026-06-12-08-00.json deleted file mode 100644 index 26d5d24c6d..0000000000 --- a/common/changes/@visactor/vchart/fix-linear-axis-relayout-nice_2026-06-12-08-00.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: re-nice the cartesian linear axis with the real plot-area length after layout when `tick.tickCount` is a function, so the length-based tick count and nice ceiling match the final plot area instead of the pre-layout chart viewRect", - "type": "patch", - "packageName": "@visactor/vchart" - } - ], - "packageName": "@visactor/vchart", - "email": "chendaxin.tk@bytedance.com" -} diff --git a/common/changes/@visactor/vchart/fix-map-bug_2026-04-20-08-30.json b/common/changes/@visactor/vchart/fix-map-bug_2026-04-20-08-30.json deleted file mode 100644 index f74780a959..0000000000 --- a/common/changes/@visactor/vchart/fix-map-bug_2026-04-20-08-30.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "fix: vchart relayout api not work bug. fix#4537", - "type": "none" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-map-bug_2026-04-20-08-58.json b/common/changes/@visactor/vchart/fix-map-bug_2026-04-20-08-58.json deleted file mode 100644 index e15c40e64c..0000000000 --- a/common/changes/@visactor/vchart/fix-map-bug_2026-04-20-08-58.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "fix: label not follow when drag. fix#4547", - "type": "none" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-process-render-bug_2026-05-12-06-22.json b/common/changes/@visactor/vchart/fix-process-render-bug_2026-05-12-06-22.json deleted file mode 100644 index da8d3a8e24..0000000000 --- a/common/changes/@visactor/vchart/fix-process-render-bug_2026-05-12-06-22.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "fix: prcoess render error. fix#4578", - "type": "none" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/refactor-update-spec-scoped-effects_2026-06-23-10-10.json b/common/changes/@visactor/vchart/refactor-update-spec-scoped-effects_2026-06-23-10-10.json deleted file mode 100644 index 1ae681e2aa..0000000000 --- a/common/changes/@visactor/vchart/refactor-update-spec-scoped-effects_2026-06-23-10-10.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "refactor: introduce scoped updateSpec effects to make chart, component, series, data, layout, render, and animation update ranges explicit; local component updates such as marker exit, title text, legend appearance, axis appearance, mark style, field, label, animation, and layout-related series changes now avoid unnecessary chart remake/recompile paths when the existing chart model can be updated in place", - "type": "patch" - } - ], - "packageName": "@visactor/vchart", - "email": "openai@example.com" -} diff --git a/common/changes/@visactor/vchart/refactor-vrender-1-1-runtime-state_2026-06-23-10-00.json b/common/changes/@visactor/vchart/refactor-vrender-1-1-runtime-state_2026-06-23-10-00.json deleted file mode 100644 index ad8aed93c7..0000000000 --- a/common/changes/@visactor/vchart/refactor-vrender-1-1-runtime-state_2026-06-23-10-00.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "refactor: align VChart with the VRender 1.1.0 app-scoped runtime, state resolver, and animation contracts while keeping standard VChart spec usage compatible; consolidate mark shared-state handling, glyph sub-graphic state isolation, word-cloud scaleIn initialization, and interaction-state behavior for Sankey, brush, legend textures, marker rich text, and circular progress tick masks", - "type": "patch" - } - ], - "packageName": "@visactor/vchart", - "email": "openai@example.com" -} diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 1932153274..f73398c7aa 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -19,16 +19,16 @@ importers: specifier: 2.46.1 version: 2.46.1(@types/react@18.3.29)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@visactor/openinula-vchart': - specifier: workspace:2.0.22 + specifier: workspace:2.1.0 version: link:../packages/openinula-vchart '@visactor/react-vchart': - specifier: workspace:2.0.22 + specifier: workspace:2.1.0 version: link:../packages/react-vchart '@visactor/vchart': - specifier: workspace:2.0.22 + specifier: workspace:2.1.0 version: link:../packages/vchart '@visactor/vchart-extension': - specifier: workspace:2.0.22 + specifier: workspace:2.1.0 version: link:../packages/vchart-extension '@visactor/vchart-theme': specifier: ~1.6.6 @@ -200,7 +200,7 @@ importers: ../../packages/openinula-vchart: dependencies: '@visactor/vchart': - specifier: workspace:2.0.22 + specifier: workspace:2.1.0 version: link:../vchart '@visactor/vrender-core': specifier: 1.1.0 @@ -288,10 +288,10 @@ importers: ../../packages/react-vchart: dependencies: '@visactor/vchart': - specifier: workspace:2.0.22 + specifier: workspace:2.1.0 version: link:../vchart '@visactor/vchart-extension': - specifier: workspace:2.0.22 + specifier: workspace:2.1.0 version: link:../vchart-extension '@visactor/vrender-core': specifier: 1.1.0 @@ -388,10 +388,10 @@ importers: ../../packages/taro-vchart: dependencies: '@visactor/vchart': - specifier: workspace:2.0.22 + specifier: workspace:2.1.0 version: link:../vchart '@visactor/vchart-extension': - specifier: workspace:2.0.22 + specifier: workspace:2.1.0 version: link:../vchart-extension devDependencies: '@babel/core': @@ -550,7 +550,7 @@ importers: specifier: ~1.0.23 version: 1.0.23 '@visactor/vutils-extension': - specifier: workspace:2.0.22 + specifier: workspace:2.1.0 version: link:../vutils-extension devDependencies: '@esbuild-plugins/node-globals-polyfill': @@ -686,7 +686,7 @@ importers: ../../packages/vchart-extension: dependencies: '@visactor/vchart': - specifier: workspace:2.0.22 + specifier: workspace:2.1.0 version: link:../vchart '@visactor/vdataset': specifier: ~1.0.23 @@ -994,10 +994,10 @@ importers: ../../tools/bugserver-trigger: dependencies: '@visactor/vchart': - specifier: workspace:2.0.22 + specifier: workspace:2.1.0 version: link:../../packages/vchart '@visactor/vchart-extension': - specifier: workspace:2.0.22 + specifier: workspace:2.1.0 version: link:../../packages/vchart-extension devDependencies: '@internal/bundler': @@ -1260,7 +1260,7 @@ importers: ../../tools/story-player: dependencies: '@visactor/vchart': - specifier: workspace:2.0.22 + specifier: workspace:2.1.0 version: link:../../packages/vchart '@visactor/vrender': specifier: 1.1.0 diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index f8e8321a97..1d503d0435 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -1,9 +1 @@ -[ - { - "definitionName": "lockStepVersion", - "policyName": "vchartMain", - "version": "2.0.21", - "mainProject": "@visactor/vchart", - "nextBump": "patch" - } -] +[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"2.1.0","mainProject":"@visactor/vchart","nextBump":"minor"}] diff --git a/docs/assets/changelog/en/release.md b/docs/assets/changelog/en/release.md index a7f3760d52..98cade1215 100644 --- a/docs/assets/changelog/en/release.md +++ b/docs/assets/changelog/en/release.md @@ -1,3 +1,30 @@ +# v2.1.0 + +2026-06-23 + +**🆕 New Features** + +- **@visactor/vchart**: markLine expandDistancesupport callback. close#4568 +- **@visactor/vchart**: support function type for `maxRow` / `maxCol` of the discrete legend, evaluated during layout against the legend's allocated rect, so the row / column count can adapt to the available space + +**🐛 Bug Fixes** + +- **@visactor/vchart**: waterfall lead line bug. fix#4580 +- **@visactor/vchart**: preserve discrete legend filtering after updateSpec when `legends.data` is a callback (Issue #4566) +- **@visactor/vchart**: re-nice the cartesian linear axis with the real plot-area length after layout when `tick.tickCount` is a function, so the length-based tick count and nice ceiling match the final plot area instead of the pre-layout chart viewRect +- **@visactor/vchart**: vchart relayout api not work bug. fix#4537 +- **@visactor/vchart**: label not follow when drag. fix#4547 +- **@visactor/vchart**: prcoess render error. fix#4578 + +**🔨 Chores** + +- **@visactor/vchart**: update changes for 009-fix-map-roam-pointer-drag: This plan fixes a map roam drag bug where mobile browsers lose stable vertical dragging after supportsTouchEvents is forced to false +- **@visactor/vchart**: introduce scoped updateSpec effects to make chart, component, series, data, layout, render, and animation update ranges explicit; local component updates such as marker exit, title text, legend appearance, axis appearance, mark style, field, label, animation, and layout-related series changes now avoid unnecessary chart remake/recompile paths when the existing chart model can be updated in place +- **@visactor/vchart**: align VChart with the VRender 1.1.0 app-scoped runtime, state resolver, and animation contracts while keeping standard VChart spec usage compatible; consolidate mark shared-state handling, glyph sub-graphic state isolation, word-cloud scaleIn initialization, and interaction-state behavior for Sankey, brush, legend textures, marker rich text, and circular progress tick masks + +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.20...v2.1.0 + +[more detail about v2.1.0](https://github.com/VisActor/VChart/releases/tag/v2.1.0) # v2.0.22 2026-04-13 diff --git a/docs/assets/changelog/en/release.md.bak b/docs/assets/changelog/en/release.md.bak index f2908a6102..a7f3760d52 100644 --- a/docs/assets/changelog/en/release.md.bak +++ b/docs/assets/changelog/en/release.md.bak @@ -1,3 +1,18 @@ +# v2.0.22 + +2026-04-13 + +**🐛 Bug Fixes** + +- **@visactor/vchart**: correct stacked bar corner clipping when barMinHeight is applied (Issue #4543) +- **@visactor/vchart**: relayout api not work bug. fix#4537 +- **@visactor/vchart**: custom mark not release after update spec. fix#4537 +- **@visactor/vchart**: map error when roam or drag canvas. fix#4547 +- **@visactor/vchart**: handle sankey tooltip labels when source index is 0 (Issue #4488) + +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.20...v2.0.22 + +[more detail about v2.0.22](https://github.com/VisActor/VChart/releases/tag/v2.0.22) # v2.0.21 2026-04-03 diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index 185fb870ed..05bee6bccd 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -1,3 +1,30 @@ +# v2.1.0 + +2026-06-23 + +**🆕 新增功能** + +- **@visactor/vchart**: markLine expandDistancesupport callback. close#4568 +- **@visactor/vchart**: 支持 function type for `maxRow` / `maxCol` of the discrete 图例, evaluated during layout against the 图例's allocated rect, so the row / column count can adapt the available space + +**🐛 问题修复** + +- **@visactor/vchart**: waterfall lead line 问题. fix#4580 +- **@visactor/vchart**: preserve discrete 图例 filtering after updateSpec when `legends.data` is a callback (问题 #4566) +- **@visactor/vchart**: re-nice the cartesian 线性坐标轴 with the real plot-area length after layout when `tick.tickCount` is a function, so the length-based tick count and nice ceiling match the final plot area instead of the pre-layout chart viewRect +- **@visactor/vchart**: vchart relayout api not work 问题. fix#4537 +- **@visactor/vchart**: label not follow when drag. fix#4547 +- **@visactor/vchart**: prcoess render error. fix#4578 + +**🔨 维护与杂项** + +- **@visactor/vchart**: 更新 changes for 009-fix-map-roam-pointer-drag: This plan fixes a map roam drag 问题 where mobile browsers lose stable vertical dragging after supportsTouchEvents is forced false +- **@visactor/vchart**: introduce scoped updateSpec effects make chart, component, series, data, layout, render, and animation update ranges explicit; local component updates such as marker exit, title text, 图例 appearance, axis appearance, mark style, field, label, animation, and layout-related series changes now avoid unnecessary chart remake/recompile paths when the existing chart model can be updated in place +- **@visactor/vchart**: align VChart with the VRender 1.1.0 app-scoped runtime, state resolver, and animation contracts while keeping standard VChart spec usage compatible; consolidate mark shared-state handling, glyph sub-graphic state isolation, word-cloud scaleIn initialization, and interaction-state behavior for Sankey, brush, 图例 textures, marker rich text, and circular progress tick masks + +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.20...v2.1.0 + +[更多详情请查看 v2.1.0](https://github.com/VisActor/VChart/releases/tag/v2.1.0) # v2.0.22 2026-04-13 diff --git a/docs/assets/changelog/zh/release.md.bak b/docs/assets/changelog/zh/release.md.bak index 2d38fa4582..185fb870ed 100644 --- a/docs/assets/changelog/zh/release.md.bak +++ b/docs/assets/changelog/zh/release.md.bak @@ -1,3 +1,18 @@ +# v2.0.22 + +2026-04-13 + +**🐛 问题修复** + +- **@visactor/vchart**: correct stacked bar corner clipping when barMinHeight is applied (问题 #4543) +- **@visactor/vchart**: relayout api not work 问题. fix#4537 +- **@visactor/vchart**: custom mark not release after update spec. fix#4537 +- **@visactor/vchart**: map error when roam or drag canvas. fix#4547 +- **@visactor/vchart**: handle sankey Tooltip labels when source index is 0 (问题 #4488) + +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.20...v2.0.22 + +[更多详情请查看 v2.0.22](https://github.com/VisActor/VChart/releases/tag/v2.0.22) # v2.0.21 2026-04-03 diff --git a/docs/package.json b/docs/package.json index a1ac6a3c4a..05093fa74b 100644 --- a/docs/package.json +++ b/docs/package.json @@ -12,10 +12,10 @@ }, "dependencies": { "@arco-design/web-react": "2.46.1", - "@visactor/openinula-vchart": "workspace:2.0.22", - "@visactor/react-vchart": "workspace:2.0.22", - "@visactor/vchart": "workspace:2.0.22", - "@visactor/vchart-extension": "workspace:2.0.22", + "@visactor/openinula-vchart": "workspace:2.1.0", + "@visactor/react-vchart": "workspace:2.1.0", + "@visactor/vchart": "workspace:2.1.0", + "@visactor/vchart-extension": "workspace:2.1.0", "@visactor/vchart-theme": "~1.6.6", "@visactor/vmind": "1.2.4-alpha.5", "@visactor/vutils": "~1.0.23", @@ -58,4 +58,4 @@ "react-device-detect": "^2.2.2", "minimist": "1.2.8" } -} \ No newline at end of file +} diff --git a/packages/block-vchart/block/vchart/index.js b/packages/block-vchart/block/vchart/index.js index 049c93c048..5b19d37a5a 100644 --- a/packages/block-vchart/block/vchart/index.js +++ b/packages/block-vchart/block/vchart/index.js @@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function V(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function U(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(V(t)!==V(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=N(t),n=N(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!U(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=it){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var _t=function(t,e,i){return ti?i:t};var yt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=m(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Mt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function wt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const Ct=4294967296;const Et=t=>e=>L(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(y(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Lt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Rt=t=>0,Ot=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=It(f.min,f);for(let r=0;r=1?Ht:t<=-1?-Ht:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ae{static distancePP(t,e){return Kt(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Kt(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return Kt(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Vt;)t+=Vt;else if(t>0)for(;t>Vt;)t-=Vt;return t};function ce(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=pe(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(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 me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ye(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Me(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function we(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ce(t,e){const i=e?oe(t.angle):t.angle,s=we(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=Ce(t,i),n=Ce(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(we(t),we(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+Ht;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+Ht;u>Nt&&(u-=Nt),g>Nt&&(g-=Nt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Me(n,i)+Me(n,s))/2>Me(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Oe(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Fe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(_(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return He(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ne extends Ve{}class Ue extends Ve{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ue(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class We{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new We,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new We;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new We(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=le(r.rotateDeg),r}}class Ge{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Ye(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Xe(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const $e=/^#([0-9a-f]{3,8})$/,Ke={transparent:4294967040},qe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ze(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Je(t){return S(t)?new si(t>>16,t>>8&255,255&t,1):y(t)?new si(t[0],t[1],t[2]):new si(255,255,255)}function Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ei=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new si((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Je(t):8===e?new si(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ii{static Brighter(t,e=1){return 1===e?t:new ii(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ii(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ii?t:new ii(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Ke[t]))return function(t){return S(t)?new si(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new si(t[0],t[1],t[2],t[3]):new si(255,255,255,1)}(Ke[t]);if(p(qe[t]))return Je(qe[t]);const e=`${t}`.trim().toLowerCase(),i=ei(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new si(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new si(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ii.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new si(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Xe(this.color.r,this.color.g,this.color.b),r=Ye(u(t)?n.h:_t(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new si(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ei(e,!0);return null!=i?i:this}setColorName(t){const e=qe[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ii(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class si{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Ze(this.r)+Ze(this.g)+Ze(this.b)+(1===this.opacity?"":Ze(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Xe(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ni(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new si(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Xe});function ai(t){if(k(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function oi(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function li(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function hi(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const ci=1e-10;function di(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ci)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=fi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ui(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ci,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ui(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function pi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ui(t,t-(i*i-e*e+t*t)/(2*i))+ui(e,s)}function gi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function fi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let _i;function yi(t,e){const i=vi(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class bi{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const xi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Si(t){let e;if(e=xi.exec(t))return new bi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});ot.getInstance().error("invalid format: "+t)}const Ai=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class ki{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return ki.instance||(ki.instance=new ki),ki.instance}newFormat(t){const e=Si(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Mi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?m:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?Ai[8+_i/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Si(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=vi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ai[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>yi(100*t,e),r:yi,s:function(t,e){const i=vi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(_i=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+vi(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function Ti(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Bi(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Bi(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Ri(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ei(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},ts=Math.sqrt,es=Math.tan;function is(t){return t>1?0:t<-1?ji:Math.acos(t)}function ss(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function ns(){}function rs(t,e){t&&os.hasOwnProperty(t.type)&&os[t.type](t,e)}var as={Feature:function(t,e){rs(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sji?t+Math.round(-t/Ni)*Ni:t,e]}function bs(t,e,i){return(t%=Ni)?e||i?_s(Ss(t),As(e,i)):Ss(t):e||i?As(e,i):ys}function xs(t){return function(e,i){return[(e+=t)>ji?e-Ni:e<-ji?e+Ni:e,i]}}function Ss(t){var e=xs(t);return e.invert=xs(-t),e}function As(t,e){var i=$i(t),s=Ji(t),n=$i(e),r=Ji(e);function a(t,e){var a=$i(e),o=$i(t)*a,l=Ji(t)*a,h=Ji(e),c=h*i+o*s;return[Xi(l*n-c*r,o*i-h*s),ss(c*n+l*r)]}return a.invert=function(t,e){var a=$i(e),o=$i(t)*a,l=Ji(t)*a,h=Ji(e),c=h*n-l*r;return[Xi(l*n+h*r,o*i+c*s),ss(c*i-o*s)]},a}function ks(t,e){(e=us(e))[0]-=t,vs(e);var i=is(-e[1]);return((-e[2]<0?-i:i)+Ni-zi)%Ni}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ns,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ts(t,e){return Gi(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function Es(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Is(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function Ds(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Is(a);var t=function(t,e){var i=Rs(e),s=e[1],n=Ji(s),r=[Ji(i),-$i(i),0],a=0,o=0;Ls.reset(),1===n?s=Hi+zi:-1===n&&(s=-Hi-zi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>ji,w=f*x;if(Ls.add(Xi(w*k*Ji(M),m*S+w*$i(M))),a+=T?A+k*Ni:A,T^p>=i^y>=i){var C=gs(us(u),us(_));vs(C);var E=gs(r,C);vs(E);var B=(T^A>=0?-1:1)*ss(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-zi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Fs))}return u}}function Fs(t){return t.length>1}function zs(t,e){return((t=t.x)[0]<0?t[1]-Hi-zi:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-zi:Hi-e[1])}1===(Bs=Os).length&&(Ps=Bs,Bs=function(t,e){return Os(Ps(t),e)});var js=Ds((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?ji:-ji,l=Gi(r-i);Gi(l-ji)0?Hi:-Hi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=ji&&(Gi(i-n)zi?Yi((Ji(e)*(r=$i(s))*Ji(i)-Ji(s)*(n=$i(e))*Ji(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*Hi,s.point(-ji,n),s.point(0,n),s.point(ji,n),s.point(ji,0),s.point(ji,-n),s.point(0,-n),s.point(-ji,-n),s.point(-ji,0),s.point(-ji,n);else if(Gi(t[0]-e[0])>zi){var r=t[0]0,n=Gi(e)>zi;function r(t,i){return $i(t)*$i(i)>e}function a(t,i,s){var n=[1,0,0],r=gs(us(t),us(i)),a=ps(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=gs(n,r),u=ms(n,h);fs(u,ms(r,c));var p=d,g=ps(u,p),f=ps(p,p),m=g*g-f*(ps(u,u)-1);if(!(m<0)){var v=ts(m),_=ms(p,(-g-v)/f);if(fs(_,u),_=ds(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Gi(_[0]-b)ji^(b<=_[0]&&_[0]<=x)){var T=ms(p,(-g+v)/f);return fs(T,u),[_,ds(T)]}}}function o(e,i){var n=s?t:ji-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Ds(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?ji:-ji),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ts(e,p)||Ts(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&Ts(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=$i(e),o=Ji(e),l=s*i;null==n?(n=e+s*Ni,r=e-l/2):(n=ks(a,n),r=ks(a,r),(s>0?nr)&&(n+=s*Ni));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Gi(s[0]-t)0?0:3:Gi(s[0]-i)0?2:1:Gi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,_,y=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=Is(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Cs(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&m)y.point(r,a);else{var l=[g=Math.max(Ns,Math.min(Vs,g)),f=Math.max(Ns,Math.min(Vs,f))],b=[r=Math.max(Ns,Math.min(Vs,r)),a=Math.max(Ns,Math.min(Vs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ws(t){return t}var Gs,Ys,Xs,$s,Ks=Oi(),qs=Oi(),Zs={point:ns,lineStart:ns,lineEnd:ns,polygonStart:function(){Zs.lineStart=Js,Zs.lineEnd=en},polygonEnd:function(){Zs.lineStart=Zs.lineEnd=Zs.point=ns,Ks.add(Gi(qs)),qs.reset()},result:function(){var t=Ks/2;return Ks.reset(),t}};function Js(){Zs.point=Qs}function Qs(t,e){Zs.point=tn,Gs=Xs=t,Ys=$s=e}function tn(t,e){qs.add($s*t-Xs*e),Xs=t,$s=e}function en(){tn(Gs,Ys)}var sn=Zs,nn=1/0,rn=nn,an=-nn,on=an;var ln,hn,cn,dn,un={point:function(t,e){tan&&(an=t);eon&&(on=e)},lineStart:ns,lineEnd:ns,polygonStart:ns,polygonEnd:ns,result:function(){var t=[[nn,rn],[an,on]];return an=on=-(rn=nn=1/0),t}},pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn=0,Sn={point:An,lineStart:kn,lineEnd:wn,polygonStart:function(){Sn.lineStart=Cn,Sn.lineEnd=En},polygonEnd:function(){Sn.point=An,Sn.lineStart=kn,Sn.lineEnd=wn},result:function(){var t=xn?[yn/xn,bn/xn]:_n?[mn/_n,vn/_n]:fn?[pn/fn,gn/fn]:[NaN,NaN];return pn=gn=fn=mn=vn=_n=yn=bn=xn=0,t}};function An(t,e){pn+=t,gn+=e,++fn}function kn(){Sn.point=Mn}function Mn(t,e){Sn.point=Tn,An(cn=t,dn=e)}function Tn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,An(cn=t,dn=e)}function wn(){Sn.point=An}function Cn(){Sn.point=Bn}function En(){Pn(ln,hn)}function Bn(t,e){Sn.point=Pn,An(ln=cn=t,hn=dn=e)}function Pn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,yn+=(n=dn*t-cn*e)*(cn+t),bn+=n*(dn+e),xn+=3*n,An(cn=t,dn=e)}var Ln=Sn;function Rn(t){this._context=t}Rn.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,Ni)}},result:ns};var On,In,Dn,Fn,zn,jn=Oi(),Hn={point:ns,lineStart:function(){Hn.point=Vn},lineEnd:function(){On&&Nn(In,Dn),Hn.point=ns},polygonStart:function(){On=!0},polygonEnd:function(){On=null},result:function(){var t=+jn;return jn.reset(),t}};function Vn(t,e){Hn.point=Nn,In=Fn=t,Dn=zn=e}function Nn(t,e){Fn-=t,zn-=e,jn.add(ts(Fn*Fn+zn*zn)),Fn=t,zn=e}var Un=Hn;function Wn(){this._string=[]}function Gn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Yn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),cs(t,i(s))),s.result()}return r.area=function(t){return cs(t,i(sn)),sn.result()},r.measure=function(t){return cs(t,i(Un)),Un.result()},r.bounds=function(t){return cs(t,i(un)),un.result()},r.centroid=function(t){return cs(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ws):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Wn):new Rn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Xn(t){return function(e){var i=new $n;for(var s in t)i[s]=t[s];return i.stream=e,i}}function $n(){}function Kn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),cs(i,t.stream(un)),e(un.result()),null!=s&&t.clipExtent(s),t}function qn(t,e,i){return Kn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Zn(t,e,i){return qn(t,[[0,0],e],i)}function Jn(t,e,i){return Kn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Qn(t,e,i){return Kn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Wn.prototype={_radius:4.5,_circle:Gn(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=Gn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},$n.prototype={constructor:$n,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var tr=16,er=$i(30*Wi);function ir(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=ts(b*b+x*x+S*S),k=ss(S/=A),M=Gi(Gi(S)-1)e||Gi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Wi:0,E()):[m*Ui,v*Ui,_*Ui]},w.angle=function(t){return arguments.length?(y=t%360*Wi,E()):y*Ui},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=ir(o,T=t*t),B()):ts(T)},w.fitExtent=function(t,e){return qn(w,t,e)},w.fitSize=function(t,e){return Zn(w,t,e)},w.fitWidth=function(t,e){return Jn(w,t,e)},w.fitHeight=function(t,e){return Qn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function lr(t){var e=0,i=ji/3,s=or(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Wi,i=t[1]*Wi):[e*Ui,i*Ui]},n}function hr(t,e){var i=Ji(t),s=(i+Ji(e))/2;if(Gi(s)2?t[2]*Wi:0),e.invert=function(e){return(e=t.invert(e[0]*Wi,e[1]*Wi))[0]*=Ui,e[1]*=Ui,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===mr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function _r(t){return es((Hi+t)/2)}function yr(t,e){var i=$i(t),s=t===e?Ji(t):qi(i/$i(e))/qi(_r(e)/_r(t)),n=i*Zi(_r(t),s)/s;if(!s)return mr;function r(t,e){n>0?e<-Hi+zi&&(e=-Hi+zi):e>Hi-zi&&(e=Hi-zi);var i=n/Zi(_r(e),s);return[i*Ji(s*t),n-i*$i(s*t)]}return r.invert=function(t,e){var i=n-e,r=Qi(s)*ts(t*t+i*i),a=Xi(t,Gi(i))*Qi(i);return i*s<0&&(a-=ji*Qi(t)*Qi(i)),[a/s,2*Yi(Zi(n/r,1/s))-Hi]},r}function br(t,e){return[t,e]}function xr(t,e){var i=$i(t),s=t===e?Ji(t):(i-$i(e))/(e-t),n=i/s+t;if(Gi(s)zi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Br.invert=pr(ss),Pr.invert=pr((function(t){return 2*Yi(t)})),Lr.invert=function(t,e){return[-e,2*Yi(Ki(t))-Hi]};var Ir={exports:{}},Dr=function(t,e){this.p1=t,this.p2=e};Dr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Dr.prototype.run=function(){return this.p2[0]-this.p1[0]},Dr.prototype.slope=function(){return this.rise()/this.run()},Dr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Dr.prototype.isVertical=function(){return!isFinite(this.slope())},Dr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Dr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Dr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Dr.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)},Dr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Fr=Dr,zr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Fr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=zr(t.slice(0,s),e),o=zr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},jr=zr;!function(t){var e=jr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Vr(Wr,e),{tolerance:s}=i;return Hr(t,s)};var Yr;!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"}(Yr||(Yr={}));const Xr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let M=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/M:0,T.push(_[t])}return T},Kr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],w=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=w.length?w:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:M,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!T.length)return $r(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...w,...T];return $r(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",w=null!==(o=k.mean)&&void 0!==o?o:"mean",C=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",L=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",O=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",I=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,j=new Map,H=new Map,V=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&j.set(r,[]),y(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=j.get(r);t&&t.push(i)}}y(S)&&(S=[_t(Math.min.apply(null,S),0,1),_t(Math.max.apply(null,S),0,1)]);const N=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[w]=o,f[C]=l,f[E]=h,f[B]=c,f[P]=d,f[L]=n,f[R]=r,f[O]=u,f[I]=p,f[D]=g,A&&(f[F]=j.get(t)||[]),N.push(f)}return N};var Zr={},Jr={};function Qr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ta(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ea(t,e){var i=t+"",s=i.length;return s9999?"+"+ea(e,6):ea(e,4))+"-"+ea(t.getUTCMonth()+1,2)+"-"+ea(t.getUTCDate(),2)+(r?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"."+ea(r,3)+"Z":n?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"Z":s||i?"T"+ea(i,2)+":"+ea(s,2)+"Z":"")}function sa(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Jr;if(h)return h=!1,Zr;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a0}function ga(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=oa(t));var r=[];switch(t.type){case"GeometryCollection":return fa(t,(function(t){va(t,s)})),t;case"FeatureCollection":return ga(t,(function(t){ga(va(t,s),(function(t){r.push(t)}))})),hi(r)}return va(t,s)}function va(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return fa(t,(function(t){va(t,e)})),t;case"LineString":return _a(ua(t),e),t;case"Polygon":return ya(ua(t),e),t;case"MultiLineString":return ua(t).forEach((function(t){_a(t,e)})),t;case"MultiPolygon":return ua(t).forEach((function(t){ya(t,e)})),t;case"Point":case"MultiPoint":return t}}function _a(t,e){pa(t)===e&&t.reverse()}function ya(t,e){pa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ba(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ka=(t,e={},i)=>{i.type=Yr.GEO;const s=Vr(Sa,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Aa(t))})):e.push(Aa(t))})),e})(t);let l=t.features;return o&&(l=ma(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=xa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=xa.bounds(t);t.bbox=e}})),t.features=l,t},Ma={},Ta=(t,e,i)=>{i.type=Yr.GEO;const s=Vr(Sa,Ma,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Or(a,t)}))}:Or(a,o));var a,o;return ka(r,s,i)},wa=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Ca=0;function Ea(t="dataset"){return Ca>1e8&&(Ca=0),t+"_"+Ca++}class Ba{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:Ea("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Pa{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ea("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Pa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?j({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Xr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Yn();const La={},Ra={albers:dr,albersusa:function(){var t,e,i,s,n,r,a=dr(),o=cr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=cr().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}},Oa=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ia(t,e){return function i(){const s=e();return s.type=t,s.path=Yn().projection(s),s.copy=s.copy||function(){const t=i();return Oa.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Da{static GenAutoIncrementId(){return Da.auto_increment_id++}}Da.auto_increment_id=0;class Fa{constructor(t){this.id=Da.GenAutoIncrementId(),this.registry=t}}const za="named",ja="inject",Ha="multi_inject",Va="inversify:tagged",Na="inversify:paramtypes";class Ua{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===za?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Wa=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Ga(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Wa.hasOwnMetadata(t,e)&&(r=Wa.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Wa.defineMetadata(t,r,e)}(Va,t,i.toString(),s)}function Ya(t){return(e,i,s)=>{Ga(e,0,s,t)}}function Xa(t){return e=>(i,s,n)=>Ya(new Ua(t,e))(i,s,n)}const $a=Xa(ja),Ka=Xa(Ha);function qa(){return function(t){return Wa.defineMetadata(Na,null,t),t}}function Za(t){return Ya(new Ua(za,t))}const Ja="Singleton",Qa="Transient",to="ConstantValue",eo="DynamicValue",io="Factory",so="Function",no="Instance",ro="Invalid";class ao{constructor(t,e){this.id=Da.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=ro,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new ao(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ja&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class oo{getConstructorMetadata(t){return{compilerGeneratedMetadata:Wa.getMetadata(Na,t),userGeneratedMetadata:Wa.getMetadata(Va,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const lo=(ho=za,t=>{const e=e=>{if(null==e)return!1;if(e.key===ho&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const po=Symbol("ContributionProvider");class go{constructor(t,e){this.serviceIdentifier=t,this.container=e,mo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function fo(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).inSingletonScope().whenTargetNamed(e)}class mo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}mo.store=new Map;class vo{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class _o extends vo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const yo=Symbol.for("EnvContribution"),bo=Symbol.for("VGlobal"),xo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Qa,this.options=e,this.id=Da.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new oo}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,za,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new ao(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new uo(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[ja],multiInject:s[Ha]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case to:case so:e=t.cache;break;case no:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Ja&&(t.cache=e,t.activated=!0)}},So=Symbol.for("RenderService");const Ao=new class{get renderService(){return this._renderService||(this._renderService=xo.get(So)),this._renderService}};let ko=0;class Mo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Ao.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++ko,t),this.tryRunAnimationFrameNextFrame(),ko}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class To{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var wo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Co=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eo=function(t,e){return function(i,s){e(i,s,t)}},Bo=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let Po=class extends To{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Da.GenAutoIncrementId(),this.hooks={onSetEnv:new _o(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Mo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Bo(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Lo,Ro,Oo,Io;Po=wo([qa(),Eo(0,$a(po)),Eo(0,Za(yo)),Co("design:paramtypes",[Object])],Po),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Lo||(Lo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Ro||(Ro={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Oo||(Oo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Io||(Io={}));const Do=Vt-1e-8;class Fo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Do)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Vt)<0&&(s+=Vt),(n%=Vt)<0&&(n+=Vt),nn;++o,a-=Ht)g(a);else for(a=s-s%Ht+Ht,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const jo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ho={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},Vo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let No,Uo,Wo,Go,Yo,Xo;var $o,Ko,qo,Zo,Jo,Qo;function tl(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),f=Math.cos(n),m=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,A=i+m,k=S+y*m,M=A-y*f;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function el(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=oe(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Vt:C>0&&0===r&&(C-=Vt);const E=Math.ceil(Math.abs(C/(Ht+.001))),B=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function sl(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=cl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function ul(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new pl(i,n),new pl(n,s)]}class pl extends nl{constructor(t,e){super(),this.type=Jo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p1.x):t===Zo.COLUMN?Ut(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class gl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new pl(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Zo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ut(t.p0.y-s.y)}if(t===Zo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ut(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class fl extends gl{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function ml(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function vl(t,e,i){const s=null!=e?e:Ut(i[i.length-1].x-i[0].x)>Ut(i[i.length-1].y-i[0].y)?Zo.ROW:Zo.COLUMN;return"monotoneY"===t?new fl(t,s):new gl(t,s)}class _l{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 yl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new _l(n,s),t),n}function bl(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class xl{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&bl(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:bl(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 Sl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("basis",i,t);return function(t,e){ml(t,e,2)}(new xl(n,s),t),n}function Al(t){return t<0?-1:1}function kl(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Al(r)+Al(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ml(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Tl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class wl{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Tl(this,this._t0,Ml(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Tl(this,Ml(this,e=kl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Tl(this,this._t0,e=kl(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class Cl extends wl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function El(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneX",i,t);return function(t,e){ml(t,e,2)}(new wl(n,s),t),n}function Bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneY",i,t);return function(t,e){ml(t,e,2)}(new Cl(n,s),t),n}let Pl=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class Ll extends Pl{lineEnd(){this.context.closePath()}}function Rl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Pl(r,e,n),t),r}function Ol(t,e){return ml(t,e,1)}class Il extends _l{lineEnd(){this.context.closePath()}}function Dl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new Il(n,s),t),n}function Fl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function zl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return yl(i,n);const o=vl(t,r,i);return ml(new e(o,s,a),i,2),o}}const jl=zl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Hl=zl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Vl extends nl{constructor(t,e,i){super(),this.type=Jo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return hl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,rl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p2.x):t===Zo.COLUMN?Ut(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=Xt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=hl(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new Vl(i,a,r),new Vl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Nl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new pl(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new Vl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Ul(t,e,i){var s,n;switch(e){case"linear":default:return yl(t,i);case"basis":return Sl(t,i);case"monotoneX":return El(t,i);case"monotoneY":return Bl(t,i);case"step":return Rl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Ll(r,e,n),t),r}(t,.5,i);case"stepBefore":return Rl(t,0,i);case"stepAfter":return Rl(t,1,i);case"catmullRom":return jl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Hl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Dl(t,i)}}class Wl extends zo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Fo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Vo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Vo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Vo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([Vo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([Vo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([Vo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([Vo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([Vo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Vo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Nl(this);sl(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Vo.M]=t=>`M${t[1]} ${t[2]}`,t[Vo.L]=t=>`L${t[1]} ${t[2]}`,t[Vo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Vo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Vo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Vo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tXo){let t,e=Wo;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),sl(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Zo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.y-e.p1.y)}if(this.direction===Zo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),lh=Object.assign(Object.assign({},th),{points:[],cornerRadius:0,closePath:!0}),hh=Object.assign(Object.assign({},th),{width:100,height:100,spikes:5,thickness:.5}),ch=Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const dh=Object.assign(Object.assign({},th),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),uh=Object.assign(Object.assign(Object.assign({},th),Zl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),ph=Object.assign(Object.assign(Object.assign({},th),Zl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),gh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},th),{fill:!0,cornerRadius:0,cornerType:"round"}),fh=Object.assign(Object.assign({},gh),{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}),mh=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=m("shape",/^(circle)/i,0);return t&&(t.style=f()||h()),t}()||function(){const t=m("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return m("extent-keyword",t.extentKeywords,1)}function c(){if(m("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=m("hex",t.hexColor,1)||m("rgba",t.rgbaColor,1)||m("rgb",t.rgbColor,1)||m("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return m("%",t.percentageValue,1)||m("position-keyword",t.positionKeywords,1)||f()}function f(){return m("px",t.pixelValue,1)||m("em",t.emValue,1)}function m(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class vh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(vh.IsGradientStr(t))try{const e=mh(t)[0];if(e){if("linear"===e.type)return vh.ParseLinear(e);if("radial"===e.type)return vh.ParseRadial(e);if("conic"===e.type)return vh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2,n=parseFloat(e.value)/180*jt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Nt,stops:vh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:vh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2;let n="angular"===e.type?parseFloat(e.value)/180*jt:0;for(;n<0;)n+=Nt;for(;n>=Nt;)n-=Nt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const bh={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"}},xh=!0,Sh=!1,Ah=/\w|\(|\)|-/,kh=/[.?!,;:/,。?!、;:]/,Mh=/\S/,Th=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function wh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Ao.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Ch(t,a)),a}function Ch(t,e,i=!1){let s=e;for(;Ah.test(t[s-1])&&Ah.test(t[s])||kh.test(t[s]);)if(s--,s<=0)return i?Eh(t,e):e;return s}function Eh(t,e){let i=e;for(;Ah.test(t[i+1])&&Ah.test(t[i])||kh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Ao.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Ph=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Lh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=uh.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Ch(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Ch(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};Lh=Ph([qa()],Lh);var Rh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Oh=Symbol.for("TextMeasureContribution");let Ih=class extends Lh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Ih=Rh([qa()],Ih);const Dh=Symbol.for("CanvasFactory"),Fh=Symbol.for("Context2dFactory");function zh(t){return xo.getNamed(Dh,Ao.global.env)(t)}const jh=1e-4,Hh=Math.sqrt(3),Vh=1/3;function Nh(t){return t>-ec&&tec||t<-ec}const Wh=[0,0],Gh=[0,0],Yh=[0,0];function Xh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function $h(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Kh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function qh(t){return(t%=Nt)<0&&(t+=Nt),t}function Zh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Nt);let d=Math.atan2(l,o);return d<0&&(d+=Nt),d>=s&&d<=n||d+Nt>=s&&d+Nt<=n}function tc(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(Nh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const sc=[-1,-1,-1],nc=[-1,-1];function rc(){const t=nc[0];nc[0]=nc[1],nc[1]=t}function ac(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Nh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Vh):Math.pow(i,Vh),s=s<0?-Math.pow(-s,Vh):Math.pow(s,Vh);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+Hh*Math.sin(e)))/(3*a),h=(-o+i*(s-Hh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,sc);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&rc(),p=Kh(e,s,r,o,nc[0]),u>1&&(g=Kh(e,s,r,o,nc[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Nh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,sc);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=$h(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);sc[0]=-l,sc[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Nt-1e-4){s=0,n=Nt;const e=r?1:-1;return a>=sc[0]+t&&a<=sc[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Nt,n+=Nt);let c=0;for(let e=0;e<2;e++){const i=sc[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Nt+t),(t>=s&&t<=n||t+Nt>=s&&t+Nt<=n)&&(t>jt/2&&t<1.5*jt&&(e=-e),c+=e)}}return c}function hc(t){return Math.round(t/jt*1e8)/1e8%2*jt}function cc(t,e){let i=hc(t[0]);i<0&&(i+=Nt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Nt?n=i+Nt:e&&i-n>=Nt?n=i-Nt:!e&&i>n?n=i+(Nt-hc(i-n)):e&&i1&&(i||(h+=Re(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;dc[0]=S,dc[1]=A,cc(dc,Boolean(a[6])),S=dc[0],A=dc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Vo.M:u=m,p=v,c=u,d=p;break;case Vo.L:if(i){if(tc(c,d,m,v,e,s,n))return!0}else h+=Re(c,d,m,v,s,n)||0;c=m,d=v;break;case Vo.C:if(i){if(Jh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ac(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Vo.Q:if(i){if(Zh(c,d,m,v,_,y,e,s,n))return!0}else h+=oc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Vo.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Re(c,d,o,l,s,n),i){if(Qh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=lc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Vo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(tc(u,p,o,p,e,s,n)||tc(o,p,o,l,e,s,n)||tc(o,l,u,l,e,s,n)||tc(u,l,u,p,e,s,n))return!0}else h+=Re(o,p,o,l,s,n),h+=Re(u,l,u,p,s,n);break;case Vo.Z:if(i){if(tc(c,d,u,p,e,s,n))return!0}else h+=Re(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mc=Symbol.for("VWindow"),vc=Symbol.for("WindowHandlerContribution");let _c=class extends To{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){super(),this.hooks={onChange:new _o(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(xo.getNamed(vc,t.env).configure(this,t),this.actived=!0)},this._uid=Da.GenAutoIncrementId(),this.global=Ao.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&>(this.width,t.width())&>(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};_c=gc([qa(),fc("design:paramtypes",[])],_c);var yc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xc=function(t,e){return function(i,s){e(i,s,t)}};let Sc=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Ao.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=pc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Zl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Zl.fontFamily,fontSize:Zl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=xo.get(mc),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Ac;Sc=yc([qa(),xc(0,$a(po)),xc(0,Za(Oh)),bc("design:paramtypes",[Object])],Sc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Ac||(Ac={}));const kc=new We;let Mc=class{constructor(){this.matrix=new We}init(t){return this.mode=Ac.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Ac.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(kc.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(kc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}scale(t,e,i){return this.mode===Ac.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Ac.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return kc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}translate(t,e){return this.mode===Ac.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Ac.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Mc=yc([qa(),bc("design:paramtypes",[])],Mc);const Tc={arc:eh,area:ih,circle:sh,line:ah,path:oh,symbol:dh,text:uh,rect:ch,polygon:lh,star:hh,richtext:ph,richtextIcon:fh,image:gh,group:nh,glyph:rh},wc=Object.keys(Tc);function Cc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Ec={arc:Object.assign({},Tc.arc),area:Object.assign({},Tc.area),circle:Object.assign({},Tc.circle),line:Object.assign({},Tc.line),path:Object.assign({},Tc.path),symbol:Object.assign({},Tc.symbol),text:Object.assign({},Tc.text),rect:Object.assign({},Tc.rect),polygon:Object.assign({},Tc.polygon),star:Object.assign({},Tc.star),richtext:Object.assign({},Tc.richtext),richtextIcon:Object.assign({},Tc.richtextIcon),image:Object.assign({},Tc.image),group:Object.assign({},Tc.group),glyph:Object.assign({},Tc.glyph)};class Bc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},wc.forEach((t=>{this._defaultTheme[t]=Object.create(Ec[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;wc.forEach((s=>{const n=Object.create(Ec[s]);t&&t[s]&&Cc(n,t[s]),i[s]&&Cc(n,i[s]),e[s]&&Cc(n,e[s]),this.combinedTheme[s]=n})),e.common&&wc.forEach((t=>{Cc(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Pc=new Bc;function Lc(t,e){return t.glyphHost?Lc(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)):Pc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Lc(t.attachedThemeGraphic)||Pc.getTheme()}var Rc=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Oc extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=Da.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Rc(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Vc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Vc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Vc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Vc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Hc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Vc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(Vc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,Vc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Vc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof zc))return void ot.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Hc.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Nc(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Fc,this.rootWheelEvent=new zc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class Yc{static GetImage(t,e){var i;const s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Yc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Yc.cache.set(t,s),s.dataPromise=Ao.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Yc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Yc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ao.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ao.global.loadBlob(t):"json"===e&&(i.dataPromise=Ao.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Yc.isLoading&&Yc.toLoadAueue.length){Yc.isLoading=!0;const t=Yc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Yc.cache.set(i,n),n.dataPromise=Ao.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()})).catch((t=>{console.error(t),Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()}))}}),0)}static loadImage(t,e){const i=Xc(t,Yc.toLoadAueue);if(-1!==i)return Yc.toLoadAueue[i].marks.push(e),void Yc.loading();Yc.toLoadAueue.push({url:t,marks:[e]}),Yc.loading()}static improveImageLoading(t){const e=Xc(t,Yc.toLoadAueue);if(-1!==e){const t=Yc.toLoadAueue.splice(e,1);Yc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Xc(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(qc[0]=t[0],qc[2]=t[0],qc[1]=t[1],qc[3]=t[1],qc):t:t:0,Jc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Qc=[1,2,3,0,1,2,3,0];function td(t,e,i,s){for(;t>=Nt;)t-=Nt;for(;t<0;)t+=Nt;for(;t>e;)e+=Nt;Jc[0].x=i,Jc[1].y=i,Jc[2].x=-i,Jc[3].y=-i;const n=Math.ceil(t/Ht)%4,r=Math.ceil(e/Ht)%4;if(s.add(Gt(t)*i,$t(t)*i),s.add(Gt(e)*i,$t(e)*i),n!==r||e-t>jt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}nd.TimeOut=1e3/60;const rd=new nd,ad=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class od{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function ld(t,e,i,s,n){return n?t.arc(i,s,e,0,Vt,!1,n):t.arc(i,s,e,0,Vt),!1}var hd=new class extends od{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return ld(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ld(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var cd=new class extends od{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function dd(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var ud=new class extends od{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return dd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return dd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return dd(t,this.parseSize(e)/2+n,i,s,r)}};function pd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var gd=new class extends od{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return pd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return pd(t,this.parseSize(e)/2+n,i,s)}};function fd(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class md extends od{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return fd(t,this.parseSize(e)/2,i,s,n)}}var vd=new md;var _d=new class extends md{constructor(){super(...arguments),this.type="triangle"}};const yd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),bd=Math.sin(Vt/10)*yd,xd=-Math.cos(Vt/10)*yd;function Sd(t,e,i,s){const n=bd*e,r=xd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Vt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Ad=new class extends od{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Sd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Sd(t,this.parseSize(e)/2+n,i,s)}};const kd=Kt(3);function Md(t,e,i,s){const n=e,r=n/kd,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Td=new class extends od{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};function wd(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Cd=new class extends od{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return wd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return wd(t,this.parseSize(e)/2+n,i,s)}};function Ed(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Bd=new class extends od{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ed(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/2+n,i,s)}};const Pd=-.5,Ld=Kt(3)/2,Rd=1/Kt(12);function Od(t,e,i,s){const n=e/2,r=e*Rd,a=n,o=e*Rd+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Pd*n-Ld*r+i,Ld*n+Pd*r+s),t.lineTo(Pd*a-Ld*o+i,Ld*a+Pd*o+s),t.lineTo(Pd*l-Ld*h+i,Ld*l+Pd*h+s),t.lineTo(Pd*n+Ld*r+i,Pd*r-Ld*n+s),t.lineTo(Pd*a+Ld*o+i,Pd*o-Ld*a+s),t.lineTo(Pd*l+Ld*h+i,Pd*h-Ld*l+s),t.closePath(),!1}var Id=new class extends od{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Od(t,this.parseSize(e)/2+n,i,s)}};function Dd(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var Fd=new class extends od{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return Dd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};function zd(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var jd=new class extends od{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2,i,s,n)}};function Hd(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var Vd=new class extends od{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return Hd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Hd(t,this.parseSize(e)/2,i,s,n)}};const Nd=Kt(3);function Ud(t,e,i,s){const n=e*Nd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Wd=new class extends od{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Ud(t,this.parseSize(e)/2/Nd,i,s)}drawOffset(t,e,i,s,n){return Ud(t,this.parseSize(e)/2/Nd+n,i,s)}};function Gd(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var Yd=new class extends od{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function Xd(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var $d=new class extends od{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return Xd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Xd(t,this.parseSize(e)/4+n,i,s)}};function Kd(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var qd=new class extends od{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return Kd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Kd(t,this.parseSize(e)/4+n,i,s)}};function Zd(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var Jd=new class extends od{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return Zd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Zd(t,this.parseSize(e)/4+n,i,s)}};function Qd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var tu=new class extends od{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function eu(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var iu=new class extends od{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return eu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return eu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function su(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var nu=new class extends od{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return su(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return su(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function ru(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function au(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ou=new class extends od{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?au(t,e,i,s):ru(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?au(t,e+2*n,i,s):ru(t,[e[0]+2*n,e[1]+2*n],i,s)}};const lu=new Ne;class hu{constructor(t,e,i=!1){this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),sl(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(sl(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{lu.x1=i.bounds.x1*t,lu.y1=i.bounds.y1*t,lu.x2=i.bounds.x2*t,lu.y2=i.bounds.y2*t,e.union(lu)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const cu={};[hd,cd,ud,gd,Wd,_d,Ad,Td,Cd,Bd,Id,Fd,jd,vd,Vd,Yd,$d,qd,Jd,ou,tu,iu,nu].forEach((t=>{cu[t.type]=t}));const du={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class uu{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function pu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function gu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=gu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=pu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=gu(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new uu(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new uu(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function vu(t,e){return _u(t)}function _u(t,e){const i={};for(let e=0;ewu.set(t,!0)));const Cu=new Map;function Eu(t){if(wu.has(t))return!0;if(Cu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Cu.set(t,!0)));const Bu=Mu(),Pu=Mu(),Lu=Mu(),Ru=Mu(),Ou=Mu(),Iu=Mu(),Du=Mu(),Fu=Mu(),zu=Mu(),ju=Mu();Mu();const Hu=Mu();Mu();const Vu=Mu();Mu();const Nu=Mu(),Uu=Mu(),Wu=Symbol.for("GraphicService"),Gu=Symbol.for("GraphicCreator"),Yu={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Xu=Object.keys(Yu),$u={duration:200,easing:"cubicOut"};function Ku(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function qu(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Zu(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 Ju(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*f,t[1]=y*n+b*l+x*u+S*m,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*f,t[5]=y*n+b*l+x*u+S*m,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*f,t[9]=y*n+b*l+x*u+S*m,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Qu(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class tp{constructor(){this.pools=[]}static identity(t){return Ku(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 tp.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},np=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rp=new We(1,0,0,1,0,0),ap={x:0,y:0};let op=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this.path=new Wl,this._clearMatrix=new We(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return ep.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ap),function(t,e,i){return uc(t,0,!1,e,i)}(this.path.commandList,ap.x,ap.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ap);const i=_h(this,this.lineWidth,this.dpr);return function(t,e,i,s){return uc(t,e,!0,i,s)}(this.path.commandList,i,ap.x,ap.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(rp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};op=sp([qa(),np("design:paramtypes",[Object,Number])],op);const lp={WIDTH:500,HEIGHT:500,DPR:1};class hp{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=lp.WIDTH,height:n=lp.HEIGHT,dpr:r=lp.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var cp;hp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(cp||(cp={}));class dp{static Get(t,e=cp.Color1,i=[0,0,0,1]){if(e===cp.Color1){const e=dp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ii.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];dp.store1[t]=e,dp.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=dp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ii.parseColorString(t);return n&&(dp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],dp.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===cp.Color1){if(dp.store1[t])return;dp.store1[t]=i,dp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(dp.store255[t])return;dp.store255[t]=i,dp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function up(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function pp(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return gp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):gp(t,e,i,s,n)}function gp(t,e,i,s,n){if(!t||!e)return t&&up(t)||e&&up(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=dp.Get(t,cp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=dp.Get(e,cp.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:up(a)})))});return o?pp(r,l,i,s,n):pp(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:_p(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:_p(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:_p(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),up(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}function fp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}dp.store255={},dp.store1={};const mp=[0,0,0,0],vp=[0,0,0,0];function _p(t,e,i){return dp.Get(t,cp.Color255,mp),dp.Get(e,cp.Color255,vp),`rgba(${Math.round(mp[0]+(vp[0]-mp[0])*i)},${Math.round(mp[1]+(vp[1]-mp[1])*i)},${Math.round(mp[2]+(vp[2]-mp[2])*i)},${mp[3]+(vp[3]-mp[3])*i})`}class yp{static GetCanvas(){try{return yp.canvas||(yp.canvas=Ao.global.createCanvas({})),yp.canvas}catch(t){return null}}static GetCtx(){if(!yp.ctx){const t=yp.GetCanvas();yp.ctx=t.getContext("2d")}return yp.ctx}}class bp extends Ge{static getInstance(){return bp._instance||(bp._instance=new bp),bp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=yp.GetCanvas(),s=yp.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new bp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class xp{static GetSize(t){for(let e=0;e=t)return xp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=xp.GenKey(t,e,i,s,n),l=xp.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=xp.GenKey(t,e,i,s,n);xp.cache[l]?xp.cache[l].push({width:a,height:o,pattern:r}):xp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}xp.cache={},xp.ImageSize=[20,40,80,160,320,640,1280,2560];const Sp=new Ne,Ap=new We;new Ne;const kp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Mp=["x","y"],Tp=["scaleX","scaleY"],wp=["angle"],Cp=new re,Ep={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Bp extends Oc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=cu[t];if(e)return e;if(e=Bp.userSymbolMap[t],e)return e;if(!0===((i=t=du[t]||t).startsWith("{const e=(new Wl).fromString(t.d),i={};Xu.forEach((e=>{t[e]&&(i[Yu[e]]=t[e])})),n.push({path:e,attribute:i}),Sp.union(e.bounds)}));const r=Sp.width(),a=Sp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new hu(t,n,!0);return Bp.userSymbolMap[t]=l,l}var i;const s=(new Wl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Yt(n,r);s.transform(0,0,a,a);const o=new hu(t,s);return Bp.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Zc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Fo(t);return sl(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new We),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&$o.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&$o.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&$o.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&$o.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&$o.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&$o.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=$o.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Ko.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i))}_setAttributes(t,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:$u;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:qo.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if(this.currentStates){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stateSort&&(t=t.sort(this.stateSort));const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=$o.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=$o.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=$o.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&$o.UPDATE_SHAPE_AND_BOUNDS)===$o.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=$o.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=$o.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=$o.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=$o.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=$o.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=$o.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=$o.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&$o.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Xl.x,y:e=Xl.y,scaleX:i=Xl.scaleX,scaleY:s=Xl.scaleY,angle:n=Xl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Gt(a),f=$t(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+d*v-x*_-A*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),Ao.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Xl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ap.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:qo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Ao.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new Wl).fromString(t):this.pathProxy=new Wl,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),Ao.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new jc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Ao.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new op(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Pp;Bp.userSymbolMap={},Bp.mixin(Uc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Pp||(Pp={}));let Lp=class t extends Bp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Iu,this._childUpdateTag=$o.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 Bc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Bc)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Ko.GLOBAL){const i=new re(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&$o.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Xl.x,y:e=Xl.y,dx:i=Xl.dx,dy:s=Xl.dy,scaleX:n=Xl.scaleX,scaleY:r=Xl.scaleY,angle:a=Xl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Lc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Ao.graphicService.updateTempAABBBounds(i),Ao.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=$o.CLEAR_BOUNDS,this._childUpdateTag&=$o.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=$o.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&$o.UPDATE_BOUNDS||(this._childUpdateTag|=$o.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&$o.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Ao.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Rp(t){return new Lp(t)}Lp.NOWORK_ANIMATE_ATTR=Ep;class Op extends Lp{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Bc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Ao.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Ao.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Ip=Symbol.for("TransformUtil"),Dp=Symbol.for("GraphicUtil"),Fp=Symbol.for("LayerService"),zp=Symbol.for("StaticLayerHandlerContribution"),jp=Symbol.for("DynamicLayerHandlerContribution"),Hp=Symbol.for("VirtualLayerHandlerContribution");var Vp,Np=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Up=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Wp=Vp=class{static GenerateLayerId(){return`${Vp.idprefix}_${Vp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Ao.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?xo.get(zp):"dynamic"===t?xo.get(jp):xo.get(Hp),e}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Op(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Vp.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};Wp.idprefix="visactor_layer",Wp.prefix_count=0,Wp=Vp=Np([qa(),Up("design:paramtypes",[])],Wp);var Gp=new Fa((t=>{t(bo).to(Po).inSingletonScope(),t(mc).to(_c),t(Dp).to(Sc).inSingletonScope(),t(Ip).to(Mc).inSingletonScope(),t(Fp).to(Wp).inSingletonScope()}));function Yp(t,e){return!(!t&&!e)}function Xp(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function $p(t,e,i){return i&&t*e>0}function Kp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function qp(t,e){return t*e>0}function Zp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Jp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Qp(t,e,i,s,n){const r=Ut(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Gt(c),k=n*$t(c),M=s*Gt(u),T=s*$t(u);let w,C,E,B;if((b>zt||_>zt)&&(w=n*Gt(d),C=n*$t(d),E=s*Gt(p),B=s*$t(p),r1?0:P<-1?jt:Math.acos(P))/2),l=Kt(t[0]*t[0]+t[1]*t[1]);S=Xt(b,(s-l)/(o-1)),x=Xt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function tg(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ut(l-o),c=l>o;let d=!1;if(n=Nt-zt)e.moveTo(i+n*Gt(o),s+n*$t(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*$t(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Qp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=Xt(v,m),r=Xt(_,m),o=Jp(g,f,u,p,n,t,Number(c)),l=Jp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*$t(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*$t(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Gt(M),s+n*$t(M));if(!(r>zt)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=Xt(B,T),n=Xt(P,T),o=Jp(S,A,b,x,r,-n,Number(c)),l=Jp(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*$t(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Gt(E),s+r*$t(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*$t(o)):e.closePath(),d}const eg=Symbol.for("ArcRenderContribution"),ig=Symbol.for("AreaRenderContribution"),sg=Symbol.for("CircleRenderContribution"),ng=Symbol.for("GroupRenderContribution"),rg=Symbol.for("ImageRenderContribution"),ag=Symbol.for("PathRenderContribution"),og=Symbol.for("PolygonRenderContribution"),lg=Symbol.for("RectRenderContribution"),hg=Symbol.for("SymbolRenderContribution"),cg=Symbol.for("TextRenderContribution"),dg=Symbol.for("InteractiveSubRenderContribution");function ug(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function pg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var gg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mg=function(t,e){return function(i,s){e(i,s,t)}};function vg(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Ku(t),qu(t,t,[n+o,r+l,a+h]),qu(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),qu(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=ip.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}qu(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,f),qu(i,i,[-s[0],-s[1],0]),Ju(t,t,i)}}let _g=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new _o(["graphic"]),onSetStage:new _o(["graphic","stage"]),onRemove:new _o(["graphic"]),onRelease:new _o(["graphic"]),onAddIncremental:new _o(["graphic","group","stage"]),onClearIncremental:new _o(["graphic","group","stage"]),beforeUpdateAABBBounds:new _o(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new _o(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new _o(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ne,this.tempAABBBounds2=new Ne}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Fo(t);return sl(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=pg(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=ug(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Au(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Au(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&He(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};_g=gg([qa(),mg(0,$a(Gu)),fg("design:paramtypes",[Object])],_g);const yg=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},bg=["radius","startAngle","endAngle",...kp];class xg extends Bp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Ru}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Lc(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Nt-zt?i.set(-r,-r,r,r):td(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,bg)}needUpdateTag(t){return super.needUpdateTag(t,bg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Wl,s.arc(0,0,r,a,o),s}clone(){return new xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xg.NOWORK_ANIMATE_ATTR}}function Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Ep;class Ag{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Lo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Uu,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Lc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Mg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Ao.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Au(n,o/Math.abs(r+a),!0,l),i.union(n)}return Ao.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,He(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Ag(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const M=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new Ag(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=ug(_,a),e=this.cache.verticalList.length*v,i=pg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Tu.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const x=ug(_,a),S=this.cache.verticalList.length*v,A=pg(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=ad(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=kg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=kg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Mg.baselineMapAlign}getAlignMapBaseline(){return Mg.alignMapBaseline}}function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ep),Mg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Mg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const wg=["symbolType","size",...kp];let Cg=class t extends Bp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Nu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Lc(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Au(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,wg)}needUpdateTag(t){return super.needUpdateTag(t,wg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Wl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Wl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Eg(t){return new Cg(t)}Cg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ep);const Bg=["segments","points","curveType","curveTension",...kp];let Pg=class t extends Bp{constructor(t={}){super(t),this.type="line",this.numberType=Fu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}getGraphicTheme(){return Lc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Wl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Lg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const Rg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},Og=["width","x1","y1","height","cornerRadius",...kp];class Ig extends Bp{constructor(t){super(t),this.type="rect",this.numberType=Hu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Lc(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Og)}needUpdateTag(t){return super.needUpdateTag(t,Og)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Rg(e);return t=new Wl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ig.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Ig(t)}Ig.NOWORK_ANIMATE_ATTR=Ep;class Fg extends Bp{constructor(t){super(t),this.type="glyph",this.numberType=Ou,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Lc(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Fg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Fg.NOWORK_ANIMATE_ATTR}}function zg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Ep;class jg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=bh[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Hg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Vg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=ad(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Bh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Hg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=wh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Ng=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...kp];class Ug extends Bp{constructor(t){super(t),this.type="image",this.numberType=Du,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Lc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return gh[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}clone(){return new Ug(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ug.NOWORK_ANIMATE_ATTR}}function Wg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Ep);class Gg extends Ug{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Zc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Zc(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=gh.width,height:e=gh.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Yg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Gg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Vg){const e=Mh.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Gg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bh(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sh;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Th(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?yh(t,s,{AABBBounds:i}):s,Th(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Gg)break;const{width:n}=Bh(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Gg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Xg{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=bh[this.direction]}store(t){if(t instanceof Gg){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 Yg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Gg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=wh(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Vg(i,t.newLine,t.character,t.ascentDescentMode),new Vg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let $g=!1;try{$g=Intl&&"function"==typeof Intl.Segmenter}catch(t){$g=!1}const Kg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...kp];class qg extends Bp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Vu,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Lc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&qg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&qg.splitText(t.text).length>1)))}static splitText(t){if($g){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=qg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Ao.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!qg.AllSingleCharacter(_)&&(_=qg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new jg(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new Xg(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new qg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ep);const Jg=["path","customPath",...kp];class Qg extends Bp{constructor(t){super(t),this.type="path",this.numberType=zu}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Wl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Wl?this.cache:t.path)}getGraphicTheme(){return Lc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new Wl).fromString(t.path):t.customPath&&(this.cache=new Wl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Jg)}needUpdateTag(t){return super.needUpdateTag(t,Jg)}toCustomPath(){return(new Wl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qg.NOWORK_ANIMATE_ATTR}}function tf(t){return new Qg(t)}Qg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ep);const ef=["segments","points","curveType","curveTension",...kp];class sf extends Bp{constructor(t){super(t),this.type="area",this.numberType=Lu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Lc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,ef)}needUpdateTag(t){return super.needUpdateTag(t,ef)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Wl;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new sf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sf.NOWORK_ANIMATE_ATTR}}function nf(t){return new sf(t)}sf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const rf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...kp];class af extends Bp{constructor(t){super(t),this.type="arc",this.numberType=Bu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=he(e),i=e+r,s&&Ut(r)zt&&o>zt)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=Kt(a*a+o*o)}=this.attribute,h=Ut(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*$t(g)),n=Zt(Number(l)/a*$t(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Lc(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Nt-zt?i.set(-s,-s,s,s):(td(l,o,s,i),td(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,rf)}needUpdateTag(t){return super.needUpdateTag(t,rf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Ut(o-a),d=o>a;if(h=Nt-zt)n.moveTo(0+h*Gt(a),0+h*$t(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*$t(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*$t(a),i=l*Gt(o),s=l*$t(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new af(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return af.NOWORK_ANIMATE_ATTR}}function of(t){return new af(t)}af.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ep);const lf=["points","cornerRadius",...kp];class hf extends Bp{constructor(t){super(t),this.type="polygon",this.numberType=ju}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Lc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,lf)}needUpdateTag(t){return super.needUpdateTag(t,lf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Wl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new hf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return hf.NOWORK_ANIMATE_ATTR}}function cf(t){return new hf(t)}hf.NOWORK_ANIMATE_ATTR=Ep;class df extends Lp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function uf(t){return new df(t)}const pf=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let gf,ff;function mf(t){return gf||(gf=pf.CreateGraphic("text",{})),gf.initAttributes(t),gf.AABBBounds}var vf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yf=function(t,e){return function(i,s){e(i,s,t)}};class bf{constructor(){this.time=Qo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(Af(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Lc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){Ef(t,e,i,s)}}const xf=new bf,Sf=new Set(["top","center","bottom"]);function Af(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function kf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Mf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Tf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function wf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:Sf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Tf(s,e,"left","center","right"),y:Tf(n,i,"top","center","bottom")}}function Cf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Ef(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=function(t){if(!t)return null;const e=Cf(t.naturalWidth,t.videoWidth,t.width),i=Cf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}(e),{backgroundRepeatMode:m,backgroundSizing:v}=function({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Mf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:kf({backgroundFit:e,backgroundKeepAspectRatio:i})}}({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let _=p,y=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=wf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(_=i*(g/s),y=g):"repeat-y"===m&&(y=s*(p/i),_=p);const n=t.dpr,r=pc.allocate({width:_,height:y,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,_,y),a.drawImage(e,0,0,_,y),e=r.nativeCanvas),pc.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}let Bf=class{constructor(t){this.subRenderContribitions=t,this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Bf=vf([qa(),yf(0,$a(po)),yf(0,Za(dg)),_f("design:paramtypes",[Object])],Bf);const Pf=new class{constructor(){this.time=Qo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Lf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class Rf{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=pc.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),pc.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Nt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=pc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Eg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:_h(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),tg(t,e,i,s,w+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},Df=Of,Ff=xf;const zf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},jf=Of,Hf=xf;const Vf=new class extends bf{constructor(){super(...arguments),this.time=Qo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:_=l.backgroundScale,backgroundOffsetX:y=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Af(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:_,backgroundOffsetX:y,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Nf=jt/2;function Uf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Ut(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ut(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ut(t[0]),i=Ut(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ut(l[0]),l[1]=Ut(l[1]),l[2]=Ut(l[2]),l[3]=Ut(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Nf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Nf,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Nf,jt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],jt,jt+Nf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Wf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Gf{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:_h(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),Uf(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let Yf=class{constructor(){this.time=Qo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Yf=Wf([qa()],Yf);let Xf=class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return Uf(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Xf=Wf([qa()],Xf);const $f=new Gf,Kf=Of,qf=xf;const Zf=new class extends Gf{constructor(){super(...arguments),this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},Jf=xf;const Qf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},tm=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},em=Of,im=xf;const sm={x:0,y:0,z:0,lastModelMatrix:null};class nm{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Pf),this.builtinContributions.push(Lf),this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Qo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Qo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Lc(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,_=$p(d,u,h),y=qp(d,g),b=Yp(h),x=Xp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return sl(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=$p(o,l,n),p=qp(o,c),g=Yp(n,r),f=Xp(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;sm.x=n,sm.y=r,sm.z=a,sm.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(s,d||s,n),sm.x=0,sm.y=0,sm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ip.free(n)}if(g&&!d){const s=t.getOffsetXY(e);sm.x+=s.x,sm.y+=s.y,sm.z=a,i.setTransformForCurrent()}else if(p)sm.x=0,sm.y=0,sm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);sm.x+=s.x,sm.y+=s.y,this.transformWithoutTranslate(i,sm.x,sm.y,sm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),sm.x=0,sm.y=0,sm.z=0;return sm}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,f,m,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ip.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var rm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},am=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},om=function(t,e){return function(i,s){e(i,s,t)}};let lm=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Bu,this.builtinContributions=[If,Ff,Df],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nzt){const t=Xt(b,y),r=Xt(x,y),a=Jp(v,_,f,m,n,t,Number(u)),o=Jp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>zt){const t=Xt(B,w),n=Xt(P,w),a=Jp(M,T,A,k,r,-n,Number(u)),o=Jp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*$t(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ut(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Kc[s]=t,i&&(i=!(null!==(e=Kc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Kc[e]=!!t[e],i&&(i=!!Kc[e]);else Kc[0]=!1,Kc[1]=!1,Kc[2]=!1,Kc[3]=!1;return{isFullStroke:i,stroke:Kc}})(d);if((_||E)&&(e.beginPath(),tg(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),tg(t,e,i,s,k,M,B),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ut(h-r)>=Nt-zt){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Nt;for(;i>Nt;)i-=Nt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),pp(o.color,l.color,h,!1)}(0,0,h,n);a||$p&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};lm=rm([qa(),om(0,$a(po)),om(0,Za(eg)),am("design:paramtypes",[Object])],lm);var hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dm=function(t,e){return function(i,s){e(i,s,t)}};let um=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[zf,Hf,jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function pm(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=cl(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function gm(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function fm(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=gm(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),pm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Zo.ROW:"y"===s?u=Zo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let vm=class extends nm{constructor(){super(...arguments),this.numberType=Fu}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();fm(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Ul(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Xt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function _m(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),pm(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),pm(t,l,1,s),o=!1):o=!0}t.closePath()}vm=mm([qa()],vm);const ym=new class extends Rf{constructor(){super(...arguments),this.time=Qo.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:sd(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:sd(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:sd(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:sd(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},bm=xf;var xm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Am=function(t,e){return function(i,s){e(i,s,t)}};let km=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[ym,bm],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Lc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Ul(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Ul(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Ul(e,E,{curveTension:b}),n=Ul(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,y,r[u],[g,t.attribute],Xt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Zo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Ut(_.x-b.x),A=Ut(_.y-b.y);x=null==_.x1?Zo.ROW:null==_.y1?Zo.COLUMN:Number.isFinite(S+A)?S>A?Zo.ROW:Zo.COLUMN:Zo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Zo.ROW:Zo.COLUMN,Number.isFinite(c)||(o=Zo.COLUMN),Number.isFinite(d)||(o=Zo.ROW);const u=i*(o===Zo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),fm(t,i[0]?e.top:e.bottom,l,x===Zo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};km=xm([qa(),Am(0,$a(po)),Am(0,Za(ig)),Sm("design:paramtypes",[Object])],km);const Mm=Of,Tm=xf;var wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};let Bm=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[Tm,Mm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Lc(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)sl(t.pathShape.commandList,e,i,s,1,1,f);else{sl((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Bm=wm([qa(),Em(0,$a(po)),Em(0,Za(ag)),Cm("design:paramtypes",[Object])],Bm);var Pm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rm=function(t,e){return function(i,s){e(i,s,t)}};let Om=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Hu,this.builtinContributions=[$f,qf,Kf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Kp(g,f,T,w,h),E=Zp(g,v,T,w,M),B=Yp(h,c),P=Xp(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),Uf(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Om=Pm([qa(),Rm(0,$a(po)),Rm(0,Za(lg)),Lm("design:paramtypes",[Object])],Om);var Im=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fm=function(t,e){return function(i,s){e(i,s,t)}};let zm=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Nu,this.builtinContributions=[Qf,im,em,tm],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Lc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};zm=Im([qa(),Fm(0,$a(po)),Fm(0,Za(hg)),Dm("design:paramtypes",[Object])],zm);const jm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ne)}allocate(t,e,i,s){if(!this.pools.length)return(new Ne).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ne(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const Hm=new class extends bf{constructor(){super(...arguments),this.time=Qo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,_,y,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:M=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:w=l.backgroundKeepAspectRatio,backgroundScale:C=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:L=l.backgroundClip,backgroundCornerRadius:R=l.backgroundCornerRadius}=t.attribute;let O,{background:I}=t.attribute;if(!I)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),O&&e.setTransformFromMatrix(O,!0,1))};let F;"richtext"===t.type&&(O=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(I)&&I.background?I:null,j=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(_=z.height)&&void 0!==_?_:e.height();if(F=jm.allocate(i,s,i+n,s+r),I=z.background,!j){const t=F.width(),e=F.height();F.set((null!==(y=z.x)&&void 0!==y?y:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,j||(F=mf(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const i=t.resources.get(I);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),j&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,L&&(e.beginPath(),R?Uf(e,F.x1,F.y1,F.width(),F.height(),R,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:M,backgroundFit:T,backgroundKeepAspectRatio:w,backgroundScale:C,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=I,R?(Uf(e,F.x1,F.y1,F.width(),F.height(),R,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&jm.free(F),D()}};var Vm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Um=function(t,e){return function(i,s){e(i,s,t)}};let Wm=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Uu,this.builtinContributions=[Hm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Lc(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=ad(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=ep.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),ep.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:ug(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Gm(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jm=function(t,e){return function(i,s){e(i,s,t)}};let Qm=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ju,this.builtinContributions=[Km,$m],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Gm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Gm(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=Ym(d,u),b=Ym(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Xm(h,_,y,d,u),A=Xm(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Ym(k,M),w=Xm(h,Ym(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let B=E-C;B<0&&(C=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Qm=qm([qa(),Jm(0,$a(po)),Jm(0,Za(og)),Zm("design:paramtypes",[Object])],Qm);var tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ev=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iv=function(t,e){return function(i,s){e(i,s,t)}};let sv=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Iu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Vf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Lc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Kp(p,m,g,f,c),C=Zp(p,v,g,f),E=Yp(c,u),B=Xp(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Uf(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Vf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Qo.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Qo.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Ao.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Lc(t,null==s?void 0:s.theme).group,i=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(i,p||i,n),a.modelMatrix=i,ip.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ip.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};sv=tv([qa(),iv(0,$a(po)),iv(0,Za(ng)),ev("design:paramtypes",[Object])],sv);var nv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},av=function(t,e){return function(i,s){e(i,s,t)}};const ov=["","repeat-x","repeat-y","repeat"];function lv({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=function(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?ov[i]:"no-repeat"}(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const hv={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function cv(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=lv({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?function(t){return{backgroundMode:hv[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Ef(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}let dv=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[Zf,Jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:_=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:M,doFill:T,doStroke:w}=A;if(!S||!t.resources)return;const C=t.resources.get(S);if("success"!==C.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Uf(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const L=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),cv(e,C.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x})))},R=()=>{w&&(o?o(e,t.attribute,l):M&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},O=function({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0,imagePosition:a="top-left"}){const{repeatMode:o,sizingMode:l}=lv({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===o&&("cover"===l||"auto"===l||1!==s||0!==n||0!==r)}({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x}),I=P||O;g?(R(),I&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),L(),I&&e.restore()):(I&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),L(),I&&e.restore(),R()),this.afterRenderStep(t,e,i,s,T,!1,k,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void Yc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Lc(t).image;this._draw(t,a,!1,i)}};dv=nv([qa(),av(0,$a(po)),av(0,Za(rg)),rv("design:paramtypes",[Object])],dv);const uv=Symbol.for("IncrementalDrawContribution"),pv=Symbol.for("ArcRender"),gv=Symbol.for("AreaRender"),fv=Symbol.for("CircleRender"),mv=Symbol.for("GraphicRender"),vv=Symbol.for("GroupRender"),_v=Symbol.for("LineRender"),yv=Symbol.for("PathRender"),bv=Symbol.for("PolygonRender"),xv=Symbol.for("RectRender"),Sv=Symbol.for("SymbolRender"),Av=Symbol.for("TextRender"),kv=Symbol.for("RichTextRender"),Mv=Symbol.for("GlyphRender"),Tv=Symbol.for("ImageRender"),wv=Symbol.for("DrawContribution"),Cv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Pu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Nt;for(;o<0;)o+=Nt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var Ev=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Pv=Symbol.for("DrawItemInterceptor"),Lv=new Ne,Rv=new Ne;class Ov{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Lv.copy(s.dirtyBounds),Rv.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,ep.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Lv),s.backupDirtyBounds.copy(Rv)),!0}}class Iv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Dv=class{constructor(){this.order=1,this.interceptors=[new Ov,new zv,new Fv,new Iv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ip.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var jv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vv=function(t,e){return function(i,s){e(i,s,t)}};let Nv=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Nv=jv([qa(),Vv(0,$a(wv)),Hv("design:paramtypes",[Object])],Nv);var Uv=new Fa((t=>{t(So).to(Nv)}));const Wv=Symbol.for("PickerService"),Gv=Symbol.for("GlobalPickerService"),Yv=Symbol.for("PickItemInterceptor"),Xv=Symbol.for("PickServiceInterceptor");var $v=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Kv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Kv=$v([qa()],Kv);let qv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Lc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=ep.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};qv=$v([qa()],qv);let Zv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Zv=$v([qa()],Zv);let Jv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=Cv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Jv=$v([qa()],Jv);var Qv=new Fa(((t,e,i)=>{i(Wv)||(t(Gv).toSelf(),t(Wv).toService(Gv)),t(Jv).toSelf().inSingletonScope(),t(Yv).toService(Jv),t(qv).toSelf().inSingletonScope(),t(Yv).toService(qv),t(Zv).toSelf().inSingletonScope(),t(Yv).toService(Zv),fo(t,Yv),t(Kv).toSelf().inSingletonScope(),t(Xv).toService(Kv),fo(t,Xv)})),t_=new Fa((t=>{t(Wu).to(_g),t(Gu).toConstantValue(pf)}));const e_=Symbol.for("AutoEnablePlugins"),i_=Symbol.for("PluginService");var s_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},n_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r_=function(t,e){return function(i,s){e(i,s,t)}};let a_=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&xo.isBound(e_)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};a_=s_([qa(),r_(0,$a(po)),r_(0,Za(e_)),n_("design:paramtypes",[Object])],a_);var o_=new Fa((t=>{t(i_).to(a_),function(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).whenTargetNamed(e)}(t,e_)})),l_=new Fa((t=>{fo(t,yo)})),h_=new Fa((t=>{t(Oh).to(Ih).inSingletonScope(),fo(t,Oh)})),c_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},d_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let u_=class{constructor(){this.type="static",this.offscreen=!1,this.global=Ao.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=zh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};u_=c_([qa(),d_("design:paramtypes",[])],u_);var p_=new Fa((t=>{t(u_).toSelf(),t(zp).toService(u_)}));var g_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function f_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function m_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=f_(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=f_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var y_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},b_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},x_=function(t,e){return function(i,s){e(i,s,t)}};let S_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):m_(e,th.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ve,this.backupDirtyBounds=new Ve,this.global=Ao.global,this.layerService=Ao.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,ep.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=__(e,i,th.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=jm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=ep.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),jm.free(n),ep.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||xo.get(uv);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let k_=class extends vm{constructor(){super(...arguments),this.numberType=Fu}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Lc(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=$p(u,p,c),_=qp(u,g),y=Yp(c),b=Xp(d,f);if(!t.valid||!m)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};k_=A_([qa()],k_);var M_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let T_=class extends km{constructor(){super(...arguments),this.numberType=Lu}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Lc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=$p(u,d,c),f=Yp(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};T_=M_([qa()],T_);var w_,C_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},E_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},B_=function(t,e){return function(i,s){e(i,s,t)}},P_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(w_||(w_={}));let L_=class extends S_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=w_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new _o([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return P_(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return P_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return P_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){if(2!==t.count)yield v_(t,th.zIndex,((i,s)=>{if(this.status===w_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return P_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return P_(this,void 0,void 0,(function*(){this.rendering&&(this.status=w_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=w_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return P_(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){yield v_(t,th.zIndex,(t=>P_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};L_=C_([qa(),B_(0,Ka(mv)),B_(1,$a(k_)),B_(2,$a(T_)),B_(3,$a(po)),B_(3,Za(Pv)),E_("design:paramtypes",[Array,Object,Object,Object])],L_);var R_=new Fa((t=>{t(bf).toSelf().inSingletonScope(),t(Rf).toSelf().inSingletonScope(),t(wv).to(S_),t(uv).to(L_),t(vv).to(sv).inSingletonScope(),t(mv).toService(vv),fo(t,ng),t(Bf).toSelf().inSingletonScope(),fo(t,dg),fo(t,mv),t(Dv).toSelf().inSingletonScope(),t(Pv).toService(Dv),fo(t,Pv)}));function O_(){O_.__loaded||(O_.__loaded=!0,xo.load(Gp),xo.load(t_),xo.load(Uv),xo.load(Qv),xo.load(o_),function(t){t.load(l_),t.load(h_),t.load(p_)}(xo),function(t){t.load(R_)}(xo))}O_.__loaded=!1,O_();const I_=xo.get(bo);Ao.global=I_;const D_=xo.get(Dp);Ao.graphicUtil=D_;const F_=xo.get(Ip);Ao.transformUtil=F_;const z_=xo.get(Wu);Ao.graphicService=z_;const j_=xo.get(Fp);Ao.layerService=j_;class H_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class V_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Ao.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Ao.global.getRequestAnimationFrame();this.rafId=t((()=>{Ao.global.devicePixelRatio!==this.dpr&&(this.dpr=Ao.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Ao.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class N_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ao.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const U_=new Ne;class W_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()}));const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(U_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(U_,t.parent&&t.parent.globalTransMatrix)))})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let G_;function Y_(){!function(){if(null==G_)try{const t=document.createElement("canvas"),e=t.getContext("2d");G_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),G_&&(G_=!!document.createElement)}catch(t){G_=!1}}();const t=Ao.global&&Ao.global.env;return t?"browser"===t:G_}let X_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};X_._pluginClasses={};const $_="white";class K_ extends Lp{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:$_}set background(t){this._background=t,this.syncBackgroundImage(t)}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}syncBackgroundImage(t){var e;const i=null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t;this.backgroundImg=!1,this.isImageBackgroundSource(i)&&this.loadImage(i,!0)}isImageBackgroundSource(t){if(!t)return!1;if("string"==typeof t)return t.startsWith("{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Bc,this.hooks={beforeRender:new _o(["stage"]),afterRender:new _o(["stage"]),afterClearScreen:new _o(["stage"]),afterClearRect:new _o(["stage"])},this.global=Ao.global,!this.global.env&&Y_()&&this.global.setEnv("browser"),this.window=xo.get(mc),this.renderService=xo.get(So),this.pluginService=xo.get(i_),this.layerService=xo.get(Fp),this.graphicService=xo.get(Wu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:$_,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&this.syncBackgroundImage(this._background),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Gc(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1);const k=X_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=X_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=X_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new H_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new V_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new N_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ve;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new W_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=X_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=X_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=X_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=xo.get(mc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=xo.get(Wv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var q_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Z_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let J_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ne}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return Z_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};J_=q_([qa()],J_);var Q_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ty=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ey=class{constructor(){this._uid=Da.GenAutoIncrementId(),this.viewBox=new Ne,this.modelMatrix=new We(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};ey=Q_([qa(),ty("design:paramtypes",[])],ey);var iy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ny=function(t,e){return function(i,s){e(i,s,t)}};let ry=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=Ao.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ne).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new We(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=Lc(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new re(e.x,e.y);l.transformPoint(a,a);const o=Lc(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&ip.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),ep.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function ay(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function oy(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function py(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),_y=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},yy=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Ve;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return _y(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return _y(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);yy(n[0],s,i),yy(n[1],e-s,i)}};let by=!1;const xy=new Fa((t=>{by||(by=!0,t(lm).toSelf().inSingletonScope(),t(pv).to(lm).inSingletonScope(),t(mv).toService(pv),t(eg).toService(Bf),fo(t,eg))}));let Sy=!1;const Ay=new Fa((t=>{Sy||(Sy=!0,t(Om).toSelf().inSingletonScope(),t(xv).to(Om).inSingletonScope(),t(mv).toService(xv),t(Xf).toSelf(),t(Yf).toSelf(),t(lg).toService(Xf),t(lg).toService(Yf),t(lg).toService(Bf),fo(t,lg))}));let ky=!1;const My=new Fa((t=>{ky||(ky=!0,t(vm).toSelf().inSingletonScope(),t(k_).toSelf().inSingletonScope(),t(_v).to(vm).inSingletonScope(),t(mv).toService(_v))}));let Ty=!1;const wy=new Fa((t=>{Ty||(Ty=!0,t(km).toSelf().inSingletonScope(),t(gv).to(km).inSingletonScope(),t(mv).toService(gv),t(ig).toService(Bf),fo(t,ig),t(T_).toSelf().inSingletonScope())}));let Cy=!1;const Ey=new Fa((t=>{Cy||(Cy=!0,t(zm).toSelf().inSingletonScope(),t(Sv).to(zm).inSingletonScope(),t(mv).toService(Sv),t(hg).toService(Bf),fo(t,hg))}));let By=!1;const Py=new Fa((t=>{By||(By=!0,t(um).toSelf().inSingletonScope(),t(fv).to(um).inSingletonScope(),t(mv).toService(fv),t(sg).toService(Bf),fo(t,sg))}));let Ly=!1;const Ry=new Fa((t=>{Ly||(Ly=!0,t(Av).to(Wm).inSingletonScope(),t(mv).toService(Av),t(cg).toService(Bf),fo(t,cg))}));let Oy=!1;const Iy=new Fa((t=>{Oy||(Oy=!0,t(Bm).toSelf().inSingletonScope(),t(yv).to(Bm).inSingletonScope(),t(mv).toService(yv),t(ag).toService(Bf),fo(t,ag))}));let Dy=!1;const Fy=new Fa((t=>{Dy||(Dy=!0,t(bv).to(Qm).inSingletonScope(),t(mv).toService(bv),t(og).toService(Bf),fo(t,og))}));var zy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jy=class{constructor(){this.numberType=Ou}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Lc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};jy=zy([qa()],jy);let Hy=!1;const Vy=new Fa((t=>{Hy||(Hy=!0,t(Mv).to(jy).inSingletonScope(),t(mv).toService(Mv))}));var Ny=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Wy=class extends nm{constructor(){super(),this.numberType=Vu,this.builtinContributions=[Hm],this.init()}drawShape(t,e,i,s,n){const r=Lc(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=$p(o,l,!0),d=$p(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Lc(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Uf(e,i-t,s-n,v,_,f,!0)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Lc(t).richtext;this._draw(t,s,!1,i)}};Wy=Ny([qa(),Uy("design:paramtypes",[])],Wy);let Gy=!1;const Yy=new Fa((t=>{Gy||(Gy=!0,t(kv).to(Wy).inSingletonScope(),t(mv).toService(kv))}));let Xy=!1;const $y=new Fa((t=>{Xy||(Xy=!0,t(Tv).to(dv).inSingletonScope(),t(mv).toService(Tv),t(rg).toService(Bf),fo(t,rg))}));function Ky(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),Jy=(t,e)=>(d(tb.warnHandler)&&tb.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),Qy=(t,e,i)=>{if(!d(tb.errorHandler))throw new Error(t);tb.errorHandler.call(null,t,e)},tb={silent:!1,warnHandler:!1,errorHandler:!1},eb=Y_(),ib=eb&&globalThis?globalThis.document:void 0;function sb(t){return("desktop-browser"===t||"mobile-browser"===t)&&eb}function nb(t){return rb(t)||"mobile-browser"===t}function rb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let ab=0;function ob(){return ab>=9999999&&(ab=0),ab++}function lb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function hb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const cb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class db extends Lp{constructor(t,e){super(t),this._skipRenderAttributes=cb,(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},jb=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class Hb extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=Hc.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=Hc.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||zb(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=jb(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=Hc.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=jb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=zb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Hc.now()-i>this.config.press.time&&jb(s[0],t){Ao.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Ub=[0,0,0];let Wb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},$l),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ql),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Zl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this._clearMatrix=new We(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return ep.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&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Nt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*y),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&xp.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Qu(Ub,[t,e,i],this.modelMatrix),t=Ub[0],e=Ub[1],i=Ub[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(Qu(Ub,[t,e,i],this.modelMatrix),t=Ub[0],e=Ub[1],i=Ub[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Qu(Ub,[e,i,s],this.modelMatrix),e=Ub[0],i=Ub[1],s=Ub[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t,e=Ao.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Ao.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Zl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Zl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Qu(Ub,[e,i,s],this.modelMatrix),e=Ub[0],i=Ub[1],s=Ub[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=yh(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:_h(this,a,this.dpr),r.strokeStyle=yh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};Wb.env="browser",Wb=Vb([qa(),Nb("design:paramtypes",[Object,Number])],Wb);var Gb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Xb=class extends hp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ao.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Wb(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function $b(t,e){return new Fa((i=>{i(Dh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Fh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Xb.env="browser",Xb=Gb([qa(),Yb("design:paramtypes",[Object])],Xb);const Kb=$b(Xb,Wb);var qb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jb=function(t,e){return function(i,s){e(i,s,t)}};let Qb=class extends ry{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=pc.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ex=class{constructor(){this.type="group",this.numberType=Iu}contains(t,e,i){return!1}};ex=tx([qa()],ex);const ix=new Fa(((t,e,i,s)=>{ix.__vloaded||(ix.__vloaded=!0,t(Db).to(ex).inSingletonScope(),t(Fb).toService(Db),fo(t,Fb))}));ix.__vloaded=!1;var sx=ix;const nx=new Fa(((t,e,i,s)=>{i(Qb)||t(Qb).toSelf().inSingletonScope(),i(Wv)?s(Wv).toService(Qb):t(Wv).toService(Qb)}));var rx,ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ox=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lx=rx=class extends ey{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${rx.idprefix}_${rx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ao.global,this.viewBox=new Ne,this.modelMatrix=new We(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:rx.GenerateCanvasId(),canvasControled:!0};this.canvas=new Xb(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new Xb({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};lx.env="browser",lx.idprefix="visactor_window",lx.prefix_count=0,lx=rx=ax([qa(),ox("design:paramtypes",[])],lx);const hx=new Fa((t=>{t(lx).toSelf(),t(vc).toDynamicValue((t=>t.container.get(lx))).whenTargetNamed(lx.env)}));var cx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ux=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class px{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function gx(t,e=!1){const i=document.createElement("img");if(Ao.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let fx=class extends J_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new px(t)}return new Ne}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return gx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return gx(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:Da.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return ux(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};fx=cx([qa(),dx("design:paramtypes",[])],fx);const mx=new Fa((t=>{mx.isBrowserBound||(mx.isBrowserBound=!0,t(fx).toSelf().inSingletonScope(),t(yo).toService(fx))}));function vx(t,e=!0){vx.__loaded||(vx.__loaded=!0,t.load(mx),t.load(Kb),t.load(hx),e&&function(t){t.load(sx),t.load(nx)}(t))}mx.isBrowserBound=!1,vx.__loaded=!1;var _x=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let yx=class extends Wb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};yx.env="feishu",yx=_x([qa()],yx);var bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Sx=class extends hp{constructor(t){super(t)}init(){this._context=new yx(this,this._dpr)}release(...t){}};Sx.env="feishu",Sx=bx([qa(),xx("design:paramtypes",[Object])],Sx);const Ax=$b(Sx,yx);var kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tx=function(t,e){return function(i,s){e(i,s,t)}};class wx{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 Cx=class extends ey{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new wx}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:Da.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Sx(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Sx({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Cx.env="feishu",Cx=kx([qa(),Tx(0,$a(bo)),Mx("design:paramtypes",[Object])],Cx);const Ex=new Fa((t=>{t(Cx).toSelf(),t(vc).toDynamicValue((t=>t.container.get(Cx))).whenTargetNamed(Cx.env)}));var Bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Px=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lx=function(t,e){return function(i,s){e(i,s,t)}};let Rx=class extends ry{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new op(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};Rx=Bx([qa(),Lx(0,$a(po)),Lx(0,Za(ub)),Lx(1,$a(po)),Lx(1,Za(Yv)),Lx(2,$a(po)),Lx(2,Za(Xv)),Px("design:paramtypes",[Object,Object,Object])],Rx);const Ox=new Fa((t=>{Ox.__vloaded||(Ox.__vloaded=!0,fo(t,ub))}));Ox.__vloaded=!1;var Ix=Ox;class Dx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:_h(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var Fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jx=function(t,e){return function(i,s){e(i,s,t)}};let Hx=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};Hx=Fx([qa(),jx(0,$a(pv)),zx("design:paramtypes",[Object])],Hx);let Vx=!1;const Nx=new Fa(((t,e,i,s)=>{Vx||(Vx=!0,t(pb).to(Hx).inSingletonScope(),t(ub).toService(pb))}));var Ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gx=function(t,e){return function(i,s){e(i,s,t)}};let Yx=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};Yx=Ux([qa(),Gx(0,$a(gv)),Wx("design:paramtypes",[Object])],Yx);let Xx=!1;const $x=new Fa(((t,e,i,s)=>{Xx||(Xx=!0,t(gb).to(Yx).inSingletonScope(),t(ub).toService(gb))}));var Kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zx=function(t,e){return function(i,s){e(i,s,t)}};let Jx=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};Jx=Kx([qa(),Zx(0,$a(fv)),qx("design:paramtypes",[Object])],Jx);let Qx=!1;const tS=new Fa(((t,e,i,s)=>{Qx||(Qx=!0,t(fb).to(Jx).inSingletonScope(),t(ub).toService(fb))}));class eS{constructor(){this.type="glyph",this.numberType=Ou}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var iS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nS=function(t,e){return function(i,s){e(i,s,t)}};let rS=class extends eS{constructor(t){super(),this.canvasRenderer=t}};rS=iS([qa(),nS(0,$a(Mv)),sS("design:paramtypes",[Object])],rS);let aS=!1;const oS=new Fa(((t,e,i,s)=>{aS||(aS=!0,t(Ab).to(rS).inSingletonScope(),t(rS).toService(Ab))}));var lS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let hS=class{constructor(){this.type="image",this.numberType=Du}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};hS=lS([qa()],hS);let cS=!1;const dS=new Fa(((t,e,i,s)=>{cS||(cS=!0,t(mb).to(hS).inSingletonScope(),t(hS).toService(mb))}));var uS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gS=function(t,e){return function(i,s){e(i,s,t)}};let fS=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};fS=uS([qa(),gS(0,$a(_v)),pS("design:paramtypes",[Object])],fS);let mS=!1;const vS=new Fa(((t,e,i,s)=>{mS||(mS=!0,t(vb).to(fS).inSingletonScope(),t(ub).toService(vb))}));var _S=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bS=function(t,e){return function(i,s){e(i,s,t)}};let xS=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};xS=_S([qa(),bS(0,$a(bv)),yS("design:paramtypes",[Object])],xS);let SS=!1;const AS=new Fa(((t,e,i,s)=>{SS||(SS=!0,t(Sb).to(xS).inSingletonScope(),t(ub).toService(Sb))}));var kS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TS=function(t,e){return function(i,s){e(i,s,t)}};let wS=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};wS=kS([qa(),TS(0,$a(yv)),MS("design:paramtypes",[Object])],wS);let CS=!1;const ES=new Fa(((t,e,i,s)=>{CS||(CS=!0,t(_b).to(wS).inSingletonScope(),t(ub).toService(_b))})),BS=new Ne;class PS{constructor(){this.type="rect",this.numberType=Hu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:_h(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;BS.setValue(i.x1,i.y1,i.x2,i.y2),BS.expand(-r/2),h=!BS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var LS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OS=function(t,e){return function(i,s){e(i,s,t)}};let IS=class extends PS{constructor(t){super(),this.canvasRenderer=t}};IS=LS([qa(),OS(0,$a(xv)),RS("design:paramtypes",[Object])],IS);let DS=!1;const FS=new Fa(((t,e,i,s)=>{DS||(DS=!0,t(yb).to(IS).inSingletonScope(),t(ub).toService(yb))}));let zS=!1;const jS=new Fa(((t,e,i,s)=>{zS||(zS=!0,t(mb).to(hS).inSingletonScope(),t(hS).toService(mb))}));var HS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NS=function(t,e){return function(i,s){e(i,s,t)}};let US=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nu}};US=HS([qa(),NS(0,$a(Sv)),VS("design:paramtypes",[Object])],US);let WS=!1;const GS=new Fa(((t,e,i,s)=>{WS||(WS=!0,t(bb).to(US).inSingletonScope(),t(ub).toService(bb))}));var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let XS=class{constructor(){this.type="text",this.numberType=Uu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};XS=YS([qa()],XS);let $S=!1;const KS=new Fa(((t,e,i,s)=>{$S||($S=!0,t(xb).to(XS).inSingletonScope(),t(ub).toService(xb))})),qS=new Fa(((t,e,i,s)=>{i(Rx)||t(Rx).toSelf().inSingletonScope(),i(Wv)?s(Wv).toService(Rx):t(Wv).toService(Rx)}));class ZS{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var JS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let tA=class extends J_{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,s,n,r){const a=null!=r?r:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,r)=>{const o=tt.createCanvasContext(e),l=new ZS(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),r>=s&&n.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};tA=JS([qa(),QS("design:paramtypes",[])],tA);const eA=new Fa((t=>{eA.isFeishuBound||(eA.isFeishuBound=!0,t(tA).toSelf().inSingletonScope(),t(yo).toService(tA))}));function iA(t,e=!0){iA.__loaded||(iA.__loaded=!0,t.load(eA),t.load(Ax),t.load(Ex),e&&function(t){t.load(Ix),t.load(qS),t.load(Nx),t.load($x),t.load(tS),t.load(oS),t.load(dS),t.load(vS),t.load(AS),t.load(ES),t.load(FS),t.load(jS),t.load(GS),t.load(KS)}(t))}eA.isFeishuBound=!1,iA.__loaded=!1;var sA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let rA=class extends Wb{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 We(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};rA.env="node",rA=sA([qa(),nA("design:paramtypes",[Object,Number])],rA);var aA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lA=class extends hp{constructor(t){super(t)}init(){this._context=new rA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};lA.env="node",lA=aA([qa(),oA("design:paramtypes",[Object])],lA);const hA=$b(lA,rA);var cA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uA=function(t,e){return function(i,s){e(i,s,t)}};let pA=class extends ey{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:Da.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new lA(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new lA({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};pA.env="node",pA=cA([qa(),uA(0,$a(bo)),dA("design:paramtypes",[Object])],pA);const gA=new Fa((t=>{t(pA).toSelf(),t(vc).toDynamicValue((t=>t.container.get(pA))).whenTargetNamed(pA.env)}));var fA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let mA=class extends J_{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};mA=fA([qa()],mA);const vA=new Fa((t=>{vA.isNodeBound||(vA.isNodeBound=!0,t(mA).toSelf().inSingletonScope(),t(yo).toService(mA))}));function _A(t,e=!0){_A.__loaded||(_A.__loaded=!0,t.load(vA),t.load(hA),t.load(gA))}vA.isNodeBound=!1,_A.__loaded=!1;var yA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xA=function(t,e){return function(i,s){e(i,s,t)}};let SA=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};SA=yA([qa(),xA(0,$a(pv)),bA("design:paramtypes",[Object])],SA);let AA=!1;const kA=new Fa(((t,e,i,s)=>{AA||(AA=!0,t(kb).to(SA).inSingletonScope(),t(Fb).toService(kb))}));var MA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wA=function(t,e){return function(i,s){e(i,s,t)}};let CA=class extends PS{constructor(t){super(),this.canvasRenderer=t}};CA=MA([qa(),wA(0,$a(xv)),TA("design:paramtypes",[Object])],CA);let EA=!1;const BA=new Fa(((t,e,i,s)=>{EA||(EA=!0,t(Bb).to(CA).inSingletonScope(),t(Fb).toService(Bb))}));class PA extends nm{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var LA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OA=function(t,e){return function(i,s){e(i,s,t)}};let IA=class extends PA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};IA=LA([qa(),OA(0,$a(_v)),RA("design:paramtypes",[Object])],IA);let DA=!1;const FA=new Fa(((t,e,i,s)=>{DA||(DA=!0,t(Cb).to(IA).inSingletonScope(),t(Fb).toService(Cb))}));var zA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HA=function(t,e){return function(i,s){e(i,s,t)}};let VA=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};VA=zA([qa(),HA(0,$a(gv)),jA("design:paramtypes",[Object])],VA);let NA=!1;const UA=new Fa(((t,e,i,s)=>{NA||(NA=!0,t(Mb).to(VA).inSingletonScope(),t(Fb).toService(Mb))}));class WA extends nm{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var GA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let $A=class extends WA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ip.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};$A=GA([qa(),XA(0,$a(Sv)),YA("design:paramtypes",[Object])],$A);let KA=!1;const qA=new Fa(((t,e,i,s)=>{KA||(KA=!0,t(Pb).to($A).inSingletonScope(),t(Fb).toService(Pb))}));var ZA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},JA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},QA=function(t,e){return function(i,s){e(i,s,t)}};let tk=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};tk=ZA([qa(),QA(0,$a(fv)),JA("design:paramtypes",[Object])],tk);let ek=!1;const ik=new Fa(((t,e,i,s)=>{ek||(ek=!0,t(Tb).to(tk).inSingletonScope(),t(Fb).toService(Tb))}));var sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rk=function(t,e){return function(i,s){e(i,s,t)}};let ak=class extends WA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Uu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=pg(a,u,n),v=ug(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&ip.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};ak=sk([qa(),rk(0,$a(Av)),nk("design:paramtypes",[Object])],ak);let ok=!1;const lk=new Fa(((t,e,i,s)=>{ok||(ok=!0,t(Lb).to(ak).inSingletonScope(),t(Fb).toService(Lb))}));var hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ck=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dk=function(t,e){return function(i,s){e(i,s,t)}};let uk=class extends PA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};uk=hk([qa(),dk(0,$a(yv)),ck("design:paramtypes",[Object])],uk);let pk=!1;const gk=new Fa(((t,e,i,s)=>{pk||(pk=!0,t(Eb).to(uk).inSingletonScope(),t(Fb).toService(Eb))}));var fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vk=function(t,e){return function(i,s){e(i,s,t)}};let _k=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};_k=fk([qa(),vk(0,$a(bv)),mk("design:paramtypes",[Object])],_k);let yk=!1;const bk=new Fa(((t,e,i,s)=>{yk||(yk=!0,t(Rb).to(_k).inSingletonScope(),t(Fb).toService(Rb))}));var xk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ak=function(t,e){return function(i,s){e(i,s,t)}};let kk=class extends eS{constructor(t){super(),this.canvasRenderer=t}};kk=xk([qa(),Ak(0,$a(Mv)),Sk("design:paramtypes",[Object])],kk);let Mk=!1;const Tk=new Fa(((t,e,i,s)=>{Mk||(Mk=!0,t(Ib).to(kk).inSingletonScope(),t(Fb).toService(Ib))}));var wk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ck=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ek=function(t,e){return function(i,s){e(i,s,t)}};let Bk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Bk=wk([qa(),Ek(0,$a(kv)),Ck("design:paramtypes",[Object])],Bk);let Pk=!1;const Lk=new Fa(((t,e,i,s)=>{Pk||(Pk=!0,t(Ob).to(Bk).inSingletonScope(),t(Fb).toService(Ob))}));var Rk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ik=function(t,e){return function(i,s){e(i,s,t)}};let Dk=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Du}};Dk=Rk([qa(),Ik(0,$a(Tv)),Ok("design:paramtypes",[Object])],Dk);let Fk=!1;const zk=new Fa(((t,e,i,s)=>{Fk||(Fk=!0,t(wb).to(Dk).inSingletonScope(),t(Fb).toService(wb))})),jk=Y_();function Hk(){Hk.__loaded||(Hk.__loaded=!0,pf.RegisterGraphicCreator("arc",of),xo.load(xy),xo.load(jk?kA:Nx))}Hk.__loaded=!1;const Vk=Hk;function Nk(){Nk.__loaded||(Nk.__loaded=!0,pf.RegisterGraphicCreator("area",nf),xo.load(wy),xo.load(jk?UA:$x))}Nk.__loaded=!1;const Uk=Nk;function Wk(){Wk.__loaded||(Wk.__loaded=!0,pf.RegisterGraphicCreator("circle",Sg),xo.load(Py),xo.load(jk?ik:tS))}Wk.__loaded=!1;const Gk=Wk;function Yk(){Yk.__loaded||(Yk.__loaded=!0,pf.RegisterGraphicCreator("glyph",zg),xo.load(Vy),xo.load(jk?Tk:oS))}Yk.__loaded=!1;const Xk=Yk;function $k(){$k.__loaded||($k.__loaded=!0,pf.RegisterGraphicCreator("group",Rp))}$k.__loaded=!1;const Kk=$k;function qk(){qk.__loaded||(qk.__loaded=!0,pf.RegisterGraphicCreator("image",Wg),xo.load($y),xo.load(jk?zk:dS))}qk.__loaded=!1;const Zk=qk;function Jk(){Jk.__loaded||(Jk.__loaded=!0,pf.RegisterGraphicCreator("line",Lg),xo.load(My),xo.load(jk?FA:vS))}Jk.__loaded=!1;const Qk=Jk;function tM(){tM.__loaded||(tM.__loaded=!0,pf.RegisterGraphicCreator("path",tf),xo.load(Iy),xo.load(jk?gk:ES))}tM.__loaded=!1;const eM=tM;function iM(){iM.__loaded||(iM.__loaded=!0,pf.RegisterGraphicCreator("polygon",cf),xo.load(Fy),xo.load(jk?bk:AS))}iM.__loaded=!1;const sM=iM;function nM(){nM.__loaded||(nM.__loaded=!0,pf.RegisterGraphicCreator("rect",Dg),xo.load(Ay),xo.load(jk?BA:FS))}nM.__loaded=!1;const rM=nM;function aM(){aM.__loaded||(aM.__loaded=!0,pf.RegisterGraphicCreator("richtext",Zg),xo.load(Yy),xo.load(jk?Lk:jS))}aM.__loaded=!1;const oM=aM;function lM(){lM.__loaded||(lM.__loaded=!0,pf.RegisterGraphicCreator("shadowRoot",uf))}lM.__loaded=!1;const hM=lM;function cM(){cM.__loaded||(cM.__loaded=!0,pf.RegisterGraphicCreator("symbol",Eg),xo.load(Ey),xo.load(jk?qA:GS))}cM.__loaded=!1;const dM=cM;function uM(){uM.__loaded||(uM.__loaded=!0,pf.RegisterGraphicCreator("text",Tg),xo.load(Ry),xo.load(jk?lk:KS))}uM.__loaded=!1;const pM=uM;function gM(){Kk(),rM()}const fM=-.5*Math.PI,mM=1.5*Math.PI,vM="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var _M;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(_M||(_M={}));const yM={[_M.selectedReverse]:{},[_M.selected]:{},[_M.hover]:{},[_M.hoverReverse]:{}},bM={container:"",width:30,height:30,style:{}},xM="scrollDrag";function SM(){return"browser"===I_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const AM={debounce:St,throttle:At};gM();let kM=class t extends db{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=_t(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=_t(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=SM(),a="browser"===I_.env?I_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=_t(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:AM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:yt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=yt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(xM,{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",AM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===I_.env?I_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(yt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ai(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ai(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=_t(t[0],0,1),c=_t(t[1],0,1),d=_t(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=yt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?yt([a+i*n,a+s*n],a,n-l):yt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=SM(),e="browser"===I_.env?I_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===I_.env?I_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};kM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};var MM,TM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wM=MM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ve).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Ut(t.deltaX)>Ut(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ne,e.addEventListener("wheel",this.scroll),this.params=MM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(xM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new kM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(wM)||(t(wM).toSelf(),t(e_).toService(wM))}));function EM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&EM(t,e)}))}const BM=t=>!u(t)&&!1!==t.visible;function PM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function LM(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const OM=["#ffffff","#000000"];function IM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ii(t).toHex(),o=new ii(e).toHex();return DM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...OM);for(const n of a)if(t!==n&&DM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function DM(t,e,i,s,n){if("lightness"===n){const i=ii.getColorBrightness(new ii(e));return ii.getColorBrightness(new ii(t))<.5?i>=.5:i<.5}return s?FM(t,e)>s:"largeText"===i?FM(t,e)>3:FM(t,e)>4.5}function FM(t,e){const i=zM(t),s=zM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function zM(t){const e=ni(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function jM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function HM(t,e){return[t[0]*e,t[1]*e]}function VM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function NM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const UM=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:vM,fontSize:14},s),getTextBounds:i?void 0:mf,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function WM(t,e,i={}){if(!t)return{width:0,height:0};const s=mf({text:t,fontFamily:e.fontFamily||i.fontFamily||vM,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function GM(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function YM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function XM(t,e="type"){const i=GM(t,e);return"rich"===i?pf.richtext(YM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),pf.text(t))}function $M(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const KM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function qM(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function ZM(t,e){const{dx:i,dy:s}=qM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function JM(){Kk(),rM(),dM(),oM(),pM()}var QM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=QM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Wl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},tT.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}tT.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const eT={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}},iT={poptip:j({},eT)};var sT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",Xt(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",Xt(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:jt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:jt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:jt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}cT.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};var dT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let uT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};j(s,cT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new cT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,iT.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};uT=dT([qa()],uT);var pT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class gT{constructor(){this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let fT=class extends gT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};fT=pT([qa()],fT);let mT=class extends gT{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};mT=pT([qa()],mT);const vT=new Fa(((t,e,i,s)=>{i(uT)||(t(uT).toSelf().inSingletonScope(),t(dg).toService(uT)),i(fT)||(t(fT).toSelf(),t(e_).toService(fT)),i(mT)||(t(mT).toSelf(),t(e_).toService(mT))}));class _T extends db{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}Kk(),Qk();class yT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},yT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}yT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Kk(),rM();class bT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},bT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}bT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},Kk(),Vk();class xT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},xT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}xT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},Kk(),Vk();class ST extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ST.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=fM,endAngle:s=mM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}ST.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},Kk(),eM();class AT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},AT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ce(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}function kT(){Kk(),Qk(),sM(),dM()}function MT(){Kk(),Qk(),Vk(),dM()}AT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},kT();class TT extends db{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TT.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=pf.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=pf.line;Y(i)[0].cornerRadius&&(t=pf.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=pf.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}TT.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}}},MT();class wT extends TT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TT.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=pf.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var CT,ET;!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.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(CT||(CT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(ET||(ET={}));const BT={[ET.selectedReverse]:{},[ET.selected]:{},[ET.hover]:{},[ET.hoverReverse]:{}},PT={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},LT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const RT=Math.sin(Math.PI/10);function OT(t,e=RT){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function IT(t,e=RT){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function DT(t){const e={};return EM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function FT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function zT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return HM(r,(s?-1:1)*(n?-1:1)*t/VM(r))}function jT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function VT(t,e,i){var s;if(IT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>ze(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>ze(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function NT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(_M.hover,!0),EM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(_M.hoverReverse,!0)})),s):i},WT=(t,e,i)=>i?(EM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(_M.hoverReverse),t.removeState(_M.hover))})),null):i,GT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(_M.selected)?(EM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(_M.selectedReverse),t.removeState(_M.selected))})),null):s.name&&!P(s.states)?(s.addState(_M.selected,!0),EM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(_M.selectedReverse,!0)})),s):i};class YT extends db{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const XT={type:"default",duration:300,easing:"linear"};class $T extends YT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=UT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=WT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=GT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=pf.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prepare(),this._prevInnerView=this._innerView&&DT(this._innerView),this.removeAllChild(!0),this._innerView=pf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(XT)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=pf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=CT.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=pf.group({x:0,y:0,pickable:!1});t.name=CT.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=pf.group({x:0,y:0,pickable:!1});i.name=CT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=pf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=CT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=yM;else{const t=this.data[s],e=j({},yM,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=pf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=CT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=yM;else{const i=j({},yM,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=pf.group({x:0,y:0,pickable:!1});return r.name=`${CT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=XM(this._getLabelAttribute(t,e,n,i));if(a.name=CT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=yM;else{const s=j({},yM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new tT(Object.assign({},e));i.name=CT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return FT(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Ut(s[0])>Ut(s[1])?o=jt/2*(l.x>e.x?1:-1):h=jt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?j({},PT.label.style,_(t,e,i,s)):_;_=j(this.getLabelAlign(m,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return d(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},EM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const KT={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&VT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function qT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function ZT(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:KT[n]||KT.parity;if(s.length>=3&&NT(s,r)){do{s=a(s,r)}while(s.length>=3&&NT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);VT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),ZT(l,s,n,(t=>VT(t,l,r))),ZT(h,s,o,(t=>VT(t,h,r)||!(!n||t===l)&&VT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function QT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},iw(t,e.attribute.angle)),{angle:ew(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({},sw(t,e.attribute.angle)),{angle:ew(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function ew(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function iw(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=ew(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function sw(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=ew(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function nw(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=IT(h),m=OT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function rw(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class aw{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=VM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return HM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class ow{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-ow.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*ow.bounceIn(2*t):.5*ow.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Nt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Nt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Nt/e)*.5+1}}static registerFunc(t,e){ow[t]=e}}function lw(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}ow.quadIn=ow.getPowIn(2),ow.quadOut=ow.getPowOut(2),ow.quadInOut=ow.getPowInOut(2),ow.cubicIn=ow.getPowIn(3),ow.cubicOut=ow.getPowOut(3),ow.cubicInOut=ow.getPowInOut(3),ow.quartIn=ow.getPowIn(4),ow.quartOut=ow.getPowOut(4),ow.quartInOut=ow.getPowInOut(4),ow.quintIn=ow.getPowIn(5),ow.quintOut=ow.getPowOut(5),ow.quintInOut=ow.getPowInOut(5),ow.backIn=ow.getBackIn(1.7),ow.backOut=ow.getBackOut(1.7),ow.backInOut=ow.getBackInOut(1.7),ow.elasticIn=ow.getElasticIn(1,.3),ow.elasticOut=ow.getElasticOut(1,.3),ow.elasticInOut=ow.getElasticInOut(1,.3*1.5),ow.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),ow.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},ow.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)ow[`flicker${t}`]=e=>lw(e,t);for(let t=2;t<10;t++)ow[`aIn${t}`]=e=>t*e*e+(1-t)*e;function hw(t,e,i){return t+(e-t)*i}const cw=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=hw(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=hw(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=hw(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=hw(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=hw(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=hw(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=hw(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=hw(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=hw(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=pp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?fp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=pp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?fp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=hw(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=hw(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=hw(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=hw(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=hw(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=hw(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=hw(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=hw(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=hw(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=id(e,i,s),r.addUpdateBoundTag()}}};function dw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=ow[s])&&void 0!==n?n:ow.linear:ow.linear,"wait"===t&&(this.onUpdate=uw),this.id=Da.GenAutoIncrementId(),this.syncAttributeUpdate=uw}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=dp.Get(i,cp.Color255),r=dp.Get(s,cp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(cw["fill"===e?"fillPure":"strokePure"])}else cw[e]?t.push(cw[e]):t.push(dw)}else cw[e]?t.push(cw[e]):t.push(dw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class gw extends pw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class fw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Da.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Io.END?this.removeAnimate(t,!0):t.status!==Io.RUNNING&&t.status!==Io.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const mw=new fw;mw.isGlobal=!0;class vw{constructor(t=Da.GenAutoIncrementId(),e=mw,i){this.id=t,this.status=Io.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new pw(Oo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new gw(Oo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new pw(Oo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Io.RUNNING&&(this.status=Io.PAUSED)}resume(){this.status===Io.PAUSED&&(this.status=Io.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Io.END&&this.onEnd(),this.status=Io.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Io.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Io.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Io.END);this.status=Io.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const _w=new Mo;class yw{constructor(){this.released=!1}tick(t,e){_w.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class bw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Ro.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Ro.INITIAL,Ao.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Ao.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new yw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Ro.INITIAL&&(this.status=Ro.PAUSE,!0)}resume(){return this.status!==Ro.INITIAL&&(this.status=Ro.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Ro.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Ro.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Ro.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Ao.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function Aw(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}Sw.getInstance();class kw{static registerBuiltInAnimate(t,e){kw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:kw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=Aw(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:kw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=Aw(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),O.attrOutChannel&&e.setAttributes(O.attrOutChannel),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_,y,b;if(e&&i){i=Aw(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(_=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:kw.builtInAnimateMap[r],f=t.custom?t.customType:Aw(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Io.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}kw.builtInAnimateMap={};const Mw="appear",Tw="disappear",ww="update",Cw="highlight",Ew="unhighlight";class Bw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class Pw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=Sw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new kw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new kw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([Mw],[{name:Mw,animation:t}],e)}applyDisappearState(t,e){this.applyState([Tw],[{name:Tw,animation:t}],e)}applyUpdateState(t,e){this.applyState([ww],[{name:ww,animation:t}],e)}applyHighlightState(t,e){this.applyState([Cw],[{name:Cw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([Ew],[{name:Ew,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class Lw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new Pw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new Bw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new Lw)._getAnimationStateManager(t),t}}class Rw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new vw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:mw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new fw}createTicker(t){return new bw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new kw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function Ow(){G(Bp,Lw),G(Bp,Rw)}class Iw extends pw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Dw extends Iw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Fw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new kw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function zw(t){return new Fw(t)}class jw extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Hw=1e3,Vw="quadInOut",Nw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Uw=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=pp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Ww=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?uy(t):[],n=uy(e);i&&s&&(i.fromTransform&&py(s,i.fromTransform.clone().getInverse()),py(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Yw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Xw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Yw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?dp.Get(t,cp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class $w extends Iw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Ww(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Uw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Kw=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Gw(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Xw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new $w({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Hw,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Vw);return c.play(d),c};class qw extends Iw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Ww(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&Uw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Zw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Nw.includes(t))(i)||(e[i]=t[i])})),e},Jw=(t,e,i)=>{const s=Zw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=Ao.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Qw=(t,e,i)=>{const s=[],n=i?null:Zw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Zw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Rg(t.attribute),n=fy(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Ao.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=fy(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(Ao.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=fy(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(Ao.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return my(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return my(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ao.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:vy(i)}];const s=[];return yy(i,e,s),s})(t,e).forEach((t=>{s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return yy(l,e,h),h})(t,e).forEach((t=>{s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=uy(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(Ao.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Jw(t,s,e),s};class eC extends Iw{constructor(t,e,i,s,n){super(null,{},i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){super.onBind(),this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:qo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:qo.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:qo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class iC extends eC{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=Ao.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class sC extends eC{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Ao.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class nC extends Iw{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=_t(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=ed(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class oC extends rC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class lC extends aC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const hC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class cC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class dC extends cC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=hC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class uC extends cC{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class pC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class gC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const fC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class mC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=fC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class vC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const _C=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class yC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>ed(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class bC extends yC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:_C(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class xC extends yC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:_C(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const SC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class AC extends yC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:SC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class kC extends yC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:SC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const MC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class TC extends yC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:MC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class wC extends yC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:MC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const CC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class EC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class BC extends EC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=CC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class PC extends EC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const LC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class RC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=LC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class OC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class IC extends Dw{onBind(){var t;const e=zw(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class DC extends Dw{onBind(){const t=zw(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function FC(){Kk(),Qk(),oM(),pM(),kw.registerBuiltInAnimate("axisEnter",IC),kw.registerBuiltInAnimate("axisUpdate",DC)}var zC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=pf.group({zIndex:999});e.name=CT.axisBreak,e.id=this._getNodeId(`${CT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},LT,s),a=null!==(e=r.size)&&void 0!==e?e:LT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=pf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=CT.axisBreakSymbol;const h=pf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=CT.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=pf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=CT.background,n.id=this._getNodeId("background"),n.states=j({},BT,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new tT(Object.assign({},t));e.name=CT.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=zC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:j({},BT,l),symbol:j({},BT,l)});const d=new TT(c);d.name=CT.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=zC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+L(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let T,w,{angle:C}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(C)&&o){C=NM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else T=this.getTextAlign(M),w=this.getTextBaseline(M,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(C!==Math.PI/2){const t=Math.abs(Math.cos(null!=C?C:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(C&&0!==C){const t=Math.abs(Math.sin(C));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:w},a),state:{text:j({},BT,c.text),shape:j({},BT,c.shape),panel:j({},BT,c.background)}});return B.angle=C,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=zC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(u(b)&&a){b=NM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return iw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return sw(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),tw(i,t),!QT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=IT(a),l=OT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=rw(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Xt(c,i))}}else{if(l){const i=rw(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Xt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);nw(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&JT(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=pf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=CT.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=WM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ai(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}jC.defaultAttributes=PT,G(jC,aw);class HC{isInValidValue(t){const{startAngle:e=fM,endAngle:i=mM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=fM,endAngle:i=mM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return zT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function VC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=VC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var WC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=jT(n,l,c,e,i);h=pf.path(Object.assign(Object.assign({},a.style),{path:HT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=pf.circle(t)}h.name=CT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},BT,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=WC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:j({},BT,d.text),shape:j({},BT,d.shape),panel:j({},BT,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=VC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&NC(e,c,i)}else e.AABBBounds.width()>r&&NC(e,r,i)}else o>a.x&&h.x2>n.x2?(NC(e,n.x2-o,i),r&&UC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}GC.defaultAttributes=PT,G(GC,HC);const YC=t=>t.map(((t,e)=>({index:e,value:t}))),XC=(t,e,i=0)=>{const s=new Ne(t).expand(i/2),n=new Ne(e).expand(i/2);return s.intersects(n)},$C=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=UM(a),_=t.range();let y=[];for(let i=0;i{ZC[t]=!0}));const iE=t=>-Math.log(-t),sE=t=>-Math.exp(-t),nE=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,rE=t=>10===t?nE:t===Math.E?Math.exp:e=>Math.pow(t,e),aE=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),oE=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),lE=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function hE(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 cE(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function dE(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function uE(t,e,i,s){return 1===i&&(i=0),dE(t,i,s)*(e/(1-i))}function pE(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function gE(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class mE{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=pE(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=_t(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const vE=Symbol("implicit");class _E extends mE{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=qC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=vE}clone(){const t=(new _E).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==vE)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return yE(t,e,r,n)}class xE extends _E{constructor(t){super(),this.type=qC.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=uE(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:bE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return bE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new xE(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:SE}=ri;function AE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=ii.parseColorString(e)){const e=SE(ii.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof si?SE(t,e):e instanceof ii?SE(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class kE extends mE{constructor(t=eE,e=eE){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=eE,this._piecewise=cE,this._interpolate=AE}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Mt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=bt(i[0],i[r-1])),this._piecewise=r>2?gE:cE,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:eE),this.rescale(i)):this._clamp!==eE}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const ME=Math.sqrt(50),TE=Math.sqrt(10),wE=Math.sqrt(2),CE=[1,2,5,10],EE=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=RE(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?PE(0,-(e-1)/s,s):PE((e-1)/s,0,s)},BE=vt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return EE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return EE(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=PE(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=PE(t,e,l);return n&&r.reverse(),r})),RE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=CE[0];return i>=ME?s=CE[3]:i>=TE?s=CE[2]:i>=wE&&(s=CE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function OE(t,e,i){const s=(e-t)/Math.max(0,i);return RE(s)}function IE(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=OE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function FE(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const zE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),jE=vt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),HE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=LE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?zE(t,e,n):zE(t,e,fE(n)),h=zE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),VE=vt(((t,e,i,s,n)=>IE(s(t),s(e),i).map((t=>fE(n(t))))));class NE extends kE{constructor(){super(...arguments),this.type=qC.Linear}clone(){var t;const e=new NE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return BE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=LE(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return IE(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function WE(t){return e=>-t(-e)}function GE(t=Number.EPSILON){return e=>Math.max(e,t)}class YE extends kE{constructor(){super(aE(10),rE(10)),this.type=qC.Log,this._limit=GE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new YE).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=aE(this._base),s=rE(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=WE(i),this._pows=WE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=iE,this.untransformer=sE):(this._logs=i,this._pows=s,this._limit=GE(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return eE}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return jE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return HE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return VE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return VE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(YE,UE);class XE extends NE{constructor(){super(oE(1),lE(1)),this.type=qC.Symlog,this._const=1}clone(){return(new XE).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=oE(t),this.untransformer=lE(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return jE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return HE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return VE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return VE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(XE,UE);class $E{constructor(){this.type=qC.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[lt(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 $E).domain(this._domain).range(this._range).unknown(this._unknown)}}function KE(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function qE(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!JC(t.type))return YC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return YC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=KE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=KE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=KE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=KC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=KC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?JE.greedy:JE.parity;for(;l.length>=3&&NT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;VT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),qE(t,l,a,(e=>VT(e,t,i))),qE(n,l,o,(e=>VT(e,n,i)||!(!a||e===t)&&VT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return YC(m)},JE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&VT(i,t,e)||(i=t,0))))}},QE=(t,e,i,s)=>{const n=KC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},tB=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,eB=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?YC([s[s.length-1]]):YC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(g),a=$(g);if(s.length<=f/n){const i=QE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=sB(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=QE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!tB(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?eB(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=UM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=FT(r,zT(s,r,e,n));return o=a,l=zT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(gt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return YC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=nB(t,i,e),r=K(s),l=$(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=aB(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return YC(c)},aB=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&XC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},oB=new Uint32Array(33),lB=new Uint32Array(33);lB[0]=0,oB[0]=~lB[0];for(let t=1;t<=32;++t)lB[t]=lB[t-1]<<1|1,oB[t]=~lB[t];function hB(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&oB[31&o]&lB[1+(31&l)])return!0}else{if(i[h]&oB[31&o])return!0;if(i[c]&lB[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,oB[31&o]&lB[1+(31&l)]);else for(s(h,oB[31&o]),s(c,lB[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,lB[31&a]|oB[1+(31&o)]);else for(n(l,lB[31&a]),n(h,oB[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function cB(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=_t(i,-o,t.width+l),d=_t(s,-o,t.width+l),u=_t(n,-a,t.height+h),p=_t(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function dB(t,e,i=!1){return i?cB(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function uB(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=dB(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=cB(t,r)),e.getRange(r)))}function pB(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return pB(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return pB(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return pB(t,e,n,s,h,c)}return!1}const fB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],mB=["top","inside-top","inside"];function vB(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const _B={mode:"same-time",duration:300,easing:"linear"};function yB(t){return 3===t||4===t}function bB(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const xB=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function SB(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}var AB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const TB=(t,e)=>Math.ceil(t)>Math.floor(e),wB=([t,e],[i,s])=>s>t&&e>i;function CB(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var EB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(_M.hover,!0),EM(this,(t=>{t===e||P(t.states)||t.addState(_M.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(EM(this,(t=>{P(t.states)||(t.removeState(_M.hoverReverse),t.removeState(_M.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void EM(this,(t=>{P(t.states)||(t.removeState(_M.selectedReverse),t.removeState(_M.selected))}));P(e.states)||(e.addState(_M.selected,!0),EM(this,(t=>{t===e||P(t.states)||t.addState(_M.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===qo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===qo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[SB(g,f,c,d,a,o),SB(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=pf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Wl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],h=o;if(!c(e)&&d(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?h.push(i):l.push(i)}))}d(r)?o=r(h,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(h).concat(l)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return XM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&TB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&TB(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(CB([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!wB([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(dB(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(dB(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(dB(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{PB[t]=e};var RB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}OB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const IB=()=>{LB("symbol",OB),LB("line-data",OB)};var DB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}FB.tag="rect-label",FB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var zB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};jB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const HB=()=>{LB("line",jB),LB("area",jB)};var VB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new NB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):yB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=yB(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=yB(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=yB(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?yB(t.quadrant)?"left":"right":yB(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(yB(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function YB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ae.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function XB(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=HT(t,!!n),o=HT(r,!!n);const h=ae.distancePP(s,l),c=ae.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=YB(e,t,!1,!!n),o=YB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=HT(t,!!n),o=HT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}GB.defaultAttributes={pickable:!1};class $B extends db{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&DT(this._innerView),this.removeAllChild(!0),this._innerView=pf.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return FT(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=j({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${CT.grid}-sub`:`${CT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=HT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=YB(t,o,!1,!!a)}const u=pf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:$B.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=HT(o,!!a),m=Ut(o[0].x-o[1].x),v=Ut(o[0].y-o[1].y),_=pf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*jt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:$B.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}$B.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},Kk(),eM();class KB extends $B{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},$B.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=fM,endAngle:r=mM}=this.attribute;i=jT(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=j({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}G(KB,aw);var qB,ZB,JB,QB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(tP,HC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(qB||(qB={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(ZB||(ZB={})),function(t){t.dataZoomChange="dataZoomChange"}(JB||(JB={}));const eP="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",iP={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:eP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:eP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},sP={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}},nP=0,rP=1,aP=2,oP=3,lP=4,hP=5,cP=5,dP=999,uP=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var pP=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:aP},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:aP},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:nP},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T;const{orient:w,middleHandlerStyle:C={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:L,end:R}=this._getState(),{position:O,width:I,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:O.x+L*I,y:O.y-t,width:(R-L)*I,height:t,zIndex:hP},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:O.x+(L+R)/2*I,y:O.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:hP},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+L*I,y:O.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},sP.horizontal),{zIndex:hP}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+R*I,y:O.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},sP.horizontal),{zIndex:hP}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+L*I-t/2,y:O.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:dP},sP.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+R*I-g/2,y:O.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:dP},sP.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===w?O.x-t:O.x+I,y:O.y+L*D,width:t,height:(R-L)*D,zIndex:hP},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===w?O.x-t/2:O.x+I+t/2,y:O.y+(L+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:hP},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+L*D,size:I,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},sP.vertical),{zIndex:hP}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+R*D,size:I,symbolType:null!==(M=B.symbolType)&&void 0!==M?M:"square",zIndex:hP},sP.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+I/2+t/2,y:O.y+L*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dP},sP.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+I/2+i/2,y:O.y+R*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dP},sP.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:oP},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:oP},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:rP},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:lP},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ve).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=pP(c,["formatMethod"]),{formatMethod:g}=d,f=pP(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:uP(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},w={textAlign:uP(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:uP(A,t,"start",this._isHorizontal)?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:uP(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:cP}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:cP}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new tT(e),s.name=i,t.add(s)),s}}const fP={debounce:St,throttle:At};class mP extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=qB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=qB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=qB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=qB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=qB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===I_.env?I_:this.stage,s=SM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===qB.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===qB.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===qB.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===qB.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(ZB.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(ZB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(ZB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===qB.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(ZB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(ZB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:fP[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===I_.env?I_:this.stage,e=SM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===I_.env?I_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===I_.env?I_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:_t(e+t,0,1),end:_t(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=qB.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}JM(),rM(),dM(),Uk(),Qk();let vP=class t extends db{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new gP(this._getRendererAttrs()),this._interaction=new mP(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(ZB.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(ZB.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(JB.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(ZB.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(JB.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var _P,yP,bP,xP;function SP(){Kk(),JM(),Ow()}vP.defaultAttributes=iP,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(_P||(_P={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(yP||(yP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(bP||(bP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(xP||(xP={}));class AP extends db{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=UT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=WT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=GT(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=pf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=pf.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=pf.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function kP(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function MP(t,e,i,s){t&&(kP(t.startSymbol,e,i,s),t.lines.forEach((t=>kP(t,e,i,s))),kP(t.line,e,i,s),kP(t.endSymbol,e,i,s))}function TP(t,e,i,s){t&&(kP(t.getTextShape(),e,i,s),kP(t.getBgRect(),e,i,s))}function wP(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function CP(t,e,i,s){t&&(wP(t.startSymbol,e,i,s),t.lines.forEach((t=>wP(t,e,i,s))),wP(t.line,e,i,s),wP(t.endSymbol,e,i,s))}function EP(t,e,i,s){t&&(wP(t.getTextShape(),e,i,s),wP(t.getBgRect(),e,i,s))}function BP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;kP(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),kP(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;kP(t.getTextShape(),e,l,n),kP(t.getBgRect(),e,l,n)}))}function PP(t,e,i,s,n){MP(t,s,i,n),Y(e).forEach((t=>{TP(t,s,i,n)}))}function LP(t,e,i,s,n){kP(t,s,i,n),Y(e).forEach((t=>{TP(t,s,i,n)}))}function RP(t,e,i,s,n){kP(t,s,i,n),Y(e).forEach((t=>{TP(t,s,i,n)}))}function OP(t,e,i,s,n,r){var a;MP(t,n,s,r),kP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?TP(i,n,s,r):kP(i,n,s,r)}function IP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;kP(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),kP(e,n+o+l,h,r),kP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(kP(i.getTextShape(),n+o+l+h+c,d,r),kP(i.getBgRect(),n+o+l+c,d,r)):kP(i,n+o+l+c,d,r)}function DP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?BP(t,e,s,r,a):"fadeIn"===i&&PP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?BP(t,e,s,n,a):"fadeIn"===i&&PP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){CP(t,s,i,n),Y(e).forEach((t=>{EP(t,s,i,n)}))}(t,e,i,s,n)}}function FP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&LP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&LP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wP(t,s,i,n),Y(e).forEach((t=>{EP(t,s,i,n)}))}(t,e,i,s,n)}}function zP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&RP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&RP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wP(t,s,i,n),Y(e).forEach((t=>{EP(t,s,i,n)}))}(t,e,i,s,n)}}function jP(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?OP(n,r,e,i,s,o):"callIn"===t&&IP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?OP(n,r,e,i,s,a):"callIn"===t&&IP(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;CP(t,n,s,r),wP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?EP(i,n,s,r):wP(i,n,s,r)}(n,r,e,t,i,s)}}const HP={type:"clipIn",duration:500,easing:"linear",delay:0},VP={type:"fadeIn",duration:500,easing:"linear",delay:0},NP={type:"callIn",duration:500,easing:"linear",delay:0},UP={type:"fadeOut",duration:500,easing:"linear",delay:0};class WP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new tT(Object.assign(Object.assign({},h),{state:{panel:j({},yM,null!==(o=a[n])&&void 0!==o?o:X(a)),text:j({},yM,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},yM,null!==(a=r[s])&&void 0!==a?a:X(r)),text:j({},yM,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class GP extends AP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=HP,this.defaultExitAnimation=UP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;ZM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(GP,WP);const YP=.001,XP={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:_P.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]}},$P={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},KP={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:bP.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},qP={interactive:!0,label:{position:yP.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}},ZP={interactive:!0,label:{autoRotate:!0,position:bP.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},JP={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},QP={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},tL={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function eL(){iL._animate=DP}SP(),kT(),Ow();class iL extends GP{markerAnimate(t){iL._animate&&this._animationConfig&&iL._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},iL.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(PM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return LM(Math.abs(e),Math.PI/2,YP)||LM(Math.abs(e),3*Math.PI/2,YP)?RM(i,e,t):PM(e)?$P.postiveXAxis[t]:$P.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new TT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},yM,null==a?void 0:a.line),startSymbol:j({},yM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},yM,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:j({},yM,null==a?void 0:a.line),startSymbol:j({},yM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},yM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",iL.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(iL.defaultAttributes.label)}}function sL(){nL._animate=FP}iL.defaultAttributes=XP,SP(),sM(),Ow();class nL extends AP{markerAnimate(t){nL._animate&&this._animationConfig&&nL._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},nL.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=VP,this.defaultExitAnimation=UP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},QP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;ZM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=pf.polygon(Object.assign({points:e},i));n.states=j({},yM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",nL.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},yM,null==i?void 0:i.area)),this._updateMarkLabels(nL.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}nL.defaultAttributes=qP,G(nL,WP),SP(),MT(),Ow();class rL extends GP{markerAnimate(t){rL._animate&&this._animationConfig&&rL._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},rL.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case bP.arcInnerStart:l=n;case bP.arcOuterStart:l=n;break;case bP.arcInnerEnd:l=r;case bP.arcOuterEnd:l=r;break;case bP.center:case bP.arcInnerMiddle:case bP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return JP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new wT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},yM,null==o?void 0:o.line),startSymbol:j({},yM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},yM,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},yM,null==o?void 0:o.line),startSymbol:j({},yM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},yM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",rL.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(rL.defaultAttributes.label)}}rL.defaultAttributes=KP,SP(),Vk(),Ow();class aL extends AP{markerAnimate(t){aL._animate&&this._animationConfig&&aL._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},aL.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=VP,this.defaultExitAnimation=UP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case bP.center:h=(s+n)/2,c=(r+a)/2;break;case bP.arcInnerStart:h=s,c=r;break;case bP.arcOuterStart:h=n,c=r;break;case bP.arcInnerEnd:h=s,c=a;break;case bP.arcOuterEnd:h=n,c=a;break;case bP.arcInnerMiddle:h=s,c=(r+a)/2;break;case bP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},JP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;ZM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=pf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},yM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",aL.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=j({},yM,null==o?void 0:o.area)),this._updateMarkLabels(aL.defaultAttributes.label)}isValidPoints(){return!0}}function oL(){lL._animate=jP}aL.defaultAttributes=ZP,G(aL,WP),SP(),kT(),MT(),dM(),Zk(),Qk(),Ow();class lL extends AP{markerAnimate(t){lL._animate&&this._animationConfig&&lL._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lL.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=NP,this.defaultExitAnimation=UP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return LM(Math.abs(s),Math.PI/2,YP)||LM(Math.abs(s),3*Math.PI/2,YP)?RM(t,s,n):PM(s)?tL.postiveXAxis[n]:tL.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=xP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},yM,null==p?void 0:p.textBackground),text:j({},yM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},yM,null==p?void 0:p.itemContent));const v=PM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=pf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},yM,null==s?void 0:s.itemContent)):"text"===n?o=new tT(Object.assign(Object.assign({},i),{state:{panel:j({},yM,null==s?void 0:s.textBackground),text:j({},yM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=pf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},yM,null==s?void 0:s.itemContent)):"image"===n?(o=pf.image(Object.assign(Object.assign({},i),r)),o.states=j({},yM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},yM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=LM(c,0,YP)||LM(d,0,YP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=KM(e-u,t-d),o=KM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(vL.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(vL.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===vL.focus||"focus"===o){const s=a.hasState(fL.focus);a.toggleState(fL.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[fL.unSelected,fL.unSelectedHover,fL.focus],t),this._setLegendItemState(e,fL.selected,t)})):(this._setLegendItemState(a,fL.selected,t),this._removeLegendItemState(a,[fL.unSelected,fL.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[fL.selected,fL.selectedHover,fL.focus],t),this._setLegendItemState(e,fL.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(fL.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(fL.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(mL.legendItemClick,a,t);i?(this._removeLegendItemState(a,[fL.selected,fL.selectedHover],t),this._setLegendItemState(a,fL.unSelected,t)):(this._setLegendItemState(a,fL.selected,t),this._removeLegendItemState(a,[fL.unSelected,fL.unSelectedHover],t))}else this._setLegendItemState(a,fL.selected,t),this._removeLegendItemState(a,[fL.unSelected,fL.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[fL.selected,fL.selectedHover],t),this._setLegendItemState(e,fL.unSelected,t))}))}this._dispatchLegendEvent(mL.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,fL.selected),this._removeLegendItemState(e,[fL.unSelected,fL.unSelectedHover])):(this._removeLegendItemState(e,[fL.selected,fL.selectedHover]),this._setLegendItemState(e,fL.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=uL,spaceRow:l=pL,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=pf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ai(c);let w;!1===x.visible?(w=pf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,vL.item,t,w)):(w=pf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,vL.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?fL.selected:fL.unSelected);const C=pf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=pf.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,vL.itemShape,t,w,S.state),s.addState(e?fL.selected:fL.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=pf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,vL.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=XM(Object.assign(Object.assign({x:P/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,vL.itemLabel,t,w,A.state),D.addState(e?fL.selected:fL.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=XM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,vL.itemValue,t,w,k.state),r.addState(e?fL.selected:fL.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new dL(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new dL(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new kM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new kM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=uL,spaceRow:o=pL}=n,l=this._itemsContainer,{space:h=gL,defaultCurrent:c=1}=r,d=xL(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=pf.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=uL,spaceRow:a=pL}=s,o=this._itemsContainer,{space:l=gL,defaultCurrent:h=1}=n,c=xL(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=pf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=pf.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(_t(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(_t(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(fL.selected)?this._setLegendItemState(t,fL.selectedHover,e):this._setLegendItemState(t,fL.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===vL.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(mL.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(fL.unSelectedHover)||t.hasState(fL.selectedHover))&&(i=!0),t.removeState(fL.unSelectedHover),t.removeState(fL.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(fL.unSelectedHover)&&!t.hasState(fL.selectedHover)||(i=!0),t.removeState(fL.unSelectedHover),t.removeState(fL.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===vL.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(mL.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(mL.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==vL.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(mL.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==vL.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(mL.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(fL.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},SL,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(fL.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var kL;function ML(t){return y(t)?t:[t,t]}function TL(t){return t?"ew-resize":"ns-resize"}AL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:uL,spaceRow:pL,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:gL,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"}(kL||(kL={})),yL();class wL extends db{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},wL.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=_t(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=SM(),n="browser"===I_.env?I_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=_t(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=SM(),n="browser"===I_.env?I_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?_t(t+p,h,c):_t(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?_t(t+p,0,c-h):_t(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:ML(d)[0],endValue:ML(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=pf.group({x:0,y:0});f.name=kL.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=pf.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=kL.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=pf.group({x:g?v:0,y:g?0:v});f.add(_);const y=pf.group({x:0,y:0});let b;if(y.name=kL.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=pf.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=kL.endText,f.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=pf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=kL.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=ML(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":TL(p)},r));if(v.name=kL.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=kL.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":TL(p)},r));if(i.name=kL.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=kL.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=yt(h,i,s);c=t[0],d=t[1]}else c=i,d=_t(h,i,s);const p=this._isHorizontal;e||(c=i);const f=pf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=kL.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":TL(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=pf.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=kL.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return pf.symbol(t)}_renderHandlerText(t,e){return pf.text(this._getHandlerTextAttributes(t,e))}_getHandlerPosition(t){return this.attribute.range&&t?"start":"end"}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":TL(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=pf.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=pf.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===I_.env?I_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=SM(),e="browser"===I_.env?I_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const n=t.name===kL.startHandler?this._startHandlerText:this._endHandlerText;if(n){const e=this._getHandlerPosition(t.name===kL.startHandler);n.setAttributes(this._getHandlerTextAttributes(i,e))}t.name===kL.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){const s=this._isHorizontal,n=this._getHandlerPosition(t.name===kL.startHandlerText);t.setAttributes(this._getHandlerTextAttributes(i,n));const r=t.name===kL.startHandlerText?this._startHandler:this._endHandler;r&&r.setAttributes({[s?"x":"y"]:e}),t.name===kL.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===I_.env?I_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}wL.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},bL(),yL();class CL extends _L{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},CL.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function EL(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}CL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},bL(),yL(),eM();class BL extends _L{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},BL.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=pf.group({x:0,y:0});this._innerView.add(x);const S=new wL({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:EL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=pf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}BL.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)"}},Kk(),pM(),oM();let PL=class t extends db{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ai(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},bM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},bM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};PL.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 LL={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"}}};Kk(),pM(),oM();let RL=class extends db{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(LL,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=XM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=WM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class OL extends Cg{constructor(t){super(t)}}var IL,DL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(IL||(IL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(DL||(DL={}));class FL extends db{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FL.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"},FL.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"},FL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},FL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},FL.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new OL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new OL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new OL(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(IL.OnPlay)},this.pause=()=>{this._dispatchEvent(IL.OnPause)},this.forward=()=>{this._dispatchEvent(IL.OnForward)},this.backward=()=>{this._dispatchEvent(IL.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}FL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},FL.defaultAttributes={[DL.Start]:{},[DL.Pause]:{},[DL.Backward]:{},[DL.Forward]:{}};const zL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},jL=[200,10];var HL,VL;!function(t){t.Default="default",t.Reverse="reverse"}(HL||(HL={})),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"}(VL||(VL={}));const NL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===HL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===HL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),UL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===HL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===HL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),WL=t=>"top"===t||"bottom"===t;class GL extends db{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},GL.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Yt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(WL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:jL[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:jL[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new wL(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=WL(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new FL(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=WL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:jL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(WL(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:WL(this._orient)?t+s:(this._size.width-r)/2,y:WL(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:WL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:WL(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:WL(this._orient)?t+s:(this._size.width-r)/2,y:WL(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function YL(){yL(),Kk(),dM()}GL.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({},zL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},zL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},zL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},zL),{key:"backward",position:"start"})}},YL();class XL extends GL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:HL.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(IL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(IL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(IL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(IL.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(VL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(NL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||UL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===HL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(VL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=I_.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(VL.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(VL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=I_.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(),I_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(VL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,I_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(VL.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(VL.change),this.dispatchCustomEvent(VL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var $L,KL=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};YL();class qL extends GL{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(IL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(IL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(IL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(IL.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(VL.change))},this.play=()=>KL(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(VL.play),this._rafId=I_.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=I_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,I_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(VL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,I_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(VL.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(VL.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(VL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}($L||($L={}));const ZL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},JL=5;const QL={debounce:St,throttle:At};Kk(),sM();let tR=class t extends db{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=ZL.updateTrigger,endTrigger:i=ZL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:QL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($L.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=ZL.trigger,resetTrigger:e=ZL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent($L.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent($L.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=JL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent($L.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent($L.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent($L.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=JL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($L.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($L.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=ZL.updateTrigger,endTrigger:e=ZL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=pf.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Le(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};tR.defaultAttributes=ZL;const eR=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},iR=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},sR={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:vM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:vM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:vM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ne).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},nR=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];Kk(),rM(),dM(),pM(),oM();let rR=class t extends db{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ai(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",j({symbolType:"circle"},u.shape,{visible:BM(u)&&BM(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},iR(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:BM(u)&&BM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},iR(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},bM),u.value),visible:BM(u)&&BM(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=BM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=BM(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!BM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(BM(n.key)?r+n.key.spacing:0)+(BM(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&($M(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:BM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),$M(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(BM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=ad(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(BM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},iR(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},iR(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},bM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(BM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},iR(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},iR(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>nR.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&BM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=BM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=UM(d),_=UM(u);let y=0;if(BM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(BM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&cu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return eR({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return eR({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};rR.defaultAttributes=sR;const aR=gt;function oR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function lR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function hR(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function cR(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function dR(t,e){const i=cR(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function uR(t,e){const i=pR(t),s=pR(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function pR(t,e={x:0,y:0}){return ae.distancePP(t,e)}function gR(t){return k(t.x)&&k(t.y)}function fR(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function mR(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const vR=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function yR(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&yR(t[i],e)}}var bR,xR,SR;function AR(t){var e,i;const{type:s}=t;return s===xR.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(bR||(bR={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(xR||(xR={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(SR||(SR={}));const kR={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},MR={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function TR(t,e){var i;if(!t)return[];const s=RR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?PR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>BR(i)?CR(t,i,e):i)).filter(p)}))):i.map((i=>BR(i)?CR(t,i,e):i)).filter(p):[]}return[]}function wR(t,e){var i,s;return PR(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function CR(t,e,i){var s;const n=RR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=kR[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=MR[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new ii(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Xe(t,i,s),a=Ye(n,r,e.l),l=new ii(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const ER=(t,e)=>{if(e&&BR(t)){const i=CR(e,t);if(i)return i}return t};function BR(t){return t&&"palette"===t.type&&!!t.key}function PR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function LR(t){return y(t)?{dataScheme:t}:t}function RR(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=AR(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class OR extends _E{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(!PR(this._range))return void super.range(this._range);const t=wR(this._range,this._domain);super.range(t)}}const IR={linear:NE,band:xE,point:class extends xE{constructor(t){super(!1),this.type=qC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:_E,threshold:$E,colorOrdinal:OR};function DR(t){const e=IR[t];return e?new e:null}function FR(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function zR(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function jR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function HR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function VR(t){return!!_(t)&&(!!t.endsWith("%")&&lb(t.substring(0,t.length-1)))}function NR(t){return!!g(t)&&("percent"in t||"offset"in t)}function UR(t,e,i,s=0){var n,r;return S(t)?t:VR(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function WR(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=UR(t[s],e.size,i)}))})),o}function GR(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function YR(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||VR(t)||d(t)||NR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function XR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const $R=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},KR=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function qR(t,e){return t&&e.key in t?t[e.key]:e.default}function ZR(t){return t&&"token"===t.type&&!!t.key}const JR={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},QR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:KR,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:JR,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},tO={name:"dark",colorScheme:{default:{dataScheme:KR,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},eO=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),eO(t[s],e.slice(1),i))};function iO(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=LR(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}sO._charts={},sO._series={},sO._components={},sO._graphicComponents={},sO._marks={},sO._regions={},sO._animations={},sO._implements={},sO._chartPlugin={},sO._vChartPlugin={},sO._componentPlugin={},sO.transforms={fields:Xr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},sO.dataParser={csv:(t,e={},i)=>(i.type=Yr.DSV,na(t)),dsv:(t,e={},i)=>{i.type=Yr.DSV;const s=Vr(aa,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return sa(n).parse(t)},tsv:(t,e={},i)=>(i.type=Yr.DSV,ra(t))},sO._layout={},sO._grammarTransforms={},sO._stageEventPlugins={},sO.registerStageEventPlugin=(t,e)=>{sO._stageEventPlugins[t]=e},sO.getStageEventPlugin=t=>sO._stageEventPlugins[t],sO._interactionTriggers={},sO.registerInteractionTrigger=(t,e)=>{sO._interactionTriggers[t]=e},sO._composedEventMap={},sO.registerComposedEvent=(t,e)=>{sO._composedEventMap[t]=e},sO._tooltipProcessors={},sO.registerTooltipProcessor=(t,e)=>{sO._tooltipProcessors[t]=e},sO.createTooltipProcessor=(t,e)=>{const i=sO._tooltipProcessors[t];return i?new i(e):null};const aO=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},oO=aO(),lO={[QR.name]:QR},hO=QR.name,cO=new Map(Object.keys(lO).map((t=>[t,lO[t]]))),dO=new Map,uO=new Map(Object.keys(lO).map((t=>[t,t===hO]))),pO=(t,e)=>{if(!t)return;const i=vO(e);cO.set(t,i),uO.set(t,!0)},gO=(t=hO)=>(uO.has(t)&&!uO.get(t)&&pO(t,cO.get(t)),cO.get(t)),fO=t=>cO.delete(t)&&dO.delete(t)&&uO.delete(t),mO=t=>!!_(t)&&cO.has(t),vO=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:hO;return nO({},gO(i),t)};class _O{static registerInstance(t){_O.instances.set(t.id,t)}static unregisterInstance(t){_O.instances.delete(t.id)}static getInstance(t){return _O.instances.get(t)}static instanceExist(t){return _O.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return _O.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}_O.instances=new Map;class yO{static registerTheme(t,e){pO(t,e)}static getTheme(t,e=!1){return gO(t)}static removeTheme(t){return fO(t)}static themeExist(t){return mO(t)}static getDefaultTheme(){return yO.themes.get(hO)}static setCurrentTheme(t){yO.themeExist(t)&&(yO._currentThemeName=t,_O.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return yO.getTheme(yO._currentThemeName,t)}static getCurrentThemeName(){return yO._currentThemeName}}function bO(t){return _(t)?yO.themeExist(t)?yO.getTheme(t):{}:g(t)?t:{}}yO.themes=cO,yO._currentThemeName=hO;const xO=["animationThreshold","colorScheme","name","padding"];function SO(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];xO.includes(n)?s[n]=r:m(r)?BR(r)?s[n]=ER(r,e):ZR(r)?s[n]=qR(i,r):s[n]=SO(r,e,i):s[n]=r})),s}function AO(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=AO(t[s],e)}return i}return y(t)?t.map((t=>AO(t,e))):t}function kO(t,e){if(!t)return t;if(m(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=kO(t[s],e)}return i}return y(t)?t.map((t=>kO(t,e))):t}function MO(t,...e){return d(t)?t(...e):t}const TO=(t,e,i,s)=>((t,e,i)=>UM(t,e,i,{fontFamily:JR.fontFamily,fontSize:JR.fontSize}))(e,i,s).measure(t),wO="__VCHART",CO=500,EO=500,BO=`${wO}_MEASURE_CANVAS_ID`,PO=`${wO}_DEFAULT_DATA_INDEX`,LO=`${wO}_DEFAULT_DATA_KEY`,RO=`${wO}_DEFAULT_DATA_SERIES_FIELD`,OO=`${wO}_DEFAULT_SERIES_STYLE_NAME`,IO=`${wO}_STACK_KEY`,DO=`${wO}_STACK_START`,FO=`${wO}_STACK_END`,zO=`${wO}_STACK_START_PERCENT`,jO=`${wO}_STACK_END_PERCENT`,HO=`${wO}_STACK_START_OffsetSilhouette`,VO=`${wO}_STACK_END_OffsetSilhouette`,NO=`${wO}_STACK_TOTAL`,UO=`${wO}_STACK_TOTAL_PERCENT`,WO=`${wO}_STACK_TOTAL_TOP`,GO=`${wO}_STACK_TOTAL_BOTTOM`,YO=`${wO}_MOSAIC_VALUE_START_PERCENT`,XO=`${wO}_MOSAIC_VALUE_END_PERCENT`,$O=`${wO}_MOSAIC_CAT_START_PERCENT`,KO=`${wO}_MOSAIC_CAT_END_PERCENT`,qO=`${wO}_SEGMENT_START`,ZO=`${wO}_SEGMENT_END`,JO=`${wO}_KEY`,QO=`${wO}_MAP_LOOK_UP_KEY`;function tI(t,e){for(let i=0;it.key===e))}function iI(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function sI(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},lI(t,a,n[o],l,e,r))})),s?nI(n):n}function nI(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):nI(t[e].nodes);return t}function rI(t,e){if("values"in t&&t.values.length){const i=hR(t.values,e),s=lR(t.values,jO);t.values.forEach((t=>{t[NO]=i,t[UO]=s}))}else for(const i in t.nodes)rI(t.nodes[i],e)}function aI(t){if(!t.values.length)return;const e=t.values[t.values.length-1][FO]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)oI(t.nodes[r],e,i,s,n)}function lI(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[FO]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),lI(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const hI=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=dI(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function uI(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>fI(t.style(e,i,s,n)):P(t.style)||(e.style=fI(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>fI(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=fI(t.state[e]))})),e.state=i}return e}function pI(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>fI(t[i](e,s,n,r)):P(t[i])||(e[i]=fI(t[i]))})),e}function gI(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),fI(i)}function fI(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const mI=t=>"line"===t||"area"===t,vI=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return mI(i)?e:null==e?void 0:e[0]},_I=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let yI=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=sO.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(sO.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var bI;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(bI||(bI={}));const xI=["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 SI,AI,kI;t.ChartEvent=void 0,(SI=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",SI.rendered="rendered",SI.renderFinished="renderFinished",SI.animationFinished="animationFinished",SI.regionSeriesDataFilterOver="regionSeriesDataFilterOver",SI.afterInitData="afterInitData",SI.afterInitEvent="afterInitEvent",SI.afterInitMark="afterInitMark",SI.rawDataUpdate="rawDataUpdate",SI.viewDataFilterOver="viewDataFilterOver",SI.viewDataUpdate="viewDataUpdate",SI.viewDataStatisticsUpdate="viewDataStatisticsUpdate",SI.markDeltaYUpdate="markDeltaYUpdate",SI.viewDataLabelUpdate="viewDataLabelUpdate",SI.scaleDomainUpdate="scaleDomainUpdate",SI.scaleRawDomainUpdate="scaleRawDomainUpdate",SI.scaleUpdate="scaleUpdate",SI.dataZoomChange="dataZoomChange",SI.drill="drill",SI.layoutStart="layoutStart",SI.layoutEnd="layoutEnd",SI.layoutRectUpdate="layoutRectUpdate",SI.playerPlay="playerPlay",SI.playerPause="playerPause",SI.playerEnd="playerEnd",SI.playerChange="playerChange",SI.playerForward="playerForward",SI.playerBackward="playerBackward",SI.scrollBarChange="scrollBarChange",SI.brushStart="brushStart",SI.brushChange="brushChange",SI.brushEnd="brushEnd",SI.brushClear="brushClear",SI.brushActive="brushActive",SI.legendSelectedDataChange="legendSelectedDataChange",SI.legendFilter="legendFilter",SI.legendItemClick="legendItemClick",SI.legendItemHover="legendItemHover",SI.legendItemUnHover="legendItemUnHover",SI.tooltipShow="tooltipShow",SI.tooltipHide="tooltipHide",SI.tooltipRelease="tooltipRelease",SI.afterResize="afterResize",SI.afterRender="afterRender",SI.afterLayout="afterLayout",SI.afterMarkLayoutEnd="afterMarkLayoutEnd",SI.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(AI||(AI={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(kI||(kI={}));const MI=[kI.mark,kI.model,kI.chart,kI.vchart];class TI{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(kI.vchart,[]),this._levelNodes.set(kI.chart,[]),this._levelNodes.set(kI.model,[]),this._levelNodes.set(kI.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const wI={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class CI{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>vI(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||AI.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||AI.chart);o.get(t)||o.set(t,new TI);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||AI.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||AI.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||AI.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||AI.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?MI.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[AI.chart,AI.window,AI.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&L(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return wI[a]&&(a=wI[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?kI.model:kI.vchart:kI.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=AI.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==kI.model&&s!==kI.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=kI.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case AI.chart:return this._viewBubbles;case AI.window:return this._windowBubbles;case AI.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case AI.chart:return this._viewListeners;case AI.window:return this._windowListeners;case AI.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return xI.includes(t)||Object.values(bI).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&sO.hasInteractionTrigger(e)}}function EI(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function BI(t,e,i){t.getParser(e)||t.registerParser(e,i)}const PI=new Map;let LI;function RI(){LI||(LI=new Ba,BI(LI,"geojson",ka),BI(LI,"topojson",Ta),EI(LI,"simplify",Gr))}function OI(t,e,i={type:"geojson",centroid:!0}){PI.has(t)&&Jy(`map type of '${t}' already exists, will be overwritten.`),RI();const s=new Pa(LI),n=j({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),PI.set(t,s)}function II(t){PI.has(t)?PI.delete(t):Jy(`map type of '${t}' does not exists.`)}function DI(t,e=!1){let i=e;return t.latestData instanceof Pa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const FI=(t,e)=>0===t.length?[]:1===t.length?DI(t[0],null==e?void 0:e.deep):t.map((t=>DI(t,null==e?void 0:e.deep)));function zI(e,i,s){EI(i=i instanceof Ba?i:e.dataSet,"copyDataView",FI);const n=new Pa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function jI(t,e,i=[]){var s;if(t instanceof Pa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Pa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Jy(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Jy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Jy("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function HI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var VI,NI,UI,WI;t.TransformLevel=void 0,(VI=t.TransformLevel||(t.TransformLevel={}))[VI.copyDataView=-10]="copyDataView",VI[VI.treemapFilter=-8]="treemapFilter",VI[VI.treemapFlatten=-7]="treemapFlatten",VI[VI.dotObjFlat=-7]="dotObjFlat",VI[VI.linkDotInfo=-7]="linkDotInfo",VI[VI.sankeyLayout=-7]="sankeyLayout",VI[VI.dataZoomFilter=-6]="dataZoomFilter",VI[VI.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(NI||(NI={})),function(t){t.data="data",t.mark="mark"}(UI||(UI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(WI||(WI={}));const GI=["line","area","trail"];function YI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(JO,i?t.slice().sort(i):t.slice()),{keys:[JO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const XI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function $I(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{$I(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function qI(t,e,i,s){const n=YI(t,(t=>i(t))),r=YI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const ZI=`${wO}_BuiltIn_CallBack_Disappear`;var JI;!function(t){t.render="render",t.disappear="disappear"}(JI||(JI={}));class QI{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;I_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new K_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Rp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:nb(o))&&!1!==c&&sO.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=WI.before}_setCanvasStyle(){if(this._stage&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(I_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=I_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>$I(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>$I(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{$I(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Zy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===WI.before&&(this._layoutState=WI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=WI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),Zy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=KI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=qI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=qI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=YI(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=YI(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:ZI,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{$I(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===NI.appear))?NI.appear:e.every((t=>t===NI.disappear))?NI.disappear:NI.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===AI.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:vI(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===AI.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===AI.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===AI.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===AI.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===AI.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{$I(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=KI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return sb(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return Su(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ao.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{$I(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=I_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){I_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function tD(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:Qy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function eD(t){t.crosshair=Y(t.crosshair||{}).map((e=>iO({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function iD(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=oi(l,i.width,i.height);a=t,o=e}else if(h&&sb(e.mode)){let t;t=_(h)?I_.getElementById(h):h;const{width:e,height:s}=oi(t,i.width,i.height);a=e,o=s}else if(rb(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function sD(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function nD(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var rD,aD,oD,lD,hD,cD;t.LayoutZIndex=void 0,(rD=t.LayoutZIndex||(t.LayoutZIndex={}))[rD.SeriesGroup=0]="SeriesGroup",rD[rD.Axis_Grid=50]="Axis_Grid",rD[rD.CrossHair_Grid=100]="CrossHair_Grid",rD[rD.Region=450]="Region",rD[rD.Mark=300]="Mark",rD[rD.Node=400]="Node",rD[rD.Axis=100]="Axis",rD[rD.MarkLine=500]="MarkLine",rD[rD.MarkArea=100]="MarkArea",rD[rD.MarkPoint=500]="MarkPoint",rD[rD.DataZoom=500]="DataZoom",rD[rD.ScrollBar=500]="ScrollBar",rD[rD.Player=500]="Player",rD[rD.Legend=500]="Legend",rD[rD.CrossHair=500]="CrossHair",rD[rD.Indicator=500]="Indicator",rD[rD.Title=500]="Title",rD[rD.Label=500]="Label",rD[rD.Brush=500]="Brush",rD[rD.CustomMark=500]="CustomMark",rD[rD.Interaction=700]="Interaction",t.LayoutLevel=void 0,(aD=t.LayoutLevel||(t.LayoutLevel={}))[aD.Indicator=10]="Indicator",aD[aD.Region=20]="Region",aD[aD.Axis=30]="Axis",aD[aD.DataZoom=40]="DataZoom",aD[aD.Player=40]="Player",aD[aD.ScrollBar=40]="ScrollBar",aD[aD.Legend=50]="Legend",aD[aD.Title=70]="Title",aD[aD.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(oD=t.AttributeLevel||(t.AttributeLevel={}))[oD.Default=0]="Default",oD[oD.Theme=1]="Theme",oD[oD.Chart=2]="Chart",oD[oD.Base_Series=3]="Base_Series",oD[oD.Series=4]="Series",oD[oD.Mark=5]="Mark",oD[oD.User_Chart=6]="User_Chart",oD[oD.User_Series=7]="User_Series",oD[oD.User_Mark=8]="User_Mark",oD[oD.User_SeriesStyle=9]="User_SeriesStyle",oD[oD.Built_In=99]="Built_In";class dD{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,j({},dD.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}dD.defaultMarkInfo={};class uD{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class pD{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>iO({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class gD extends uD{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=pD,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new dD,this._lastLayoutRect=null,this.id=ob(),this.userId=t.id,this._spec=t,this.effect={},this.event=new yI(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${wO}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=sO.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return L(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class fD{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=WR(YR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:UR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:UR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:UR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:UR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:UR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:UR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=UR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=UR(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=UR(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(GR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class mD extends gD{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new fD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=j(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=j(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class vD extends pD{_initTheme(t,e){return{spec:t,theme:this._theme}}}class _D extends mD{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=vD,this.modelType="region",this.specKey="region",this.type=_D.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function yD(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function bD(t,e,i){e?t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function xD(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function SD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=TD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),xD(d,!0,p,l),s&&bD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function AD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=TD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=TD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),xD(d,!1,p,o),s&&bD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function MD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=TD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=TD(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=yD(t);n.length&&SD(n,e,i,!1,"left",s),r.length&&SD(r,e,i,!0,"left",s),a.length&&AD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=yD(t);n.length&&kD(n,e,i,!1,"top",s),r.length&&kD(r,e,i,!0,"top",s),a.length&&MD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=yD(t);n.length&&SD(n,e,i,!1,"right",s),r.length&&SD(r,e,i,!0,"right",s),a.length&&AD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=yD(t);n.length&&kD(n,e,i,!1,"bottom",s),r.length&&kD(r,e,i,!0,"bottom",s),a.length&&MD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=TD(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{U(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=TD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Qy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}wD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(lD||(lD={})),t.STATE_VALUE_ENUM=void 0,(hD=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",hD.STATE_HOVER="hover",hD.STATE_HOVER_REVERSE="hover_reverse",hD.STATE_DIMENSION_HOVER="dimension_hover",hD.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",hD.STATE_SELECTED="selected",hD.STATE_SELECTED_REVERSE="selected_reverse",hD.STATE_SANKEY_EMPHASIS="selected",hD.STATE_SANKEY_EMPHASIS_REVERSE="blur",hD.STATE_HIGHLIGHT="highlight",hD.STATE_BLUR="blur",hD.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(cD||(cD={}));const CD=["linear","radial","conical"],ED={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const BD={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{BD[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class PD extends uD{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class LD extends PD{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,GI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!BD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(wO)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(wO))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(JC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class RD extends uD{constructor(){super(...arguments),this.id=ob(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=sO.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class OD extends RD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const ID=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,DD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=ID(l.delay,n,a,o),d=ID(l.duration,n,a,o),u=ID(l.oneByOne,n,a,o),p=ID(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Qw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:tC)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Kw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Qw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:tC)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Gw(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Xw(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:qo.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new $w({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Hw,null!==(l=i.easing)&&void 0!==l?l:Vw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:qo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new qw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Hw,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Vw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Kw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},FD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},zD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class jD extends RD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new OD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Rp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Wl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==lD.enter&&t.context.diffState!==lD.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=e,this.model=i.model,this.key=i.key,this.state=new LD(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&iO(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(QC(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=DR(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):CD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):QC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=wR(TR(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},ED[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ii.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)CD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=wR(TR(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return YI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return sO.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[LO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=YI(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===NI.appear))?NI.appear:t.every((t=>t===NI.disappear))?NI.disappear:t[0];return null!=e?e:NI.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{zD(t),s.push(...t.getGraphics())})),e.forEach((t=>{zD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);DD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=FD(e,n),r=FD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===NI.exit?NI.exit:i===NI.update?NI.update:NI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===lD.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===lD.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=lD.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=lD.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=lD.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=NI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=NI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return XI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=XI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),u(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=_I(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=sO.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=sO.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===WI.before||(this._product||this._initProduct(),Zy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===lD.exit&&!e.isExiting)if(e.context.animationState===lD.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:lD.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Rp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{t.clearStates()}))}}var HD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(HD||(HD={}));class VD extends jD{constructor(){super(...arguments),this.type=VD.type,this._marks=[],this._diffState=lD.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Jy("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?(Jy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return $I(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===lD.update){const t=this.hasAnimation(),e=_I(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=lD.update}render(){this._isCommited&&(Zy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}VD.type="group";const ND={measureText:TO};class UD{static instance(){return UD.instance_||(UD.instance_=new UD),UD.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class WD{constructor(){this.id=ob(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Jy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class GD extends WD{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const YD={type:"fadeIn"};function XD(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return YD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const $D={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},KD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},qD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},ZD=()=>{sO.registerAnimation("scaleInOut",(()=>KD))},JD=()=>{sO.registerAnimation("fadeInOut",(()=>qD))},QD=(t,e)=>({appear:XD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:nC,duration:$D.update.duration,easing:$D.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),tF=()=>{sO.registerAnimation("line",QD)},eF=()=>{kw.registerBuiltInAnimate("growPointsIn",bC),kw.registerBuiltInAnimate("growPointsOut",xC),kw.registerBuiltInAnimate("growPointsXIn",AC),kw.registerBuiltInAnimate("growPointsXOut",kC),kw.registerBuiltInAnimate("growPointsYIn",TC),kw.registerBuiltInAnimate("growPointsYOut",wC),kw.registerBuiltInAnimate("clipIn",oC),kw.registerBuiltInAnimate("clipOut",lC)},iF=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class sF{constructor(t){this._markSet=new dD,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const nF={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class rF extends sF{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},nF,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}rF.type="element-highlight",rF.defaultOptions=nF;const aF=()=>{sO.registerInteractionTrigger(rF.type,rF)},oF={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class lF extends sF{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},oF,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}lF.type="element-select",lF.defaultOptions=oF;const hF=()=>{sO.registerInteractionTrigger(lF.type,lF)};class cF extends WD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class dF{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>sO.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>sO.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>sO.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return sO.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>sO.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){sO.registerTransform(t,e)}static registerFunction(t,e){t&&e&&UD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&UD.instance().unregisterFunction(t)}static getFunction(t){return t?UD.instance().getFunction(t):null}static getFunctionList(){return UD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=sO.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=sO.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,PI.get(e);var e}static registerSVG(t,e,i){const s=sO.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=sO.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){_O.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 ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=ob(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=JI.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=sD(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?sO.getSeriesBuiltInTheme(e):sO.getComponentBuiltInTheme(e);i=i?iO({},s,i[e]):s}s===t.length-1&&p(i)&&(i=SO({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},yR(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=sb(v);if(S?vx(xo):"node"===v&&_A(xo),S&&f&&(this._container=_(f)?I_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=yO.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new QI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new CI(this,this._compiler),this._event=new yI(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),_O.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=iO({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=AO(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;dF.getFunctionList()&&dF.getFunctionList().length&&(t=kO(t,dF)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=sO.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=sO.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=sO.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return iD(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:CO,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:EO})}_initDataSet(t){this._dataSet=t instanceof Ba?t:new Ba,BI(this._dataSet,"dataview",wa),BI(this._dataSet,"array",s),EI(this._dataSet,"copyDataView",FI);for(const t in sO.transforms)EI(this._dataSet,t,sO.transforms[t]);for(const t in sO.dataParser)BI(this._dataSet,t,sO.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(!0),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))):t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?NI.none:NI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,_O.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Pa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=jI(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?iO({},t[n][e.index],i):i):t[n]=s?iO({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?iO({},t[n][r],i):i)}else t.id===e&&(t[n]=s?iO({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=iO({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=nO({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=bO(this._currentThemeName),this._currentTheme=o(a,l);else{const t=nO({},bO(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),bO(n),bO(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(iT.poptip,eT,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!sb(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return bO(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!yO.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield tD(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!sb(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t,e,i;null===(t=this._chart)||void 0===t||t.resetLayoutItemTag(),null===(e=this._chart)||void 0===e||e.setLayoutTag(!0,null,!1),null===(i=this._compiler)||void 0===i||i.render()}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?I_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?XR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Jy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?XR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Jy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return UD.instance().getFunction(t)}registerFunction(t,e){t&&e&&UD.instance().registerFunction(t,e)}unregisterFunction(t){t&&UD.instance().unregisterFunction(t)}getFunctionList(){return UD.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=sO.getChartPlugins();t.length>0&&(this._chartPlugin=new GD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=sO.getVChartPlugins();e.length>0&&(this._vChartPlugin=new cF(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=JI.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;this._renderState=JI.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent()}}dF.InstanceManager=_O,dF.ThemeManager=yO,dF.globalConfig={uniqueTooltip:!0},dF.Utils=ND,dF.vglobal=I_;sO.registerRegion("region",_D),sO.registerLayout("base",wD),hM(),Kk(),sO.registerMark(VD.type,VD),sO.registerStageEventPlugin("gesture",Hb),aF(),hF(),pO(tO.name,tO);const uF="monotone",pF="linear",gF="bevel";function fF(t,e){return e("component",t)}function mF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=sO.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const vF=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},_F=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))},yF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},bF=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=mF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},xF=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const SF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function AF(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=MF(bF(h,r,a,c),d,g),o.value=MF(bF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=bF(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function kF(t,e,i,s,n,r,a){if(d(e)){AF(t,e(n,a),i,s,r,a)}else e&&AF(t,e,i,s,r,a)}const MF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=mi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class TF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{kF(a,t,e,i,s,n,r)})):d(t)?kF(a,t,e,i,s,n,r):t&&AF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:bF(r.visible,t,n),value:MF(bF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:bF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=bF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&SF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const wF={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?$(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?$(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},CF=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=tI([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return EF(a,n,o)},EF=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{lb(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{lb(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=wF[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},BF=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{lb(t[e])||(t[e]=0)}))})),t},PF=`${wO}_HIERARCHY_DEPTH`,LF=`${wO}_HIERARCHY_ROOT`,RF=`${wO}_HIERARCHY_ROOT_INDEX`;function OF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function IF(t,e,i){t&&(i.needDefaultSeriesField&&(t[RO]=i.defaultSeriesField),t[PO]=e,t[LO]=i.getKey(t,e,i))}function DF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function FF(t,e,i,s=0,n,r){void 0===r&&(r=e),IF(t,e,i),t[PF]=s,t[LF]=n||t[i.categoryField],t[RF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>FF(e,s,i,t[PF]+1,t[LF],r)))}const zF={label:{name:"label",type:"text"}},jF=`${wO}_rect_x`,HF=`${wO}_rect_x1`,VF=`${wO}_rect_y`,NF=`${wO}_rect_y1`,UF={data:!0},WF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},GF=[...Object.keys($D),"normal"];function YF(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return ZF(n)&&delete n.type,n.oneByOne&&(n=$F(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:KF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=iO({},o[e],a);return ZF(n)&&delete n.type,n.oneByOne&&(n=$F(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:KF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function XF(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),JF(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function $F(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function KF(t,e){var i;return null!==(i=null==t?void 0:t[PO])&&void 0!==i?i:e.context.graphicIndex}function qF(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function ZF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function JF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),JF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),JF(t[s],e,i))}function QF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class tz extends pD{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=AR(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=sO.getSeriesMarkMap(o)?function(t,e,i){const s=sO.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=iO({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return iO({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=iO({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>iO({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class ez extends gD{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${wO}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=tz,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=QF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(EI(this._rawData.dataSet,"invalidTravel",BF),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=jI(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=zI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=zI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new OD(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=$(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=EF(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){EI(this._dataSet,"dimensionStatistics",CF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Pa(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&tI(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){EI(this._dataSet,"dimensionStatistics",CF);const s=new Pa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=tI(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&tI(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Pa(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(EI(this._rawData.dataSet,"addVChartProperty",yF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:OF.bind(this),call:IF}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=YF({},XF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:nb(s)||rb(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=iO(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=iO(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=iF(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=iF(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=iF(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:RO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:OO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,OO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new TF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},UF),WF),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>WF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Pa||HI(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();QF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:RO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new OR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return TR(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:RO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,iO({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:LO}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==FO&&t!==jO&&t!==DO&&t!==zO||(t=this.getStackValueField()),null!==(e=iI(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>lb(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:RO]}}function iz(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();JC(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function sz(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}ez.mark=zF,ez.transformerConstructor=tz;class nz extends ez{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);JC(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${wO}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(FO),this.setFieldX2(DO)):(this.setFieldY(FO),this.setFieldY2(DO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(jO),this.setFieldX2(zO)):(this.setFieldY(jO),this.setFieldY2(zO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(VO),this.setFieldX2(HO)):(this.setFieldY(VO),this.setFieldY2(HO))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(iz("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function rz(t){return"bottom"===t||"top"===t}function az(t){return"left"===t||"right"===t}function oz(t){return"z"===t}function lz(t,e){return HR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function hz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function cz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?rz(t)?"linear":"band":rz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const dz=(t,e,i)=>{var s;const n=null!==(s="band"===e?fF("axisBand",i):["linear","log","symlog"].includes(e)?fF("axisLinear",i):{})&&void 0!==s?s:{},r=rz(t)?fF("axisX",i):az(t)?fF("axisY",i):fF("axisZ",i);return iO({},fF("axis",i),n,r)};class uz{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:Qy)("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:Qy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>tE(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return rz(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class pz extends uz{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:AI.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const gz=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},fz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},mz=(t,e,i,s)=>{var n;const r=e.getScale(),a=tE(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:vz(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,_z=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class yz extends uz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!gz(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:AI.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:AI.canvas}),callback:this.onMouseOut}),nb(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:AI.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),nb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var bz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(bz||(bz={}));const xz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class Sz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(xz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:gF,curveType:pF,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===uF?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(xz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:qF(this._spec,xz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Pa(this._option.dataSet,{name:`${wO}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(bz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[xz.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(bz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,iO({},this._spec[xz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Az=Object.assign(Object.assign({},zF),xz),kz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>kz(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},Mz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class Tz extends jD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return Mz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(QC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?kz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:lD.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[LO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class wz extends Tz{constructor(){super(...arguments),this.type=wz.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)===xR.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}wz.type="line";const Cz=()=>{sO.registerMark(wz.type,wz),hM(),Qk(),HB(),IB(),eF(),sO.registerGraphicComponent("line",Lg)};class Ez extends jD{constructor(){super(...arguments),this.type=Ez.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}Ez.type="symbol";const Bz=()=>{sO.registerMark(Ez.type,Ez),hM(),dM(),IB(),sO.registerGraphicComponent("symbol",Eg)};class Pz extends tz{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function Lz(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function Rz(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function Oz(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function Iz(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function Dz(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function Fz(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const zz=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return YC(v)};class jz{constructor(t){this.id=ob(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Hz extends jz{constructor(){super(Hz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!JC(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&Lz(c)&&Lz(d)))return;const u=Rz(t,c),p=Rz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!Iz(u,p))return}else if(0===y&&0===b){if(!Iz(p,u))return}else if(_||A)if(_&&!A){if(!Oz(u,p))return}else if(A&&!_){if(!Oz(p,u))return}else{if(f===b)return;if(f>b){if(!Dz(u,p))return}else if(!Dz(p,u))return}else{if(0===f&&0===y){if(!Fz(u,p))return}else if(0===b&&0===g&&!Fz(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){EI(e.getOption().dataSet,"tickAlign",zz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Hz.pluginType="component",Hz.type="AxisSyncPlugin";const Vz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Nz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function Uz(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function Wz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Gz=t=>"band"===t||"ordinal"===t||"point"===t;function Yz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Xz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class $z extends WD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const Kz=`${wO}_ARC_TRANSFORM_VALUE`,qz=`${wO}_ARC_RATIO`,Zz=`${wO}_ARC_START_ANGLE`,Jz=`${wO}_ARC_END_ANGLE`,Qz=`${wO}_ARC_K`,tj=`${wO}_ARC_MIDDLE_ANGLE`,ej=`${wO}_ARC_QUADRANT`,ij=`${wO}_ARC_RADIAN`,sj=-Math.PI/2,nj=3*Math.PI/2,rj=.6,aj=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},oj=(t,e,i)=>{var s;const n=null!==(s="band"===e?fF("axisBand",i):"linear"===e?fF("axisLinear",i):{})&&void 0!==s?s:{},r=fF("angle"===t?"axisAngle":"axisRadius",i);return iO({},fF("axis",i),n,r)};function lj(t,e,i,s){switch(t){case r.cartesianBandAxis:return dz(lz(i,["z"]),"band",e);case r.cartesianLinearAxis:return dz(lz(i,["z"]),"linear",e);case r.cartesianLogAxis:return dz(lz(i,["z"]),"log",e);case r.cartesianSymlogAxis:return dz(lz(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return dz(lz(i),void 0,e);case r.polarBandAxis:return oj(i.orient,"band",e);case r.polarLinearAxis:return oj(i.orient,"linear",e);case r.polarAxis:return oj(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=fF(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>rz(t.orient)));let g;g=p(u)?iO({},Gz(u.type)?a:o,l):l;const f=n.find((t=>az(t.orient)));let m;return m=p(f)?iO({},tE(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=fF(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?iO({},Gz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?iO({},tE(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return hj(i,fF(t,e));default:return fF(t,e)}}const hj=(t,e)=>{var i;const s=iO({},e,e[hz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class cj extends pD{getTheme(t,e){return lj(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},YR(e)),{[s]:0}))}}class dj extends mD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=cj,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof jc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:AI.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new $z(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!U(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(t.release(!0),null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var uj,pj;dj.transformerConstructor=cj,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(uj||(uj={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(pj||(pj={}));class gj extends jD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=sO.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(bI.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}gj.type="component";const fj=()=>{sO.registerMark(gj.type,gj)},mj=t=>t;class vj extends dj{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?uj.circleAxis:uj.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?pj.circleAxisGrid:pj.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=YF(null===(h=sO.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this._specVisible&&(this.getVisible()||this._spec.forceInitTick||this._hideWhenEmpty)}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new OD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&fR(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?JC(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!JC(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return fR(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=mR(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),fR(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):fR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(fR(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=$(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=uI(s=t.domainLine)).startSymbol=uI(s.startSymbol),s.endSymbol=uI(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return fI(iO({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:fI(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>fI(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=fI(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return fI(iO({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:fI(t.tick.style)),t.tick.state&&(i.tick.state=pI(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return fI(iO({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:fI(t.subTick.style)),t.subTick.state&&(i.subTick.state=pI(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=Vz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:iO({},d,fI(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:fI(h.style)}),h.state&&(i.title.state.shape=pI(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:fI(o.style)}),o.state&&(i.title.state.background=pI(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=pI(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=fI(t.background.style)),t.background.state&&(i.panel.state=pI(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:MO(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return fI(iO({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:fI(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:MO(t.subGrid.alternateColor),style:fI(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=mF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){BI(this._option.dataSet,"scale",mj);const i=this.registerTicksTransform();return new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===CT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}vj.specKey="axes";const _j=()=>{fj(),sO.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},yj=[Hz];class bj extends vj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),fR(this._regions,(t=>{const e=this.getOrient();rz(e)?Xz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):az(e)?Xz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):oz(e)&&Xz(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=iO({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(iO({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=rz(this.getOrient()),n=t=>{var e;return(s?!rz(t.getOrient()):rz(t.getOrient()))&&JC(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=lz(i,["z"]),oz(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!Wz(e))return null;const{axisType:t,componentName:s}=cz(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>az(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!Wz(t))return;const{axisType:s,componentName:n}=cz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=sO.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return rz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):oz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(yj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){rz(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!rz(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!oz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;az(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=UR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=UR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=rz(this.getOrient())?t.fieldX:oz(this.getOrient())?t.fieldZ:t.fieldY,JC(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:JC(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(bI.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(rz(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=rz(this._orient)?{x:$(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return fR(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:rz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:oz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();fR(this._regions,(e=>{rz(t)?Xz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):az(t)?Xz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):oz(t)&&Xz(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=rz(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=rz(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=iO(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ve).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=rz(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?_t(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):_t(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return Yz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:JC(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}bj.type=r.cartesianAxis,bj.specKey="axes";const xj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Sj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,kj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function Mj(t,e,i="count"){const s=kj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const Tj=Math.sqrt(50),wj=Math.sqrt(10),Cj=Math.sqrt(2);class Ej{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=Uz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=rz(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Aj),e.sort(Aj),{domain:Sj(t,e),scope:Mj(t,e,i)}}(r,Ky(t),this._spec.breaks[0].scopeType);e=Ky(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=Uz(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-$(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=Tj?10:n>=wj?5:n>=Cj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const Bj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},Pj={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},Lj={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},Rj={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}};class Oj extends bj{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new NE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!oz(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=rz(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=VR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=Ky(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,ZE),t}}Oj.type=r.cartesianLinearAxis,Oj.specKey="axes",Oj.builtInTheme={axis:Rj,axisLinear:Bj,axisX:Pj,axisY:Lj},G(Oj,Ej);const Ij=()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),_j(),sO.registerComponent(Oj.type,Oj)};class Dj{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new OD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=Yz(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>Yz(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const Fj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class zj extends bj{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new xE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,iB),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=uE(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),_j(),sO.registerComponent(zj.type,zj,!1)};class Hj extends Oj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),fR(this._regions,(t=>{rz(this.getOrient())?Xz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Xz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=iO({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new OD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=mi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>Yz(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>Yz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,ZE),t}transformScaleDomain(){}}Hj.type=r.cartesianTimeAxis,Hj.specKey="axes",Hj.builtInTheme={axis:Rj,axisX:Pj,axisY:Lj};class Vj extends Oj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new YE}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,ZE),t}transformScaleDomain(){}}Vj.type=r.cartesianLogAxis,Vj.specKey="axes",Vj.builtInTheme={axis:Rj,axisLinear:Bj,axisX:Pj,axisY:Lj},G(Vj,Ej);class Nj extends Oj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new XE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,ZE),t}transformScaleDomain(){}}Nj.type=r.cartesianSymlogAxis,Nj.specKey="axes",Nj.builtInTheme={axis:Rj,axisLinear:Bj,axisX:Pj,axisY:Lj},G(Nj,Ej);const Uj=`${wO}_hide_`;function Wj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Gj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[Uj]&&(Wj(t,!0),t[Uj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[Uj]=!0,Wj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},Yj=()=>{sO.registerGrammarTransform("symbolOverlap",{transform:Gj,runType:"afterEncode"})},Xj={min:K,max:$,average:cR,sum:hR};function $j(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function Kj(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function qj(t,e,i,s){return Kj(t,e,i,"min",s)}function Zj(t,e,i,s){return Kj(t,e,i,"max",s)}function Jj(t,e,i,s){return Kj(t,e,i,"average",s)}function Qj(t,e,i,s){return Kj(t,e,i,"sum",s)}const tH=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=$j;if("min"===n?l=qj:"max"===n?l=Zj:"average"===n?l=Jj:"sum"===n&&(l=Qj),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},eH=()=>{sO.registerGrammarTransform("dataSampling",{transform:tH})};class iH extends nz{constructor(){super(...arguments),this.type=xR.line,this.transformerConstructor=Pz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),XF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=sz(this);this._symbolMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),XF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}iH.type=xR.line,iH.mark=Az,iH.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},iH.transformerConstructor=Pz,G(iH,Sz);class sH{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{HI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Pa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Jy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Jy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class nH{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{hb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{tI(e,[{key:t,operations:JC(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&tI(e,[{key:i.field,operations:JC(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?DR("colorOrdinal"):DR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(hb(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(U(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),hb(s.domain)?e.reRender=!0:U(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!hb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=JC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=JC(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;JC(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(JC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=JC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));JC(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class rH{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class aH extends uD{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=ob(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:CO,height:EO},this._viewRect={width:CO,height:EO},this._viewBox={x1:0,y1:0,x2:CO,y2:EO},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=YR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new yI(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new sH(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new rH;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=sO.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(YF({},XF("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=sO.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=sO.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof gD)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof jD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof jD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&HI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=iD(this._spec,this._option,{width:CO,height:EO})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=TR(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new nH(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){sD(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=TR(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{sD(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,sD(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):sD(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];sD(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=WR(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(bI.AFTER_MARK_RENDER_END,e)};this._event.on(bI.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:vI;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(mI(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===bz.dimensionHover||s===bz.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>tE(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>tE(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const oH=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class lH{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):eO(t,a,c.spec),eO(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=oH(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=oH(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(sO.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(sO.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=sO.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=sO.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=sO.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):vF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=vF(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class hH extends lH{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),L(i,"trimPadding")&&iO(i,nD(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class cH extends hH{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),eD(t)}}const dH=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=sI(t,!0);for(const e in o)for(const i in o[e].nodes)oI(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)aI(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&rI(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class pH{_beforeInit(){this._dataSet&&EI(this._dataSet,"stackSplit",dH)}_initStack(){this._stack=new uH(this),this._stack.init()}}const gH={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:bz.dimensionHover};class fH extends sF{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},gH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=vI(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}fH.type="dimension-hover",fH.defaultOptions=gH;const mH=()=>{sO.registerInteractionTrigger(fH.type,fH)},vH=()=>{sO.registerComposedEvent(bz.dimensionHover,yz),sO.registerComposedEvent(bz.dimensionClick,pz)},_H=t=>t.fieldX[0],yH=t=>t.fieldY[0],bH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},xH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},SH=(t,e)=>t?e?_H:bH:e?yH:xH,AH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=_z(t,(t=>rz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=_z(t,(t=>az(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{tE(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=kH(t,i,SH(e,tE(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=kH(t,i,SH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},kH=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:MH(t,s,i)},MH=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=mz(e,t,"cartesian",null!=i?i:rz(t.getOrient())?_H:yH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},TH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(tE(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(JC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Nz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};CH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&wH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),wH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=mF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},CH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},EH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=BH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},BH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},PH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return TH(c,r,e),c.xField.cacheInfo?EH(c.xField):c.yField.cacheInfo?EH(c.yField):void 0},LH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],RH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&LH.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(OH(s).every((t=>{var e;return!SF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},OH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},IH={dom:`${wO}_TOOLTIP_HANDLER_DOM`,canvas:`${wO}_TOOLTIP_HANDLER_CANVAS`},DH={key:"其他",value:"..."};var FH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(FH||(FH={}));class zH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=RH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},DH),t):DH;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&SF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class jH extends zH{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!tE(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const HH=()=>{sO.registerTooltipProcessor("dimension",jH)};class VH extends zH{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Ko.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(vI(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const NH=()=>{sO.registerTooltipProcessor("mark",VH)};class UH extends zH{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const WH=()=>{sO.registerTooltipProcessor("group",UH)};class GH extends aH{constructor(){super(...arguments),this.transformerConstructor=cH,this.type="line",this.seriesType=xR.line}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}GH.type="line",GH.seriesType=xR.line,GH.transformerConstructor=cH,G(GH,pH);const YH=[...Mz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class XH extends Tz{constructor(){super(...arguments),this.type=XH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return YH}_getIgnoreAttributes(){return[]}}XH.type="area";const $H=()=>{sO.registerMark(XH.type,XH),hM(),Uk(),HB(),IB(),eF(),sO.registerGraphicComponent("area",nf)};class KH extends TF{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const qH=Object.assign(Object.assign(Object.assign({},zF),xz),{area:{name:"area",type:"area"}}),ZH=()=>{sO.registerAnimation("area",QD),tF(),ZD()};class JH extends Pz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=iO({},f.style,g.style),l.state=iO({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class QH extends nz{constructor(){super(...arguments),this.type=xR.area,this.transformerConstructor=JH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(QH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===uF?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return FR(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return FR(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[FO]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),XF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),XF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=sz(this);this._symbolMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),XF("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new KH(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}QH.type=xR.area,QH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},QH.mark=qH,QH.transformerConstructor=JH,G(QH,Sz);class tV extends hH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),eD(t)}}class eV extends aH{constructor(){super(...arguments),this.transformerConstructor=tV,this.type="area",this.seriesType=xR.area}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}eV.type="area",eV.seriesType=xR.area,eV.transformerConstructor=tV,G(eV,pH);function iV(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const sV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:iV(t,e)}),nV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:iV(t,e)}),rV={type:"fadeIn"},aV={type:"growCenterIn"};function oV(t,e){if(!1===e)return{};switch(e){case"fadeIn":return rV;case"scaleIn":return aV;default:return sV(t)}}class lV extends jD{constructor(){super(...arguments),this.type=lV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}lV.type="rect";const hV=()=>{hM(),rM(),LB("rect",FB),sO.registerMark(lV.type,lV),kw.registerBuiltInAnimate("growHeightIn",mC),kw.registerBuiltInAnimate("growHeightOut",vC),kw.registerBuiltInAnimate("growWidthIn",RC),kw.registerBuiltInAnimate("growWidthOut",OC),kw.registerBuiltInAnimate("growCenterIn",pC),kw.registerBuiltInAnimate("growCenterOut",gC),sO.registerGraphicComponent("rect",Dg)},cV=Object.assign(Object.assign({},zF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function dV(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=$R(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[jF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):FR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[HF]):FR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=FR(this._dataToPosX(t),e,i),n=FR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[VF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):FR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[NF]):FR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=FR(this._dataToPosY(t),e,i),n=FR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},gV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:qF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(gV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(EI(this._option.dataSet,"addVChartProperty",yF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};EI(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Pa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:OF.bind(this),call:IF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new OD(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=NF,s=VF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=HF,s=jF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=sI(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)dV(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=FR(this[r](t),l,i),u=FR(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!zR(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[DO],n=e[FO],r=e[zO],d=e[jO];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?VF:jF],i=e[a?NF:HF];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[DO]:s,[FO]:o}),c?{[zO]:u,[jO]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(Dg(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>FR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>FR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=$(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=sz(this);this._barMark.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),XF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=$R(this._spec.barWidth,a)),l&&(c=Math.max(c,$R(this._spec.barMinWidth,a))),h&&(c=Math.min(c,$R(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=$R(null!==(l=i[r-1])&&void 0!==l?l:X(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=JC(g.type||"band");return d(e,m)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}gV.type=xR.bar,gV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},gV.mark=cV,gV.transformerConstructor=pV;const fV=()=>{eH(),hV(),sO.registerAnimation("bar",((t,e)=>({appear:oV(t,e),enter:sV(t,!1),exit:nV(t,!1),disappear:{duration:$D.disappear.duration}}))),jj(),Ij(),sO.registerSeries(gV.type,gV)};class mV extends hH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),eD(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class vV extends aH{constructor(){super(...arguments),this.transformerConstructor=mV,this.type="bar",this.seriesType=xR.bar}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}vV.type="bar",vV.seriesType=xR.bar,vV.transformerConstructor=mV,G(vV,pH);const _V=[10,20],yV=qC.Linear,bV="circle",xV=qC.Ordinal,SV=["circle","square","triangle","diamond","star"],AV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},kV=Object.assign(Object.assign({},zF),{point:{name:"point",type:"symbol"}});class MV extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class TV extends nz{constructor(){super(...arguments),this.type=xR.scatter,this.transformerConstructor=MV,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${wO}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${wO}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:yV,defaultRange:_V},"size")}getShapeAttribute(t,e){return u(e)?bV:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:xV,defaultRange:SV},"shape")}initMark(){this._symbolMark=this._createMark(TV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:qF(this._spec,TV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=sz(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),XF("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:bV},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i,s,n;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.y)}))}));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==r?void 0:r.renderInner)&&r.renderInner();const a=null===(i=null==r?void 0:r.getComponent)||void 0===i?void 0:i.call(r);(null==a?void 0:a.evaluate)&&a.evaluate(null,null);const o=null===(s=null==r?void 0:r.getProduct)||void 0===s?void 0:s.call(r);o&&(null==t?void 0:t.scale)&&(null==t?void 0:t.scaleCenter)&&((null===(n=o.attribute)||void 0===n?void 0:n.postMatrix)||o.setAttributes({postMatrix:new We}),o.scale(t.scale,t.scale,t.scaleCenter))}handlePan(t){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}TV.type=xR.scatter,TV.mark=kV,TV.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},TV.transformerConstructor=MV;const wV=()=>{Bz(),sO.registerAnimation("scatter",((t,e)=>Object.assign({appear:AV(0,e)},KD))),jj(),Ij(),sO.registerSeries(TV.type,TV)};class CV extends hH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class EV extends aH{constructor(){super(...arguments),this.transformerConstructor=CV,this.type="scatter",this.seriesType=xR.scatter}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}EV.type="scatter",EV.seriesType=xR.scatter,EV.transformerConstructor=CV,G(EV,pH);class BV extends ez{constructor(){super(...arguments),this.type=xR.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${wO}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const PV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[PO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[QO]=e.nameMap[n]:t[QO]=n})),t.features);class LV extends TF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class RV extends jD{constructor(){super(...arguments),this.type=RV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}RV.type="path";const OV=()=>{sO.registerMark(RV.type,RV),hM(),eM(),sO.registerGraphicComponent("path",tf)},IV=Object.assign(Object.assign({},zF),{area:{name:"area",type:"path"}});class DV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ia(i,e):Ra[i]?(La[i]||(La[i]=Ia(i,Ra[i])),La[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class FV{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class zV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function jV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:FV}:nb(e)||rb(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:zV}:null}const HV={debounce:St,throttle:At};class VV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=nb(this._renderMode)||rb(this._renderMode),jV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return jV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:kI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:kI.chart,consume:!1}];l.on(...c,HV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,HV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||jV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||jV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:kI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:kI.chart,consume:!1}];l.on(...c,HV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,HV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){jV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||jV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:kI.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:kI.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||jV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:kI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||jV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:kI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:kI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:kI.chart,source:AI.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:kI.chart,source:AI.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=HV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=HV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:kI.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:kI.chart,source:AI.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:kI.chart,source:AI.chart},this._handleDragMouseUp)}))}}function NV(t,e){return`${wO}_${e}_${t}`}class UV extends dj{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:NV(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=iO(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new DV(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===xR.map||e.type===xR.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),fR(this._regions,(t=>{var e;if(t.type===xR.map||t.type===xR.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new We})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==xR.map&&e.type!==xR.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[QO],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}UV.type=r.geoCoordinate,G(UV,VV);const WV=()=>{sO.registerComponent(UV.type,UV)};class GV extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class YV extends BV{constructor(){super(...arguments),this.type=xR.map,this.transformerConstructor=GV,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),PI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),EI(this._dataSet,"copyDataView",FI),EI(this._dataSet,"map",PV),EI(this._dataSet,"lookup",_F);const s=PI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Pa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:QO,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new OD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(YV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:qF(this._spec,YV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:RO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:RO]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(YF(null===(t=sO.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),XF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new LV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[PO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[PO],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s,n;const{scale:r,scaleCenter:a}=t;if(1===r)return;const o=this.getRootMark().getProduct();o&&(o.attribute.postMatrix||o.setAttributes({postMatrix:new We}),o.scale(r,r,a));const l=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==l?void 0:l.renderInner)&&l.renderInner();const h=null===(i=null==l?void 0:l.getComponent)||void 0===i?void 0:i.call(l);(null==h?void 0:h.evaluate)&&h.evaluate(null,null);const c=null===(s=null==l?void 0:l.getProduct)||void 0===s?void 0:s.call(l);c&&r&&a&&((null===(n=c.attribute)||void 0===n?void 0:n.postMatrix)||c.setAttributes({postMatrix:new We}),c.scale(r,r,a))}handlePan(t){var e,i,s,n;const{delta:r}=t;if(0===r[0]&&0===r[1])return;const a=this.getRootMark().getProduct();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new We}),a.translate(r[0],r[1]));const o=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==o?void 0:o.renderInner)&&o.renderInner();const l=null===(i=null==o?void 0:o.getComponent)||void 0===i?void 0:i.call(o);(null==l?void 0:l.evaluate)&&l.evaluate(null,null);const h=null===(s=null==o?void 0:o.getProduct)||void 0===s?void 0:s.call(o);h&&r&&((null===(n=h.attribute)||void 0===n?void 0:n.postMatrix)||h.setAttributes({postMatrix:new We}),h.translate(r[0],r[1]))}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return PO}getActiveMarks(){return[this._pathMark]}}YV.type=xR.map,YV.mark=IV,YV.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},YV.transformerConstructor=GV;const XV=`${wO}_waterfall_default_seriesField`,$V=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[WO]=!0:delete t[WO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=KV([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const f=g[0];let{start:m,end:v}=qV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=se(_,e)):(t[c]=+y,y=se(y,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=KV(r,t,n,a,c,h,i,e),a.push(n)})),a};function KV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=qV(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===XV)&&(t[XV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function qV(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?Jy("total.collectCountField error"):n=e[a].start;o<0?Jy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=se(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const ZV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},JV={type:"fadeIn"},QV={type:"growCenterIn"};function tN(t,e){switch(e){case"fadeIn":return JV;case"scaleIn":return QV;default:return sV(t,!1)}}class eN extends jD{constructor(){super(...arguments),this.type=eN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Lg(t)}}eN.type="rule";const iN=()=>{sO.registerMark(eN.type,eN),hM(),Qk(),sO.registerGraphicComponent("line",Lg)},sN=Object.assign(Object.assign({},cV),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),nN=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:rN(t.map((t=>t.latestData)).flat(),e.fields,i)}};function rN(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>rN(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class aN{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new Pa(e instanceof Ba?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),EI(e,"dimensionTree",nN),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class oN extends pV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const lN={rect:gN,symbol:uN,arc:mN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=uN(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:vN,line:_N,area:_N,rect3d:gN,arc3d:mN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function hN(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=lN[t])&&void 0!==i?i:lN.point;return e.series.type===xR.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=dN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:yN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function cN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==xR.sankey){const{formatFunc:t,args:n}=mF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function dN(t){return d(t)?e=>t(e.data):t}function uN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=dN(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:pN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function pN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function gN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=dN(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:fN(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function fN(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function mN(t){var e;const{labelSpec:i}=t,s=null!==(e=dN(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function vN(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=cN(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Tg(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function _N(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[RO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function yN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class bN extends gV{constructor(){super(...arguments),this.type=xR.waterfall,this.transformerConstructor=oN,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&rI(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new aN(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=XV)}getSeriesKeys(){return this._seriesField===XV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),EI(this._dataSet,"waterfallFillTotal",ZV),EI(this._dataSet,"waterfall",$V),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=zI(this.getViewData(),this._dataSet,{name:`${wO}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new OD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:DO,endAs:FO,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=sz(this);this._barMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),XF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),XF("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(bN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return vN(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?FR(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):FR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&zR([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}bN.type=xR.waterfall,bN.mark=sN,bN.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},bN.transformerConstructor=oN;const xN=()=>{iN(),hV(),sO.registerAnimation("waterfall",((t,e)=>({appear:tN(t,e),enter:sV(t,!1),exit:nV(t,!1),disappear:{duration:$D.disappear.duration}}))),JD(),jj(),Ij(),sO.registerSeries(bN.type,bN)},SN=`${wO}_BOX_PLOT_OUTLIER_VALUE`;var AN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(AN||(AN={}));const kN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[SN]:e};return n.forEach((e=>{i[e]=t[e]})),p(r)&&(i[r]=t[r]),i})))})),i};class MN extends TF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===AN.OUTLIER)return this.series.getOutliersField();if(t===AN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case AN.MIN:return this.series.getMinField();case AN.MAX:return this.series.getMaxField();case AN.MEDIAN:return this.series.getMedianField();case AN.Q1:return this.series.getQ1Field();case AN.Q3:return this.series.getQ3Field();case AN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===AN.OUTLIER)return e[SN];if(t===AN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case AN.MIN:return e[this.series.getMinField()];case AN.MAX:return e[this.series.getMaxField()];case AN.MEDIAN:return e[this.series.getMedianField()];case AN.Q1:return e[this.series.getQ1Field()];case AN.Q3:return e[this.series.getQ3Field()];case AN.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[SN])}getDefaultContentList(t){return[{key:this.getContentKey(AN.OUTLIER),value:this.getContentValue(AN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(AN.MAX),value:this.getContentValue(AN.MAX)},{key:this.getContentKey(AN.Q3),value:this.getContentValue(AN.Q3)},{key:this.getContentKey(AN.MEDIAN),value:this.getContentValue(AN.MEDIAN)},{key:this.getContentKey(AN.Q1),value:this.getContentValue(AN.Q1)},{key:this.getContentKey(AN.MIN),value:this.getContentValue(AN.MIN)},{key:this.getContentKey(AN.SERIES_FIELD),value:this.getContentValue(AN.SERIES_FIELD)}]}}class TN extends jD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==lD.enter&&t.context.diffState!==lD.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=zg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=sO.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const wN=()=>{sO.registerGraphicComponent("glyph",zg),hM(),Xk()},CN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],EN=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class BN extends TN{constructor(){super(...arguments),this.type=BN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=CN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=EN,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}BN.type="boxPlot";const PN=Object.assign(Object.assign({},zF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),LN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},RN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},ON=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),IN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=ON(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=ON(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=ON(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=ON(t,"box").attribute.width,i=ON(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=ON(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=ON(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=ON(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=ON(t,"box").attribute.height,i=ON(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},DN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=ON(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=ON(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=ON(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=ON(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=ON(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=ON(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=ON(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=ON(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=ON(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=ON(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class FN extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return LN(IN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class zN extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return RN(IN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class jN extends FN{computeAttribute(){return LN(DN)(this.target,this.params,this.params.options)}}class HN extends zN{computeAttribute(){return RN(DN)(this.target,this.params,this.params.options)}}class VN extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class NN extends nz{constructor(){super(...arguments),this.type=xR.boxPlot,this.transformerConstructor=VN,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(NN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(NN.mark.outlier,{key:PO,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>FR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>FR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>FR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>FR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>FR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>FR(e(this.getDatumPositionValues(t,SN),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>FR(e(this.getDatumPositionValues(t,SN),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;EI(this._dataSet,"foldOutlierData",kN),EI(this._dataSet,"addVChartProperty",yF);const t=new Pa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${wO}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:OF.bind(this),call:IF}},!1),this._outlierData=new OD(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=$R(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,$R(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,$R(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=$R(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=JC(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=sz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=sO.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(XF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(YF(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(YF(null===(a=sO.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new MN(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}NN.type=xR.boxPlot,NN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},NN.mark=PN,NN.transformerConstructor=VN;const UN=()=>{wN(),Qk(),rM(),sO.registerGraphicComponent("line",(t=>Lg(t))),sO.registerGraphicComponent("rect",(t=>Dg(t))),sO.registerMark(BN.type,BN),Bz(),ZD(),jj(),Ij(),kw.registerBuiltInAnimate("boxplotScaleIn",FN),kw.registerBuiltInAnimate("boxplotScaleOut",zN),kw.registerBuiltInAnimate("barBoxplotScaleIn",jN),kw.registerBuiltInAnimate("barBoxplotScaleOut",HN),sO.registerSeries(NN.type,NN)};class WN extends jD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=WN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Zg(t):Tg(t)}}WN.type="text";const GN=()=>{sO.registerMark(WN.type,WN),hM(),pM(),oM(),sO.registerGraphicComponent("text",Tg),sO.registerGraphicComponent("richtext",Zg)};class YN extends TF{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const XN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),$N={type:"fadeIn"},KN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function qN(t,e){return"fadeIn"===e?$N:XN(t)}const ZN=Object.assign(Object.assign({},cV),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class JN extends pV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class QN extends gV{constructor(){super(...arguments),this.type=xR.rangeColumn,this._barMarkType="rect",this._barName=xR.bar,this.transformerConstructor=JN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(QN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:qF(this._spec,QN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(QN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(QN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=sz(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),XF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),XF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(YF(null===(n=sO.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),XF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new YN(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}QN.type=xR.rangeColumn,QN.mark=ZN,QN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},QN.transformerConstructor=JN;const tU=()=>{hV(),GN(),sO.registerAnimation("rangeColumn",((t,e)=>({appear:qN(t,e),enter:XN(t),exit:KN(t),disappear:{duration:$D.disappear.duration}}))),JD(),jj(),Ij(),sO.registerSeries(QN.type,QN)};var eU,iU;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(eU||(eU={})),function(t){t.middle="middle",t.start="start",t.end="end"}(iU||(iU={}));class sU extends TF{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const nU=Object.assign({},qH);class rU extends QH{constructor(){super(...arguments),this.type=xR.rangeArea}initMark(){this._areaMark=this._createMark(rU.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new sU(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}rU.type=xR.rangeArea,rU.mark=nU;class aU extends ez{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=rj,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};JC(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:[]};JC(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&iz(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function oU(t){return lb(t)?Number.parseFloat(t):0}const lU=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&hU(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[Kz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[Kz]*t;v(e,A,i),A+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},hU=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===oU(t[e])))||!i&&0===t.reduce(((t,i)=>t+oU(i[e])),0)));function cU(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const dU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:cU(t,!0,NI.appear)}),uU={type:"fadeIn"},pU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:cU(t,!0,NI.enter)}),gU=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:cU(t,!0,NI.exit)});function fU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return uU;case"growRadius":return dU(Object.assign(Object.assign({},t),{growField:"radius"}));default:return dU(Object.assign(Object.assign({},t),{growField:"angle"}))}}class mU extends jD{constructor(t,e){super(t,e),this.type=vU.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[tj])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class vU extends mU{constructor(){super(...arguments),this.type=vU.type}}vU.type="arc";const _U=()=>{hM(),Vk(),LB("arc",UB),kw.registerBuiltInAnimate("growRadiusIn",BC),kw.registerBuiltInAnimate("growRadiusOut",PC),kw.registerBuiltInAnimate("growAngleIn",dC),kw.registerBuiltInAnimate("growAngleOut",uC),sO.registerGraphicComponent("arc",of),sO.registerMark(vU.type,vU)},yU=Object.assign(Object.assign({},zF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class bU extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=iO({},this._theme,i,t);const n=(t,e)=>iO({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const xU=`${wO}_LABEL_VISIBLE`;class SU extends aU{constructor(){super(...arguments),this.transformerConstructor=bU,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:UR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:UR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=sj,this._endAngle=nj,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[tj];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;EI(this._dataSet,"pie",lU),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:Zz,asEndAngle:Jz,asRatio:qz,asMiddleAngle:tj,asRadian:ij,asQuadrant:ej,asK:Qz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Pa(this._dataSet,{name:`${wO}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new OD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},SU.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:LO,groupKey:this._seriesField,isSeriesMark:!0},{morph:qF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return _R(Zz)(t)}endAngleScale(t){return _R(Jz)(t)}_computeLayoutRadius(){return aj((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:jR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:jR(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:_R(xU).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[tj];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===NI.appear)return this._startAngle;if(i===NI.disappear)return this._endAngle;const r=[NI.disappear,NI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[PO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[PO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[PO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[PO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[tj]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[tj]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[tj]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[tj]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=YF(null===(i=sO.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}SU.transformerConstructor=bU,SU.mark=yU,SU.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class AU extends SU{constructor(){super(...arguments),this.type=xR.pie}}AU.type=xR.pie;const kU=()=>{_U(),sO.registerAnimation("pie",((t,e)=>({appear:fU(t,e),enter:pU(t),exit:gU(t),disappear:{duration:$D.disappear.duration}}))),sO.registerAnimation("emptyCircle",((t,e)=>({appear:fU(t,e)}))),sO.registerSeries(AU.type,AU)};function MU(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const TU=t=>({type:MU(t.growField),options:{overall:!0}}),wU={type:"fadeIn"},CU=t=>({type:MU(t.growField)}),EU=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function BU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return wU;case"growAngle":return TU(Object.assign(Object.assign({},t),{growField:"angle"}));default:return TU(Object.assign(Object.assign({},t),{growField:"radius"}))}}class PU extends aU{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(FO),this.setInnerRadiusField(DO)}setValueFieldToPercent(){this.setRadiusField(jO),this.setInnerRadiusField(zO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const LU=Object.assign(Object.assign({},zF),{rose:{name:"rose",type:"arc"}});class RU extends tz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class OU extends vj{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=sO.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=sj,this._endAngle=nj,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),fR(this._regions,(t=>{"radius"===this.getOrient()?Xz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Xz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:UR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:UR(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:Nz(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){fR(this._regions,(t=>{"radius"===this.getOrient()?Xz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Xz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return JC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:JC(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>Yz(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ae.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return aj((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=rj,e=0;const i=this.getChart().getSpec();return fR(this.getRegions(),(s=>{const n=s;if(r=n.type,[xR.rose,xR.radar,xR.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(iO({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(iO({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}OU.type=r.polarAxis,OU.specKey="axes";const IU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},DU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class FU extends OU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new NE}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,ZE),t}}FU.type=r.polarLinearAxis,FU.specKey="axes",FU.builtInTheme={axis:Rj,axisLinear:Bj,axisAngle:DU,axisRadius:IU},G(FU,Ej);const zU=()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),sO.registerGraphicComponent(uj.circleAxis,((t,e)=>new GC(t,e))),sO.registerGraphicComponent(pj.circleAxisGrid,((t,e)=>new tP(t,e))),_j(),sO.registerComponent(FU.type,FU)};class jU extends OU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new xE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,rB),t}transformScaleDomain(){}}jU.type=r.polarBandAxis,jU.specKey="axes",jU.builtInTheme={axis:Rj,axisBand:Fj,axisAngle:DU,axisRadius:IU},G(jU,Dj);const HU=()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),sO.registerGraphicComponent(uj.circleAxis,((t,e)=>new GC(t,e))),sO.registerGraphicComponent(pj.circleAxisGrid,((t,e)=>new tP(t,e))),_j(),sO.registerComponent(jU.type,jU)};class VU extends PU{constructor(){super(...arguments),this.type=xR.rose,this.transformerConstructor=RU,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(VU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:qF(this._spec,VU.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>FR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=FR(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),XF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}VU.type=xR.rose,VU.mark=LU,VU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},VU.transformerConstructor=RU;const NU=()=>{sO.registerSeries(VU.type,VU),_U(),sO.registerAnimation("rose",((t,e)=>({appear:BU(t,e),enter:CU(t),exit:EU(t),disappear:{duration:$D.disappear.duration}}))),HU(),zU()};class UU extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,aR(this._fromAngle,this._toAngle)&&aR(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class WU extends nC{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!gR(t)&&!gR(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const GU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function YU(t,e,i){return"fadeIn"===e?GU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function XU(t,e,i){return"fadeIn"===e?GU(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const $U=(t,e)=>({custom:iC,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),KU=Object.assign(Object.assign(Object.assign({},zF),xz),{area:{name:"area",type:"area"}});class qU extends PU{constructor(){super(...arguments),this.type=xR.radar,this.transformerConstructor=Pz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(qU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:pF,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?oe(this._spec.startAngle):sj},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(YF(null===(s=sO.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),XF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=sO.getAnimationInKey(e);t.setAnimationConfig(YF(null==i?void 0:i(n,r),XF(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}qU.type=xR.radar,qU.mark=KU,qU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},qU.transformerConstructor=Pz,G(qU,Sz);const ZU=()=>{sO.registerSeries(qU.type,qU),$H(),Cz(),Bz(),sO.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:YU(t,e,"in"),enter:YU(t,e,"in"),exit:YU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:$D.disappear.duration},update:[{channel:["points","center"],custom:WU,customParameters:t,duration:$D.update.duration,easing:$D.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),sO.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:XU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:$D.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:UU,customParameters:t,duration:$D.update.duration,easing:$D.update.easing}]}))),sO.registerAnimation("radarGroup",((t,e)=>({appear:$U(t,"in"),disappear:{duration:$D.disappear.duration}}))),Vk(),HU(),zU()};class JU extends TF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>mi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const QU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(wO)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[PO]:r,[LO]:`${s}_${e}`})),r++}))})),n},tW={fill:"#bbb",fillOpacity:.2},eW=Object.assign(Object.assign({},zF),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}});class iW extends nz{constructor(){super(...arguments),this.type=xR.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),EI(this._option.dataSet,"objFlat",QU),EI(this._option.dataSet,"copyDataView",FI),BI(this._option.dataSet,"dataview",wa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(iO(tW,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(iW.mark.group),this._containerMark=this._createMark(iW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(iW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(iW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(iW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(iW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(iW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(iW.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!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",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:RO}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new OR).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:RO}}initTooltip(){this._tooltipHelper=new JU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}iW.type=xR.dot,iW.mark=eW,iW.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class sW extends TF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>mi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const nW=Object.assign(Object.assign({},zF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),rW=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class aW extends nz{constructor(){super(...arguments),this.type=xR.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),EI(this._option.dataSet,"linkDotInfo",rW),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(aW.mark.group),this._containerMark=this._createMark(aW.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(aW.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(aW.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:RO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new sW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}aW.type=xR.link,aW.mark=nW,aW.builtInTheme={link:{arrow:{style:{size:10}}}};const oW=Object.assign(Object.assign({},zF),{group:{name:"group",type:"group"}});class lW extends aU{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?DO:qO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?FO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?oe(n):sj;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):nj,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=FR(this.angleAxisHelper.dataToPosition([t[DO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=FR(this.angleAxisHelper.dataToPosition([t[FO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?FR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(lW.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return of(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Dg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const uW=()=>{sO.registerAnimation("circularProgress",((t,e)=>({appear:dW(t,e),enter:{type:"growAngleIn"},disappear:{duration:$D.disappear.duration}})))};class pW extends tz{constructor(){super(...arguments),this._supportStack=!0}}class gW extends lW{constructor(){super(...arguments),this.type=xR.circularProgress,this.transformerConstructor=pW,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(gW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:qF(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(gW.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?DO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?FO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),XF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),XF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}gW.type=xR.circularProgress,gW.mark=hW,gW.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},gW.transformerConstructor=pW;const fW=()=>{sO.registerSeries(gW.type,gW),_U(),uW(),JD(),HU(),zU()};function mW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const vW={type:"fadeIn"};function _W(t,e="grow"){return!1===e?{}:"fadeIn"===e?vW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:mW(t)}))(t)}class yW extends TF{enableByType(t){return"dimension"!==t}}const bW=Object.assign(Object.assign({},zF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class xW extends nz{constructor(){super(...arguments),this.type=xR.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(xW.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return FR(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return FR(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?FR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return FR(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return FR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?FR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(xW.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return FR(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return FR(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),XF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),XF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new yW(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}xW.type=xR.linearProgress,xW.mark=bW,xW.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const SW=()=>{hV(),sO.registerAnimation("linearProgress",((t,e)=>({appear:_W(t,e),enter:_W(t),disappear:{duration:$D.disappear.duration}}))),JD(),sO.registerSeries(xW.type,xW)},AW=[0],kW=[20,40],MW=[200,500],TW={shrink:!1,enlarge:!1,fontSizeLimitMin:0},wW=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class CW{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const EW=`${wO}_WORD_CLOUD_TEXT`,BW=Object.assign(Object.assign({},zF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),PW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class LW extends ez{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=kW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:MW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:AW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?EW:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:TW},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||sb(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:AW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!wW.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new CW(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(LW.mark.word,{key:LO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(LW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(YF(sO.getAnimationInKey("wordCloud")(n,s),XF("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new OR).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:RO])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new NE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new NE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[PO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:LO,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:I_.createCanvas.bind(I_),getTextBounds:mf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Wg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}LW.mark=BW,LW.builtInTheme={wordCloud:PW};function RW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||$D.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=OW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},IW=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=IW(t.children,e,t,n))})),s},DW=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=DW(t.children,e,t,n)),n=e(t,s,i,n)})),n},FW=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):FW(t.children,e,i)))})),e};function zW(t,e){let i,s;if(VW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function VW(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function GW(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function YW(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function XW(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function $W(t){return{_:t,next:null,prev:null}}function KW(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];GW(n,s,r);let a,o,l,h,c,d,u,p=$W(s),g=$W(n),f=$W(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=OW(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Ct)/Ct}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:QW.defaultOpionts.nodeSort;IW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)IW([o],qW(h)),DW([o],ZW(this._getPadding,.5,a)),IW([o],JW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);IW([o],qW(QW.defaultOpionts.setRadius)),DW([o],ZW(Rt,1,a)),c&&DW([o],ZW(this._getPadding,o.radius/t,a)),IW([o],JW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}QW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const tG=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=tG(t.children):t.value=0),e+=Math.abs(t.value)})),e};function eG(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){tG(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function iG(t){return t.depth}function sG(t,e){return e-1-t.endDepth}const nG=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),rG=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},aG={left:iG,right:sG,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:iG,end:sG},oG=bt(0,1);class lG{constructor(t){this._ascendingSourceBreadth=(t,e)=>nG(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>nG(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},lG.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):aG[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return eG(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[rG(s[t.source]),rG(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=_t(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*oG(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(nG),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(nG),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];hG(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),cG);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},dG.defaultOpionts,t):Object.assign({},dG.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Lt(this.options.center[0],t.width),s=t.y0+Lt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>Lt(t,n))):Lt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Lt(t,n))):Lt(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Lt(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=OW(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ce({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function uG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:hG,slice:uG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?uG:hG)(t,e,i,s,n)}};class fG{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},fG.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?pG(this.options.aspectRatio):null!==(e=gG[this.options.splitType])&&void 0!==e?e:gG.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=OW(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function mG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ci?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=mG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Ci(o.map(Ci))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rwt(e)));u=Ri(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=vG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function kG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Pi((function(i){return-1*MG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},wG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||yG,s=e.lossFunction||_G,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];di(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:TG(f),arcs:f})}))},CG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:EG,triangle:EG,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 EG(){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 BG(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const PG=t=>CG[t]?CG[t]():CG.circle(),LG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function RG(t){return d(t)?t:function(){return t}}class OG{constructor(t){var e,i;switch(this.options=j({},OG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=PG(this.options.shape),this.getText=null!==(e=RG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=RG(this.options.fontWeight),this.getTextFontSize=RG(this.options.fontSize),this.getTextFontStyle=RG(this.options.fontStyle),this.getTextFontFamily=RG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>LG(10,50);break;case"random-light":this.getTextColor=()=>LG(50,90);break;default:this.getTextColor=RG(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return oe(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():wt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class DG extends OG{constructor(t){var e;super(j({},DG.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<=DG.defaultOptions.minFontSize&&(this.options.minFontSize=DG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=IG[this.options.spiral])&&void 0!==e?e:IG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=RG(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=BG(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(HG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(jG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}HG(p,this._size)&&(p=VG(p,this._size))}else if(HG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||zG(p,i))&&(!i||!FG(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function FG(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function zG(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,HG=(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 VG(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},UG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},WG=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},GG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=BG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=PG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)WG(n,UG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)WG(n,UG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)WG(n,UG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)WG(n,UG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)WG(n,UG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=UG({x:l,y:h},o,-Math.PI/2,5),e=UG({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);WG(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var C=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var M=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const w=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)};const B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=M(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function U(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=U(t),n=U(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=it){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var yt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function _(t){return o=void 0,u&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Ct(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const wt=4294967296;const Et=t=>e=>R(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(_(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Rt=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,Ot=t=>0,It=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Lt(f.min,f);for(let r=0;r=1?jt:t<=-1?-jt:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ae{static distancePP(t,e){return $t(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return $t(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return $t(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Nt;)t+=Nt;else if(t>0)for(;t>Nt;)t-=Nt;return t};function ce(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=pe(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(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 me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function _e(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Ce(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?oe(t.angle):t.angle,s=Me(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+jt;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+jt;u>Ut&&(u-=Ut),g>Ut&&(g-=Ut);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Ce(n,i)+Ce(n,s))/2>Ce(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Ie(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Fe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}},He=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ne(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ue{}class We extends Ue{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class Ge{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ge,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ge;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ge(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=le(r.rotateDeg),r}}class Ye{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Xe(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Ke(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const $e=/^#([0-9a-f]{3,8})$/,qe={transparent:4294967040},Ze={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Je(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Qe(t){return S(t)?new ni(t>>16,t>>8&255,255&t,1):_(t)?new ni(t[0],t[1],t[2]):new ni(255,255,255)}function ti(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ei(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ii=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ni((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Qe(t):8===e?new ni(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class si{static Brighter(t,e=1){return 1===e?t:new si(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new si(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof si?t:new si(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(qe[t]))return function(t){return S(t)?new ni(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ni(t[0],t[1],t[2],t[3]):new ni(255,255,255,1)}(qe[t]);if(p(Ze[t]))return Qe(Ze[t]);const e=`${t}`.trim().toLowerCase(),i=ii(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ni(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Xe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ni(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=si.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ni(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Ke(this.color.r,this.color.g,this.color.b),r=Xe(u(t)?n.h:yt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ni(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ii(e,!0);return null!=i?i:this}setColorName(t){const e=Ze[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new si(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ei(t.color.r),this.color.g=ei(t.color.g),this.color.b=ei(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ni{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Je(this.r)+Je(this.g)+Je(this.b)+(1===this.opacity?"":Je(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Ke(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ri(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new ni(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Ke});function oi(t){if(k(t))return[t,t,t,t];if(_(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function li(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const hi=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function ci(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function di(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const ui=1e-10;function pi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ui)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=vi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=gi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ui,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function gi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function fi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return gi(t,t-(i*i-e*e+t*t)/(2*i))+gi(e,s)}function mi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function vi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let bi;function xi(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class Si{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ai=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ki(t){let e;if(e=Ai.exec(t))return new Si({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});ot.getInstance().error("invalid format: "+t)}const Ci=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ti{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return Ti.instance||(Ti.instance=new Ti),Ti.instance}newFormat(t){const e=ki(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Mi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:y,group:_,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?m:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?Ci[8+bi/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?y+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=_(k,1/0));let C=S.length+k.length+A.length,T=C>1)+S+k+A+T.slice(C);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=ki(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=_i(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ci[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>xi(100*t,e),r:xi,s:function(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(bi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+_i(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function wi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Ri(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ri(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Pi(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},is=Math.sqrt,ss=Math.tan;function ns(t){return t>1?0:t<-1?Ni:Math.acos(t)}function rs(t){return t>1?Ui:t<-1?-Ui:Math.asin(t)}function as(){}function os(t,e){t&&hs.hasOwnProperty(t.type)&&hs[t.type](t,e)}var ls={Feature:function(t,e){os(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sNi?t+Math.round(-t/Wi)*Wi:t,e]}function Ss(t,e,i){return(t%=Wi)?e||i?bs(ks(t),Cs(e,i)):ks(t):e||i?Cs(e,i):xs}function As(t){return function(e,i){return[(e+=t)>Ni?e-Wi:e<-Ni?e+Wi:e,i]}}function ks(t){var e=As(t);return e.invert=As(-t),e}function Cs(t,e){var i=qi(t),s=ts(t),n=qi(e),r=ts(e);function a(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*i+o*s;return[$i(l*n-c*r,o*i-h*s),rs(c*n+l*r)]}return a.invert=function(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*n-l*r;return[$i(l*n+h*r,o*i+c*s),rs(c*i-o*s)]},a}function Ts(t,e){(e=gs(e))[0]-=t,_s(e);var i=ns(-e[1]);return((-e[2]<0?-i:i)+Wi-ji)%Wi}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:as,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ws(t,e){return Xi(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function Ps(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Fs(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function zs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Fs(a);var t=function(t,e){var i=Ls(e),s=e[1],n=ts(s),r=[ts(i),-qi(i),0],a=0,o=0;Is.reset(),1===n?s=Ui+ji:-1===n&&(s=-Ui-ji);for(var l=0,h=t.length;l=0?1:-1,C=k*A,T=C>Ni,M=f*x;if(Is.add($i(M*k*ts(C),m*S+M*qi(C))),a+=T?A+k*Wi:A,T^p>=i^_>=i){var w=ms(gs(u),gs(y));_s(w);var E=ms(r,w);_s(E);var B=(T^A>=0?-1:1)*rs(E[2]);(s>B||s===B&&(w[0]||w[1]))&&(o+=T^A>=0?1:-1)}}return(a<-ji||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Hs))}return u}}function Hs(t){return t.length>1}function js(t,e){return((t=t.x)[0]<0?t[1]-Ui-ji:Ui-t[1])-((e=e.x)[0]<0?e[1]-Ui-ji:Ui-e[1])}1===(Rs=Ds).length&&(Os=Rs,Rs=function(t,e){return Ds(Os(t),e)});var Ns=zs((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Ni:-Ni,l=Xi(r-i);Xi(l-Ni)0?Ui:-Ui),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ni&&(Xi(i-n)ji?Ki((ts(e)*(r=qi(s))*ts(i)-ts(s)*(n=qi(e))*ts(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*Ui,s.point(-Ni,n),s.point(0,n),s.point(Ni,n),s.point(Ni,0),s.point(Ni,-n),s.point(0,-n),s.point(-Ni,-n),s.point(-Ni,0),s.point(-Ni,n);else if(Xi(t[0]-e[0])>ji){var r=t[0]0,n=Xi(e)>ji;function r(t,i){return qi(t)*qi(i)>e}function a(t,i,s){var n=[1,0,0],r=ms(gs(t),gs(i)),a=fs(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ms(n,r),u=ys(n,h);vs(u,ys(r,c));var p=d,g=fs(u,p),f=fs(p,p),m=g*g-f*(fs(u,u)-1);if(!(m<0)){var v=is(m),y=ys(p,(-g-v)/f);if(vs(y,u),y=ps(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Xi(y[0]-b)Ni^(b<=y[0]&&y[0]<=x)){var T=ys(p,(-g+v)/f);return vs(T,u),[y,ps(T)]}}}function o(e,i){var n=s?t:Ni-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return zs(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Ni:-Ni),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ws(e,p)||ws(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&ws(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=qi(e),o=ts(e),l=s*i;null==n?(n=e+s*Wi,r=e-l/2):(n=Ts(a,n),r=Ts(a,r),(s>0?nr)&&(n+=s*Wi));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Xi(s[0]-t)0?0:3:Xi(s[0]-i)0?2:1:Xi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,y,_=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&_.lineEnd()},polygonStart:function(){_=b,l=[],h=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=y&&e,n=(l=Fs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Bs(l,o,e,r,a),a.polygonEnd());_=a,l=h=c=null}};function S(t,e){n(t,e)&&_.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(_.lineStart(),_.point(r,a));else if(o&&m)_.point(r,a);else{var l=[g=Math.max(Ws,Math.min(Vs,g)),f=Math.max(Ws,Math.min(Vs,f))],b=[r=Math.max(Ws,Math.min(Vs,r)),a=Math.max(Ws,Math.min(Vs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(_.lineStart(),_.point(r,a),y=!1):(m||(_.lineStart(),_.point(l[0],l[1])),_.point(b[0],b[1]),o||_.lineEnd(),y=!1)}g=r,f=a,m=o}return x}}function Ys(t){return t}var Xs,Ks,$s,qs,Zs=Di(),Js=Di(),Qs={point:as,lineStart:as,lineEnd:as,polygonStart:function(){Qs.lineStart=tn,Qs.lineEnd=nn},polygonEnd:function(){Qs.lineStart=Qs.lineEnd=Qs.point=as,Zs.add(Xi(Js)),Js.reset()},result:function(){var t=Zs/2;return Zs.reset(),t}};function tn(){Qs.point=en}function en(t,e){Qs.point=sn,Xs=$s=t,Ks=qs=e}function sn(t,e){Js.add(qs*t-$s*e),$s=t,qs=e}function nn(){sn(Xs,Ks)}var rn=Qs,an=1/0,on=an,ln=-an,hn=ln;var cn,dn,un,pn,gn={point:function(t,e){tln&&(ln=t);ehn&&(hn=e)},lineStart:as,lineEnd:as,polygonStart:as,polygonEnd:as,result:function(){var t=[[an,on],[ln,hn]];return ln=hn=-(on=an=1/0),t}},fn=0,mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn={point:Cn,lineStart:Tn,lineEnd:En,polygonStart:function(){kn.lineStart=Bn,kn.lineEnd=Pn},polygonEnd:function(){kn.point=Cn,kn.lineStart=Tn,kn.lineEnd=En},result:function(){var t=An?[xn/An,Sn/An]:bn?[yn/bn,_n/bn]:vn?[fn/vn,mn/vn]:[NaN,NaN];return fn=mn=vn=yn=_n=bn=xn=Sn=An=0,t}};function Cn(t,e){fn+=t,mn+=e,++vn}function Tn(){kn.point=Mn}function Mn(t,e){kn.point=wn,Cn(un=t,pn=e)}function wn(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,Cn(un=t,pn=e)}function En(){kn.point=Cn}function Bn(){kn.point=Rn}function Pn(){On(cn,dn)}function Rn(t,e){kn.point=On,Cn(cn=un=t,dn=pn=e)}function On(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,xn+=(n=pn*t-un*e)*(un+t),Sn+=n*(pn+e),An+=3*n,Cn(un=t,pn=e)}var In=kn;function Ln(t){this._context=t}Ln.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Wi)}},result:as};var Dn,Fn,zn,Hn,jn,Nn=Di(),Un={point:as,lineStart:function(){Un.point=Vn},lineEnd:function(){Dn&&Wn(Fn,zn),Un.point=as},polygonStart:function(){Dn=!0},polygonEnd:function(){Dn=null},result:function(){var t=+Nn;return Nn.reset(),t}};function Vn(t,e){Un.point=Wn,Fn=Hn=t,zn=jn=e}function Wn(t,e){Hn-=t,jn-=e,Nn.add(is(Hn*Hn+jn*jn)),Hn=t,jn=e}var Gn=Un;function Yn(){this._string=[]}function Xn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Kn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),us(t,i(s))),s.result()}return r.area=function(t){return us(t,i(rn)),rn.result()},r.measure=function(t){return us(t,i(Gn)),Gn.result()},r.bounds=function(t){return us(t,i(gn)),gn.result()},r.centroid=function(t){return us(t,i(In)),In.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ys):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Yn):new Ln(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function $n(t){return function(e){var i=new qn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function qn(){}function Zn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),us(i,t.stream(gn)),e(gn.result()),null!=s&&t.clipExtent(s),t}function Jn(t,e,i){return Zn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Qn(t,e,i){return Jn(t,[[0,0],e],i)}function tr(t,e,i){return Zn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function er(t,e,i){return Zn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Yn.prototype={_radius:4.5,_circle:Xn(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=Xn(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}},qn.prototype={constructor:qn,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 ir=16,sr=qi(30*Yi);function nr(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,y=c-n,_=v*v+y*y;if(_>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=is(b*b+x*x+S*S),k=rs(S/=A),C=Xi(Xi(S)-1)e||Xi((v*E+y*B)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Yi:0,E()):[m*Gi,v*Gi,y*Gi]},M.angle=function(t){return arguments.length?(_=t%360*Yi,E()):_*Gi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},M.precision=function(t){return arguments.length?(a=nr(o,T=t*t),B()):is(T)},M.fitExtent=function(t,e){return Jn(M,t,e)},M.fitSize=function(t,e){return Qn(M,t,e)},M.fitWidth=function(t,e){return tr(M,t,e)},M.fitHeight=function(t,e){return er(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&w,E()}}function cr(t){var e=0,i=Ni/3,s=hr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Yi,i=t[1]*Yi):[e*Gi,i*Gi]},n}function dr(t,e){var i=ts(t),s=(i+ts(e))/2;if(Xi(s)2?t[2]*Yi:0),e.invert=function(e){return(e=t.invert(e[0]*Yi,e[1]*Yi))[0]*=Gi,e[1]*=Gi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===yr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function br(t){return ss((Ui+t)/2)}function xr(t,e){var i=qi(t),s=t===e?ts(t):Ji(i/qi(e))/Ji(br(e)/br(t)),n=i*Qi(br(t),s)/s;if(!s)return yr;function r(t,e){n>0?e<-Ui+ji&&(e=-Ui+ji):e>Ui-ji&&(e=Ui-ji);var i=n/Qi(br(e),s);return[i*ts(s*t),n-i*qi(s*t)]}return r.invert=function(t,e){var i=n-e,r=es(s)*is(t*t+i*i),a=$i(t,Xi(i))*es(i);return i*s<0&&(a-=Ni*es(t)*es(i)),[a/s,2*Ki(Qi(n/r,1/s))-Ui]},r}function Sr(t,e){return[t,e]}function Ar(t,e){var i=qi(t),s=t===e?ts(t):(i-qi(e))/(e-t),n=i/s+t;if(Xi(s)ji&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Rr.invert=fr(rs),Or.invert=fr((function(t){return 2*Ki(t)})),Ir.invert=function(t,e){return[-e,2*Ki(Zi(t))-Ui]};var Fr={exports:{}},zr=function(t,e){this.p1=t,this.p2=e};zr.prototype.rise=function(){return this.p2[1]-this.p1[1]},zr.prototype.run=function(){return this.p2[0]-this.p1[0]},zr.prototype.slope=function(){return this.rise()/this.run()},zr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},zr.prototype.isVertical=function(){return!isFinite(this.slope())},zr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},zr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},zr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},zr.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)},zr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Hr=zr,jr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Hr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=jr(t.slice(0,s),e),o=jr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Nr=jr;!function(t){var e=Nr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Vr(Yr,e),{tolerance:s}=i;return Ur(t,s)};var Kr;!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"}(Kr||(Kr={}));const $r=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),_(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let C=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/C:0,T.push(y[t])}return T},Zr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],w=M.length?M:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:w});if(!T.length)return qr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...M,...T];return qr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},Jr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",w=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",R=null!==(p=k.min)&&void 0!==p?p:"min",O=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(y=k.values)&&void 0!==y?y:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),_(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}_(S)&&(S=[yt(Math.min.apply(null,S),0,1),yt(Math.max.apply(null,S),0,1)]);const U=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[M]=o,f[w]=l,f[E]=h,f[B]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,A&&(f[F]=H.get(t)||[]),U.push(f)}return U};var Qr={},ta={};function ea(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ia(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function sa(t,e){var i=t+"",s=i.length;return s9999?"+"+sa(e,6):sa(e,4))+"-"+sa(t.getUTCMonth()+1,2)+"-"+sa(t.getUTCDate(),2)+(r?"T"+sa(i,2)+":"+sa(s,2)+":"+sa(n,2)+"."+sa(r,3)+"Z":n?"T"+sa(i,2)+":"+sa(s,2)+":"+sa(n,2)+"Z":s||i?"T"+sa(i,2)+":"+sa(s,2)+"Z":"")}function ra(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return ta;if(h)return h=!1,Qr;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a0}function ma(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=ha(t));var r=[];switch(t.type){case"GeometryCollection":return va(t,(function(t){_a(t,s)})),t;case"FeatureCollection":return ma(t,(function(t){ma(_a(t,s),(function(t){r.push(t)}))})),di(r)}return _a(t,s)}function _a(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return va(t,(function(t){_a(t,e)})),t;case"LineString":return ba(ga(t),e),t;case"Polygon":return xa(ga(t),e),t;case"MultiLineString":return ga(t).forEach((function(t){ba(t,e)})),t;case"MultiPolygon":return ga(t).forEach((function(t){xa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ba(t,e){fa(t)===e&&t.reverse()}function xa(t,e){fa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Sa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Ta=(t,e={},i)=>{i.type=Kr.GEO;const s=Vr(ka,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ca(t))})):e.push(Ca(t))})),e})(t);let l=t.features;return o&&(l=ya(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=Aa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=Aa.bounds(t);t.bbox=e}})),t.features=l,t},Ma={},wa=(t,e,i)=>{i.type=Kr.GEO;const s=Vr(ka,Ma,e),{object:n}=s;if(!y(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Dr(a,t)}))}:Dr(a,o));var a,o;return Ta(r,s,i)},Ea=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!_(t))throw new TypeError("Invalid data: must be DataView array!");return _(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Ba=0;function Pa(t="dataset"){return Ba>1e8&&(Ba=0),t+"_"+Ba++}class Ra{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:Pa("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Oa{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Pa("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Oa||!0!==(null==e?void 0:e.clone)||(i=!0),i?L(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?H({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",$r),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Kn();const Ia={},La={albers:pr,albersusa:function(){var t,e,i,s,n,r,a=pr(),o=ur().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=ur().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}},Da=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Fa(t,e){return function i(){const s=e();return s.type=t,s.path=Kn().projection(s),s.copy=s.copy||function(){const t=i();return Da.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class za{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class Ha extends za{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}class ja{static GenAutoIncrementId(){return ja.auto_increment_id++}}ja.auto_increment_id=0;class Na{}const Ua=new Na;let Va=0;class Wa{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Ua.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Va,t),this.tryRunAnimationFrameNextFrame(),Va}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class Ga{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Ya=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Xa extends Ga{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=ja.GenAutoIncrementId(),this.hooks={onSetEnv:new Ha(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Wa);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Wa),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Ya(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}var Ka=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class $a extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=ja.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Ka(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(io(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=io(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=io(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=io(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=eo.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(io(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(io(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,io(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):io(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof Qa))return void ot.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=eo.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new so(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Ja,this.rootWheelEvent=new Qa,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&y(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const oo=Nt-1e-8;class lo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>oo)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Nt)<0&&(s+=Nt),(n%=Nt)<0&&(n+=Nt),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const co=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,uo={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},po={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let go,fo,mo,vo,yo,_o;function bo(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;t_o){let t,e=mo;for(let s=1,r=i.length;s1&&(g=Math.sqrt(g),i*=g,s*=g);const f=d/i,m=c/i,v=-c/s,y=d/s,_=f*o+m*l,b=v*o+y*l,x=f*t+m*e,S=v*t+y*e;let A=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const C=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),M=Math.atan2(b-T,_-C);let w=Math.atan2(S-T,x-C)-M;w<0&&1===r?w+=Nt:w>0&&0===r&&(w-=Nt);const E=Math.ceil(Math.abs(w/(jt+.001))),B=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Ro(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=No(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Vo(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new Wo(i,n),new Wo(n,s)]}class Wo extends Oo{constructor(t,e){super(),this.type=Co.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===ko.ROW?Vt(this.p0.x-this.p1.x):t===ko.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class Go{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new Uo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new Wo(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===ko.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===ko.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Yo extends Go{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Xo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Ko(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?ko.ROW:ko.COLUMN;return"monotoneY"===t?new Yo(t,s):new Go(t,s)}class $o{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 qo(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ko("linear",i,t);return Zo(new $o(n,s),t),n}function Zo(t,e){return Xo(t,e,1)}function Jo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Qo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Jo(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:Jo(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 tl(t,e){return Xo(t,e,2)}function el(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return qo(t,e);const n=Ko("basis",i,t);return tl(new Qo(n,s),t),n}function il(t){return t<0?-1:1}function sl(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(il(r)+il(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function nl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function rl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class al{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:rl(this,this._t0,nl(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,rl(this,nl(this,e=sl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:rl(this,this._t0,e=sl(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class ol extends al{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ll(t,e){return Xo(t,e,2)}function hl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return qo(t,e);const n=Ko("monotoneX",i,t);return ll(new al(n,s),t),n}function cl(t,e){return Xo(t,e,2)}function dl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return qo(t,e);const n=Ko("monotoneY",i,t);return cl(new ol(n,s),t),n}let ul=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class pl extends ul{lineEnd(){this.context.closePath()}}function gl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Go("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?ko.ROW:ko.COLUMN);return fl(new ul(r,e,n),t),r}function fl(t,e){return Xo(t,e,1)}function ml(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Go("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?ko.ROW:ko.COLUMN);return fl(new pl(r,e,n),t),r}class vl extends $o{lineEnd(){this.context.closePath()}}function yl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ko("linear",i,t);return _l(new vl(n,s),t),n}function _l(t,e){return Xo(t,e,1)}function bl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function xl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return qo(i,n);const o=Ko(t,r,i);return Xo(new e(o,s,a),i,2),o}}const Sl=xl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:bl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Al=xl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:bl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class kl extends Oo{constructor(t,e,i){super(),this.type=Co.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Ho(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?jo(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===ko.ROW?Vt(this.p0.x-this.p2.x):t===ko.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=Xt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Ho(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new kl(i,a,r),new kl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Cl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Wo(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new kl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new Uo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Tl(t,e,i){var s,n;switch(e){case"linear":default:return qo(t,i);case"basis":return el(t,i);case"monotoneX":return hl(t,i);case"monotoneY":return dl(t,i);case"step":return gl(t,.5,i);case"stepClosed":return ml(t,.5,i);case"stepBefore":return gl(t,0,i);case"stepAfter":return gl(t,1,i);case"catmullRom":return Sl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Al(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return yl(t,i)}}class Ml extends ho{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new lo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([po.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([po.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([po.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([po.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([po.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([po.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([po.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([po.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([po.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Cl(this);Ro(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[po.M]=t=>`M${t[1]} ${t[2]}`,t[po.L]=t=>`L${t[1]} ${t[2]}`,t[po.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[po.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[po.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];Bo(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[po.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=bo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=Tl(e,i);"x"===s?this.direction=ko.ROW:"y"===s?this.direction=ko.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[po.M]=this.moveToTransform,t[po.L]=this.lineToTransform,t[po.Q]=this.quadraticCurveToTransform,t[po.C]=this.bezierCurveToTransform,t[po.AT]=this.arcToTransform,t[po.E]=this.ellipseTransform,t[po.R]=this.rectTransform,t[po.A]=this.arcTransform,t[po.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Ro(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===ko.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===ko.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),Ql=Object.assign(Object.assign({},Gl),{points:[],cornerRadius:0,closePath:!0}),th=Object.assign(Object.assign({},Gl),{width:100,height:100,spikes:5,thickness:.5}),eh=Object.assign(Object.assign({},Gl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),ih=Object.assign(Object.assign({},Gl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),sh=Object.assign(Object.assign({},Gl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),nh=Object.assign(Object.assign(Object.assign({},Gl),jl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),rh=Object.assign(Object.assign(Object.assign({},Gl),jl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ah=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Gl),{fill:!0,cornerRadius:0,cornerType:"round"}),oh=Object.assign(Object.assign({},ah),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});class lh{static GetImage(t,e){var i;const s=lh.cache.get(t);s?"fail"===s.loadState?Ua.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):lh.loadImage(t,e)}static GetSvg(t,e){var i;let s=lh.cache.get(t);s?"fail"===s.loadState?Ua.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},lh.cache.set(t,s),s.dataPromise=Ua.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=lh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},lh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ua.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ua.global.loadBlob(t):"json"===e&&(i.dataPromise=Ua.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!lh.isLoading&&lh.toLoadAueue.length){lh.isLoading=!0;const t=lh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(lh.cache.set(i,n),n.dataPromise=Ua.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()})).catch((t=>{console.error(t),lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()}))}}),0)}static loadImage(t,e){const i=hh(t,lh.toLoadAueue);if(-1!==i)return lh.toLoadAueue[i].marks.push(e),void lh.loading();lh.toLoadAueue.push({url:t,marks:[e]}),lh.loading()}static improveImageLoading(t){const e=hh(t,lh.toLoadAueue);if(-1!==e){const t=lh.toLoadAueue.splice(e,1);lh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function hh(t,e){for(let i=0;i{var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)dh[s]=t,i&&(i=!(null!==(e=dh[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)dh[e]=!!t[e],i&&(i=!!dh[e]);else dh[0]=!1,dh[1]=!1,dh[2]=!1,dh[3]=!1;return{isFullStroke:i,stroke:dh}},ph=[0,0,0,0],gh=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ph[0]=t[0],ph[2]=t[0],ph[1]=t[1],ph[3]=t[1],ph):t:t:0,fh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],mh=[1,2,3,0,1,2,3,0];function vh(t,e,i,s){for(;t>=Ut;)t-=Ut;for(;t<0;)t+=Ut;for(;t>e;)e+=Ut;fh[0].x=i,fh[1].y=i,fh[2].x=-i,fh[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Gt(t)*i,Kt(t)*i),s.add(Gt(e)*i,Kt(e)*i),n!==r||e-t>Ht){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Sh.TimeOut=1e3/60;const Ah=new Sh,kh=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,Ch=(t,e)=>{const i=kh(t,e);return isNaN(i)?i:Math.max(e,i)};class Th{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Mh(t,e,i,s,n){return n?t.arc(i,s,e,0,Nt,!1,n):t.arc(i,s,e,0,Nt),!1}var wh=new class extends Th{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return Mh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Mh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Eh=new class extends Th{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Ph=new class extends Th{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Rh(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Th{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2+n,i,s)}};function Ih(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Lh extends Th{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Ih(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ih(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Lh;var Fh=new class extends Lh{constructor(){super(...arguments),this.type="triangle"}};const zh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Hh=Math.sin(Nt/10)*zh,jh=-Math.cos(Nt/10)*zh;function Nh(t,e,i,s){const n=Hh*e,r=jh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Nt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Uh=new class extends Th{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Nh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Nh(t,this.parseSize(e)/2+n,i,s)}};const Vh=$t(3);function Wh(t,e,i,s){const n=e,r=n/Vh,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Gh=new class extends Th{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Yh(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Xh=new class extends Th{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Yh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Yh(t,this.parseSize(e)/2+n,i,s)}};function Kh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var $h=new class extends Th{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Kh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Kh(t,this.parseSize(e)/2+n,i,s)}};const qh=-.5,Zh=$t(3)/2,Jh=1/$t(12);function Qh(t,e,i,s){const n=e/2,r=e*Jh,a=n,o=e*Jh+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(qh*n-Zh*r+i,Zh*n+qh*r+s),t.lineTo(qh*a-Zh*o+i,Zh*a+qh*o+s),t.lineTo(qh*l-Zh*h+i,Zh*l+qh*h+s),t.lineTo(qh*n+Zh*r+i,qh*r-Zh*n+s),t.lineTo(qh*a+Zh*o+i,qh*o-Zh*a+s),t.lineTo(qh*l+Zh*h+i,qh*h-Zh*l+s),t.closePath(),!1}var tc=new class extends Th{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Qh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qh(t,this.parseSize(e)/2+n,i,s)}};function ec(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ic=new class extends Th{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return ec(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return ec(t,this.parseSize(e)/2,i,s,n)}};function sc(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var nc=new class extends Th{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return sc(t,this.parseSize(e)/2,i,s,n)}};function rc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var ac=new class extends Th{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return rc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return rc(t,this.parseSize(e)/2,i,s,n)}};const oc=$t(3);function lc(t,e,i,s){const n=e*oc;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var hc=new class extends Th{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return lc(t,this.parseSize(e)/2/oc,i,s)}drawOffset(t,e,i,s,n){return lc(t,this.parseSize(e)/2/oc+n,i,s)}};function cc(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var dc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return cc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return cc(t,this.parseSize(e)/4+n,i,s)}};function uc(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var pc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return uc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return uc(t,this.parseSize(e)/4+n,i,s)}};function gc(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var fc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return gc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return gc(t,this.parseSize(e)/4+n,i,s)}};function mc(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var vc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return mc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return mc(t,this.parseSize(e)/4+n,i,s)}};function yc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var _c=new class extends Th{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return yc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function bc(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var xc=new class extends Th{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return bc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return bc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Sc(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var Ac=new class extends Th{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return Sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Sc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function kc(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Cc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Tc=new class extends Th{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?Cc(t,e,i,s):kc(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Cc(t,e+2*n,i,s):kc(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Mc=new Ve;class wc{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Ro(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Ro(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Mc.x1=i.bounds.x1*t,Mc.y1=i.bounds.y1*t,Mc.x2=i.bounds.x2*t,Mc.y2=i.bounds.y2*t,e.union(Mc)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const Ec=[wh,Eh,Ph,Oh,hc,Fh,Uh,Gh,Xh,$h,tc,ic,nc,Dh,ac,dc,pc,fc,vc,Tc,_c,xc,Ac],Bc={};Ec.forEach((t=>{Bc[t.type]=t}));const Pc={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Rc{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ic(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ic(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ic(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Rc(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Rc(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function Fc(t,e){return zc(t)}function zc(t,e){const i={};for(let e=0;e{Ua.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)}))}function Yc(t,e,i,s=0){return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let Xc=0;function Kc(){return Xc++}var $c;function qc(t){const e=[];let i=0,s="";for(let n=0;nZc.set(t,!0)));const Jc=new Map;function Qc(t){if(Zc.has(t))return!0;if(Jc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function td(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Jc.set(t,!0)));const ed=Kc(),id=Kc(),sd=Kc(),nd=Kc(),rd=Kc(),ad=Kc(),od=Kc(),ld=Kc(),hd=Kc(),cd=Kc(),dd=Kc(),ud=Kc(),pd=Kc(),gd=Kc(),fd=Kc(),md=Kc(),vd=Kc(),yd=Symbol.for("GraphicService"),_d=Symbol.for("GraphicCreator"),bd={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},xd=Object.keys(bd),Sd={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Ad=Object.keys(Sd),kd={duration:200,easing:"cubicOut"},Cd=Symbol.for("CanvasFactory"),Td=Symbol.for("Context2dFactory");function Md(t){return function(){var t,e;const i=null===(t=Ua.global)||void 0===t?void 0:t.env,s=i?null===(e=Ua.canvasFactory)||void 0===e?void 0:e.call(Ua,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const wd=1e-4,Ed=Math.sqrt(3),Bd=1/3;function Pd(t){return t>-Gd&&tGd||t<-Gd}function Od(t){return"number"==typeof t&&Number.isFinite(t)}const Id=[0,0],Ld=[0,0],Dd=[0,0];function Fd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function zd(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Hd(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function jd(t){return(t%=Ut)<0&&(t+=Ut),t}function Nd(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Ut);let d=Math.atan2(l,o);return d<0&&(d+=Ut),d>=s&&d<=n||d+Ut>=s&&d+Ut<=n}function Wd(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(Pd(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Xd=[-1,-1,-1],Kd=[-1,-1];function $d(){const t=Kd[0];Kd[0]=Kd[1],Kd[1]=t}function qd(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Pd(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Bd):Math.pow(i,Bd),s=s<0?-Math.pow(-s,Bd):Math.pow(s,Bd);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+Ed*Math.sin(e)))/(3*a),h=(-o+i*(s-Ed*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Xd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&$d(),p=Hd(e,s,r,o,Kd[0]),u>1&&(g=Hd(e,s,r,o,Kd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Pd(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Xd);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=zd(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Xd[0]=-l,Xd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ut-1e-4){s=0,n=Ut;const e=r?1:-1;return a>=Xd[0]+t&&a<=Xd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ut,n+=Ut);let c=0;for(let e=0;e<2;e++){const i=Xd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ut+t),(t>=s&&t<=n||t+Ut>=s&&t+Ut<=n)&&(t>Ht/2&&t<1.5*Ht&&(e=-e),c+=e)}}return c}function Qd(t){return Math.round(t/Ht*1e8)/1e8%2*Ht}function tu(t,e){let i=Qd(t[0]);i<0&&(i+=Ut);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ut?n=i+Ut:e&&i-n>=Ut?n=i-Ut:!e&&i>n?n=i+(Ut-Qd(i-n)):e&&i1&&(i||(h+=Oe(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,A=b;eu[0]=S,eu[1]=A,tu(eu,Boolean(a[6])),S=eu[0],A=eu[1];const k=S,C=A-S,T=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case po.M:u=m,p=v,c=u,d=p;break;case po.L:if(i){if(Wd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case po.C:if(i){if(Ud(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=qd(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(Nd(c,d,m,v,y,_,e,s,n))return!0}else h+=Zd(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case po.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Vd(m,v,y,k,k+C,T,e,M,n))return!0}else h+=Jd(m,v,y,k,k+C,T,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case po.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Wd(u,p,o,p,e,s,n)||Wd(o,p,o,l,e,s,n)||Wd(o,l,u,l,e,s,n)||Wd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case po.Z:if(i){if(Wd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class nu{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(nu.IsGradientStr(t))try{const e=su(t)[0];if(e){if("linear"===e.type)return nu.ParseLinear(e);if("radial"===e.type)return nu.ParseRadial(e);if("conic"===e.type)return nu.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2,n=parseFloat(e.value)/180*Ht-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ut,stops:nu.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:nu.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2;let n="angular"===e.type?parseFloat(e.value)/180*Ht:0;for(;n<0;)n+=Ut;for(;n>=Ut;)n-=Ut;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function ou(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function lu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s,t}function hu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n,t}function cu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s,t}function du(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function uu(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function pu(t,e,i){const s=i[0],n=i[1],r=i[2];return t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function gu(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function fu(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],v=s[0],y=s[1],_=s[2],b=i[0],x=i[1],S=i[2];return Math.abs(g-b)0&&(Au.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Au.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Tu),function(t,e,i){return iu(t,0,!1,e,i)}(this.path.commandList,Tu.x,Tu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Tu);const i=ru(this,this.lineWidth,this.dpr);return function(t,e,i,s){return iu(t,e,!0,i,s)}(this.path.commandList,i,Tu.x,Tu.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(Cu,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Au.free(t))),this.stack.length=0}}const wu={WIDTH:500,HEIGHT:500,DPR:1};class Eu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=wu.WIDTH,height:n=wu.HEIGHT,dpr:r=wu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Bu;Eu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Bu||(Bu={}));class Pu{static Get(t,e=Bu.Color1,i=[0,0,0,1]){if(e===Bu.Color1){const e=Pu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=si.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Pu.store1[t]=e,Pu.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Pu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=si.parseColorString(t);return n&&(Pu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Pu.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Bu.Color1){if(Pu.store1[t])return;Pu.store1[t]=i,Pu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Pu.store255[t])return;Pu.store255[t]=i,Pu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Ru(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Ou(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Iu(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Iu(t,e,i,s,n)}function Iu(t,e,i,s,n){if(!t||!e)return t&&Ru(t)||e&&Ru(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Pu.Get(t,Bu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Pu.Get(e,Bu.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:Ru(a)})))});return o?Ou(r,l,i,s,n):Ou(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return Lu(s,n,i);if("radial"===s.gradient)return Du(s,n,i);if("conical"===s.gradient)return Fu(s,n,i)}return!1}return n&&n(r,a),Ru(zu(r,a,i),s)}function Lu(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Uu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Uu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Fu(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Uu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function zu(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]}function Hu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Pu.store255={},Pu.store1={};const ju=[0,0,0,0],Nu=[0,0,0,0];function Uu(t,e,i){return Pu.Get(t,Bu.Color255,ju),Pu.Get(e,Bu.Color255,Nu),`rgba(${Math.round(ju[0]+(Nu[0]-ju[0])*i)},${Math.round(ju[1]+(Nu[1]-ju[1])*i)},${Math.round(ju[2]+(Nu[2]-ju[2])*i)},${ju[3]+(Nu[3]-ju[3])*i})`}class Vu{static GetCanvas(){try{return Vu.canvas||(Vu.canvas=Ua.global.createCanvas({})),Vu.canvas}catch(t){return null}}static GetCtx(){if(!Vu.ctx){const t=Vu.GetCanvas();Vu.ctx=t.getContext("2d")}return Vu.ctx}}class Wu extends Ye{static getInstance(){return Wu._instance||(Wu._instance=new Wu),Wu._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Vu.GetCanvas(),s=Vu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Wu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Gu{static GetSize(t){for(let e=0;e=t)return Gu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Gu.GenKey(t,e,i,s,n),l=Gu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=Gu.GenKey(t,e,i,s,n);Gu.cache[l]?Gu.cache[l].push({width:a,height:o,pattern:r}):Gu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Yu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Ut;for(;i>Ut;)i-=Ut;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),Ou(o.color,l.color,h,!1)}function Xu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Vu.GetCanvas(),d=Vu.GetCtx();if(!d)return null;const u=Gu.GetSize(o),p=Gu.GetSize(l);let g=Gu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Wu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);t++){const e=y.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Gu.Set(e,i,s,r,a,g,u,p),g}Gu.cache={},Gu.ImageSize=[20,40,80,160,320,640,1280,2560];const Ku=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function $u(t){return null==t?void 0:t}class qu{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:$u(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Ku.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:$u(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function Zu(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Ju(t){if(!Zu(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Ju(t[i])})),e}function Qu(t,e){var i;const s=null!==(i=Ju(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];Zu(n)&&Zu(i)?s[t]=Qu(n,i):s[t]=Ju(i)})),s}class tp{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Ju(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];Zu(r)&&Zu(n)?t[i]=Qu(r,n):!Zu(r)&&Zu(a)&&Zu(n)?t[i]=Qu(a,n):t[i]=Ju(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?ep.PAINT|ep.BOUNDS|ep.PICK:ep.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?ep.PAINT|ep.BOUNDS:ep.PAINT}};class np{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:kd;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:Ao.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:Ao.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:Ao.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const rp=new qu;function ap(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,op(t),!0)}function op(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=rp.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function lp(t){if(t)return t.parentScope&&lp(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&op(t),t}function hp(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function cp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function dp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,cp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),hp(null!=e?e:t.ownerStage))}const up=new Ve,pp=new Ge,gp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],fp=["x","y"],mp=["scaleX","scaleY"],vp=["angle"],yp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),_p=new re,bp=[],xp=ep.PAINT|ep.SHAPE|ep.BOUNDS|ep.TRANSFORM|ep.LAYOUT;function Sp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Ap(t){if(!Sp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=Sp(s)?Ap(s):s})),i}function kp(t,e){return t===e||!!(Sp(t)||Sp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function Cp(t,e){var i;const s=null!==(i=Ap(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];Sp(n)&&Sp(i)?s[t]=Cp(n,i):s[t]=Ap(i)})),s}const Tp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Mp extends $a{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,cp(this.stage,this),hp(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&lp(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Ao.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(lp(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new qu).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Ap(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&Sp(n)&&Sp(s)?e[t]=Cp(n,s):e[t]=Ap(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:Ap(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e){const i=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((s=>{const n=Object.prototype.hasOwnProperty.call(e,s),r=t[s];if(!n)return void(Object.prototype.hasOwnProperty.call(t,s)&&(i.set(s,{prev:r,next:void 0}),delete t[s]));const a=e[s];kp(r,a)||(i.set(s,{prev:r,next:a}),t[s]=Ap(a))})),i}_syncAttribute(){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const t=this.buildStaticAttributeSnapshot(),e=this.syncObjectToSnapshot(this.attribute,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,e}_syncFinalAttributeFromStaticTruth(){const t=this.finalAttribute;if(!t)return;const e=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(t,e)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=sp[t];return n?n(e,i):null!==(s=ip[t])&&void 0!==s?s:ep.PAINT}(e,i,s):null!==(n=ip[e])&&void 0!==n?n:ep.PAINT;return r&ep.PICK&&(r|=ep.BOUNDS),r===ep.PAINT&&this.needUpdateTag(e)&&(r=ep.SHAPE|ep.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&xp)!==xp?(t&ep.SHAPE?this.addUpdateShapeAndBoundsTag():t&ep.BOUNDS&&this.addUpdateBoundTag(),t&ep.PAINT&&this.addUpdatePaintTag(),t&ep.TRANSFORM&&this.addUpdatePositionTag(),t&ep.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=ep.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!Sp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=Sp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&xo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Mp.userSymbolMap[t],e)return e;if(!0===Nc(t=Pc[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=_(i.path)?i.path:[i.path];up.clear();const n=[];s.forEach((t=>{const e=(new Ml).fromString(t.d),i={};Ad.forEach((e=>{t[e]&&(i[Sd[e]]=t[e])})),n.push({path:e,attribute:i}),up.union(e.bounds)}));const r=up.width(),a=up.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new wc(t,n,!0);return Mp.userSymbolMap[t]=l,l}const i=(new Ml).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Yt(s,n);i.transform(0,0,r,r);const a=new wc(t,i);return Mp.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=gh(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new lo(t);return Ro(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ge),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&xo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&xo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&xo.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&xo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=xo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===So.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===Ao.STATE||null!=i&&i>=Ao.ANIMATE_BIND&&i<=Ao.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===Ao.STATE||null!=o&&o>=Ao.ANIMATE_BIND&&o<=Ao.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!kp(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:bp,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Ao.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:Ao.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:kd}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:bp,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Ap(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Ao.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:Ao.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:bp,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:bp,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Ao.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:Ao.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Ao.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Dl.x,y:e=Dl.y,scaleX:i=Dl.scaleX,scaleY:s=Dl.scaleY,angle:n=Dl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Gt(a),f=Kt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const y=m-i,_=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*y-S*_,t.f=p+h*m+d*v-x*y-A*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),Ua.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Dl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=pp.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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:Ua.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:Ao.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:Ao.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=Ua.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Ml).fromString(t):this.pathProxy=new Ml,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:Ua.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new to(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):$a.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:Ao.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:Ao.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Ua.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Mu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}function wp(t){return!!t&&("string"==typeof t?!yp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Op=Pp();class Ip{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Bp.forEach((t=>{this._defaultTheme[t]=Object.create(Op[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Bp.forEach((s=>{const n=Object.create(Op[s]);t&&t[s]&&Rp(n,t[s]),i[s]&&Rp(n,i[s]),e[s]&&Rp(n,e[s]),this.combinedTheme[s]=n})),e.common&&Bp.forEach((t=>{Rp(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Lp=new Ip;function Dp(t,e){return t.glyphHost?Dp(t.glyphHost):e?(t.isContainer,e):Fp(t)||t.attachedThemeGraphic&&Dp(t.attachedThemeGraphic)||Lp.getTheme()}function Fp(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)):Lp.getTheme()}return null}const zp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},Hp=["radius","startAngle","endAngle",...gp];class jp extends Mp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=nd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Dp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ua.graphicService.updateTempAABBBounds(i);return zp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ut-zt?i.set(-r,-r,r,r):vh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Hp)}needUpdateTag(t){return super.needUpdateTag(t,Hp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Ml,s.arc(0,0,r,a,o),s}clone(){return new jp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return jp.NOWORK_ANIMATE_ATTR}}function Np(t){return new jp(t)}function Up(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Vp(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Wp(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[hi(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=hi(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}jp.NOWORK_ANIMATE_ATTR=Tp;class Gp{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Bl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=vd}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Dp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Xp({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Ua.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Yc(n,o/Math.abs(r+a),!0,l),i.union(n)}return Ua.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ua.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ne(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=Ua.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Gp(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=Ua.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new Gp(a,T,C),w=_(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=Up(y,a),e=this.cache.verticalList.length*v,i=Vp(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>qc(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===$c.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const S=Up(y,a),A=x.verticalList.length*v,k=Vp(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Ch(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Yp){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Yp){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Xp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xp.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Xp.baselineMapAlign}getAlignMapBaseline(){return Xp.alignMapBaseline}}function Kp(t){return new Xp(t)}Xp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Tp),Xp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Xp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const $p=["heightLimit","lineClamp"];class qp extends Xp{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=Ch(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=Ua.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new Gp(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),T=[],M=[0,0];let w=1/0;if(y>0&&(w=Math.max(Math.floor(y/x),1)),b&&(w=Math.min(w,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Yc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Jp)}needUpdateTag(t){return super.needUpdateTag(t,Jp)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Ml).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Ml).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function tg(t){return new Qp(t)}Qp.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Tp);const eg=["segments","points","curveType","curveTension",...gp];let ig=class t extends Mp{constructor(t={}){super(t),this.type="line",this.numberType=ld}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}getGraphicTheme(){return Dp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Ua.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,eg)}needUpdateTag(t){return super.needUpdateTag(t,eg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Ml;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function sg(t){return new ig(t)}ig.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const ng=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},rg=["width","x1","y1","height","cornerRadius",...gp];class ag extends Mp{constructor(t){super(t),this.type="rect",this.numberType=ud}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Dp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);return zp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,rg)}needUpdateTag(t){return super.needUpdateTag(t,rg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=ng(e);return t=new Ml,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new ag(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ag.NOWORK_ANIMATE_ATTR}}function og(t){return new ag(t)}ag.NOWORK_ANIMATE_ATTR=Tp;const lg=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class hg extends ag{constructor(t){super(t),this.type="rect3d",this.numberType=pd}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Xt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;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,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Dp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new dg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return dg.NOWORK_ANIMATE_ATTR}}function ug(t){return new dg(t)}dg.NOWORK_ANIMATE_ATTR=Tp;const pg=Symbol.for("EnvContribution"),gg=Symbol.for("VGlobal"),fg="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",mg={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"}},vg=!0,yg=!1,_g=/\w|\(|\)|-/,bg=/[.?!,;:/,。?!、;:]/,xg=/\S/,Sg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Ag(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Ua.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=kg(t,a)),a}function kg(t,e,i=!1){let s=e;for(;_g.test(t[s-1])&&_g.test(t[s])||bg.test(t[s]);)if(s--,s<=0)return i?Cg(t,e):e;return s}function Cg(t,e){let i=e;for(;_g.test(t[i+1])&&_g.test(t[i])||bg.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Tg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Ua.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Mg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=mg[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function wg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Eg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Ch(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Tg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Tg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ag(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Tg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=wg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ag(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Tg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Ag(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Tg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Bg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...gp];class Pg extends Mp{constructor(t){super(t),this.type="image",this.numberType=od,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Dp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);return zp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ah[t]}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}clone(){return new Pg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Pg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Tp);class Og extends Pg{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=gh(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=gh(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=ah.width,height:e=ah.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Ig{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Og?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=mg[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Eg){const e=xg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Og)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Tg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||yg;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Sg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||vg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?au(t,s,{AABBBounds:i}):s,Sg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Og)break;const{width:n}=Tg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Og?t.width:t.getWidthWithEllips(this.direction)})),i}}class Lg{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=mg[this.direction]}store(t){if(t instanceof Og){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 Ig(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Og?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Ag(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Eg(i,t.newLine,t.character,t.ascentDescentMode),new Eg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Dg=!1;try{Dg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Dg=!1}const Fg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...gp];class zg extends Mp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=gd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:rh.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:rh.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:rh.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:rh.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:rh.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:rh.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:rh.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:rh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Dp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&zg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&zg.splitText(t.text).length>1)))}static splitText(t){if(Dg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=zg.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Ua.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ua.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!zg.AllSingleCharacter(y)&&(y=zg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Mg(0,0,(k?n:x?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Lg(T);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&T.lines[T.lines.length-1].paragraphs.push(s)):M.deal(s,!0),T.lines.length!==t&&(t=T.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,T.lines[T.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===T.layoutDirection?k:C)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:s)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new zg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return zg.NOWORK_ANIMATE_ATTR}}function Hg(t){return new zg(t)}zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Tp);const jg=["path","customPath",...gp];class Ng extends Mp{constructor(t){super(t),this.type="path",this.numberType=hd}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Ml?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Ml?this.cache:t.path)}getGraphicTheme(){return Dp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);zp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Ml).fromString(t.path):t.customPath&&(this.cache=new Ml,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,jg)}needUpdateTag(t){return super.needUpdateTag(t,jg)}toCustomPath(){return(new Ml).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Ng(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ng.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Ng(t)}Ng.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Tp);const Vg=["segments","points","curveType","curveTension",...gp];class Wg extends Mp{constructor(t){super(t),this.type="area",this.numberType=sd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Dp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Ua.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Ml;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Wg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wg.NOWORK_ANIMATE_ATTR}}function Gg(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const Yg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...gp];class Xg extends Mp{constructor(t){super(t),this.type="arc",this.numberType=ed}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=he(e),i=e+a,s&&Vt(a)>zt&&Vt(a)zt&&o>zt)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=$t(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Kt(g)),n=Zt(Number(l)/a*Kt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Dp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ua.graphicService.updateTempAABBBounds(i);zp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Ut-zt?i.set(-s,-s,s,s):(vh(l,o,s,i),vh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Yg)}needUpdateTag(t){return super.needUpdateTag(t,Yg)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ut-zt)n.moveTo(0+h*Gt(a),0+h*Kt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Kt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Kt(a),i=l*Gt(o),s=l*Kt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function Kg(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Tp);const $g=["width","height","spikes","thickness",...gp];class qg extends Mp{constructor(t){super(t),this.type="star",this._cachedPoints=[],this.numberType=fd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e,spikes:i}=this.attribute;return(null==t||t>0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return Dp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Ml,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Tp;class Jg extends Xg{constructor(t){super(t),this.type="arc3d",this.numberType=id}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),Ua.graphicService.updateTempAABBBounds(i),Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return Jg.NOWORK_ANIMATE_ATTR}}function Qg(t){return new Jg(t)}var tf;Jg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Tp),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(tf||(tf={}));let ef=class t extends Mp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=ad,this._childUpdateTag=xo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(ap(this.sharedStateScope,t),dp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Ip),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Ip)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===So.GLOBAL){const i=new re(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&xo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Dl.x,y:e=Dl.y,dx:i=Dl.dx,dy:s=Dl.dy,scaleX:n=Dl.scaleX,scaleY:r=Dl.scaleY,angle:a=Dl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Dp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Ua.graphicService.updateTempAABBBounds(i),Ua.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=xo.CLEAR_BOUNDS,this._childUpdateTag&=xo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&xo.UPDATE_BOUNDS||(this._childUpdateTag|=xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:Ua.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&xo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Ua.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&ap(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return op({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function sf(t){return new ef(t)}ef.NOWORK_ANIMATE_ATTR=Tp;const nf=["points","cornerRadius",...gp];class rf extends Mp{constructor(t){super(t),this.type="polygon",this.numberType=cd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Dp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Ua.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,nf)}needUpdateTag(t){return super.needUpdateTag(t,nf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Ml,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new rf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rf.NOWORK_ANIMATE_ATTR}}function af(t){return new rf(t)}rf.NOWORK_ANIMATE_ATTR=Tp;class of extends rf{constructor(t){super(t),this.type="pyramid3d",this.numberType=dd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),Ua.graphicService.updateTempAABBBounds(i),Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,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}getNoWorkAnimateAttr(){return of.NOWORK_ANIMATE_ATTR}}function lf(t){return new of(t)}of.NOWORK_ANIMATE_ATTR=Tp;class hf extends ef{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function cf(t){return new hf(t)}class df{constructor(){this.registry=new Map}create(t,e){const i=this.registry.get(t);if(!i)throw new Error(`GraphicFactory has no creator registered for type "${t}"`);return new i(e)}register(t,e){if(!t)throw new Error("GraphicFactory requires a non-empty graphic type");this.registry.set(t,e)}}const uf=new df;const pf=new class{constructor(){this.store=new Map}registerStore(t,e){this.store.set(t,e),this[t]=e}RegisterGraphicCreator(t,e){gf(t,e)}CreateGraphic(t,e){return this.store.has(t)?ff(t,e):null}};function gf(t,e){if(!t)throw new Error("Graphic registration requires a non-empty graphic type");pf.registerStore(t,e),uf.register(t,function(t){return class{constructor(e){try{return new t(e)}catch(i){return t(e)}}}}(e))}function ff(t,e){return uf.create(t,e)}function mf(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=m[1];y[2]=null!==(s=m[2])&&void 0!==s?s:0}if(ou(t),du(t,t,[n+o,r+l,a+h]),du(t,t,[y[0],y[1],y[2]]),lu(t,t,g),hu(t,t,p),du(t,t,[-y[0],-y[1],y[2]]),pu(t,t,[c,d,u]),f){const i=ku.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}du(i,i,[s[0],s[1],0]),cu(i,i,f),du(i,i,[-s[0],-s[1],0]),gu(t,t,i)}}function vf(t){const{alpha:e,beta:i}=t.attribute;return e||i}class yf{constructor(t=pf){this.creator=t,this.hooks={onAttributeUpdate:new Ha(["graphic"]),onSetStage:new Ha(["graphic","stage"]),onRemove:new Ha(["graphic"]),onRelease:new Ha(["graphic"]),onAddIncremental:new Ha(["graphic","group","stage"]),onClearIncremental:new Ha(["graphic","group","stage"]),beforeUpdateAABBBounds:new Ha(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Ha(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new Ha(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Vp(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Up(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Yc(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Yc(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Ne(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}let _f,bf;function xf(t){return _f||(_f=ff("text",{})),_f.initAttributes(t),_f.AABBBounds}function Sf(t){return bf||(bf=ff("richtext",{})),bf.setAttributes(t),bf.AABBBounds}const Af=Symbol.for("TransformUtil"),kf=Symbol.for("GraphicUtil"),Cf=Symbol.for("LayerService"),Tf=Symbol.for("StaticLayerHandlerContribution"),Mf=Symbol.for("DynamicLayerHandlerContribution"),wf=Symbol.for("VirtualLayerHandlerContribution"),Ef=Symbol.for("RenderService"),Bf=Symbol.for("BeforeRenderConstribution"),Pf=Symbol.for("AutoEnablePlugins"),Rf=Symbol.for("PluginService"),Of=Symbol.for("GraphicPicker"),If=Symbol.for("PickerService"),Lf=Symbol.for("BoundsPicker"),Df=Symbol.for("GlobalPickerService"),Ff=Symbol.for("PickItemInterceptor"),zf=Symbol.for("PickServiceInterceptor"),Hf=Symbol.for("IncrementalDrawContribution"),jf=Symbol.for("ArcRender"),Nf=Symbol.for("Arc3dRender"),Uf=Symbol.for("AreaRender"),Vf=Symbol.for("CircleRender"),Wf=Symbol.for("GraphicRender"),Gf=Symbol.for("GroupRender"),Yf=Symbol.for("LineRender"),Xf=Symbol.for("PathRender"),Kf=Symbol.for("PolygonRender"),$f=Symbol.for("RectRender"),qf=Symbol.for("Rect3DRender"),Zf=Symbol.for("SymbolRender"),Jf=Symbol.for("TextRender"),Qf=Symbol.for("RichTextRender"),tm=Symbol.for("Pyramid3dRender"),em=Symbol.for("GlyphRender"),im=Symbol.for("ImageRender"),sm=Symbol.for("RenderSelector"),nm=Symbol.for("DrawContribution"),rm=Symbol.for("StarRender"),am=Symbol.for("VWindow"),om=Symbol.for("WindowHandlerContribution");function lm(t){const e=Ua.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class hm extends Ga{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=Ua.global,e=lm){super(),this.handlerFactory=e,this.hooks={onChange:new Ha(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=ja.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&>(this.width,t.width())&>(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class cm{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Md(Object.assign({nativeCanvas:Ua.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Md(Object.assign({nativeCanvas:Ua.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const dm=new cm;class um{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Ua.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=dm.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:jl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:jl.fontFamily,fontSize:jl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=Ua.windowFactory)||void 0===s?void 0:s.call(Ua))&&void 0!==n?n:new hm(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var pm;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(pm||(pm={}));const gm=new Ge;class fm{constructor(){this.matrix=new Ge}init(t){return this.mode=pm.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=pm.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(gm.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(gm.a,gm.b,gm.c,gm.d,gm.e,gm.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(gm.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(gm.a,gm.b,gm.c,gm.d,gm.e,gm.f),this}scale(t,e,i){return this.mode===pm.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===pm.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return gm.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(gm.a,gm.b,gm.c,gm.d,gm.e,gm.f),this}translate(t,e){return this.mode===pm.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===pm.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}class mm{constructor(){this.global=Ua.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ge(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new re(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var vm=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function ym(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function _m(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=ym(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=ym(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Sm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Am{constructor(){this.time=To.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(Tm(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Dp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){Im(t,e,i,s)}}const km=new Am,Cm=new Set(["top","center","bottom"]);function Tm(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Mm({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const wm={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Em({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=wm[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Mm({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Bm(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Pm(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:Cm.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Bm(s,e,"left","center","right"),y:Bm(n,i,"top","center","bottom")}}function Rm(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Om(t){if(!t)return null;const e=Rm(t.naturalWidth,t.videoWidth,t.width),i=Rm(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Im(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Om(e),{backgroundRepeatMode:m,backgroundSizing:v}=Em({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Pm(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=dm.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),dm.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class Lm{constructor(t){this.subRenderContribitions=t,this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}}class Dm{constructor(){this.time=To.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const Fm=new Dm;class zm{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Hm=new zm,jm={getContributions:()=>[]};class Nm{constructor(t=[],e=jm,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):_m(e,Gl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ue,this.backupDirtyBounds=new Ue,this.global=null!==(s=i.global)&&void 0!==s?s:Ua.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:Ua.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:jm,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Gl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Gl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Au.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=xm(e,i,Gl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Sm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Au.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Sm.free(n),Au.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||function(){const t=Ua.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class Vm{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class Wm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Gm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Ym{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const Xm={getContributions:()=>[]};class Km{constructor(t=Xm,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new Gm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class $m{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class qm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Ua.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Ua.global.getRequestAnimationFrame();this.rafId=t((()=>{Ua.global.devicePixelRatio!==this.dpr&&(this.dpr=Ua.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Ua.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class Zm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ua.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Jm=new Ve;class Qm{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&xo.UPDATE_PAINT)||s._updateTag&xo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(Jm.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(Jm,t.parent&&t.parent.globalTransMatrix)))})),t.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let tv;function ev(){if(null==tv)try{const t=document.createElement("canvas"),e=t.getContext("2d");tv=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),tv&&(tv=!!document.createElement)}catch(t){tv=!1}}function iv(){ev();const t=Ua.global&&Ua.global.env;return t?"browser"===t:tv}const sv="white";class nv extends ef{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:sv}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Ip,this.hooks={beforeRender:new Ha(["stage"]),afterRender:new Ha(["stage"]),afterClearScreen:new Ha(["stage"]),afterClearRect:new Ha(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:Ua.global,!this.global.env&&iv()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:Ua.windowFactory)&&void 0!==n?n:()=>new hm(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=Ua.pickerServiceFactory)&&void 0!==a?a:()=>new mm,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=Ua.renderServiceFactory)||void 0===h?void 0:h.call(Ua))&&void 0!==c?c:Ua.renderService)&&void 0!==d?d:new Um,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=Ua.pluginServiceFactory)||void 0===p?void 0:p.call(Ua))&&void 0!==g?g:Ua.pluginService)&&void 0!==f?f:new Km,this.layerService=null!==(v=null!==(m=e.layerService)&&void 0!==m?m:Ua.layerService)&&void 0!==v?v:new cv(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:Ua.graphicService)&&void 0!==b?b:new yf,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:sv,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,op(s)),dp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new ao(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[y,_,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,A=Math.cos(d)*Math.cos(u)*1);const k=lv.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=lv.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=lv.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new $m))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new qm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new Zm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ue;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Qm,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=lv.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=lv.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=lv.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return op({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class rv{constructor(t=nv,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class av extends ef{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Ip,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Ua.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Ua.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}class ov{constructor(t=av){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let lv=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function hv(t){const e=Ua.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}lv._pluginClasses={};class cv{static GenerateLayerId(){return`${cv.idprefix}_${cv.prefix_count++}`}constructor(t=Ua.global,e=new ov,i=hv){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:cv.GenerateLayerId(),layerHandler:n})}),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}}cv.idprefix="visactor_layer",cv.prefix_count=0;const dv=Symbol("ContributionProvider");class uv{constructor(t,e){this.serviceIdentifier=t,this.container=e,mv.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function pv(t,e){return new uv(t,e)}function gv(t,e){t(dv).toDynamicValue((({container:t})=>pv(e,t))).inSingletonScope().whenTargetNamed(e)}function fv(t,e){t(dv).toDynamicValue((({container:t})=>pv(e,t))).whenTargetNamed(e)}class mv{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}mv.store=new Map;class vv{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=nh.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=kg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=kg(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}}const yv=Symbol.for("TextMeasureContribution");class _v extends vv{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function bv({bind:t}){t(gg).toDynamicValue((({container:t})=>new Xa(pv(pg,t)))).inSingletonScope(),t(am).to(hm),t(kf).toDynamicValue((({container:t})=>new um(pv(yv,t)))).inSingletonScope(),t(Af).to(fm).inSingletonScope(),t(Cf).to(cv).inSingletonScope()}function xv({bind:t}){t(Ef).to(Um)}const Sv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===id,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Ut;for(;o<0;)o+=Ut;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};class Av{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class kv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Dp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Au.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class Cv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class Tv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=Sv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function Mv({bind:t,isBound:e}){e(If)||(t(Df).toSelf(),t(If).toService(Df)),t(Tv).toSelf().inSingletonScope(),t(Ff).toService(Tv),t(kv).toSelf().inSingletonScope(),t(Ff).toService(kv),t(Cv).toSelf().inSingletonScope(),t(Ff).toService(Cv),gv(t,Ff),t(Av).toSelf().inSingletonScope(),t(zf).toService(Av),gv(t,zf)}function wv({bind:t}){t(yd).to(yf),t(_d).toConstantValue(pf)}class Ev{constructor(){this.type="static",this.offscreen=!1,this.global=Ua.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Md({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}}function Bv(t){(function({bind:t}){gv(t,pg)})({bind:t.bind}),function({bind:t}){t(yv).to(_v).inSingletonScope(),gv(t,yv)}({bind:t.bind}),function({bind:t}){t(Ev).toSelf(),t(Tf).toService(Ev)}({bind:t.bind})}const Pv=Ht/2;function Rv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Pv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Pv,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Pv,Ht,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ht,Ht+Pv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function Ov(t,e){return!(!t&&!e)}function Iv(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Lv(t,e,i){return i&&t*e>0}function Dv(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Fv(t,e){return t*e>0}function zv(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Hv(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uB*B+P*P&&(k=T,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Nv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*Gt(c),k=n*Kt(c),C=s*Gt(u),T=s*Kt(u);let M,w,E,B;if((b>zt||y>zt)&&(M=n*Gt(d),w=n*Kt(d),E=s*Gt(p),B=s*Kt(p),r1?0:P<-1?Ht:Math.acos(P))/2),l=$t(t[0]*t[0]+t[1]*t[1]);S=Xt(b,(s-l)/(o-1)),x=Xt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:M,yore:w,xire:C,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Uv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ut-zt)e.moveTo(i+n*Gt(o),s+n*Kt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Kt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:T,innerDeltaAngle:M,innerEndAngle:w,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Nv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=Xt(v,m),r=Xt(y,m),o=jv(g,f,u,p,n,t,Number(c)),l=jv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Gt(Wt(l.y01,l.x01)),s+o.cy+m*Kt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Kt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Kt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Gt(C),s+n*Kt(C));if(!(r>zt)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=Xt(B,T),n=Xt(P,T),o=jv(S,A,b,x,r,-n,Number(c)),l=jv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Kt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,w,E,c):e.moveTo(i+r*Gt(E),s+r*Kt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Kt(o)):e.closePath(),d}const Vv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Wv{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=dm.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),dm.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Ut),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=dm.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=tg({}));const C=h.columns?v/h.columns:b,T=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,T-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:Vv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=dm.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),dm.free(l),c}dm.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const Gv=new Wv;class Yv{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{innerPadding:m=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,T-=m;const w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:ru(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:T-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Uv(t,e,i,s,M+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&w(u,"outerBorder"),f&&w(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:T,startAngle:y,endAngle:_})}}const Xv=new Yv,Kv=Gv,$v=km;class qv{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:ru(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Zv=new qv,Jv=Gv,Qv=km;class ty extends Am{constructor(){super(...arguments),this.time=To.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Tm(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const ey=new ty;class iy{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:k-i)||0,w=(null!=w?w:C-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:ru(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,w-o*g)):(e.beginPath(),Rv(e,u,p,M-o*g,w-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}class sy{constructor(){this.time=To.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}}class ny{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Rv(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ry=new iy,ay=Gv,oy=km;class ly extends iy{constructor(){super(...arguments),this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}}const hy=new ly,cy=km;class dy{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:ru(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class uy{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const py=new dy,gy=new uy,fy=Gv,my=km,vy=Gv,yy=km;class _y extends Wv{constructor(){super(...arguments),this.time=To.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:xh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:xh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:xh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:xh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class by{constructor(t){this.groupRenderContribitions=t,this.numberType=ad}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ey)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Dp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:T=l.y}=t.attribute,M=Dv(p,m,g,f,c),w=zv(p,v,g,f),E=Ov(c,u),B=Iv(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(M||w||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Rv(e,i,s,g,f,y,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ey));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===To.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,T-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,C-i,T-s,l),e.stroke()))};A?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===To.afterFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Ua.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Dp(t,null==s?void 0:s.theme).group,i=ku.allocate(),n=ku.allocate();mf(n,t,e),gu(i,p||i,n),a.modelMatrix=i,ku.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ku.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var xy,Sy=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(xy||(xy={}));class Ay extends Nm{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=xy.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Ha([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Sy(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Gl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Gl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return Sy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Sy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Sy(this,void 0,void 0,(function*(){if(2!==t.count)yield bm(t,Gl.zIndex,((i,s)=>{if(this.status===xy.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Sy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Sy(this,void 0,void 0,(function*(){this.rendering&&(this.status=xy.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=xy.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 Sy(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:()=>Sy(this,void 0,void 0,(function*(){yield bm(t,Gl.zIndex,(t=>Sy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const ky=Symbol.for("DrawItemInterceptor"),Cy=new Ve,Ty=new Ve;class My{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Cy.copy(s.dirtyBounds),Ty.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Au.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Cy),s.backupDirtyBounds.copy(Ty)),!0}}class wy{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}class Ey{constructor(){this.order=1,this.interceptors=[new My,new Py,new By,new wy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ku.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const Ry=Symbol.for("ArcRenderContribution"),Oy=Symbol.for("AreaRenderContribution"),Iy=Symbol.for("CircleRenderContribution"),Ly=Symbol.for("GroupRenderContribution"),Dy=Symbol.for("ImageRenderContribution"),Fy=Symbol.for("PathRenderContribution"),zy=Symbol.for("PolygonRenderContribution"),Hy=Symbol.for("RectRenderContribution"),jy=Symbol.for("SymbolRenderContribution"),Ny=Symbol.for("TextRenderContribution"),Uy=Symbol.for("StarRenderContribution"),Vy=Symbol.for("CommonRenderContribution"),Wy=Symbol.for("InteractiveSubRenderContribution");function Gy(t){!function({bind:t}){t(Am).toSelf().inSingletonScope(),t(Wv).toSelf().inSingletonScope(),t(nm).to(Nm),t(Hf).to(Ay),t(Gf).toDynamicValue((({container:t})=>new by(pv(Ly,t)))).inSingletonScope(),t(Wf).toService(Gf),gv(t,Ly),gv(t,Wy),t(Lm).toDynamicValue((({container:t})=>new Lm(pv(Wy,t)))).inSingletonScope(),gv(t,Wf),t(Ey).toSelf().inSingletonScope(),t(ky).toService(Ey),gv(t,ky)}({bind:t.bind})}class Yy{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class Xy{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new Yy(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function Ky(){return new Xy}const $y=Ky();function qy(){qy.__loaded||(qy.__loaded=!0,bv({bind:$y.bind}),wv({bind:$y.bind}),xv({bind:$y.bind}),Mv({bind:$y.bind,isBound:$y.isBound}),function({bind:t}){t(Rf).to(Km),fv(t,Pf)}({bind:$y.bind}),Bv($y),Gy($y))}function Zy(){return $y}function Jy(t){qy();const[e]=$y.getAll(t);return e}function Qy(t,e){return qy(),$y.getNamed(t,e)}function t_(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}qy.__loaded=!1;const e_=t_((()=>Jy(gg)));Ua.global=e_;const i_=Zy(),s_=t_((()=>Jy(kf))),n_=t_((()=>Jy(Af))),r_=t_((()=>Jy(yd))),a_=t_((()=>Jy(Cf)));function o_(){Ua.global=e_,Ua.graphicUtil=s_,Ua.transformUtil=n_,Ua.graphicService=r_,Ua.layerService=a_,Ua.canvasFactory=t=>Qy(Cd,t),Ua.context2dFactory=t=>Qy(Td,t),Ua.windowFactory=()=>new hm(Ua.global),Ua.windowHandlerFactory=t=>function(t){const e=Qy(om,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),Ua.renderServiceFactory=()=>Jy(Ef),Ua.renderService=t_((()=>Jy(Ef))),Ua.pluginServiceFactory=()=>Jy(Rf),Ua.pluginService=t_((()=>Jy(Rf))),Ua.pickerServiceFactory=()=>Jy(If),Ua.layerHandlerFactory=t=>Jy("static"===t?Tf:"dynamic"===t?Mf:wf),Ua.incrementalDrawContributionFactory=()=>Jy(Hf)}o_();const l_={x:0,y:0,z:0,lastModelMatrix:null};class h_{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(Fm),e(Hm),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===To.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===To.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Dp(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,y=Lv(d,u,h),_=Fv(d,g),b=Ov(h),x=Iv(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Ro(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Lv(o,l,n),p=Fv(o,c),g=Ov(n,r),f=Iv(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;l_.x=n,l_.y=r,l_.z=a,l_.lastModelMatrix=d;const p=u&&(s||vf(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=ku.allocate(),n=ku.allocate();mf(n,t,e),gu(s,d||s,n),l_.x=0,l_.y=0,l_.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ku.free(n)}if(g&&!d){const s=t.getOffsetXY(e);l_.x+=s.x,l_.y+=s.y,l_.z=a,i.setTransformForCurrent()}else if(p)l_.x=0,l_.y=0,l_.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);l_.x+=s.x,l_.y+=s.y,this.transformWithoutTranslate(i,l_.x,l_.y,l_.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),l_.x=0,l_.y=0,l_.z=0;return l_}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,f,m,v,y,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ku.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class c_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ed,this.builtinContributions=[Xv,$v,Kv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nzt){const t=Xt(b,_),r=Xt(x,_),a=jv(v,y,f,m,n,t,Number(u)),o=jv(A,k,C,T,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||w<.001)e.lineTo(i+C,s+T),p=!0;else if(M>zt){const t=Xt(B,M),n=Xt(P,M),a=jv(C,T,A,k,r,-n,Number(u)),o=jv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Kt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Dp(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let T=0;const M=(c(S)&&S||S[0])&&"conical"===h.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Ut-zt){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),w||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Yu(0,0,h,n);a||Lv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}class d_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=nd,this.builtinContributions=[Zv,Qv,Jv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}function u_(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=No(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function p_(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function g_(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=p_(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),u_(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=ko.ROW:"y"===s?u=ko.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function m_(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}class v_ extends h_{constructor(){super(...arguments),this.numberType=ld}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();g_(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Tl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Xt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}function y_(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?ko.ROW:ko.COLUMN,Number.isFinite(c)||(o=ko.COLUMN),Number.isFinite(d)||(o=ko.ROW);const u=i*(o===ko.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),u_(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),u_(t,l,1,s),o=!1):o=!0}t.closePath()}const b_=new _y,x_=km;class S_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=sd,this.builtinContributions=[b_,x_],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Dp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:T,points:M,segments:w}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===C&&!w&&!M.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,_,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(w&&w.length){let e,i;const s=w.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Tl(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Tl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Tl(e,E,{curveTension:b}),n=Tl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Xt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=ko.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),A=Vt(y.y-b.y);x=null==y.x1?ko.ROW:null==y.y1?ko.COLUMN:Number.isFinite(S+A)?S>A?ko.ROW:ko.COLUMN:ko.ROW,y_(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),g_(t,i[0]?e.top:e.bottom,l,x===ko.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const A_=Gv,k_=km;class C_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=hd,this.builtinContributions=[k_,A_],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Dp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)Ro(t.pathShape.commandList,e,i,s,1,1,f);else{Ro((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}class T_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=ud,this.builtinContributions=[ry,oy,ay],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Dp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:M}=t.attribute;T=(null!=T?T:b-S)||0,M=(null!=M?M:x-A)||0;const w=Dv(g,f,T,M,h),E=zv(g,v,T,M,C),B=Ov(h,c),P=Iv(d,m);if(!t.valid||!y)return;if(!B&&!P)return;if(!(w||E||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,M)):(e.beginPath(),Rv(e,i,s,T,M,u,"bevel"!==p));const R={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,w,E,l,n,a,o,R),k?(this._runStroke(t,e,i,s,l,R,E,S,A,o),this._runFill(t,e,i,s,l,R,w,S,A,a)):(this._runFill(t,e,i,s,l,R,w,S,A,a),this._runStroke(t,e,i,s,l,R,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,w,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}class M_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=md,this.builtinContributions=[py,my,fy,gy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Dp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,M=s,w=C;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,C);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,M=t.y,w=void 0}!1===A.draw(e,c,T,M,w,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,A,a)):(this._runFill(t,e,i,s,l,x,y,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const w_=new class extends Am{constructor(){super(...arguments),this.time=To.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:w=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:R=l.backgroundClip,backgroundCornerRadius:O=l.backgroundCornerRadius}=t.attribute;let I,{background:L}=t.attribute;if(!L)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(L)&&L.background?L:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Sm.allocate(i,s,i+n,s+r),L=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=xf(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const i=t.resources.get(L);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,R&&(e.beginPath(),O?Rv(e,F.x1,F.y1,F.width(),F.height(),O,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:T,backgroundKeepAspectRatio:M,backgroundScale:w,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=L,O?(Rv(e,F.x1,F.y1,F.width(),F.height(),O,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Sm.free(F),D()}};class E_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=vd,this.builtinContributions=[w_],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Dp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=Ch(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:T}=S,M=!f,w=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,T,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,w,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Au.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Au.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,w))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,w))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,w),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,w)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,w),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,w,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,w,e),this.afterRenderStep(t,e,i,s,C,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!u(c),_=y?c.width:i.clipedWidth,b=y?0:Up(d,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}function B_(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?B_(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void B_(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,y=v/m;const _=P_(d,u),b=P_(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=R_(h,y,_,d,u),A=R_(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,T=P_(k,C),M=R_(h,P_(y,v),T,k,C);let w=Math.atan2(S.y-M.y,S.x-M.x);const E=Math.atan2(A.y-M.y,A.x-M.x);let B=E-w;B<0&&(w=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const D_=["","repeat-x","repeat-y","repeat"];function F_(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?D_[i]:"no-repeat"}function z_({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=F_(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const H_={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function j_(t){return{backgroundMode:H_[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function N_({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=z_({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function U_(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=z_({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?j_(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Im(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class V_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=od,this.builtinContributions=[hy,cy],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:T,doStroke:M}=A;if(!S||!t.resources)return;const w=t.resources.get(S);if("success"!==w.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Rv(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),U_(e,w.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},O=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=N_({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),L=P||I;g?(O(),L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore()):(L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore(),O()),this.afterRenderStep(t,e,i,s,T,!1,k,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&y(s))return void lh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Dp(t).image;this._draw(t,a,!1,i)}}var W_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class G_{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return W_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class Y_{constructor(){this._uid=ja.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class X_{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Pu.Get(e,Bu.Color1),this.ambient=i;const s=$t(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Xt(Yt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=y(e)?Pu.Get(e,Bu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const K_=()=>{lv.registerPlugin("DirectionalLight",X_)};class $_{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=ku.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=ku.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return fu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=ku.allocate()),this._vp=gu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=ku.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=ku.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return mu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=ku.allocate()),this._vp=gu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return vu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;vu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const q_=()=>{lv.registerPlugin("OrthoCamera",$_)},Z_={getContributions:()=>[]},J_={getContributions:()=>[]};class Q_{constructor(t=Z_,e=J_,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:Ua.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:Z_,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:J_,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ge(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=Dp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new re(e.x,e.y);l.transformPoint(a,a);const o=Dp(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&ku.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Au.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class tb{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new Vm,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new Wm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new Ym,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new Gm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new rv(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new ov,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new df}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new Um(new Nm([],(t=this.registry.contribution,e=ky,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class eb{constructor(t={}){this.context=new tb(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function ib(t={}){return new eb(t)}class sb extends eb{}class nb extends eb{}class rb extends S_{constructor(){super(...arguments),this.numberType=sd}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Dp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Lv(u,d,c),f=Ov(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=Dp(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=Lv(u,p,c),y=Fv(u,g),_=Ov(c),b=Iv(d,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||a||o))return;const{context:x}=n;for(let n=e;n{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function fb(t,e){let i=cb.get(t);i||(i=new Map,cb.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function mb(t,e,i){const s=fb(t,e);i&&s.forEach((t=>i(t))),s.clear()}function vb(){return ub(),ob}function yb(){mv.refreshAllContributions()}function _b(){return ub(),null!=lb||(lb=new Xa(pv(pg,ob))),lb}function bb(t){const e=vb(),i=_b();Ua.global=i,Ua.canvasFactory=t=>e.getNamed(Cd,t),Ua.context2dFactory=t=>e.getNamed(Td,t),Ua.windowHandlerFactory=t=>pb(om,t),Ua.windowFactory=()=>new hm(i,(t=>pb(om,t))),Ua.pluginServiceFactory=()=>new Km(pv(Pf,e),{pluginRegistry:t.context.registry.plugin}),Ua.incrementalDrawContributionFactory=()=>new Ay([],new ab,new rb(pv(Oy,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,ky))}function xb(t){var e;const i=vb();yb();const s=i.getAll(Wf),n=fb(t.registry.renderer,"vrender:runtime-renderer");mb(t.registry.renderer,"vrender:runtime-renderer",null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),gb(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,"vrender:runtime-renderer")}function Sb(t){var e;const i=vb();yb();const s=i.getAll(ky),n=null!==(e=db.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,ky,e)})),n.clear(),db.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(ky));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(ky,e),r.add(e)),n.add(e)}))}function Ab(t,e){var i;const s=vb();yb();const n=s.getAll(e),r=fb(t.registry.picker,"vrender:runtime-picker");mb(t.registry.picker,"vrender:runtime-picker",null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),gb(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,"vrender:runtime-picker")}function kb(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function Cb(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function Tb(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function Mb(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function Lb(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=ng(t.attribute),n=Fb(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=Fb(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=Fb(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;n{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return Xb(l,e,h),h},Vb=(t,e)=>{const i=t.attribute,s=i.points;if(s)return Nb(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return Nb(t,e)}return[]};const Wb=t=>t.map((t=>({x:t.x,y:t.y}))),Gb=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},Yb=t=>{const e=new Ue;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return Gb(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return Gb(t,{x:e.x1,y:n},{x:e.x2,y:n})},Xb=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=Yb(t);Xb(n[0],s,i),Xb(n[1],e-s,i)}},Kb=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:Wb(i)}];const s=[];return Xb(i,e,s),s},$b=(t,e)=>{const i=Ib(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;rObject.assign({},t))):[]}function Zb(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:qb(t.touches),configurable:!0},changedTouches:{value:qb(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function Jb(t,e){try{return t[e]}catch(t){return}}function Qb(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Zb(t),l=Jb(t,"target"),h=Jb(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var tx=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function sx(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class nx{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:ix(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},ex(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},ex(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=tx(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=ix(i,this.selectionStartCursorIdx),a=ix(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=ex(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=sx(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),Ua.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),Ua.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class rx{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=ix(i,Math.ceil(t)),n=ix(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=ix(i.attribute.textConfig,a),h=ix(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(ax,[this.formatTextCommandCb]),this.commandCbs.set(ox,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):g(t)&&e.forEach((e=>H(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new nx,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),Ua.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(Ua.global.isMacOS()&&t.metaKey&&"c"===t.key||!Ua.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return Ua.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(Ua.global.isMacOS()&&t.metaKey&&"a"===t.key||!Ua.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},ex(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=Hg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:Sf(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||og({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},ex(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),Ua.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=sf({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,lx.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=sg({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=sf({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=Sf(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=Sf(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(og({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(og({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(og({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=Sf(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=Sf(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:Sf(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Mx=new Tx;function Ex(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Bx=new WeakSet;function Px({bind:t}){Ex(Bx,t)||(t(c_).toDynamicValue((({container:t})=>new c_(pv(Ry,t)))).inSingletonScope(),t(jf).toService(c_),t(Wf).toService(jf),t(Ry).toService(Lm),gv(t,Ry))}const Rx=Px,Ox=new WeakSet;function Ix({bind:t}){Ex(Ox,t)||(t(T_).toDynamicValue((({container:t})=>new T_(pv(Hy,t)))).inSingletonScope(),t($f).toService(T_),t(Wf).toService($f),t(ny).toSelf(),t(sy).toSelf(),t(Hy).toService(ny),t(Hy).toService(sy),t(Hy).toService(Lm),gv(t,Hy))}const Lx=Ix,Dx=new WeakSet;function Fx({bind:t}){Ex(Dx,t)||(t(v_).toDynamicValue((()=>new v_)).inSingletonScope(),t(Yf).toService(v_),t(Wf).toService(Yf))}const zx=Fx,Hx=new WeakSet;function jx({bind:t}){Ex(Hx,t)||(t(S_).toDynamicValue((({container:t})=>new S_(pv(Oy,t)))).inSingletonScope(),t(Uf).toService(S_),t(Wf).toService(Uf),t(Oy).toService(Lm),gv(t,Oy))}const Nx=jx,Ux=new WeakSet;function Vx({bind:t}){Ex(Ux,t)||(t(M_).toDynamicValue((({container:t})=>new M_(pv(jy,t)))).inSingletonScope(),t(Zf).toService(M_),t(Wf).toService(Zf),t(jy).toService(Lm),gv(t,jy))}const Wx=Vx,Gx=new WeakSet;function Yx({bind:t}){Ex(Gx,t)||(t(d_).toDynamicValue((({container:t})=>new d_(pv(Iy,t)))).inSingletonScope(),t(Vf).toService(d_),t(Wf).toService(Vf),t(Iy).toService(Lm),gv(t,Iy))}const Xx=Yx,Kx=new WeakSet;function $x({bind:t}){Ex(Kx,t)||(t(Jf).toDynamicValue((({container:t})=>new E_(pv(Ny,t)))).inSingletonScope(),t(Wf).toService(Jf),t(Ny).toService(Lm),gv(t,Ny))}const qx=$x,Zx=new WeakSet;function Jx({bind:t}){Ex(Zx,t)||(t(C_).toDynamicValue((({container:t})=>new C_(pv(Fy,t)))).inSingletonScope(),t(Xf).toService(C_),t(Wf).toService(Xf),t(Fy).toService(Lm),gv(t,Fy))}const Qx=Jx,tS=new WeakSet;function eS({bind:t}){Ex(tS,t)||(t(Kf).toDynamicValue((({container:t})=>new L_(pv(zy,t)))).inSingletonScope(),t(Wf).toService(Kf),t(zy).toService(Lm),gv(t,zy))}const iS=eS;class sS extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[yy,vy],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const nS=new WeakSet;function rS({bind:t}){Ex(nS,t)||(t(sS).toDynamicValue((({container:t})=>new sS(pv(Uy,t)))).inSingletonScope(),t(rm).toService(sS),t(Wf).toService(rm),gv(t,Uy))}const aS=rS;class oS{constructor(){this.numberType=rd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Dp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const lS=new WeakSet;function hS({bind:t}){Ex(lS,t)||(t(oS).toDynamicValue((()=>new oS)).inSingletonScope(),t(em).toService(oS),t(Wf).toService(em))}const cS=hS;class dS extends h_{constructor(){super(),this.numberType=gd,this.builtinContributions=[w_],this.init()}drawShape(t,e,i,s,n){const r=Dp(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Lv(o,l,!0),d=Lv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Dp(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,y)):(e.beginPath(),Rv(e,i-t,s-n,v,y,f,!0)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,s,o,l))}draw(t,e,i){const s=Dp(t).richtext;this._draw(t,s,!1,i)}}const uS=new WeakSet;function pS({bind:t}){Ex(uS,t)||(t(dS).toDynamicValue((()=>new dS)).inSingletonScope(),t(Qf).toService(dS),t(Wf).toService(Qf))}const gS=pS,fS=new WeakSet;function mS({bind:t}){Ex(fS,t)||(t(im).toDynamicValue((({container:t})=>new V_(pv(Dy,t)))).inSingletonScope(),t(Wf).toService(im),t(Dy).toService(Lm),gv(t,Dy))}const vS=mS;class yS extends h_{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Pu.Get(r,Bu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[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+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class _S extends yS{constructor(){super(...arguments),this.type="rect3d",this.numberType=pd}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=Dp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,T=Dv(v,y,A,k,d),M=zv(v,b,A,k,S),w=Ov(d),E=Iv(u,_);if(!t.valid||!x)return;if(!w&&!E)return;if(!(T||M||a||o))return;const{light:B}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,B,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=Dp(t).rect;this._draw(t,s,!1,i)}}const bS=new WeakSet;function xS({bind:t}){Ex(bS,t)||(t(_S).toDynamicValue((()=>new _S)).inSingletonScope(),t(qf).toService(_S),t(Wf).toService(qf))}const SS=xS;class AS extends h_{constructor(){super(...arguments),this.numberType=id}drawShape(t,e,i,s,n,r,a,o){var l;const h=Dp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Pu.Get(c,Bu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},T={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Ut-zt)e.moveTo(i+r*Gt(o),s+r*Kt(o),n),e.arc(i,s,r,o,l,!c,n),a>zt&&(e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Gt(p),y=r*Kt(p),_=a*Gt(f),b=a*Kt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>zt)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Ut,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=zt)e.moveTo(i,s,n);else if(c>=Ut-zt)e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Gt(h),s+a*Kt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Gt(c),f=a*Kt(c),m=a*Gt(p),v=a*Kt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const kS=new WeakSet;function CS({bind:t}){Ex(kS,t)||(t(AS).toDynamicValue((()=>new AS)).inSingletonScope(),t(Nf).toService(AS),t(Wf).toService(Nf))}const TS=CS;class MS extends yS{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=dd}drawShape(t,e,i,s,n,r,a,o){var l;const h=Dp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=Dp(t).polygon;this._draw(t,s,!1,i)}}const wS=new WeakSet;function ES({bind:t}){Ex(wS,t)||(t(MS).toDynamicValue((()=>new MS)).inSingletonScope(),t(tm).toService(MS),t(Wf).toService(tm))}const BS=ES;function PS(){gf("arc",Kg)}function RS(){gf("arc3d",Qg)}function OS(){gf("area",Gg)}function IS(){gf("circle",Np)}function LS(){gf("glyph",ug)}function DS(){gf("group",sf)}function FS(){gf("image",Rg)}function zS(){gf("line",sg)}function HS(){gf("path",Ug)}function jS(){gf("polygon",af)}function NS(){gf("star",Zg)}function US(){gf("pyramid3d",lf)}function VS(){gf("rect",og)}function WS(){gf("rect3d",cg)}function GS(){gf("richtext",Hg)}function YS(){gf("symbol",tg)}function XS(){gf("text",Kp)}function KS(){gf("shadowRoot",cf)}function $S(){gf("wrapText",Zp)}class qS{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?Ua.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Ua.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Wp("text"===t.type&&t.attribute?t.attribute:Dp(t).text)}getTransformOfText(t){const e=Dp(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let p=n.anchorType;if(u(p)&&(p="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===p&&(p="top-left"),"position"===p||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=ze(c,p);l=t.x,h=t.y}const f=Ua.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),v=e.viewBox,_=l+m.left-f.left+v.x1,b=h+m.top-f.top+v.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===p&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:b,left:_,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else g(n.style)?o=Object.assign(Object.assign({},o),n.style):y(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));Ua.global.updateDom(i,{width:n.width,height:n.height,style:o})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===Ua.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Gl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Gl.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&Ua.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===Ua.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const ZS=()=>{lv.registerPlugin("HtmlAttributePlugin",qS)};class JS extends qS{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?Ua.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&Ua.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const QS=()=>{lv.registerPlugin("ReactAttributePlugin",JS)};class tA{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/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,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}const eA=()=>{lv.registerPlugin("ViewTransform3dPlugin",tA)},iA=new Ve;class sA{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=ja.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Dp(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},f=g.main,m=g.cross;"column"!==r&&"column-reverse"!==r||(f.len=d,m.len=c,f.field="y",m.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,y=0;const _=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===f.field?e.width():e.height(),s="x"===m.field?e.width():e.height();_.push({mainLen:i,crossLen:s}),v+=i,y=Math.max(y,s)}));const b=[];if(v>f.len&&"wrap"===a){let t=0,e=0;_.forEach((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),b.push({idx:_.length-1,mainLen:t,crossLen:e})}else b.push({idx:_.length-1,mainLen:v,crossLen:y});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,f,_,x,t),x=t.idx+1})),y=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":m.len,center:m.len/2};this.layoutCross(p,o,m,t,_,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(m.len-y)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",m,s,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(m.len-y)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(m.len-y)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&iA.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(iA.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const nA=()=>{lv.registerPlugin("FlexLayoutPlugin",sA)};var rA=Object.freeze({__proto__:null,ARC3D_NUMBER_TYPE:id,ARC_NUMBER_TYPE:ed,AREA_NUMBER_TYPE:sd,AbstractGraphicRender:class{},get AnimateMode(){return Pl},get AnimateStatus(){return Il},get AnimateStepType(){return Ol},AppContext:tb,Application:Na,Arc:Xg,Arc3d:Jg,Arc3dRender:Nf,ArcRender:jf,ArcRenderContribution:Ry,Area:Wg,AreaRender:Uf,AreaRenderContribution:Oy,get AttributeUpdateType(){return Ao},AutoEnablePlugins:Pf,BaseCanvas:Eu,BaseEnvContribution:G_,BaseRender:h_,get BaseRenderContributionTime(){return To},BaseWindowHandlerContribution:Y_,Basis:Qo,BeforeRenderConstribution:Bf,BoundsContext:lo,BoundsPicker:Lf,BrowserEntry:eb,CIRCLE_NUMBER_TYPE:nd,Canvas3DDrawItemInterceptor:Py,Canvas3DPickItemInterceptor:Tv,CanvasFactory:Cd,CanvasTextLayout:Gp,Circle:jp,CircleRender:Vf,CircleRenderContribution:Iy,ColorInterpolate:Wu,ColorStore:Pu,get ColorType(){return Bu},CommonDrawItemInterceptorContribution:Ey,CommonRenderContribution:Vy,Context2dFactory:Td,ContributionProvider:dv,ContributionRegistry:Ym,ContributionStore:mv,CubicBezierCurve:Uo,CurveContext:Cl,get CurveTypeEnum(){return Co},CustomEvent:to,CustomPath2D:Ml,CustomSymbolClass:wc,DEFAULT_TEXT_FONT_FAMILY:fg,DebugDrawItemInterceptorContribution:wy,DefaultArcAllocate:ux,DefaultArcAttribute:Yl,DefaultArcRenderContribution:Yv,DefaultAreaAllocate:gx,DefaultAreaAttribute:Xl,DefaultAreaTextureRenderContribution:_y,DefaultAttribute:Gl,DefaultBaseBackgroundRenderContribution:Am,DefaultBaseClipRenderAfterContribution:zm,DefaultBaseClipRenderBeforeContribution:Dm,DefaultBaseInteractiveRenderContribution:Lm,DefaultBaseTextureRenderContribution:Wv,DefaultCanvasAllocate:cm,DefaultCanvasArcRender:c_,DefaultCanvasAreaRender:S_,DefaultCanvasCircleRender:d_,DefaultCanvasGroupRender:by,DefaultCanvasImageRender:V_,DefaultCanvasLineRender:v_,DefaultCanvasPathRender:C_,DefaultCanvasPolygonRender:L_,DefaultCanvasRectRender:T_,DefaultCanvasSymbolRender:M_,DefaultCanvasTextRender:E_,DefaultCircleAllocate:mx,DefaultCircleAttribute:Kl,DefaultCircleRenderContribution:qv,DefaultConnectAttribute:Vl,DefaultDebugAttribute:Wl,DefaultFillStyle:Fl,DefaultGlobal:Xa,DefaultGlobalPickerService:mm,DefaultGlyphAttribute:ql,DefaultGraphicAllocate:hx,DefaultGraphicMemoryManager:Tx,DefaultGraphicService:yf,DefaultGraphicUtil:um,DefaultGroupAttribute:$l,DefaultGroupBackgroundRenderContribution:ty,DefaultImageAttribute:ah,DefaultImageRenderContribution:ly,DefaultLayerService:cv,DefaultLayout:Ll,DefaultLineAllocate:yx,DefaultLineAttribute:Zl,DefaultMat4Allocate:Su,DefaultMatrixAllocate:xu,DefaultPathAllocate:bx,DefaultPathAttribute:Jl,DefaultPickService:Q_,DefaultPickStyle:Nl,DefaultPolygonAttribute:Ql,DefaultRect3dAttribute:ih,DefaultRectAllocate:cx,DefaultRectAttribute:eh,DefaultRectRenderContribution:iy,DefaultRenderService:Um,DefaultRichTextAttribute:rh,DefaultRichTextIconAttribute:oh,DefaultStarAttribute:th,DefaultStrokeStyle:Hl,DefaultStyle:Ul,DefaultSymbolAllocate:Sx,DefaultSymbolAttribute:sh,DefaultSymbolClipRangeStrokeRenderContribution:uy,DefaultSymbolRenderContribution:dy,DefaultTextAllocate:kx,DefaultTextAttribute:nh,DefaultTextMeasureContribution:_v,DefaultTextStyle:jl,DefaultTransform:Dl,DefaultTransformUtil:fm,DefaultWindow:hm,get Direction(){return ko},DirectionalLight:X_,DrawContribution:nm,DrawItemInterceptor:ky,DynamicLayerHandlerContribution:Mf,get Edge(){return ch},EditModule:nx,EmptyContext2d:Mu,EnvContribution:pg,EventManager:so,EventSystem:ao,EventTarget:no,FORMAT_ALL_TEXT_COMMAND:ox,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:ax,Factory:lv,FederatedEvent:qa,FederatedMouseEvent:Za,FederatedPointerEvent:Ja,FederatedWheelEvent:Qa,FlexLayoutPlugin:sA,GLYPH_NUMBER_TYPE:rd,GRAPHIC_UPDATE_TAG_KEY:gp,GROUP_NUMBER_TYPE:ad,Generator:ja,GlobalPickerService:Df,Glyph:dg,GlyphRender:em,GradientParser:nu,Graphic:Mp,GraphicCreator:_d,GraphicFactory:df,GraphicPicker:Of,GraphicRender:Wf,GraphicService:yd,GraphicUtil:kf,Group:ef,GroupRender:Gf,GroupRenderContribution:Ly,get GroupUpdateAABBBoundsMode(){return tf},HtmlAttributePlugin:qS,get IContainPointMode(){return So},IMAGE_NUMBER_TYPE:od,Image:Pg,ImageRender:im,ImageRenderContribution:Dy,IncrementalDrawContribution:Hf,InteractiveDrawItemInterceptorContribution:By,InteractivePickItemInterceptorContribution:Cv,InteractiveSubRenderContribution:Wy,LINE_NUMBER_TYPE:ld,Layer:av,LayerFactory:ov,LayerService:Cf,Line:ig,LineRender:Yf,Linear:$o,LinearClosed:vl,Mat4Allocate:_u,MatrixAllocate:yu,get MeasureModeEnum(){return Bl},MiniappEntry:nb,MonotoneX:al,MonotoneY:ol,NOWORK_ANIMATE_ATTR:Tp,Node:$a,NodeEntry:sb,OrthoCamera:$_,PATH_NUMBER_TYPE:hd,POLYGON_NUMBER_TYPE:cd,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:dd,Path:Ng,PathRender:Xf,PathRenderContribution:Fy,PerformanceRAF:Wa,PickItemInterceptor:Ff,PickServiceInterceptor:zf,PickerRegistry:Wm,PickerService:If,PluginRegistry:Gm,PluginService:Rf,Polygon:rf,PolygonRender:Kf,PolygonRenderContribution:zy,Pyramid3d:of,Pyramid3dRender:tm,RECT3D_NUMBER_TYPE:pd,RECT_NUMBER_TYPE:ud,RICHTEXT_NUMBER_TYPE:gd,RafBasedSTO:Sh,ReactAttributePlugin:JS,Rect:ag,Rect3DRender:qf,Rect3d:hg,RectRender:$f,RectRenderContribution:Hy,ReflectSegContext:Yo,RenderSelector:sm,RenderService:Ef,RendererRegistry:Vm,ResourceLoader:lh,RichText:zg,RichTextEditPlugin:lx,RichTextRender:Qf,STAR_NUMBER_TYPE:fd,get STATUS(){return Rl},SVG_ATTRIBUTE_MAP:bd,SVG_ATTRIBUTE_MAP_KEYS:xd,SVG_PARSE_ATTRIBUTE_MAP:Sd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Ad,SYMBOL_NUMBER_TYPE:md,SegContext:Go,ShadowPickServiceInterceptorContribution:Av,ShadowRoot:hf,ShadowRootDrawItemInterceptorContribution:My,ShadowRootPickItemInterceptorContribution:kv,SplitRectAfterRenderContribution:ny,SplitRectBeforeRenderContribution:sy,Stage:nv,StageFactory:rv,Star:qg,StarRender:rm,StarRenderContribution:Uy,StateDefinitionCompiler:qu,StateEngine:tp,StaticLayerHandlerContribution:Tf,Step:ul,StepClosed:pl,Symbol:Qp,SymbolRender:Zf,SymbolRenderContribution:jy,TEXT_NUMBER_TYPE:vd,Text:Xp,get TextDirection(){return $c},TextMeasureContribution:yv,TextRender:Jf,TextRenderContribution:Ny,Theme:Ip,TransformUtil:Af,get UpdateTag(){return xo},VGlobal:gg,VWindow:am,ViewTransform3dPlugin:tA,VirtualLayerHandlerContribution:wf,WILDCARD:"*",WindowHandlerContribution:om,WrapText:qp,XMLParser:Vc,_calculateLineHeight:kh,_interpolateColor:Iu,addArcToBezierPath:Bo,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:Ob,alignSubpath:Mb,application:Ua,applyTransformOnBezierCurves:Lb,arc3dModule:TS,arcModule:Rx,areaModule:Nx,bezier:wo,bezierCurversToPath:Db,binarySplitPolygon:Yb,bindArc3dRenderModule:CS,bindArcRenderModule:Px,bindAreaRenderModule:jx,bindCircleRenderModule:Yx,bindContributionProvider:gv,bindContributionProviderNoSingletonScope:fv,bindGlyphRenderModule:hS,bindImageRenderModule:mS,bindLineRenderModule:Fx,bindPathRenderModule:Jx,bindPolygonRenderModule:eS,bindPyramid3dRenderModule:ES,bindRect3dRenderModule:xS,bindRectRenderModule:Ix,bindRichtextRenderModule:pS,bindStarRenderModule:rS,bindSymbolRenderModule:Vx,bindTextRenderModule:$x,boundStroke:Yc,builtInSymbolStrMap:Pc,builtinSymbols:Ec,builtinSymbolsMap:Bc,calcLineCache:Tl,calculateArcCornerRadius:Nv,calculateLineHeight:Ch,canvasAllocate:dm,centroidOfSubpath:Bb,circleBounds:vh,circleModule:Xx,clock:eo,colorEqual:function(t,e){const i=si.parseColorString(t),s=si.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:Uu,configureRuntimeApplicationForApp:bb,container:i_,cornerTangents:jv,createApp:ib,createArc:Kg,createArc3d:Qg,createArea:Gg,createBrowserApp:ib,createCanvasEventTransformer:function(t,e,i,s){return Qb(t.parentElement,e,i,s)},createCircle:Np,createColor:au,createConicalGradient:Xu,createContributionProvider:pv,createEventTransformer:Qb,createGlyph:ug,createGraphic:ff,createGroup:sf,createImage:Rg,createLine:sg,createMat4:bu,createMiniappApp:function(t={}){return new nb(t)},createNodeApp:function(t={}){return new sb(t)},createPath:Ug,createPolygon:af,createPyramid3d:lf,createRect:og,createRect3d:cg,createRectPath:Rv,createRichText:Hg,createShadowRoot:cf,createStage:function(t){return o_(),(new rv).create(t)},createStar:Zg,createSymbol:tg,createText:Kp,createWrapText:Zp,cubicCalc:Do,cubicLength:Lo,cubicPointAt:Fo,cubicSubdivide:Tb,defaultArcAllocate:px,defaultArcBackgroundRenderContribution:$v,defaultArcRenderContribution:Xv,defaultArcTextureRenderContribution:Kv,defaultAreaAllocate:fx,defaultBaseBackgroundRenderContribution:km,defaultBaseClipRenderAfterContribution:Hm,defaultBaseClipRenderBeforeContribution:Fm,defaultBaseTextureRenderContribution:Gv,defaultCircleAllocate:vx,defaultCircleBackgroundRenderContribution:Qv,defaultCircleRenderContribution:Zv,defaultCircleTextureRenderContribution:Jv,defaultGraphicMemoryManager:Mx,defaultGroupBackgroundRenderContribution:ey,defaultImageBackgroundRenderContribution:cy,defaultImageRenderContribution:hy,defaultLineAllocate:_x,defaultPathAllocate:xx,defaultRectAllocate:dx,defaultRectBackgroundRenderContribution:oy,defaultRectRenderContribution:ry,defaultRectTextureRenderContribution:ay,defaultStarBackgroundRenderContribution:yy,defaultStarTextureRenderContribution:vy,defaultSymbolAllocate:Ax,defaultSymbolBackgroundRenderContribution:my,defaultSymbolClipRangeStrokeRenderContribution:gy,defaultSymbolRenderContribution:py,defaultSymbolTextureRenderContribution:fy,defaultTextAllocate:Cx,diff:Cb,divideCubic:No,drawArc:Eo,drawArcPath:Uv,drawAreaSegments:y_,drawBackgroundImage:Im,drawImageWithLayout:U_,drawIncrementalAreaSegments:m_,drawIncrementalSegments:f_,drawSegments:g_,enumCommandMap:po,fillVisible:Lv,findBestMorphingRotation:Rb,findConfigIndexByCursorIdx:ix,findCursorIdxByConfigIndex:sx,findNextGraphic:xm,flatten_simplify:kb,foreach:_m,foreachAsync:bm,genBasisSegments:el,genBasisTypeSegments:tl,genLinearClosedSegments:yl,genLinearClosedTypeSegments:_l,genLinearSegments:qo,genLinearTypeSegments:Zo,genMonotoneXSegments:hl,genMonotoneXTypeSegments:ll,genMonotoneYSegments:dl,genMonotoneYTypeSegments:cl,genNumberType:Kc,genStepClosedSegments:ml,genStepSegments:gl,genStepTypeSegments:fl,getAttributeFromDefaultAttrList:xh,getBackgroundImage:Tm,getConicGradientAt:Yu,getCurrentEnv:function(){return iv()?"browser":"node"},getDefaultCharacterConfig:ex,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Up(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=ku.allocate();return du(o,o,[a[0],a[1],0]),n&&lu(o,o,n),s&&hu(o,o,s),du(o,o,[-a[0],-a[1],0]),o},getLegacyBindingContext:Zy,getModelMatrix:mf,getRichTextBounds:Sf,getRuntimeInstallerBindingContext:vb,getRuntimeInstallerGlobal:_b,getScaledStroke:ru,getTextBounds:xf,getTheme:Dp,getThemeFromGroup:Fp,globalTheme:Lp,glyphModule:cS,graphicCreator:pf,graphicService:r_,graphicUtil:s_,identityMat4:ou,imageModule:vS,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeDrawContributionsToApp:Sb,installRuntimeGraphicRenderersToApp:xb,installRuntimePickersToApp:Ab,interpolateColor:Ou,interpolateGradientConicalColor:Fu,interpolateGradientLinearColor:Lu,interpolateGradientRadialColor:Du,interpolatePureColorArray:zu,interpolatePureColorArrayToStr:Hu,intersect:Hv,isBrowserEnv:iv,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){ev();const t=Ua.global&&Ua.global.env;return t?"node"===t:!tv},isSvg:Nc,isXML:Uc,layerService:a_,lineModule:zx,lookAt:fu,mapToCanvasPointForCanvas:function(t){var e;if(Od(t._canvasX)&&Od(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:uu,mat4Allocate:ku,matrixAllocate:Au,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i.c,b=i.d,x=0,S=0,t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=0,b=0,x=1,S=0,t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i.e,b=i.f,x=0,S=1,t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t},multiplyMat4Mat4:gu,newThemeObj:Pp,ortho:mu,parsePadding:gh,parseStroke:uh,parseSvgPath:bo,pathModule:Qx,pathToBezierCurves:Ib,point:Jo,pointEqual:yh,pointInterpolation:_h,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Jt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Jt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>yh(t,e[i]))):!Number.isNaN(t.x+t.y)&&yh(t,e))},pointsInterpolation:bh,polygonModule:iS,preLoadAllModule:qy,pyramid3dModule:BS,quadCalc:zo,quadLength:jo,quadPointAt:Ho,rafBasedSto:Ah,rect3dModule:SS,rectFillVisible:Dv,rectModule:Lx,rectStrokeVisible:zv,recursiveCallBinarySplit:Xb,refreshRuntimeInstallerContributions:yb,registerArc3dGraphic:RS,registerArcGraphic:PS,registerAreaGraphic:OS,registerCircleGraphic:IS,registerDirectionalLight:K_,registerFlexLayoutPlugin:nA,registerGlobalEventTransformer:function(t,e,i,s,n){const r=Qb(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:LS,registerGraphic:gf,registerGroupGraphic:DS,registerHtmlAttributePlugin:ZS,registerImageGraphic:FS,registerLineGraphic:zS,registerOrthoCamera:q_,registerPathGraphic:HS,registerPolygonGraphic:jS,registerPyramid3dGraphic:US,registerReactAttributePlugin:QS,registerRect3dGraphic:WS,registerRectGraphic:VS,registerRichtextGraphic:GS,registerShadowRootGraphic:KS,registerStarGraphic:NS,registerSymbolGraphic:YS,registerTextGraphic:XS,registerViewTransform3dPlugin:eA,registerWindowEventTransformer:function(t,e,i,s,n){const r=Qb(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:$S,renderCommandList:Ro,resolveBackgroundDrawMode:Em,resolveBackgroundParamsByImageSizing:j_,resolveBackgroundPosition:Pm,resolveBackgroundSizing:Mm,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:z_,resolveImageRepeatMode:F_,resolveRenderableImageSize:Om,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:gS,rotateX:lu,rotateY:hu,rotateZ:cu,runFill:Ov,runStroke:Iv,scaleMat4:pu,segments:Mo,shouldClipImageByLayout:N_,shouldUseMat4:vf,snapLength:Io,splitArc:Hb,splitArea:Ub,splitCircle:jb,splitLine:Vb,splitPath:$b,splitPolygon:Kb,splitRect:zb,splitToGrids:Fb,starModule:aS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Fv,symbolModule:Wx,textAttributesToStyle:Wp,textDrawOffsetX:Up,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Vp,textModule:qx,transformMat4:vu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:n_,translate:du,verticalLayout:qc,vglobal:e_,waitForAllSubLayers:Gc,wrapCanvas:Md,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=Ua.global)||void 0===t?void 0:t.env,s=i?null===(e=Ua.context2dFactory)||void 0===e?void 0:e.call(Ua,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=_(t)?t[0]:t,i=[];if(!e)return i;if(!0===Uc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};td(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};td(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});function aA(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),hA=(t,e)=>(d(dA.warnHandler)&&dA.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),cA=(t,e,i)=>{if(!d(dA.errorHandler))throw new Error(t);dA.errorHandler.call(null,t,e)},dA={silent:!1,warnHandler:!1,errorHandler:!1},uA=iv(),pA=uA&&globalThis?globalThis.document:void 0;function gA(t){return("desktop-browser"===t||"mobile-browser"===t)&&uA}function fA(t){return mA(t)||"mobile-browser"===t}function mA(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let vA=0;function yA(){return vA>=9999999&&(vA=0),vA++}function _A(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function bA(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}function xA(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&xA(t,e)}))}const SA=t=>!u(t)&&!1!==t.visible;function AA(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function kA(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const TA=["#ffffff","#000000"];function MA(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new si(t).toHex(),o=new si(e).toHex();return wA(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...TA);for(const n of a)if(t!==n&&wA(n,e,i,s,r))return n}(a,o,i,s,n,r)}function wA(t,e,i,s,n){if("lightness"===n){const i=si.getColorBrightness(new si(e));return si.getColorBrightness(new si(t))<.5?i>=.5:i<.5}return s?EA(t,e)>s:"largeText"===i?EA(t,e)>3:EA(t,e)>4.5}function EA(t,e){const i=BA(t),s=BA(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function BA(t){const e=ri(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function PA(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function RA(t,e){return[t[0]*e,t[1]*e]}function OA(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function IA(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const LA=ff,DA={arc:t=>LA("arc",t),circle:t=>LA("circle",t),group:t=>LA("group",t),image:t=>LA("image",t),line:t=>LA("line",t),path:t=>LA("path",t),polygon:t=>LA("polygon",t),rect:t=>LA("rect",t),richtext:t=>LA("richtext",t),symbol:t=>LA("symbol",t),text:t=>LA("text",t)},FA=-.5*Math.PI,zA=1.5*Math.PI,HA="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var jA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(jA||(jA={}));const NA={[jA.selectedReverse]:{},[jA.selected]:{},[jA.hover]:{},[jA.hoverReverse]:{}},UA={container:"",width:30,height:30,style:{}},VA="scrollDrag",WA=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:HA,fontSize:14},s),getTextBounds:i?void 0:xf,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function GA(t,e,i={}){if(!t)return{width:0,height:0};const s=xf({text:t,fontFamily:e.fontFamily||i.fontFamily||HA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function YA(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function XA(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function KA(t,e="type"){const i=YA(t,e);return"rich"===i?DA.richtext(XA(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),DA.text(t))}function $A(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const qA=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function ZA(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function JA(t,e){const{dx:i,dy:s}=ZA(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const QA={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},tk={size:8,stroke:"#000",lineWidth:1,zIndex:1};const ek=Math.sin(Math.PI/10);function ik(t,e=ek){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function sk(t,e=ek){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function nk(t){const e={};return xA(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function rk(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function ak(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return RA(r,(s?-1:1)*(n?-1:1)*t/OA(r))}function ok(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function hk(t,e,i){var s;if(sk(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>He(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>He(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function ck(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function pk(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function gk(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function fk(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function mk(t,e){const i=fk(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function vk(t,e){const i=yk(t),s=yk(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function yk(t,e={x:0,y:0}){return ae.distancePP(t,e)}function _k(t){return k(t.x)&&k(t.y)}function bk(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function xk(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const Sk=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function kk(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&kk(t[i],e)}}var Ck;!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"}(Ck||(Ck={}));const Tk={};function Mk(t){switch(t){case Ck.Linear:case Ck.Log:case Ck.Pow:case Ck.Sqrt:case Ck.Symlog:case Ck.Time:return!0;default:return!1}}function wk(t){return!!Tk[t]}function Ek(t){switch(t){case Ck.Ordinal:case Ck.Point:case Ck.Band:return!0;default:return!1}}function Bk(t){return t}Object.values(Ck).forEach((t=>{Tk[t]=!0}));const Pk=t=>-Math.log(-t),Rk=t=>-Math.exp(-t),Ok=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Ik=t=>10===t?Ok:t===Math.E?Math.exp:e=>Math.pow(t,e),Lk=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Dk=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Fk=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function zk(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 Hk(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function jk(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Nk(t,e,i,s){return 1===i&&(i=0),jk(t,i,s)*(e/(1-i))}function Uk(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Vk(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class Gk{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=Uk(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=yt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Yk=Symbol("implicit");class Xk extends Gk{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=Ck.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Yk}clone(){const t=(new Xk).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==Yk)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return Kk(t,e,r,n)}class qk extends Xk{constructor(t){super(),this.type=Ck.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=Nk(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:$k(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return $k(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new qk(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:Zk}=ai;function Jk(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=si.parseColorString(e)){const e=Zk(si.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof ni?Zk(t,e):e instanceof si?Zk(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class Qk extends Gk{constructor(t=Bk,e=Bk){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Bk,this._piecewise=Hk,this._interpolate=Jk}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Ct,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=bt(i[0],i[r-1])),this._piecewise=r>2?Vk:Hk,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Bk),this.rescale(i)):this._clamp!==Bk}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const tC=Math.sqrt(50),eC=Math.sqrt(10),iC=Math.sqrt(2),sC=[1,2,5,10],nC=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=lC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?aC(0,-(e-1)/s,s):aC((e-1)/s,0,s)},rC=vt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return nC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return nC(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=aC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=aC(t,e,l);return n&&r.reverse(),r})),lC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=sC[0];return i>=tC?s=sC[3]:i>=eC?s=sC[2]:i>=iC&&(s=sC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function hC(t,e,i){const s=(e-t)/Math.max(0,i);return lC(s)}function cC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=hC(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function uC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const pC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),gC=vt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),fC=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=oC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?pC(t,e,n):pC(t,e,Wk(n)),h=pC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),mC=vt(((t,e,i,s,n)=>cC(s(t),s(e),i).map((t=>Wk(n(t))))));class vC extends Qk{constructor(){super(...arguments),this.type=Ck.Linear}clone(){var t;const e=new vC;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return rC(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=oC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return cC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function _C(t){return e=>-t(-e)}function bC(t=Number.EPSILON){return e=>Math.max(e,t)}class xC extends Qk{constructor(){super(Lk(10),Ik(10)),this.type=Ck.Log,this._limit=bC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new xC).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=Lk(this._base),s=Ik(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=_C(i),this._pows=_C(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Pk,this.untransformer=Rk):(this._logs=i,this._pows=s,this._limit=bC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Bk}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return gC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return fC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(xC,yC);class SC extends vC{constructor(){super(Dk(1),Fk(1)),this.type=Ck.Symlog,this._const=1}clone(){return(new SC).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=Dk(t),this.untransformer=Fk(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return gC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return fC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(SC,yC);class AC{constructor(){this.type=Ck.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[lt(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 AC).domain(this._domain).range(this._range).unknown(this._unknown)}}var kC,CC,TC;function MC(t){var e,i;const{type:s}=t;return s===CC.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(kC||(kC={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(CC||(CC={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(TC||(TC={}));const wC={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},EC={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function BC(t,e){var i;if(!t)return[];const s=FC(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?LC(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>IC(i)?RC(t,i,e):i)).filter(p)}))):i.map((i=>IC(i)?RC(t,i,e):i)).filter(p):[]}return[]}function PC(t,e){var i,s;return LC(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function RC(t,e,i){var s;const n=FC(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=wC[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=EC[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!y(r))return r;let o=new si(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ke(t,i,s),a=Xe(n,r,e.l),l=new si(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const OC=(t,e)=>{if(e&&IC(t)){const i=RC(e,t);if(i)return i}return t};function IC(t){return t&&"palette"===t.type&&!!t.key}function LC(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function DC(t){return _(t)?{dataScheme:t}:t}function FC(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=MC(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class zC extends Xk{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!LC(this._range))return void super.range(this._range);const t=PC(this._range,this._domain);super.range(t)}}const HC={linear:vC,band:qk,point:class extends qk{constructor(t){super(!1),this.type=Ck.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:Xk,threshold:AC,colorOrdinal:zC};function jC(t){const e=HC[t];return e?new e:null}function NC(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function UC(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function VC(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function WC(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function GC(t){return!!y(t)&&(!!t.endsWith("%")&&_A(t.substring(0,t.length-1)))}function YC(t){return!!g(t)&&("percent"in t||"offset"in t)}function XC(t,e,i,s=0){var n,r;return S(t)?t:GC(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function KC(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=XC(t[s],e.size,i)}))})),o}function $C(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function qC(t){let e={};return _(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||GC(t)||d(t)||YC(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function ZC(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const JC=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},QC=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function tT(t,e){return t&&e.key in t?t[e.key]:e.default}function eT(t){return t&&"token"===t.type&&!!t.key}const iT={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},sT={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:QC,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:iT,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},nT={name:"dark",colorScheme:{default:{dataScheme:QC,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},rT=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),rT(t[s],e.slice(1),i))};function aT(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=DC(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}oT._charts={},oT._series={},oT._components={},oT._graphicComponents={},oT._marks={},oT._regions={},oT._animations={},oT._implements={},oT._chartPlugin={},oT._vChartPlugin={},oT._componentPlugin={},oT.transforms={fields:$r,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},oT.dataParser={csv:(t,e={},i)=>(i.type=Kr.DSV,aa(t)),dsv:(t,e={},i)=>{i.type=Kr.DSV;const s=Vr(la,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return ra(n).parse(t)},tsv:(t,e={},i)=>(i.type=Kr.DSV,oa(t))},oT._layout={},oT._grammarTransforms={},oT._stageEventPlugins={},oT.registerStageEventPlugin=(t,e)=>{oT._stageEventPlugins[t]=e},oT.getStageEventPlugin=t=>oT._stageEventPlugins[t],oT._interactionTriggers={},oT.registerInteractionTrigger=(t,e)=>{oT._interactionTriggers[t]=e},oT._composedEventMap={},oT.registerComposedEvent=(t,e)=>{oT._composedEventMap[t]=e},oT._tooltipProcessors={},oT.registerTooltipProcessor=(t,e)=>{oT._tooltipProcessors[t]=e},oT.createTooltipProcessor=(t,e)=>{const i=oT._tooltipProcessors[t];return i?new i(e):null};const cT=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},dT=cT(),uT={[sT.name]:sT},pT=sT.name,gT=new Map(Object.keys(uT).map((t=>[t,uT[t]]))),fT=new Map,mT=new Map(Object.keys(uT).map((t=>[t,t===pT]))),vT=(t,e)=>{if(!t)return;const i=xT(e);gT.set(t,i),mT.set(t,!0)},yT=(t=pT)=>(mT.has(t)&&!mT.get(t)&&vT(t,gT.get(t)),gT.get(t)),_T=t=>gT.delete(t)&&fT.delete(t)&&mT.delete(t),bT=t=>!!y(t)&&gT.has(t),xT=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:pT;return lT({},yT(i),t)};class ST{static registerInstance(t){ST.instances.set(t.id,t)}static unregisterInstance(t){ST.instances.delete(t.id)}static getInstance(t){return ST.instances.get(t)}static instanceExist(t){return ST.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return ST.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}ST.instances=new Map;class AT{static registerTheme(t,e){vT(t,e)}static getTheme(t,e=!1){return yT(t)}static removeTheme(t){return _T(t)}static themeExist(t){return bT(t)}static getDefaultTheme(){return AT.themes.get(pT)}static setCurrentTheme(t){AT.themeExist(t)&&(AT._currentThemeName=t,ST.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return AT.getTheme(AT._currentThemeName,t)}static getCurrentThemeName(){return AT._currentThemeName}}function kT(t){return y(t)?AT.themeExist(t)?AT.getTheme(t):{}:g(t)?t:{}}AT.themes=gT,AT._currentThemeName=pT;const CT=["animationThreshold","colorScheme","name","padding"];function TT(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];CT.includes(n)?s[n]=r:m(r)?IC(r)?s[n]=OC(r,e):eT(r)?s[n]=tT(i,r):s[n]=TT(r,e,i):s[n]=r})),s}function MT(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=MT(t[s],e)}return i}return _(t)?t.map((t=>MT(t,e))):t}function wT(t,e){if(!t)return t;if(m(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(y(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=wT(t[s],e)}return i}return _(t)?t.map((t=>wT(t,e))):t}function ET(t,...e){return d(t)?t(...e):t}const BT=(t,e,i,s)=>((t,e,i)=>WA(t,e,i,{fontFamily:iT.fontFamily,fontSize:iT.fontSize}))(e,i,s).measure(t),PT="__VCHART",RT=500,OT=500,IT=`${PT}_MEASURE_CANVAS_ID`,LT=`${PT}_DEFAULT_DATA_INDEX`,DT=`${PT}_DEFAULT_DATA_KEY`,FT=`${PT}_DEFAULT_DATA_SERIES_FIELD`,zT=`${PT}_DEFAULT_SERIES_STYLE_NAME`,HT=`${PT}_STACK_KEY`,jT=`${PT}_STACK_START`,NT=`${PT}_STACK_END`,UT=`${PT}_STACK_START_PERCENT`,VT=`${PT}_STACK_END_PERCENT`,WT=`${PT}_STACK_START_OffsetSilhouette`,GT=`${PT}_STACK_END_OffsetSilhouette`,YT=`${PT}_STACK_TOTAL`,XT=`${PT}_STACK_TOTAL_PERCENT`,KT=`${PT}_STACK_TOTAL_TOP`,$T=`${PT}_STACK_TOTAL_BOTTOM`,qT=`${PT}_MOSAIC_VALUE_START_PERCENT`,ZT=`${PT}_MOSAIC_VALUE_END_PERCENT`,JT=`${PT}_MOSAIC_CAT_START_PERCENT`,QT=`${PT}_MOSAIC_CAT_END_PERCENT`,tM=`${PT}_SEGMENT_START`,eM=`${PT}_SEGMENT_END`,iM=`${PT}_KEY`,sM=`${PT}_MAP_LOOK_UP_KEY`;function nM(t,e){for(let i=0;it.key===e))}function aM(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function oM(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},uM(t,a,n[o],l,e,r))})),s?lM(n):n}function lM(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):lM(t[e].nodes);return t}function hM(t,e){if("values"in t&&t.values.length){const i=gk(t.values,e),s=pk(t.values,VT);t.values.forEach((t=>{t[YT]=i,t[XT]=s}))}else for(const i in t.nodes)hM(t.nodes[i],e)}function cM(t){if(!t.values.length)return;const e=t.values[t.values.length-1][NT]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)dM(t.nodes[r],e,i,s,n)}function uM(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[NT]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),uM(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const pM=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=fM(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function mM(t){return!d(t)&&!P(t)&&Object.keys(t).some((e=>d(t[e])))}function vM(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(d(t))return xM(t(r,i,s,n));if(mM(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{d(e[t])&&(e[t]=e[t](r,i,s,n))})),xM(e)}return xM(t)}function yM(t={}){const e=Object.assign({},t);if(d(t.style)||mM(t.style)?e.style=(e,i,s,n)=>vM(t.style,e,i,s,n):P(t.style)||(e.style=xM(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])||mM(t.state[e])?i[e]=(i,s,n,r)=>vM(t.state[e],i,s,n,r):P(t.state[e])||(i[e]=xM(t.state[e]))})),e.state=i}return e}function _M(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>xM(t[i](e,s,n,r)):P(t[i])||(e[i]=xM(t[i]))})),e}function bM(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),xM(i)}function xM(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const SM=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},AM=t=>"line"===t||"area"===t,kM=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return AM(i)?e:null==e?void 0:e[0]},CM=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let TM=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=oT.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(oT.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var MM;!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"}(MM||(MM={}));const wM=["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 EM,BM,PM;t.ChartEvent=void 0,(EM=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",EM.rendered="rendered",EM.renderFinished="renderFinished",EM.animationFinished="animationFinished",EM.regionSeriesDataFilterOver="regionSeriesDataFilterOver",EM.afterInitData="afterInitData",EM.afterInitEvent="afterInitEvent",EM.afterInitMark="afterInitMark",EM.rawDataUpdate="rawDataUpdate",EM.viewDataFilterOver="viewDataFilterOver",EM.viewDataUpdate="viewDataUpdate",EM.viewDataStatisticsUpdate="viewDataStatisticsUpdate",EM.markDeltaYUpdate="markDeltaYUpdate",EM.viewDataLabelUpdate="viewDataLabelUpdate",EM.scaleDomainUpdate="scaleDomainUpdate",EM.scaleRawDomainUpdate="scaleRawDomainUpdate",EM.scaleUpdate="scaleUpdate",EM.dataZoomChange="dataZoomChange",EM.drill="drill",EM.layoutStart="layoutStart",EM.layoutEnd="layoutEnd",EM.layoutRectUpdate="layoutRectUpdate",EM.playerPlay="playerPlay",EM.playerPause="playerPause",EM.playerEnd="playerEnd",EM.playerChange="playerChange",EM.playerForward="playerForward",EM.playerBackward="playerBackward",EM.scrollBarChange="scrollBarChange",EM.brushStart="brushStart",EM.brushChange="brushChange",EM.brushEnd="brushEnd",EM.brushClear="brushClear",EM.brushActive="brushActive",EM.legendSelectedDataChange="legendSelectedDataChange",EM.legendFilter="legendFilter",EM.legendItemClick="legendItemClick",EM.legendItemHover="legendItemHover",EM.legendItemUnHover="legendItemUnHover",EM.tooltipShow="tooltipShow",EM.tooltipHide="tooltipHide",EM.tooltipRelease="tooltipRelease",EM.afterResize="afterResize",EM.afterRender="afterRender",EM.afterLayout="afterLayout",EM.afterMarkLayoutEnd="afterMarkLayoutEnd",EM.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(BM||(BM={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(PM||(PM={}));const RM=[PM.mark,PM.model,PM.chart,PM.vchart];class OM{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(PM.vchart,[]),this._levelNodes.set(PM.chart,[]),this._levelNodes.set(PM.model,[]),this._levelNodes.set(PM.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const IM={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class LM{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>kM(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||BM.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||BM.chart);o.get(t)||o.set(t,new OM);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||BM.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||BM.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||BM.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||BM.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?RM.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[BM.chart,BM.window,BM.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return IM[a]&&(a=IM[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?PM.model:PM.vchart:PM.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=BM.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==PM.model&&s!==PM.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=PM.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case BM.chart:return this._viewBubbles;case BM.window:return this._windowBubbles;case BM.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case BM.chart:return this._viewListeners;case BM.window:return this._windowListeners;case BM.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return wM.includes(t)||Object.values(MM).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&oT.hasInteractionTrigger(e)}}function DM(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function FM(t,e,i){t.getParser(e)||t.registerParser(e,i)}const zM=new Map;let HM;function jM(){HM||(HM=new Ra,FM(HM,"geojson",Ta),FM(HM,"topojson",wa),DM(HM,"simplify",Xr))}function NM(t,e,i={type:"geojson",centroid:!0}){zM.has(t)&&hA(`map type of '${t}' already exists, will be overwritten.`),jM();const s=new Oa(HM),n=H({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),zM.set(t,s)}function UM(t){zM.has(t)?zM.delete(t):hA(`map type of '${t}' does not exists.`)}function VM(t,e=!1){let i=e;return t.latestData instanceof Oa&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const WM=(t,e)=>0===t.length?[]:1===t.length?VM(t[0],null==e?void 0:e.deep):t.map((t=>VM(t,null==e?void 0:e.deep)));function GM(e,i,s){DM(i=i instanceof Ra?i:e.dataSet,"copyDataView",WM);const n=new Oa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function YM(t,e,i=[]){var s;if(t instanceof Oa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Oa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return hA(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return hA(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),hA("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function XM(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var KM,$M,qM,ZM;t.TransformLevel=void 0,(KM=t.TransformLevel||(t.TransformLevel={}))[KM.copyDataView=-10]="copyDataView",KM[KM.treemapFilter=-8]="treemapFilter",KM[KM.treemapFlatten=-7]="treemapFlatten",KM[KM.dotObjFlat=-7]="dotObjFlat",KM[KM.linkDotInfo=-7]="linkDotInfo",KM[KM.sankeyLayout=-7]="sankeyLayout",KM[KM.dataZoomFilter=-6]="dataZoomFilter",KM[KM.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}($M||($M={})),function(t){t.data="data",t.mark="mark"}(qM||(qM={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(ZM||(ZM={}));const JM=["line","area","trail"];function QM(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(iM,i?t.slice().sort(i):t.slice()),{keys:[iM],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const tw=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function ew(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{ew(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function sw(t,e,i,s){const n=QM(t,(t=>i(t))),r=QM(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const nw=`${PT}_BuiltIn_CallBack_Disappear`;var rw;!function(t){t.render="render",t.disappear="disappear"}(rw||(rw={}));const aw=[0,0,0];class ow{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Fl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Hl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},jl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ge(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ge(1,0,0,1,0,0),this._clearMatrix=new Ge(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ge(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Au.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&&(Au.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Au.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Ut;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=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:jl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:jl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(vu(aw,[e,i,s],this.modelMatrix),e=aw[0],i=aw[1],s=aw[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=au(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:ru(this,a,this.dpr),r.strokeStyle=au(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Au.free(t))),this.stack.length=0}}ow.env="browser";class lw extends Eu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ua.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ow(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}}function hw(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,Cd,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Td,e.env));r||i.bind(Cd).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(Td).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}lw.env="browser";const cw=hw(lw,ow);class dw extends ow{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}dw.env="feishu";class uw extends Eu{constructor(t){super(t)}init(){this._context=new dw(this,this._dpr)}release(...t){}}uw.env="feishu";const pw=hw(uw,dw);class gw extends ow{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:ru(this,l,this.dpr),r.strokeStyle=au(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=Ua.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Ua.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}gw.env="harmony";class fw extends Eu{constructor(t){super(t)}init(){this._context=new gw(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}fw.env="harmony";const mw=hw(fw,gw);class vw extends ow{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:ru(this,l,this.dpr),r.strokeStyle=au(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=Ua.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Ua.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}vw.env="lynx";class yw extends Eu{constructor(t){super(t)}init(){this._context=new vw(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}yw.env="lynx";const _w=hw(yw,vw);class bw extends ow{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}bw.env="node";class xw extends Eu{constructor(t){super(t)}init(){this._context=new bw(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}}xw.env="node";const Sw=hw(xw,bw);class Aw extends ow{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,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(au(this,l,t,i,s)))}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:ru(this,l,this.dpr)),r.setStrokeStyle(au(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}Aw.env="taro";class kw extends Eu{constructor(t){super(t)}init(){this._context=new Aw(this,this._dpr)}release(...t){}}kw.env="taro";const Cw=hw(kw,Aw);class Tw extends dw{}Tw.env="tt";class Mw extends Eu{constructor(t){super(t)}init(){this._context=new Tw(this,this._dpr)}release(...t){}}Mw.env="tt";const ww=hw(Mw,Tw);class Ew extends ow{draw(){}createPattern(t,e){return null}}Ew.env="wx";class Bw extends Eu{constructor(t){super(t)}init(){this._context=new Ew(this,this._dpr)}release(...t){}}Bw.env="wx";const Pw=hw(Bw,Ew);function Rw(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function Ow(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}class Iw extends Q_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=dm.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:ru(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class vE extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ed}}let yE=!1;function _E(t){yE||(yE=!0,t.bind(Kw).toDynamicValue((()=>new vE(Rw(t,jf)))).inSingletonScope(),t.bind(pE).toService(Kw))}class bE extends h_{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ku.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class xE extends bE{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=id,this.themeType="arc"}}let SE=!1;function AE(t){var e;SE||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Nf))&&(SE=!0,t.bind($w).toDynamicValue((()=>new xE(Rw(t,Nf)))).inSingletonScope(),t.bind(pE).toService($w))}class kE extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=sd}}let CE=!1;function TE(t){CE||(CE=!0,t.bind(qw).toDynamicValue((()=>new kE(Rw(t,Uf)))).inSingletonScope(),t.bind(pE).toService(qw))}class ME extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=nd}}let wE=!1;function EE(t){wE||(wE=!0,t.bind(Zw).toDynamicValue((()=>new ME(Rw(t,Vf)))).inSingletonScope(),t.bind(pE).toService(Zw))}class BE{constructor(){this.type="glyph",this.numberType=rd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}class PE extends BE{constructor(t){super(),this.canvasRenderer=t}}let RE=!1;function OE(t){RE||(RE=!0,t.bind(cE).toDynamicValue((()=>new PE(Rw(t,em)))).inSingletonScope(),t.bind(pE).toService(cE))}class IE extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=od}}let LE=!1;function DE(t){LE||(LE=!0,t.bind(Jw).toDynamicValue((()=>new IE(Rw(t,im)))).inSingletonScope(),t.bind(pE).toService(Jw))}class FE extends h_{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:ru(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ku.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class zE extends FE{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ld}}let HE=!1;function jE(t){HE||(HE=!0,t.bind(tE).toDynamicValue((()=>new zE(Rw(t,Yf)))).inSingletonScope(),t.bind(pE).toService(tE))}const NE=new Ve;class UE{constructor(){this.type="rect",this.numberType=ud}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:ru(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;NE.setValue(i.x1,i.y1,i.x2,i.y2),NE.expand(-r/2),h=!NE.containsPoint(e)}}return s.highPerformanceRestore(),h}}class VE extends UE{constructor(t){super(),this.canvasRenderer=t}}let WE=!1;class GE extends FE{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=hd}}let YE=!1;function XE(t){YE||(YE=!0,t.bind(iE).toDynamicValue((()=>new GE(Rw(t,Xf)))).inSingletonScope(),t.bind(pE).toService(iE))}class KE extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=cd}}let $E=!1;function qE(t){$E||($E=!0,t.bind(oE).toDynamicValue((()=>new KE(Rw(t,Kf)))).inSingletonScope(),t.bind(pE).toService(oE))}class ZE extends bE{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=dd,this.themeType="polygon"}}let JE=!1;function QE(t){var e;JE||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,tm))&&(JE=!0,t.bind(lE).toDynamicValue((()=>new ZE(Rw(t,tm)))).inSingletonScope(),t.bind(pE).toService(lE))}class tB extends UE{constructor(t){super(),this.canvasRenderer=t}}let eB=!1;function iB(t){eB||(eB=!0,t.bind(sE).toDynamicValue((()=>new tB(Rw(t,$f)))).inSingletonScope(),t.bind(pE).toService(sE))}class sB extends bE{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=pd,this.themeType="rect"}}let nB=!1;function rB(t){var e;nB||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,qf))&&(nB=!0,t.bind(nE).toDynamicValue((()=>new sB(Rw(t,qf)))).inSingletonScope(),t.bind(pE).toService(nE))}class aB{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=gd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let oB=!1;function lB(t){oB||(oB=!0,t.bind(hE).toDynamicValue((()=>new aB(Rw(t,Qf)))).inSingletonScope(),t.bind(pE).toService(hE))}class hB extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=fd}}let cB=!1;function dB(t){var e;cB||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,rm))&&(cB=!0,t.bind(uE).toDynamicValue((()=>new hB(Rw(t,rm)))).inSingletonScope(),t.bind(pE).toService(uE))}class uB extends bE{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=md}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:ru(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ku.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let pB=!1;function gB(t){pB||(pB=!0,t.bind(rE).toDynamicValue((()=>new uB(Rw(t,Zf)))).inSingletonScope(),t.bind(pE).toService(rE))}class fB extends bE{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=vd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Vp(a,u,n),v=Up(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&ku.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let mB=!1;function vB(t){mB||(mB=!0,t.bind(aE).toDynamicValue((()=>new fB(Rw(t,Jf)))).inSingletonScope(),t.bind(pE).toService(aE))}const yB=Kc();Kc();class _B{constructor(){this.type="gif-image",this.numberType=yB}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let bB=!1;function xB(t){bB||(bB=!0,t.bind(Qw).toDynamicValue((()=>new _B)).inSingletonScope(),t.bind(pE).toService(Qw))}function SB(t){t.isBound(Iw)||t.bind(Iw).toDynamicValue((()=>new Iw(Ow(pE,t),Rw(t,nm),Ow(Ff,t),Ow(zf,t)))).inSingletonScope(),t.isBound(If)?t.rebind(If).toService(Iw):t.bind(If).toService(Iw)}function AB(t){(function(t){fE||(fE=!0,t.bind(dE).toDynamicValue((()=>new gE)).inSingletonScope(),t.bind(pE).toService(dE),gv(t.bind.bind(t),pE))})(t),_E(t),AE(t),TE(t),EE(t),OE(t),DE(t),jE(t),function(t){WE||(WE=!0,t.bind(eE).toDynamicValue((()=>new VE(Rw(t,$f)))).inSingletonScope(),t.bind(pE).toService(eE))}(t),XE(t),qE(t),QE(t),iB(t),rB(t),lB(t),dB(t),gB(t),vB(t),xB(t),SB(t)}class kB extends Y_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${kB.idprefix}_${kB.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ua.global,this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:kB.GenerateCanvasId(),canvasControled:!0};this.canvas=new lw(s)}createWindowByCanvas(t){var e,i;let s;if("string"==typeof t.canvas){if(s=this.global.getElementById(t.canvas),s||"undefined"==typeof document||(s=document.getElementById(t.canvas)),!s)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else s=t.canvas;if(!s)throw new Error("发生错误,传入的canvas不正确");let n=t.width,r=t.height;if(null==n||null==r||!t.canvasControled){const t=s.getBoundingClientRect();n=t.width,r=t.height}let a=t.dpr;null==a&&(a=null!==(e=s.getContext("2d").pixelRatio)&&void 0!==e?e:s.width/n),this.canvas=new lw({width:n,height:r,dpr:a,nativeCanvas:s,canvasControled:null!==(i=t.canvasControled)&&void 0!==i&&i})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}}function CB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,kB))||t.bind(kB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,kB.env))||t.bind(om).toService(kB).whenTargetNamed(kB.env)}kB.env="browser",kB.idprefix="visactor_window",kB.prefix_count=0;var TB=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class MB{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function wB(t,e=!1){const i=document.createElement("img");if(Ua.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class EB extends G_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new MB(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return wB(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return wB(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ja.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return TB(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function BB(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,EB))||(t.bind(EB).toSelf().inSingletonScope(),t.bind(pg).toService(EB))}function PB(t=Zy(),e=!0){PB.__loaded||(PB.__loaded=!0,BB(t),cw(t),CB(t),e&&AB(t))}PB.__loaded=!1;class RB extends Y_{get container(){return null}constructor(t=Ua.global){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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new uw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new uw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function OB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,RB))||t.bind(RB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,RB.env))||t.bind(om).toService(RB).whenTargetNamed(RB.env)}RB.env="feishu";class IB extends Q_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Mu(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}}let LB=!1;class DB extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ed}}let FB=!1;function zB(t){FB||(FB=!0,t.bind(Dw).toDynamicValue((()=>new DB(Rw(t,jf)))).inSingletonScope(),t.bind(Lw).toService(Dw))}class HB extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=sd}}let jB=!1;function NB(t){jB||(jB=!0,t.bind(Fw).toDynamicValue((()=>new HB(Rw(t,Uf)))).inSingletonScope(),t.bind(Lw).toService(Fw))}class UB extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=nd}}let VB=!1;function WB(t){VB||(VB=!0,t.bind(zw).toDynamicValue((()=>new UB(Rw(t,Vf)))).inSingletonScope(),t.bind(Lw).toService(zw))}class GB extends BE{constructor(t){super(),this.canvasRenderer=t}}let YB=!1;function XB(t){YB||(YB=!0,t.bind(Yw).toDynamicValue((()=>new GB(Rw(t,em)))).inSingletonScope(),t.bind(Lw).toService(Yw))}class KB{constructor(){this.type="image",this.numberType=od}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let $B=!1;function qB(t){$B||($B=!0,t.bind(Hw).toDynamicValue((()=>new KB)).inSingletonScope(),t.bind(Lw).toService(Hw))}class ZB extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ld}}let JB=!1;function QB(t){JB||(JB=!0,t.bind(jw).toDynamicValue((()=>new ZB(Rw(t,Yf)))).inSingletonScope(),t.bind(Lw).toService(jw))}class tP extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=cd}}let eP=!1;function iP(t){eP||(eP=!0,t.bind(Gw).toDynamicValue((()=>new tP(Rw(t,Kf)))).inSingletonScope(),t.bind(Lw).toService(Gw))}class sP extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=hd}}let nP=!1;function rP(t){nP||(nP=!0,t.bind(Nw).toDynamicValue((()=>new sP(Rw(t,Xf)))).inSingletonScope(),t.bind(Lw).toService(Nw))}class aP extends UE{constructor(t){super(),this.canvasRenderer=t}}let oP=!1;function lP(t){oP||(oP=!0,t.bind(Uw).toDynamicValue((()=>new aP(Rw(t,$f)))).inSingletonScope(),t.bind(Lw).toService(Uw))}class hP{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=gd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let cP=!1;function dP(t){cP||(cP=!0,t.bind(Xw).toDynamicValue((()=>new hP(Rw(t,Qf)))).inSingletonScope(),t.bind(Lw).toService(Xw))}class uP extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=md}}let pP=!1;function gP(t){pP||(pP=!0,t.bind(Vw).toDynamicValue((()=>new uP(Rw(t,Zf)))).inSingletonScope(),t.bind(Lw).toService(Vw))}class fP{constructor(){this.type="text",this.numberType=vd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let mP=!1;function vP(t){mP||(mP=!0,t.bind(Ww).toDynamicValue((()=>new fP)).inSingletonScope(),t.bind(Lw).toService(Ww))}function yP(t){(function(t){LB||(LB=!0,gv(t.bind.bind(t),Lw))})(t),function(t){t.isBound(IB)||t.bind(IB).toDynamicValue((()=>new IB(Ow(Lw,t),Ow(Ff,t),Ow(zf,t)))).inSingletonScope(),t.isBound(If)?t.rebind(If).toService(IB):t.bind(If).toService(IB)}(t),zB(t),NB(t),WB(t),XB(t),qB(t),QB(t),iP(t),rP(t),lP(t),dP(t),gP(t),vP(t)}class _P{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class bP{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function xP(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function SP(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new _P(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function AP(t,e,i,s){const n=xP(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new bP(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function kP(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function CP(t,e=kP(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class TP extends G_{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},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 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=kP(i),n=null!==(e=t.dpr)&&void 0!==e?e:CP(i,s),r=AP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=xP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=SP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return CP(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function MP(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,TP))||(t.bind(TP).toSelf().inSingletonScope(),t.bind(pg).toService(TP))}function wP(t=Zy(),e=!0){wP.__loaded||(wP.__loaded=!0,MP(t),pw(t),OB(t),e&&yP(t))}wP.__loaded=!1;function EP(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function BP(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new fw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new fw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return EP(t,"target",s),EP(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=BP(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=BP(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&PP(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),PP(t,"x",_),PP(t,"y",b),PP(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),PP(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),PP(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),PP(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),PP(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),PP(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function OP(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,RP))||t.bind(RP).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,RP.env))||t.bind(om).toService(RP).whenTargetNamed(RP.env)}RP.env="harmony";const IP="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function LP(t){return"number"==typeof t&&Number.isFinite(t)}function DP(...t){for(let e=0;e({width:i,height:s})),new bP(t,l,n,i,s,e)}function NP(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=HP(e*s,i*s);if(t)return t}throw new Error(IP)}class UP extends G_{constructor(){super(),this.type="harmony",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,this.rafSTO=new Sh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=FP(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=FP(s),r=null!==(i=t.dpr)&&void 0!==i?i:zP(s),a=function(t,e){if(!LP(t)||!LP(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=jP(NP(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=jP(NP(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return zP(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=DP(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=DP(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function VP(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,UP))||(t.bind(UP).toSelf().inSingletonScope(),t.bind(pg).toService(UP))}function WP(t=Zy(),e=!0){WP.__loaded||(WP.__loaded=!0,VP(t),mw(t),OP(t),e&&yP(t))}WP.__loaded=!1;function GP(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function YP(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new yw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new yw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return GP(t,"target",s),GP(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=YP(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=YP(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&XP(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),XP(t,"x",_),XP(t,"y",b),XP(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),XP(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),XP(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),XP(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),XP(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),XP(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function $P(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,KP))||t.bind(KP).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,KP.env))||t.bind(om).toService(KP).whenTargetNamed(KP.env)}KP.env="lynx";function qP(t){return"number"==typeof t&&Number.isFinite(t)}function ZP(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=QP(r),o=null!==(i=t.dpr)&&void 0!==i?i:tR(r,a),l=iR(t.width,t.height),h=sR(nR(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=QP(a),l=null!==(n=t.dpr)&&void 0!==n?n:tR(a,o),h=iR(t.width,t.height),c=Math.random().toString(),d=sR(nR(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tR(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=ZP(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=ZP(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function aR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,rR))||(t.bind(rR).toSelf().inSingletonScope(),t.bind(pg).toService(rR))}function oR(t=Zy(),e=!0){oR.__loaded||(oR.__loaded=!0,aR(t),_w(t),$P(t),e&&yP(t))}oR.__loaded=!1;class lR extends Y_{get container(){return null}constructor(t=Ua.global){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:ja.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new xw(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new xw({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function hR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,lR))||t.bind(lR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,lR.env))||t.bind(om).toService(lR).whenTargetNamed(lR.env)}lR.env="node";class cR extends G_{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function dR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,cR))||(t.bind(cR).toSelf().inSingletonScope(),t.bind(pg).toService(cR))}function uR(t=Zy(),e=!0){uR.__loaded||(uR.__loaded=!0,dR(t),Sw(t),hR(t))}uR.__loaded=!1;class pR extends Y_{get container(){return null}constructor(t=Ua.global){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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new kw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new kw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.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){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function gR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,pR))||t.bind(pR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,pR.env))||t.bind(om).toService(pR).whenTargetNamed(pR.env)}pR.env="taro";class fR extends G_{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},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 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=AP(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=xP(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=SP(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}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(...t){}}function mR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,fR))||(t.bind(fR).toSelf().inSingletonScope(),t.bind(pg).toService(fR))}function vR(t=Zy(),e=!0){vR.__loaded||(vR.__loaded=!0,mR(t),Cw(t),gR(t),e&&yP(t))}vR.__loaded=!1;class yR extends Y_{get container(){return null}constructor(t=Ua.global){super(),this.global=t,this.type="tt",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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Mw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Mw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function _R(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,yR))||t.bind(yR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,yR.env))||t.bind(om).toService(yR).whenTargetNamed(yR.env)}yR.env="tt";function bR(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function xR(t,e=bR(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class SR extends G_{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=bR(i),n=null!==(e=t.dpr)&&void 0!==e?e:xR(i,s),r=AP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=xP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=SP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return xR(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function AR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,SR))||(t.bind(SR).toSelf().inSingletonScope(),t.bind(pg).toService(SR))}function kR(t=Zy(),e=!0){kR.__loaded||(kR.__loaded=!0,AR(t),ww(t),_R(t),e&&yP(t))}kR.__loaded=!1;class CR{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={}}}function TR(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class MR extends Y_{get container(){return null}constructor(t=Ua.global){super(),this.global=t,this.type="wx",this.eventManager=new CR}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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Bw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Bw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,s,n,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return TR(t,"target",o),TR(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s: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!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function wR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,MR))||t.bind(MR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,MR.env))||t.bind(om).toService(MR).whenTargetNamed(MR.env)}MR.env="wx";function ER(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function BR(t,e=ER(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class PR extends G_{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=ER(i),n=null!==(e=t.dpr)&&void 0!==e?e:BR(i,s),r=AP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=xP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=SP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return BR(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function RR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,PR))||(t.bind(PR).toSelf().inSingletonScope(),t.bind(pg).toService(PR))}function OR(t=Zy(),e=!0){OR.__loaded||(OR.__loaded=!0,RR(t),Pw(t),wR(t),e&&yP(t))}OR.__loaded=!1;var IR={},LR={},DR={};Object.defineProperty(DR,"__esModule",{value:!0}),DR.loop=DR.conditional=DR.parse=void 0;DR.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};DR.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};DR.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var FR={};Object.defineProperty(FR,"__esModule",{value:!0}),FR.readBits=FR.readArray=FR.readUnsigned=FR.readString=FR.peekBytes=FR.readBytes=FR.peekByte=FR.readByte=FR.buildStream=void 0;FR.buildStream=function(t){return{data:t,pos:0}};var zR=function(){return function(t){return t.data[t.pos++]}};FR.readByte=zR;FR.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var HR=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};FR.readBytes=HR;FR.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};FR.readString=function(t){return function(e){return Array.from(HR(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};FR.readUnsigned=function(t){return function(e){var i=HR(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};FR.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=HR(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=$R(t),i=VR(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=$R(this.attribute.gifImage),e=VR(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=Ua.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=Ua.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function JR(t){return new ZR(t)}class QR extends V_{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=yB,this._renderContribitions=void 0,this.builtinContributions=[tO],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=Dp(t).image;this._draw(t,n,!1,i)}}const tO=new class extends iy{constructor(){super(...arguments),this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let eO=!1;function iO(t){eO||(eO=!0,t.bind(QR).toDynamicValue((()=>new QR(Ow(Dy,t)))).inSingletonScope(),t.bind(Wf).toService(QR))}function sO(){pf.RegisterGraphicCreator("gif",JR)}function nO(){if(nO.__loaded)return;nO.__loaded=!0;const t=Zy();sO(),iO(t),xB(t)}nO.__loaded=!1;const rO=nO,aO=[{register:PS,bindModule:Rx},{register:RS,bindModule:TS},{register:OS,bindModule:Nx},{register:IS,bindModule:Xx},{register:LS,bindModule:cS},{register:DS},{register:FS,bindModule:vS},{register:zS,bindModule:zx},{register:HS,bindModule:Qx},{register:jS,bindModule:iS},{register:US,bindModule:BS},{register:VS,bindModule:Lx},{register:WS,bindModule:SS},{register:GS,bindModule:gS},{register:KS},{register:NS,bindModule:aS},{register:YS,bindModule:Wx},{register:XS,bindModule:qx},{register:$S},{register:sO}];let oO=!1;const lO=[_E,AE,TE,EE,OE,DE,jE,XE,qE,QE,iB,rB,lB,dB,gB,vB,xB];function hO(t){return{getContributions:t}}function cO(t,{envParams:e,force:i=!1}={}){_b().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function dO(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){bb(t);const a=vb();i(a),s(a),n(a),yb(),cO(e,{envParams:r,force:!0})}function uO(t,e){dO(t,"browser",{bindEnv:BB,bindCanvasModules:cw,bindWindowContribution:CB},e)}function pO(t,e){dO(t,"node",{bindEnv:dR,bindCanvasModules:Sw,bindWindowContribution:hR},e)}function gO(t){bb(t),function(){if(oO)return;const t=vb();oO=!0,aO.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),iO(t),yb()}(),Sb(t),xb(t)}function fO(t){bb(t);const e=vb();lO.forEach((t=>t(e))),SB(e),Ab(t,pE),function(t){const e=vb(),i=hO((()=>t.registry.picker.getAll())),s=hO((()=>e.isBound(Ff)?e.getAll(Ff):[])),n=hO((()=>e.isBound(zf)?e.getAll(zf):[])),r=_b();Ua.pickerServiceFactory=()=>new Iw(i,{},s,n),Ua.global=r}(t)}function mO(t){bb(t);yP(vb()),Ab(t,Lw),function(t){const e=vb(),i=hO((()=>t.registry.picker.getAll())),s=hO((()=>e.isBound(Ff)?e.getAll(Ff):[])),n=hO((()=>e.isBound(zf)?e.getAll(zf):[]));Ua.pickerServiceFactory=()=>new IB(i,s,n)}(t)}const vO=iv();function yO(){if(yO.__loaded)return;yO.__loaded=!0;const t=Zy();PS(),Rx({bind:t.bind}),vO?_E(t):zB(t)}yO.__loaded=!1;const _O=yO;function bO(){if(bO.__loaded)return;bO.__loaded=!0;const t=Zy();RS(),K_(),q_(),TS({bind:t.bind}),AE(t)}bO.__loaded=!1;const xO=bO;function SO(){if(SO.__loaded)return;SO.__loaded=!0;const t=Zy();OS(),Nx({bind:t.bind}),vO?TE(t):NB(t)}SO.__loaded=!1;const AO=SO;function kO(){if(kO.__loaded)return;kO.__loaded=!0;const t=Zy();IS(),Xx({bind:t.bind}),vO?EE(t):WB(t)}kO.__loaded=!1;const CO=kO;function TO(){if(TO.__loaded)return;TO.__loaded=!0;const t=Zy();LS(),cS({bind:t.bind}),vO?OE(t):XB(t)}TO.__loaded=!1;const MO=TO;function wO(){wO.__loaded||(wO.__loaded=!0,DS())}wO.__loaded=!1;const EO=wO;function BO(){if(BO.__loaded)return;BO.__loaded=!0;const t=Zy();FS(),vS({bind:t.bind}),vO?DE(t):qB(t)}BO.__loaded=!1;const PO=BO;function RO(){if(RO.__loaded)return;RO.__loaded=!0;const t=Zy();zS(),zx({bind:t.bind}),vO?jE(t):QB(t)}RO.__loaded=!1;const OO=RO;function IO(){if(IO.__loaded)return;IO.__loaded=!0;const t=Zy();HS(),Qx({bind:t.bind}),vO?XE(t):rP(t)}IO.__loaded=!1;const LO=IO;function DO(){if(DO.__loaded)return;DO.__loaded=!0;const t=Zy();jS(),iS({bind:t.bind}),vO?qE(t):iP(t)}DO.__loaded=!1;const FO=DO;function zO(){if(zO.__loaded)return;zO.__loaded=!0;const t=Zy();US(),K_(),q_(),BS({bind:t.bind}),QE(t)}zO.__loaded=!1;const HO=zO;function jO(){if(jO.__loaded)return;jO.__loaded=!0;const t=Zy();VS(),Lx({bind:t.bind}),vO?iB(t):lP(t)}jO.__loaded=!1;const NO=jO;function UO(){if(UO.__loaded)return;UO.__loaded=!0;const t=Zy();WS(),SS({bind:t.bind}),rB(t)}UO.__loaded=!1;const VO=UO;function WO(){if(WO.__loaded)return;WO.__loaded=!0;const t=Zy();GS(),gS({bind:t.bind}),vO?lB(t):dP(t)}WO.__loaded=!1;const GO=WO;function YO(){YO.__loaded||(YO.__loaded=!0,KS())}YO.__loaded=!1;const XO=YO;function KO(){if(KO.__loaded)return;KO.__loaded=!0;const t=Zy();NS(),aS({bind:t.bind}),dB(t)}KO.__loaded=!1;const $O=KO;function qO(){if(qO.__loaded)return;qO.__loaded=!0;const t=Zy();YS(),Wx({bind:t.bind}),vO?gB(t):gP(t)}qO.__loaded=!1;const ZO=qO;function JO(){if(JO.__loaded)return;JO.__loaded=!0;const t=Zy();XS(),qx({bind:t.bind}),vO?vB(t):vP(t)}JO.__loaded=!1;const QO=JO;function tI(){tI.__loaded||(tI.__loaded=!0,$S())}tI.__loaded=!1;const eI=tI;function iI(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}class sI{static registerBuiltInAnimate(t,e){sI.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._activeConfigList=null,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:sI.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=iI(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:sI.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=iI(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:T,customType:M,controlOptions:w}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),E.startAt(b);const O=i*x+B;O>0&&E.wait(O);let I=null,L=t.to,D=t.from;const F=this.shouldCommitAttrOutChannel(p);L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(E,T,M,D,L,_,m,f,w,C,p,e);let z=0;x&&(z=x*(s-i-1));const H=d(y)?y(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&E.wait(z),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,y,_,b;if(e&&i){i=iI(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:sI.builtInAnimateMap[r],m=t.custom?t.customType:iI(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Il.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}sI.builtInAnimateMap={};class nI{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-nI.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*nI.bounceIn(2*t):.5*nI.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ut/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ut*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ut/e)*.5+1}}static registerFunc(t,e){nI[t]=e}}function rI(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}nI.quadIn=nI.getPowIn(2),nI.quadOut=nI.getPowOut(2),nI.quadInOut=nI.getPowInOut(2),nI.cubicIn=nI.getPowIn(3),nI.cubicOut=nI.getPowOut(3),nI.cubicInOut=nI.getPowInOut(3),nI.quartIn=nI.getPowIn(4),nI.quartOut=nI.getPowOut(4),nI.quartInOut=nI.getPowInOut(4),nI.quintIn=nI.getPowIn(5),nI.quintOut=nI.getPowOut(5),nI.quintInOut=nI.getPowInOut(5),nI.backIn=nI.getBackIn(1.7),nI.backOut=nI.getBackOut(1.7),nI.backInOut=nI.getBackInOut(1.7),nI.elasticIn=nI.getElasticIn(1,.3),nI.elasticOut=nI.getElasticOut(1,.3),nI.elasticInOut=nI.getElasticInOut(1,.3*1.5),nI.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),nI.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},nI.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)nI[`flicker${t}`]=e=>rI(e,t);for(let t=2;t<10;t++)nI[`aIn${t}`]=e=>t*e*e+(1-t)*e;function aI(t,e,i){return t+(e-t)*i}const oI=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=aI(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=aI(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=aI(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=aI(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=aI(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=aI(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=aI(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=aI(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=aI(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Ou(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?Hu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Ou(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?Hu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=aI(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=aI(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=aI(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=aI(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=aI(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=aI(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=aI(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=aI(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=aI(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=bh(e,i,s),r.addUpdateBoundTag()}}};function lI(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:Ao.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=nI[s])&&void 0!==n?n:nI.linear:nI.linear,"wait"===t&&(this.onUpdate=yI),this.id=ja.GenAutoIncrementId(),this.syncAttributeUpdate=yI}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Pu.Get(i,Bu.Color255),r=Pu.Get(s,Bu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(oI["fill"===e?"fillPure":"strokePure"])}else oI[e]?t.push(oI[e]):t.push(lI)}else oI[e]?t.push(oI[e]):t.push(lI)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class xI extends bI{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();mI(this.target,t,Ao.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class SI extends bI{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class AI extends SI{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class kI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Il.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class CI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class TI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,mI(this.target,i,Ao.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class MI extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class wI extends TI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class EI extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class BI extends TI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}class PI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){mI(this.target,this.from,Ao.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const RI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class OI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){gI(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){gI(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class II extends OI{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=RI(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,r),this.determineUpdateFunction()}}class LI extends OI{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class DI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class FI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const zI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class HI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=zI(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){fI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class jI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){fI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const NI=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class UI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(gI(this.target,{points:r.map(((t,i)=>_h(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class VI extends UI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:NI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&vI(this.target,e)}else this.valid=!1}}class WI extends UI{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:NI(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const GI=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class YI extends UI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:GI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&vI(this.target,e)}else this.valid=!1}}class XI extends UI{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:GI(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const KI=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class $I extends UI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:KI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&vI(this.target,e)}else this.valid=!1}}class qI extends UI{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:KI(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const ZI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class JI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class QI extends JI{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=ZI(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,r)}}class tL extends JI{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const eL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class iL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=eL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){fI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){fI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rL extends nL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?y:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&vI(this.target,e)}}class aL extends nL{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,y=v&&k(v.x)?v.x:f,_=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class oL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,mI(this.target,{text:n})}}class lL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class hL extends lL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&vI(this.target,e)}}class cL extends lL{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class dL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),T=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,w=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,E=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,B=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(w){case"x":A={scaleX:null!==(g=null!=E?E:T.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=B?B:T.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=E?E:T.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=B?B:T.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&vI(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),gI(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class uL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class pL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function gL(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;tfL[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&gL(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(gI(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class yL{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new sI(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function _L(t){return new yL(t)}class bL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;mI(this.target,{text:o})}}class xL extends AI{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(vI(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),vI(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),vI(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),vI(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;vI(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:bL});const i=s._titleBottom.attribute.text;vI(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:bL})}else vI(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),vI(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;vI(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());vI(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class SL extends AI{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class AL extends AI{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if(vI(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:bL}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:bL}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class kL extends AI{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class CL extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=e_.createCanvas({width:t.width,height:t.height,dpr:e_.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=e_.createCanvas({width:t.width,height:t.height,dpr:e_.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==CL.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class TL extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class ML extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==ML.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==ML.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class wL{static createTempCanvas(t,e,i){return e_.createCanvas({width:t,height:e,dpr:i||e_.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=wL.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(wL.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(wL.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(wL.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(wL.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(wL.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(wL.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(wL.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class PL extends ML{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class LL extends ML{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=wL.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class DL extends CL{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=e_.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=e_.createCanvas({width:i,height:s,dpr:e_.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class FL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}mI(this.target,{textConfig:o})}}class zL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),mI(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),mI(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class HL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),mI(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),mI(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function VL(t,e){gI(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class WL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,vI(this.target,m)}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class GL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,vI(this.target,d)}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class YL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,vI(this.target,p)}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class XL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,vI(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),mI(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class KL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,vI(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),mI(this.target,n)}}class $L extends SI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new sI(this.target);a.execute({type:"custom",custom:WL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:GL,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class qL extends SI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new sI(this.target);a.execute({type:"custom",custom:WL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:YL,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class ZL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class JL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class QL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class tD extends SI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new sI(this.target);n.execute({type:"custom",custom:JL,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:ZL,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class eD extends SI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new sI(this.target);n.execute({type:"custom",custom:QL,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:ZL,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class iD extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),gI(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Ou(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Ou(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class sD extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Ua.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Ml,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Ua.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Ao.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Ao.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=No(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=No(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}nD.getInstance();const rD="appear",aD="disappear",oD="update",lD="highlight",hD="unhighlight";class cD{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class dD{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new sI(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new sI(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([rD],[{name:rD,animation:t}],e)}applyDisappearState(t,e){this.applyState([aD],[{name:aD,animation:t}],e)}applyUpdateState(t,e){this.applyState([oD],[{name:oD,animation:t}],e)}applyHighlightState(t,e){this.applyState([lD],[{name:lD,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([hD],[{name:hD,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class uD{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new dD(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new cD(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class pD extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=ja.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Il.END?this.removeAnimate(t,!0):t.status!==Il.RUNNING&&t.status!==Il.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const gD=new pD;function fD(t,e){for(let i=0;i{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new bI(Ol.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new xI(Ol.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new PI(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Il.RUNNING&&(this.status=Il.PAUSED)}resume(){this.status===Il.PAUSED&&(this.status=Il.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Il.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Il.END,this.target.restoreStaticAttribute(),void(this.__skipRestoreStaticAttributeOnRemove=!0);this.status=Il.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&mI(this.target,this._startProps,Ao.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const yD=new Wa;class _D{constructor(){this.released=!1}tick(t,e){yD.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class bD extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Rl.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Rl.INITIAL,Ua.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Ua.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new _D;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Rl.INITIAL&&(this.status=Rl.PAUSE,!0)}resume(){return this.status!==Rl.INITIAL&&(this.status=Rl.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Rl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Rl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Rl.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Rl.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Rl.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Rl.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Ua.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function SD(){G(Mp,uD),G(Mp,xD)}const AD=Symbol.for("vrender.bootstrap.state"),kD=new WeakMap;function CD(t,e){var i;const s=null!==(i=t[AD])&&void 0!==i?i:new Set;return t[AD]=s,!s.has(e)&&(s.add(e),!0)}function TD(t,e){var i,s,n,r;const a=null!==(i=null==t?void 0:t.type)&&void 0!==i?i:"unknown",o=null!==(s=null==t?void 0:t.numberType)&&void 0!==s?s:"unknown",l=null!==(r=null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)&&void 0!==r?r:"anonymous";return`${e}:${String(o)}:${String(a)}:${l}`}function MD(t,e){let i=kD.get(t);i||(i=new Map,kD.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function wD(t,e,i){const s=MD(t,e);i&&s.forEach((t=>i(t))),s.clear()}function ED(t){var e,i;const s=null!==(e=Zy().getAll(Wf))&&void 0!==e?e:[],n=MD(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;wD(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=TD(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function BD(t,e){var i,s;const n=null!==(i=Zy().getAll(e))&&void 0!==i?i:[],r=MD(t.registry.picker,"vrender:legacy-picker"),a=new Set;wD(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=TD(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const PD=uO,RD=pO,OD={taro:{installEnv:function(t,e){dO(t,"taro",{bindEnv:mR,bindCanvasModules:Cw,bindWindowContribution:gR},e)},loadEnv:vR},feishu:{installEnv:function(t,e){dO(t,"feishu",{bindEnv:MP,bindCanvasModules:pw,bindWindowContribution:OB},e)},loadEnv:wP},tt:{installEnv:function(t,e){dO(t,"tt",{bindEnv:AR,bindCanvasModules:ww,bindWindowContribution:_R},e)},loadEnv:kR},wx:{installEnv:function(t,e){dO(t,"wx",{bindEnv:RR,bindCanvasModules:Pw,bindWindowContribution:wR},e)},loadEnv:OR},lynx:{installEnv:function(t,e){dO(t,"lynx",{bindEnv:aR,bindCanvasModules:_w,bindWindowContribution:$P},e)},loadEnv:oR},harmony:{installEnv:function(t,e){dO(t,"harmony",{bindEnv:VP,bindCanvasModules:mw,bindWindowContribution:OP},e)},loadEnv:WP}},ID=[nA,eA,ZS,QS,K_,q_],LD=[()=>{sI.registerBuiltInAnimate("increaseCount",oL),sI.registerBuiltInAnimate("fromTo",PI),sI.registerBuiltInAnimate("scaleIn",dL),sI.registerBuiltInAnimate("scaleOut",uL),sI.registerBuiltInAnimate("growHeightIn",HI),sI.registerBuiltInAnimate("growHeightOut",jI),sI.registerBuiltInAnimate("growWidthIn",iL),sI.registerBuiltInAnimate("growWidthOut",sL),sI.registerBuiltInAnimate("growCenterIn",DI),sI.registerBuiltInAnimate("growCenterOut",FI),sI.registerBuiltInAnimate("clipIn",MI),sI.registerBuiltInAnimate("clipOut",wI),sI.registerBuiltInAnimate("fadeIn",EI),sI.registerBuiltInAnimate("fadeOut",BI),sI.registerBuiltInAnimate("growPointsIn",VI),sI.registerBuiltInAnimate("growPointsOut",WI),sI.registerBuiltInAnimate("growPointsXIn",YI),sI.registerBuiltInAnimate("growPointsXOut",XI),sI.registerBuiltInAnimate("growPointsYIn",$I),sI.registerBuiltInAnimate("growPointsYOut",qI),sI.registerBuiltInAnimate("growAngleIn",II),sI.registerBuiltInAnimate("growAngleOut",LI),sI.registerBuiltInAnimate("growRadiusIn",QI),sI.registerBuiltInAnimate("growRadiusOut",tL),sI.registerBuiltInAnimate("moveIn",rL),sI.registerBuiltInAnimate("moveOut",aL),sI.registerBuiltInAnimate("rotateIn",hL),sI.registerBuiltInAnimate("rotateOut",cL),sI.registerBuiltInAnimate("update",vL),sI.registerBuiltInAnimate("state",pL),sI.registerBuiltInAnimate("labelItemAppear",xL),sI.registerBuiltInAnimate("labelItemDisappear",SL),sI.registerBuiltInAnimate("poptipAppear",AL),sI.registerBuiltInAnimate("poptipDisappear",kL),sI.registerBuiltInAnimate("inputText",bL),sI.registerBuiltInAnimate("inputRichText",FL),sI.registerBuiltInAnimate("outputRichText",zL),sI.registerBuiltInAnimate("slideRichText",jL),sI.registerBuiltInAnimate("slideOutRichText",HL),sI.registerBuiltInAnimate("slideIn",WL),sI.registerBuiltInAnimate("growIn",GL),sI.registerBuiltInAnimate("spinIn",YL),sI.registerBuiltInAnimate("moveScaleIn",$L),sI.registerBuiltInAnimate("moveRotateIn",qL),sI.registerBuiltInAnimate("strokeIn",XL),sI.registerBuiltInAnimate("slideOut",ZL),sI.registerBuiltInAnimate("growOut",JL),sI.registerBuiltInAnimate("spinOut",QL),sI.registerBuiltInAnimate("moveScaleOut",tD),sI.registerBuiltInAnimate("moveRotateOut",eD),sI.registerBuiltInAnimate("strokeOut",KL),sI.registerBuiltInAnimate("pulse",iD),sI.registerBuiltInAnimate("MotionPath",NL),sI.registerBuiltInAnimate("streamLight",sD),sI.registerBuiltInAnimate("dissolve",BL),sI.registerBuiltInAnimate("grayscale",IL),sI.registerBuiltInAnimate("distortion",PL),sI.registerBuiltInAnimate("particle",LL),sI.registerBuiltInAnimate("glitch",OL),sI.registerBuiltInAnimate("gaussianBlur",RL),sI.registerBuiltInAnimate("pixelation",DL)},SD],DD=[_O,xO,AO,CO,MO,rO,EO,PO,OO,LO,FO,HO,NO,VO,GO,XO,ZO,QO,eI,$O];function FD(){ID.forEach((t=>t())),LD.forEach((t=>t()))}function zD(t,e){if(!CD(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==e_?void 0:e_.env)?e_.envParams:void 0}(e);return void 0===i?pO(t):RD(t,i),gO(t),mO(t),uR(),DD.forEach((t=>t())),ED(t),BD(t,Lw),FD(),t}function HD(t,e,i){if(!CD(t,e))return t;const s=OD[e];return s.installEnv(t,i),gO(t),function(t){mO(t)}(t),s.loadEnv(),DD.forEach((t=>t())),ED(t),BD(t,Lw),FD(),t}var jD=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt())),ED(t),BD(t,pE),FD(),t):t}(ib(jD(t,["envParams"])),e)}var UD=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nqD(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=$D(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&qD(t,i,s))}}}(t,s,r,o)}function JD(t){const{env:e}=t,i=Object.assign({},t);return delete i.env,delete i.key,"browser"===e?ND(i):"node"===e?function(t={}){const{envParams:e}=t,i=GD(t,["envParams"]);return zD(YD(i),e)}(i):"taro"===e?function(t={}){return WD("taro",t)}(i):"feishu"===e?function(t={}){return WD("feishu",t)}(i):"tt"===e?function(t={}){return WD("tt",t)}(i):"wx"===e?function(t={}){return WD("wx",t)}(i):"lynx"===e?function(t={}){return WD("lynx",t)}(i):function(t={}){return WD("harmony",t)}(i)}const QD=e=>{switch(e){case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony";case t.RenderModeEnum.lynx:return"lynx";default:return"browser"}},tF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},eF=(t,e)=>{const i=QD(t),s=tF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},iF=(t,e)=>{const i=ZD((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,JD,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}};class sF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option,m=eF(o,l);e_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=m?m:{});const v=this._option.stage;if(this._isExternalStage=!!v,this._releaseVRenderAppRef=void 0,this._stage=v,!this._stage){const t=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=QD(i.mode),n=eF(i.mode,i.modeParams);return iF(s,n)})({app:this._option.app,mode:o,modeParams:l});this._releaseVRenderAppRef=t.releaseAppRef;try{this._stage=(y=t.app,_=Object.assign({background:f,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(s=this._option.renderHooks)&&void 0!==s?s:{}),y.createStage(_))}catch(t){throw null===(n=this._releaseVRenderAppRef)||void 0===n||n.call(this),this._releaseVRenderAppRef=void 0,t}}var y,_;this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const b=sf({x:0,y:0,width:this._width,height:this._height});b.name="root",this._stage.defaultLayer.appendChild(b),this._rootGroup=b;const x=(p(h)?h:fA(o))&&!1!==c&&oT.getStageEventPlugin("gesture");x&&(this._gestureController=new x(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=ZM.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!_(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!gA(this._option.mode))return!1;return!1===(p(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:e_.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(e_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=e_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>ew(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>ew(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{ew(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===ZM.before;(e||i)&&(lA(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=ZM.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=ZM.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),lA(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=iw(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=sw(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=sw(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=QM(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=QM(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:nw,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{ew(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===$M.appear))?$M.appear:e.every((t=>t===$M.disappear))?$M.disappear:$M.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===BM.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=SM(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=SM(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:kM(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===BM.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===BM.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===BM.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===BM.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===BM.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{ew(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=iw(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return gA(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&Gc(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{ew(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=e_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){e_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function nF(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:cA)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const rF={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}},aF={poptip:H({},rF)};function oF(t){t.crosshair=Y(t.crosshair||{}).map((e=>aT({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function lF(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=li(l,i.width,i.height);a=t,o=e}else if(h&&gA(e.mode)){let t;t=y(h)?e_.getElementById(h):h;const{width:e,height:s}=li(t,i.width,i.height);a=e,o=s}else if(mA(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}const hF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function cF(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function dF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function uF(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;hF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function pF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var gF,fF,mF,vF,yF,_F;t.LayoutZIndex=void 0,(gF=t.LayoutZIndex||(t.LayoutZIndex={}))[gF.SeriesGroup=0]="SeriesGroup",gF[gF.Axis_Grid=50]="Axis_Grid",gF[gF.CrossHair_Grid=100]="CrossHair_Grid",gF[gF.Region=450]="Region",gF[gF.Mark=300]="Mark",gF[gF.Node=400]="Node",gF[gF.Axis=100]="Axis",gF[gF.MarkLine=500]="MarkLine",gF[gF.MarkArea=100]="MarkArea",gF[gF.MarkPoint=500]="MarkPoint",gF[gF.DataZoom=500]="DataZoom",gF[gF.ScrollBar=500]="ScrollBar",gF[gF.Player=500]="Player",gF[gF.Legend=500]="Legend",gF[gF.CrossHair=500]="CrossHair",gF[gF.Indicator=500]="Indicator",gF[gF.Title=500]="Title",gF[gF.Label=500]="Label",gF[gF.Brush=500]="Brush",gF[gF.CustomMark=500]="CustomMark",gF[gF.Interaction=700]="Interaction",t.LayoutLevel=void 0,(fF=t.LayoutLevel||(t.LayoutLevel={}))[fF.Indicator=10]="Indicator",fF[fF.Region=20]="Region",fF[fF.Axis=30]="Axis",fF[fF.DataZoom=40]="DataZoom",fF[fF.Player=40]="Player",fF[fF.ScrollBar=40]="ScrollBar",fF[fF.Legend=50]="Legend",fF[fF.Title=70]="Title",fF[fF.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(mF=t.AttributeLevel||(t.AttributeLevel={}))[mF.Default=0]="Default",mF[mF.Theme=1]="Theme",mF[mF.Chart=2]="Chart",mF[mF.Base_Series=3]="Base_Series",mF[mF.Series=4]="Series",mF[mF.Mark=5]="Mark",mF[mF.User_Chart=6]="User_Chart",mF[mF.User_Series=7]="User_Series",mF[mF.User_Mark=8]="User_Mark",mF[mF.User_SeriesStyle=9]="User_SeriesStyle",mF[mF.Built_In=99]="Built_In";class bF{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,H({},bF.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}bF.defaultMarkInfo={};class xF{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class SF{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>aT({},i,s,t);return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class AF extends xF{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=SF,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new bF,this._lastLayoutRect=null,this.id=yA(),this.userId=t.id,this._spec=t,this.effect={},this.event=new TM(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${PT}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=oT.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class kF{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=KC(qC(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:XC(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:XC(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:XC(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:XC(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:XC(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:XC(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=XC(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=XC(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=XC(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec($C(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class CF extends AF{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new kF(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=H(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=H(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class TF extends SF{_initTheme(t,e){return{spec:t,theme:this._theme}}}class MF extends CF{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=TF,this.modelType="region",this.specKey="region",this.type=MF.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function wF(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function EF(t,e,i){e?t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function BF(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function PF(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=LF(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),BF(d,!0,p,l),s&&EF(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function RF(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=LF(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=LF(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),BF(d,!1,p,o),s&&EF(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function IF(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=LF(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=LF(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=wF(t);n.length&&PF(n,e,i,!1,"left",s),r.length&&PF(r,e,i,!0,"left",s),a.length&&RF(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=wF(t);n.length&&OF(n,e,i,!1,"top",s),r.length&&OF(r,e,i,!0,"top",s),a.length&&IF(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=wF(t);n.length&&PF(n,e,i,!1,"right",s),r.length&&PF(r,e,i,!0,"right",s),a.length&&RF(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=wF(t);n.length&&OF(n,e,i,!1,"bottom",s),r.length&&OF(r,e,i,!0,"bottom",s),a.length&&IF(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=LF(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=LF(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:cA)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}DF.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(vF||(vF={})),t.STATE_VALUE_ENUM=void 0,(yF=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",yF.STATE_HOVER="hover",yF.STATE_HOVER_REVERSE="hover_reverse",yF.STATE_DIMENSION_HOVER="dimension_hover",yF.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",yF.STATE_SELECTED="selected",yF.STATE_SELECTED_REVERSE="selected_reverse",yF.STATE_SANKEY_EMPHASIS="selected",yF.STATE_SANKEY_EMPHASIS_REVERSE="blur",yF.STATE_HIGHLIGHT="highlight",yF.STATE_BLUR="blur",yF.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(_F||(_F={}));const FF=["linear","radial","conical"],zF={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const HF={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{HF[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class jF extends xF{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(H(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class NF extends jF{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,JM.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!HF[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(PT)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(PT))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(Mk(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class UF extends xF{constructor(){super(...arguments),this.id=yA(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=oT.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class VF extends UF{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const WF=1e3,GF="quadInOut",YF=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],XF=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=Ou(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},KF=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Ib(t):[],n=Ib(e);i&&s&&(i.fromTransform&&Lb(s,i.fromTransform.clone().getInverse()),Lb(s,i.toTransfrom));const[r,a]=Ob(s,n);return t?Rb(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},qF=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],ZF=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!qF.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Pu.Get(t,Bu.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class JF extends SI{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;KF(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&XF(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):mI(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const QF=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=$F(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=ZF(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new JF({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:WF,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:GF);return c.play(d),c};class tz extends SI{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;KF(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&XF(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const ez=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>YF.includes(t))(i)||(e[i]=t[i])})),e},iz=(t,e,i)=>{const s=ez(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=Ua.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},sz=(t,e,i)=>{const s=[],n=i?null:ez(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:ez(t.attribute);if("rect"===t.type)zb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)Hb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)jb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=Vb(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ua.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?Kb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?Ub(t,e).forEach((t=>{s.push(Ua.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&$b(t,e).forEach((t=>{"path"in t?s.push(Ua.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ua.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&iz(t,s,e),s},rz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,az=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=rz(l.delay,n,a,o),d=rz(l.duration,n,a,o),u=rz(l.oneByOne,n,a,o),p=rz(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?sz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:nz)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);QF(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?sz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:nz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>$F(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>ZF(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Ao.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new JF({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:WF,null!==(l=i.easing)&&void 0!==l?l:GF))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Ao.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new tz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:WF,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:GF))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):QF(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},oz=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},lz=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},hz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},cz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];hz(t,a,s)},dz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));hz(t,r,i)},uz=Symbol("statesClearedBeforeReInit");class pz extends UF{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new VF(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=sf("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Ml)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===vF.enter||t.context.diffState===vF.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&hz(t,r,e)},this.name=e,this.model=i.model,this.key=i.key,this.state=new NF(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&aT(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(wk(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return y(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=jC(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):FF.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):wk(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=PC(BC(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},zF[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=si.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)FF.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=PC(BC(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return QM(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return oT.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[DT],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=QM(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===$M.appear))?$M.appear:t.every((t=>t===$M.disappear))?$M.disappear:t[0];return null!=e?e:$M.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{lz(t),s.push(...t.getGraphics())})),e.forEach((t=>{lz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);az([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=oz(e,n),r=oz(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===$M.exit?$M.exit:i===$M.update?$M.update:$M.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===vF.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===vF.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=vF.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=vF.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=vF.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=$M.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=$M.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return tw(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=tw(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||d(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!d(r)&&(!FF.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!wk(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);u(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,CM(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=oT.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=oT.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===ZM.before||(this._product||this._initProduct(),lA(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[uz],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?cz(i,t,!0,a):dz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[uz]=e:delete s[uz]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===vF.exit&&!e.isExiting)if(e.context.animationState===vF.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===vF.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:vF.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=sf({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[uz]=t.currentStates.slice())}))}}var gz;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(gz||(gz={}));class fz extends pz{constructor(){super(...arguments),this.type=fz.type,this._marks=[],this._diffState=vF.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(hA("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?(hA("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return ew(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===vF.update){const t=this.hasAnimation(),e=CM(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=vF.update}render(){this._isCommited&&(lA(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}fz.type="group";const mz={measureText:BT};class vz{static instance(){return vz.instance_||(vz.instance_=new vz),vz.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class yz{constructor(){this.id=yA(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?hA("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class _z extends yz{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const bz=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},xz=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class Sz extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=eo.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=eo.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||bz(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=xz(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=eo.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=xz(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=bz(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=eo.now()-i>this.config.press.time&&xz(s[0],t){Ua.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:Ao.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class kz extends Az{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},y=null!==(o=v.width)&&void 0!==o?o:0,_=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const C=Ua.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:y/2,y:null!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:_/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(y+_)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,M;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},M={startAngle:x}):(T={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?T:M,"in"===b?M:T,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class Cz extends Az{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",y=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",_=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Ua.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===y?0:f,height:"in"===v&&"y"===y?0:m,fill:!0});let x={},S={};"y"===y?"negative"===_?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===_?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Tz extends SI{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=yt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&gL(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(gI(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=_h(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));mI(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const Mz={type:"fadeIn"};function wz(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return Mz;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const Ez={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},Bz={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},Pz={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},Rz=()=>{oT.registerAnimation("scaleInOut",(()=>Bz))},Oz=()=>{oT.registerAnimation("fadeInOut",(()=>Pz))},Iz=(t,e)=>({appear:wz(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Tz,duration:Ez.update.duration,easing:Ez.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),Lz=()=>{oT.registerAnimation("line",Iz)},Dz=()=>{sI.registerBuiltInAnimate("growPointsIn",VI),sI.registerBuiltInAnimate("growPointsOut",WI),sI.registerBuiltInAnimate("growPointsXIn",YI),sI.registerBuiltInAnimate("growPointsXOut",XI),sI.registerBuiltInAnimate("growPointsYIn",$I),sI.registerBuiltInAnimate("growPointsYOut",qI),sI.registerBuiltInAnimate("clipIn",MI),sI.registerBuiltInAnimate("clipOut",wI)},Fz=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class zz{constructor(t){this._markSet=new bF,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const Hz={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class jz extends zz{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},Hz,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&dz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}jz.type="element-highlight",jz.defaultOptions=Hz;const Nz=()=>{oT.registerInteractionTrigger(jz.type,jz)},Uz={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class Vz extends zz{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},Uz,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),cz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&dz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}Vz.type="element-select",Vz.defaultOptions=Uz;const Wz=()=>{oT.registerInteractionTrigger(Vz.type,Vz)};class Gz extends yz{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const Yz=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},Xz=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...Xz(t))})),s},Kz=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(Yz(t,r),!1)};class $z{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>oT.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>oT.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>oT.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return oT.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>oT.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){oT.registerTransform(t,e)}static registerFunction(t,e){t&&e&&vz.instance().registerFunction(t,e)}static unregisterFunction(t){t&&vz.instance().unregisterFunction(t)}static getFunction(t){return t?vz.instance().getFunction(t):null}static getFunctionList(){return vz.instance().getFunctionNameList()}static registerMap(t,e,i){const s=oT.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=oT.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,zM.get(e);var e}static registerSVG(t,e,i){const s=oT.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=oT.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){ST.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 ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=yA(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=rw.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=uF(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?oT.getSeriesBuiltInTheme(e):oT.getComponentBuiltInTheme(e);i=i?aT({},s,i[e]):s}s===t.length-1&&p(i)&&(i=TT({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},kk(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=gA(v);if(S?PB(i_):"node"===v&&uR(i_),S&&f&&(this._container=y(f)?e_.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=AT.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new sF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new LM(this,this._compiler),this._event=new TM(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),ST.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=aT({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=MT(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;$z.getFunctionList()&&$z.getFunctionList().length&&(t=wT(t,$z)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=oT.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=oT.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=oT.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return lF(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:RT,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:OT})}_initDataSet(t){this._dataSet=t instanceof Ra?t:new Ra,FM(this._dataSet,"dataview",Ea),FM(this._dataSet,"array",s),DM(this._dataSet,"copyDataView",WM);for(const t in oT.transforms)DM(this._dataSet,t,oT.transforms[t]);for(const t in oT.dataParser)FM(this._dataSet,t,oT.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),cF(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?$M.none:$M.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,ST.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{Yz(t)})),this._exitingVRenderComponents.clear())}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Oa?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=YM(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?aT({},t[n][e.index],i):i):t[n]=s?aT({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?aT({},t[n][r],i):i)}else t.id===e&&(t[n]=s?aT({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=aT({},t.getSpec(),e));const r=t.updateSpec(e),a=cF(r),o=dF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=lT({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=kT(this._currentThemeName),this._currentTheme=o(a,l);else{const t=lT({},kT(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),kT(n),kT(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),H(aF.poptip,rF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!gA(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return kT(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!AT.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield nF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!gA(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=y(this._canvas)?e_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?ZC(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return hA("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?ZC(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(hA("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return vz.instance().getFunction(t)}registerFunction(t,e){t&&e&&vz.instance().registerFunction(t,e)}unregisterFunction(t){t&&vz.instance().unregisterFunction(t)}getFunctionList(){return vz.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=oT.getChartPlugins();t.length>0&&(this._chartPlugin=new _z(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=oT.getVChartPlugins();e.length>0&&(this._vChartPlugin=new Gz(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=rw.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;this._renderState=rw.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent()}}$z.InstanceManager=ST,$z.ThemeManager=AT,$z.globalConfig={uniqueTooltip:!0},$z.Utils=mz,$z.vglobal=e_;oT.registerRegion("region",MF),oT.registerLayout("base",DF),XO(),EO(),oT.registerMark(fz.type,fz),oT.registerStageEventPlugin("gesture",Sz),Nz(),Wz(),vT(nT.name,nT);const qz="monotone",Zz="linear",Jz="bevel";t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));class Qz{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}function tH(t,e){return e("component",t)}function eH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=oT.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const iH=(t,e,i,s)=>{if(u(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},sH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,d(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],c=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(d(e.set))g=function(t){const i=c.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=c.get(`${e[a]}`);if(u(i))for(let i=0;i(g(t),t)))},nH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},rH=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=eH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},aH=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const oH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function lH(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=cH(rH(h,r,a,c),d,g),o.value=cH(rH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=rH(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function hH(t,e,i,s,n,r,a){if(d(e)){lH(t,e(n,a),i,s,r,a)}else e&&lH(t,e,i,s,r,a)}const cH=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=yi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class dH{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{hH(a,t,e,i,s,n,r)})):d(t)?hH(a,t,e,i,s,n,r):t&&lH(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:rH(r.visible,t,n),value:cH(rH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:rH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=rH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&oH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const uH={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?K(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?K(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},pH=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=nM([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return gH(a,n,o)},gH=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{_A(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{_A(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=uH[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},fH=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{_A(t[e])||(t[e]=0)}))})),t},mH=`${PT}_HIERARCHY_DEPTH`,vH=`${PT}_HIERARCHY_ROOT`,yH=`${PT}_HIERARCHY_ROOT_INDEX`;function _H(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function bH(t,e,i){t&&(i.needDefaultSeriesField&&(t[FT]=i.defaultSeriesField),t[LT]=e,t[DT]=i.getKey(t,e,i))}function xH(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function SH(t,e,i,s=0,n,r){void 0===r&&(r=e),bH(t,e,i),t[mH]=s,t[vH]=n||t[i.categoryField],t[yH]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>SH(e,s,i,t[mH]+1,t[vH],r)))}const AH={label:{name:"label",type:"text"}},kH=`${PT}_rect_x`,CH=`${PT}_rect_x1`,TH=`${PT}_rect_y`,MH=`${PT}_rect_y1`,wH={data:!0},EH={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},BH=[...Object.keys(Ez),"normal"];function PH(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var s;let n=t;return DH(n)&&delete n.type,n.oneByOne&&(n=OH(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:IH,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=aT({},o[e],a);return DH(n)&&delete n.type,n.oneByOne&&(n=OH(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:IH,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function RH(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=L(t,null,i),FH(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function OH(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function IH(t,e){var i;return null!==(i=null==t?void 0:t[LT])&&void 0!==i?i:e.context.graphicIndex}function LH(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function DH(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function FH(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),FH(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),FH(t[s],e,i))}function zH(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class HH extends SF{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=MC(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=oT.getSeriesMarkMap(o)?function(t,e,i){const s=oT.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=aT({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return aT({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=aT({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>aT({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const jH=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(EH[e]||(t[e]=!0),t)),{}),NH={compileOnlyKeys:EH,dataRelatedKeys:jH,seriesOnlyKeys:{tooltip:!0}},UH={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},VH=t=>(t=>g(t)&&!_(t)&&!d(t))(t)?t:u(t)?{}:null,WH=(t,e,i)=>{const s=VH(t),n=VH(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function GH(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class YH extends AF{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${PT}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=HH,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=zH(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(DM(this._rawData.dataSet,"invalidTravel",fH),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=YM(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=GM(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=GM(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new VF(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=K(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=gH(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=H(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){DM(this._dataSet,"dimensionStatistics",pH);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Oa(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&nM(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){DM(this._dataSet,"dimensionStatistics",pH);const s=new Oa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=nM(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&nM(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Oa(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:y(t)?e=>e[t]:_(t)&&t.every((t=>y(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(DM(this._rawData.dataSet,"addVChartProperty",nH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:_H.bind(this),call:bH}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:y(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=PH({},RH(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:fA(s)||mA(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=aT(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=aT(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=Fz(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=Fz(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=Fz(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:FT;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:zT,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,zT,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(oT.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new dH(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,GH(i))}_getSpecUpdatePolicy(){return NH}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},wH),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),l),!l.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>WH(t[i],e[i],UH)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&WH(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?GH(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&GH(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Oa||XM(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();zH(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:FT,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new zC).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return BC(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:FT}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),u(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),u(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,p=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${p}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,aT({},d,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:DT}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${u(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==NT&&t!==VT&&t!==jT&&t!==UT||(t=this.getStackValueField()),null!==(e=aM(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>_A(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:FT]}}function XH(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Mk(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function KH(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}YH.mark=AH,YH.transformerConstructor=HH;class $H extends YH{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);Mk(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${PT}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(NT),this.setFieldX2(jT)):(this.setFieldY(NT),this.setFieldY2(jT))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(VT),this.setFieldX2(UT)):(this.setFieldY(VT),this.setFieldY2(UT))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(GT),this.setFieldX2(WT)):(this.setFieldY(GT),this.setFieldY2(WT))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(XH("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function qH(t){return"bottom"===t||"top"===t}function ZH(t){return"left"===t||"right"===t}function JH(t){return"z"===t}function QH(t,e){return WC(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function tj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function ej(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?qH(t)?"linear":"band":qH(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const ij=(t,e,i)=>{var s;const n=null!==(s="band"===e?tH("axisBand",i):["linear","log","symlog"].includes(e)?tH("axisLinear",i):{})&&void 0!==s?s:{},r=qH(t)?tH("axisX",i):ZH(t)?tH("axisY",i):tH("axisZ",i);return aT({},tH("axis",i),n,r)};class sj{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:cA)("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:cA)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>Ek(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return qH(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class nj extends sj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:BM.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const rj=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},aj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},oj=(t,e,i,s)=>{var n;const r=e.getScale(),a=Ek(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:lj(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,hj=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class cj extends sj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!rj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:BM.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:BM.canvas}),callback:this.onMouseOut}),fA(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:BM.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),fA(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var dj;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(dj||(dj={}));const uj={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},pj={sampling:!0,samplingFactor:!0};class gj{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(uj.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:Jz,curveType:Zz,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===qz?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(uj.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:LH(this._spec,uj.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Oa(this._option.dataSet,{name:`${PT}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(dj.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[uj.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(dj.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,aT({},this._spec[uj.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const fj=Object.assign(Object.assign({},AH),uj),mj=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>mj(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},vj=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class yj extends pz{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return vj}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(wk(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?mj(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:vF.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[DT]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const _j=new Uint32Array(33),bj=new Uint32Array(33);bj[0]=0,_j[0]=~bj[0];for(let t=1;t<=32;++t)bj[t]=bj[t-1]<<1|1,_j[t]=~bj[t];function xj(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&_j[31&o]&bj[1+(31&l)])return!0}else{if(i[h]&_j[31&o])return!0;if(i[c]&bj[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,_j[31&o]&bj[1+(31&l)]);else for(s(h,_j[31&o]),s(c,bj[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,bj[31&a]|_j[1+(31&o)]);else for(n(l,bj[31&a]),n(h,_j[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function Sj(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=yt(i,-o,t.width+l),d=yt(s,-o,t.width+l),u=yt(n,-a,t.height+h),p=yt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function Aj(t,e,i=!1){return i?Sj(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function kj(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=Aj(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=Sj(t,r)),e.getRange(r)))}function Cj(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return Cj(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return Cj(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return Cj(t,e,n,s,h,c)}return!1}const Mj=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],wj=["top","inside-top","inside"];function Ej(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const Bj={mode:"same-time",duration:300,easing:"linear"};function Pj(t){return 3===t||4===t}function Rj(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const Oj=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function Ij(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}class Lj extends AI{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class Dj extends AI{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const Fj=(t,e)=>Math.ceil(t)>Math.floor(e),zj=([t,e],[i,s])=>s>t&&e>i;function Hj(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const jj=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Nj extends ef{constructor(t,e){super(t),this._skipRenderAttributes=jj,(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?H(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{Wj(t,e,i)})),e}function Gj(t,e){e&&(null==t||t.onComplete.push(e))}function Yj(t){t.forEach((t=>{t()}))}function Xj(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var Kj=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(jA.hover,!0),xA(this,(t=>{t===e||P(t.states)||t.addState(jA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(xA(this,(t=>{P(t.states)||(t.removeState(jA.hoverReverse),t.removeState(jA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void xA(this,(t=>{P(t.states)||(t.removeState(jA.selectedReverse),t.removeState(jA.selected))}));P(e.states)||(e.addState(jA.selected,!0),xA(this,(t=>{t===e||P(t.states)||t.addState(jA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===Ao.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Ao.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[Ij(g,f,c,d,a,o),Ij(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=DA.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Ml)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),Yj(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Gj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(Bj),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=Wj(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=Wj(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},Xj(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(d(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(a);const o=[],l=a;if(!c(t)&&d(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}d(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return KA(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&Fj(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&Fj(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(Hj([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!zj([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(Aj(i,e,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(Aj(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(Aj(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;Vj(i,null==n?void 0:n.attribute),Vj(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{qj[t]=e};var Jj=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};Qj.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const tN=()=>{Zj("line",Qj),Zj("area",Qj)};var eN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}iN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const sN=()=>{Zj("symbol",iN),Zj("line-data",iN)};class nN extends yj{constructor(){super(...arguments),this.type=nN.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)===CC.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}nN.type="line";const rN=()=>{oT.registerMark(nN.type,nN),XO(),OO(),tN(),sN(),Dz(),oT.registerGraphicComponent("line",sg)};class aN extends pz{constructor(){super(...arguments),this.type=aN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}aN.type="symbol";const oN=()=>{oT.registerMark(aN.type,aN),XO(),ZO(),sN(),oT.registerGraphicComponent("symbol",tg)};class lN extends HH{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function hN(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function cN(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function dN(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function uN(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function pN(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function gN(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const fN=t=>t.map(((t,e)=>({index:e,value:t}))),mN=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},vN=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=WA(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return fN(v)};class bN{constructor(t){this.id=yA(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class xN extends bN{constructor(){super(xN.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Mk(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&hN(c)&&hN(d)))return;const u=cN(t,c),p=cN(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=u,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!uN(u,p))return}else if(0===_&&0===b){if(!uN(p,u))return}else if(y||A)if(y&&!A){if(!dN(u,p))return}else if(A&&!y){if(!dN(p,u))return}else{if(f===b)return;if(f>b){if(!pN(u,p))return}else if(!pN(p,u))return}else{if(0===f&&0===_){if(!gN(u,p))return}else if(0===b&&0===g&&!gN(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){DM(e.getOption().dataSet,"tickAlign",_N);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}xN.pluginType="component",xN.type="AxisSyncPlugin";const SN={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function AN(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function kN(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function CN(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const TN=t=>"band"===t||"ordinal"===t||"point"===t;function MN(t,e){return{id:t,label:t,value:e,rawValue:t}}function wN(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class EN extends yz{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const BN=`${PT}_ARC_TRANSFORM_VALUE`,PN=`${PT}_ARC_RATIO`,RN=`${PT}_ARC_START_ANGLE`,ON=`${PT}_ARC_END_ANGLE`,IN=`${PT}_ARC_K`,LN=`${PT}_ARC_MIDDLE_ANGLE`,DN=`${PT}_ARC_QUADRANT`,FN=`${PT}_ARC_RADIAN`,zN=-Math.PI/2,HN=3*Math.PI/2,jN=.6,NN=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},UN=(t,e,i)=>{var s;const n=null!==(s="band"===e?tH("axisBand",i):"linear"===e?tH("axisLinear",i):{})&&void 0!==s?s:{},r=tH("angle"===t?"axisAngle":"axisRadius",i);return aT({},tH("axis",i),n,r)};function VN(t,e,i,s){switch(t){case r.cartesianBandAxis:return ij(QH(i,["z"]),"band",e);case r.cartesianLinearAxis:return ij(QH(i,["z"]),"linear",e);case r.cartesianLogAxis:return ij(QH(i,["z"]),"log",e);case r.cartesianSymlogAxis:return ij(QH(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return ij(QH(i),void 0,e);case r.polarBandAxis:return UN(i.orient,"band",e);case r.polarLinearAxis:return UN(i.orient,"linear",e);case r.polarAxis:return UN(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=tH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>qH(t.orient)));let g;g=p(u)?aT({},TN(u.type)?a:o,l):l;const f=n.find((t=>ZH(t.orient)));let m;return m=p(f)?aT({},Ek(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=tH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?aT({},TN(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?aT({},Ek(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return WN(i,tH(t,e));default:return tH(t,e)}}const WN=(t,e)=>{var i;const s=aT({},e,e[tj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class GN extends SF{getTheme(t,e){return VN(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},qC(e)),{[s]:0}))}}class YN extends CF{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=GN,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof to||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:BM.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new EN(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;Yz(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=Xz(t),s=Kz(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}Yz(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var XN,KN;YN.transformerConstructor=GN,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(XN||(XN={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(KN||(KN={}));class $N extends pz{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=Kz(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?Yz(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(Yz(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=oT.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(MM.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}$N.type="component";const qN=()=>{oT.registerMark($N.type,$N)};var ZN,JN;!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.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(ZN||(ZN={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(JN||(JN={}));const QN={[JN.selectedReverse]:{},[JN.selected]:{},[JN.hover]:{},[JN.hoverReverse]:{}},tU=t=>t,eU={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class iU extends YN{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?XN.circleAxis:XN.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?KN.circleAxisGrid:KN.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=PH(null===(h=oT.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new VF(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&bk(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?Mk(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!Mk(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return bk(this._regions,(e=>{var i;_(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=xk(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),bk(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):bk(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(bk(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=K(t.map((t=>t.fields.length)));for(let t=1;tV(null==e?void 0:e[i],null==t?void 0:t[i])||eU[i]))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=yM(s=t.domainLine)).startSymbol=yM(s.startSymbol),s.endSymbol=yM(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=j(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return xM(aT({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:xM(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>xM(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=xM(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return xM(aT({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:xM(t.tick.style)),t.tick.state&&(i.tick.state=_M(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return xM(aT({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:xM(t.subTick.style)),t.subTick.state&&(i.subTick.state=_M(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=SN[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:aT({},d,xM(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:xM(h.style)}),h.state&&(i.title.state.shape=_M(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:xM(o.style)}),o.state&&(i.title.state.background=_M(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=_M(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=xM(t.background.style)),t.background.state&&(i.panel.state=_M(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:ET(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return xM(aT({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:xM(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:ET(t.subGrid.alternateColor),style:xM(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=eH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){FM(this._option.dataSet,"scale",tU);const i=this.registerTicksTransform();return new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===ZN.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}iU.specKey="axes";const sU=()=>{qN(),oT.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},nU=[xN];class rU extends iU{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),bk(this._regions,(t=>{const e=this.getOrient();qH(e)?wN(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):ZH(e)?wN(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):JH(e)&&wN(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=aT({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(aT({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=qH(this.getOrient()),n=t=>{var e;return(s?!qH(t.getOrient()):qH(t.getOrient()))&&Mk(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=QH(i,["z"]),JH(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!CN(e))return null;const{axisType:t,componentName:s}=ej(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>ZH(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!CN(t))return;const{axisType:s,componentName:n}=ej(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=oT.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return qH(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):JH(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(nU.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){qH(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!qH(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!JH(this.getOrient())&&this._spec.innerOffset){const t=this._spec;ZH(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=XC(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=XC(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=qH(this.getOrient())?t.fieldX:JH(this.getOrient())?t.fieldZ:t.fieldY,Mk(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:Mk(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(MM.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(qH(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=qH(this._orient)?{x:K(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return bk(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:qH(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:JH(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();bk(this._regions,(e=>{qH(t)?wN(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):ZH(t)?wN(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):JH(t)&&wN(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=qH(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&_(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=qH(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=aT(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ue).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=qH(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?yt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):yt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return MN(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:Mk(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}rU.type=r.cartesianAxis,rU.specKey="axes";class aU{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new VF(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=MN(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>MN(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const oU=(t,e,i,s)=>{const n=yN(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},lU=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,hU=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?fN([s[s.length-1]]):fN([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(g),a=K(g);if(s.length<=f/n){const i=oU(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=dU(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=oU(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!lU(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?hU(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function pU(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=lk(t,!!n),o=lk(r,!!n);const h=ae.distancePP(s,l),c=ae.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=uU(e,t,!1,!!n),o=uU(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=lk(t,!!n),o=lk(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class gU extends Nj{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&nk(this._innerView),this.removeAllChild(!0),this._innerView=DA.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return rk(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=H({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${ZN.grid}-sub`:`${ZN.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=lk(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=uU(t,o,!1,!!a)}const u=DA.path(Object.assign({path:c,z:l},d(r)?H({},this.skipDefault?null:gU.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=lk(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=DA.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ht/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?H({},this.skipDefault?null:gU.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}gU.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class fU{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=OA(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return RA([n[1],-1*n[0]],t*(e?1:-1)*s)}}class mU extends AI{onBind(){var t;const e=_L(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;Vj(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class vU extends AI{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;Vj(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function yU(){EO(),OO(),GO(),QO(),sI.registerBuiltInAnimate("axisEnter",mU),sI.registerBuiltInAnimate("axisUpdate",vU)}EO(),LO();class _U extends gU{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},gU.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=FA,endAngle:r=zA}=this.attribute;i=ok(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=H({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function bU(){EO(),OO(),FO(),ZO()}function xU(){EO(),OO(),_O(),ZO()}G(_U,fU),bU();class SU extends Nj{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},SU.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=DA.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=DA.line;Y(i)[0].cornerRadius&&(t=DA.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=DA.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}SU.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}}},xU();class AU extends SU{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},SU.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=DA.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function kU(){EO(),NO(),ZO(),GO(),QO()}var CU=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-E)):j>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-E/2));const N="right"===_||"end"===_,U="left"===_||"start"===_,V=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:Y(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=T-b[1]-b[3],e=I+E,i=1===j?(t-e)/2+E+I/2:b[0]+E-(T/2+e/2-E)+I/2;if(V(i,"center"),A){const t=i-I/2-E+F/2;A.setAttributes({x:t})}}if(U&&1!==j){const t=T-b[1]-b[3],e=0===j?-t/2+E/2:-T+b[3]+b[1]+E;if(V(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=T-b[1]-b[3],e=0===j?t/2+E/2:t;if(V(e,"right"),A){const t=e-I-E+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===H&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(O.states=m.text);const{visible:W}=a,G=CU(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:M,x:k,y:C}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Ml)}this._bgRect=t}this._textShape=O,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:H({},TU.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}TU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const MU=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(jA.hover,!0),xA(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(jA.hoverReverse,!0)})),s):i},wU=(t,e,i)=>i?(xA(e,(t=>{t.name&&!P(t.states)&&(t.removeState(jA.hoverReverse),t.removeState(jA.hover))})),null):i,EU=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(jA.selected)?(xA(e,(t=>{t.name&&!P(t.states)&&(t.removeState(jA.selectedReverse),t.removeState(jA.selected))})),null):s.name&&!P(s.states)?(s.addState(jA.selected,!0),xA(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(jA.selectedReverse,!0)})),s):i},BU={type:"default",duration:300,easing:"linear"};class PU extends Uj{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=MU(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=wU(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=EU(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=DA.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),Yj(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Gj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(xA(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=Wj(this),{delay:a=0,duration:o=BU.duration,easing:l=BU.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};Vj(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=Wj(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},Xj(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&nk(this._innerView),this.removeAllChild(!0),this._innerView=DA.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(BU)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=DA.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=ZN.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=DA.group({x:0,y:0,pickable:!1});t.name=ZN.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=DA.group({x:0,y:0,pickable:!1});i.name=ZN.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=DA.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=ZN.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=NA;else{const t=this.data[s],e=H({},NA,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=DA.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=ZN.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=NA;else{const i=H({},NA,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=DA.group({x:0,y:0,pickable:!1});return r.name=`${ZN.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=KA(this._getLabelAttribute(t,e,n,i));if(a.name=ZN.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=NA;else{const s=H({},NA,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new TU(Object.assign({},e));i.name=ZN.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return rk(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=Ht/2*(l.x>e.x?1:-1):h=Ht/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=d(y)?H({},QA.label.style,y(t,e,i,s)):y;y=H(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return d(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},xA(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=L(r.attribute),a=L(e.attribute),o=Cb(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},Vj(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const RU={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&hk(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function OU(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function IU(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:RU[n]||RU.parity;if(s.length>=3&&ck(s,r)){do{s=a(s,r)}while(s.length>=3&&ck(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);hk(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),IU(l,s,n,(t=>hk(t,l,r))),IU(h,s,o,(t=>hk(t,h,r)||!(!n||t===l)&&hk(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function DU(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},HU(t,e.attribute.angle)),{angle:zU(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({},jU(t,e.attribute.angle)),{angle:zU(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function zU(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function HU(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=zU(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function jU(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=zU(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function NU(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=sk(h),m=ik(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function UU(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var VU=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=DA.group({zIndex:999});e.name=ZN.axisBreak,e.id=this._getNodeId(`${ZN.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=H({},tk,s),a=null!==(e=r.size)&&void 0!==e?e:tk.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=DA.symbol(Object.assign({x:s.x,y:s.y},o));l.name=ZN.axisBreakSymbol;const h=DA.symbol(Object.assign({x:n.x,y:n.y},o));h.name=ZN.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=DA.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=ZN.background,n.id=this._getNodeId("background"),n.states=H({},QN,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new TU(Object.assign({},t));e.name=ZN.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=VU(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:H({},QN,l),symbol:H({},QN,l)});const d=new SU(c);d.name=ZN.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=VU(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let T,M,{angle:w}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=IA(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else T=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(w&&0!==w){const t=Math.abs(Math.sin(w));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:M},a),state:{text:H({},QN,c.text),shape:H({},QN,c.shape),panel:H({},QN,c.background)}});return B.angle=w,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=VU(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(u(b)&&a){b=IA(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return HU(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return jU(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),FU(i,t),!DU(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=sk(a),l=ik(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=UU(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Xt(c,i))}}else{if(l){const i=UU(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Xt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);NU(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&LU(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=DA.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=ZN.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=GA(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=oi(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}WU.defaultAttributes=QA,G(WU,fU);const GU={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},YU={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},XU={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},KU={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}};class $U extends rU{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new qk}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,cU),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Nk(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),sU(),oT.registerComponent($U.type,$U,!1)},ZU=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function JU(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,tV=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function eV(t,e,i="count"){const s=tV(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const iV=Math.sqrt(50),sV=Math.sqrt(10),nV=Math.sqrt(2);class rV{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=kN(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=qH(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!d(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(X(e)-e[0]);i<=1||k(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(QU),e.sort(QU),{domain:JU(t,e),scope:eV(t,e,i)}}(r,aA(t),this._spec.breaks[0].scopeType);e=aA(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=kN(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-K(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=iV?10:n>=sV?5:n>=nV?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function aV(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function oV(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!Mk(t.type))return fN(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return fN([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=aV(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=aV(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=aV(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=yN(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=yN(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?hV.greedy:hV.parity;for(;l.length>=3&&ck(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;hk(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),oV(t,l,a,(e=>hk(e,t,i))),oV(n,l,o,(e=>hk(e,n,i)||!(!a||e===t)&&hk(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return fN(m)},hV={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&hk(i,t,e)||(i=t,0))))}},cV={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class dV extends rU{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new vC}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!JH(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=qH(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=GC(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=aA(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,lV),t}}dV.type=r.cartesianLinearAxis,dV.specKey="axes",dV.builtInTheme={axis:YU,axisLinear:cV,axisX:XU,axisY:KU},G(dV,rV);const uV=()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),sU(),oT.registerComponent(dV.type,dV)},pV=`${PT}_hide_`;function gV(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const fV=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[pV]&&(gV(t,!0),t[pV]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[pV]=!0,gV(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},mV=()=>{oT.registerGrammarTransform("symbolOverlap",{transform:fV,runType:"afterEncode"})},vV={min:$,max:K,average:fk,sum:gk};function yV(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function _V(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function bV(t,e,i,s){return _V(t,e,i,"min",s)}function xV(t,e,i,s){return _V(t,e,i,"max",s)}function SV(t,e,i,s){return _V(t,e,i,"average",s)}function AV(t,e,i,s){return _V(t,e,i,"sum",s)}const kV=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=yV;if("min"===n?l=bV:"max"===n?l=xV:"average"===n?l=SV:"sum"===n&&(l=AV),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},CV=()=>{oT.registerGrammarTransform("dataSampling",{transform:kV})};class TV extends $H{constructor(){super(...arguments),this.type=CC.line,this.transformerConstructor=lN,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),pj)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),RH("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=KH(this);this._symbolMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),RH("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}TV.type=CC.line,TV.mark=fj,TV.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},TV.transformerConstructor=lN,G(TV,gj);class MV{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{XM(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Oa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];hA(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];hA(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class wV{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{bA(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{nM(e,[{key:t,operations:Mk(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&nM(e,[{key:i.field,operations:Mk(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?jC("colorOrdinal"):jC(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(bA(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),bA(s.domain)?e.reRender=!0:V(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!bA(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Mk(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Mk(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;Mk(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(Mk(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Mk(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Mk(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class EV{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");cz(t,s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");dz(t,s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");dz(t,s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");cz(t,s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&cz(t,i,!0,l):a&&cz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&cz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{dz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&dz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const BV={[r.markPoint]:!0,[r.markLine]:!0,[r.markArea]:!0},PV={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class RV extends xF{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=yA(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:RT,height:OT},this._viewRect={width:RT,height:OT},this._viewBox={x1:0,y1:0,x2:RT,y2:OT},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(PV).some((t=>!u(e[t])))},this._paddingSpec=qC(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new TM(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new MV(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new EV;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=oT.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(PH({},RH("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=j(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=oT.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=oT.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof AF)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof pz))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof pz)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&XM(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=lF(this._spec,this._option,{width:RT,height:OT})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=BC(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new wV(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){uF(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=BC(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=qC(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{uF(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},n={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===r.label||l.type===r.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));n[l.type]&&(n[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(_(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);dF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),uF(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);dF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),uF(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(n).forEach((e=>{if(n[e]){const i=this._spec[e];(_(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(BV[t]&&_(e)&&_(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return BV[t]&&_(e)&&e.length>0&&_(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!BV[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;BV[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];uF(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=KC(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(MM.AFTER_MARK_RENDER_END,e)};this._event.on(MM.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:kM;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(AM(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===dj.dimensionHover||s===dj.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>Ek(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>Ek(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const OV=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)},IV={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class LV{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},IV),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):rT(t,a,c.spec),rT(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=OV(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=OV(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(oT.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(oT.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=oT.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=oT.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=oT.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):iH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=iH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class DV extends LV{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&aT(i,pF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class FV extends DV{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),oF(t)}}const zV=(t,e)=>{const i={nodes:{}},{fields:s}=d(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=oM(t,!0);for(const e in o)for(const i in o[e].nodes)dM(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)cM(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&hM(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class jV{_beforeInit(){this._dataSet&&DM(this._dataSet,"stackSplit",zV)}_initStack(){this._stack=new HV(this),this._stack.init()}}const NV={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:dj.dimensionHover};class UV extends zz{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},NV,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=kM(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}UV.type="dimension-hover",UV.defaultOptions=NV;const VV=()=>{oT.registerInteractionTrigger(UV.type,UV)},WV=()=>{oT.registerComposedEvent(dj.dimensionHover,cj),oT.registerComposedEvent(dj.dimensionClick,nj)},GV=t=>t.fieldX[0],YV=t=>t.fieldY[0],XV=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},KV=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},$V=(t,e)=>t?e?GV:XV:e?YV:KV,qV=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=hj(t,(t=>qH(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=hj(t,(t=>ZH(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Ek(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=ZV(t,i,$V(e,Ek(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=ZV(t,i,$V(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},ZV=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:JV(t,s,i)},JV=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=oj(e,t,"cartesian",null!=i?i:qH(t.getOrient())?GV:YV);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},QV=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(Ek(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(Mk(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=AN(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};eW(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&tW(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),tW=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=eH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},eW=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},iW=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=sW(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},sW=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},nW=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return QV(c,r,e),c.xField.cacheInfo?iW(c.xField):c.yField.cacheInfo?iW(c.yField):void 0},rW=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],aW=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&rW.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(oW(s).every((t=>{var e;return!oH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},oW=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},lW={dom:`${PT}_TOOLTIP_HANDLER_DOM`,canvas:`${PT}_TOOLTIP_HANDLER_CANVAS`},hW={key:"其他",value:"..."};var cW;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(cW||(cW={}));class dW{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=aW(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},hW),t):hW;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&oH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class uW extends dW{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Ek(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const pW=()=>{oT.registerTooltipProcessor("dimension",uW)};class gW extends dW{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,So.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(kM(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const fW=()=>{oT.registerTooltipProcessor("mark",gW)};class mW extends dW{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const vW=()=>{oT.registerTooltipProcessor("group",mW)};class yW extends RV{constructor(){super(...arguments),this.transformerConstructor=FV,this.type="line",this.seriesType=CC.line}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}yW.type="line",yW.seriesType=CC.line,yW.transformerConstructor=FV,G(yW,jV);const _W=[...vj,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class bW extends yj{constructor(){super(...arguments),this.type=bW.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return _W}_getIgnoreAttributes(){return[]}}bW.type="area";const xW=()=>{oT.registerMark(bW.type,bW),XO(),AO(),tN(),sN(),Dz(),oT.registerGraphicComponent("area",Gg)};class SW extends dH{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const AW=Object.assign(Object.assign(Object.assign({},AH),uj),{area:{name:"area",type:"area"}}),kW=()=>{oT.registerAnimation("area",Iz),Lz(),Rz()};class CW extends lN{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=aT({},f.style,g.style),l.state=aT({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function TW(){EO(),NO()}function MW(){return"browser"===e_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const wW={debounce:St,throttle:At};TW();let EW=class t extends Nj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=yt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=yt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=MW(),a="browser"===e_.env?e_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=yt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:wW[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(VA,{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",wW[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===e_.env?e_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:oi(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=oi(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=yt(t[0],0,1),c=yt(t[1],0,1),d=yt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=MW(),e="browser"===e_.env?e_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===e_.env?e_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};EW.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class BW{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ue).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=BW.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(VA,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new EW(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Xt(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Xt(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ht/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ht/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ht,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}HW.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class jW{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};H(s,HW.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new HW(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,H(e,aF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class NW{constructor(){this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class UW extends NW{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class VW extends NW{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function WW(t){t.isBound(jW)||(t.bind(jW).toSelf().inSingletonScope(),t.bind(Wy).toService(jW)),t.isBound(UW)||(t.bind(UW).toSelf(),t.bind(Pf).toService(UW)),t.isBound(VW)||(t.bind(VW).toSelf(),t.bind(Pf).toService(VW))}class GW extends Nj{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}EO(),OO();class YW extends GW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},YW.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}YW.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},EO(),NO();class XW extends GW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},XW.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}XW.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},EO(),_O();class KW extends GW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},KW.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}KW.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},EO(),_O();class $W extends GW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},$W.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=FA,endAngle:s=zA}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}$W.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},EO(),LO();class qW extends GW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},qW.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ce(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}qW.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class ZW{isInValidValue(t){const{startAngle:e=FA,endAngle:i=zA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=FA,endAngle:i=zA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return ak(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function JW(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=JW(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var eG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=ok(n,l,c,e,i);h=DA.path(Object.assign(Object.assign({},a.style),{path:lk(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=DA.circle(t)}h.name=ZN.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=H({},QN,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=eG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;u(_)&&(_=0===r?"end":"middle"),"start"===_?(y="bottom",g={x:s.x,y:s.y-v}):"end"===_&&(y="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:y,textAlign:"center"},l),state:{text:H({},QN,d.text),shape:H({},QN,d.shape),panel:H({},QN,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=JW(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&QW(e,c,i)}else e.AABBBounds.width()>r&&QW(e,r,i)}else o>a.x&&h.x2>n.x2?(QW(e,n.x2-o,i),r&&tG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}iG.defaultAttributes=QA,G(iG,ZW);const sG=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=WA(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=rk(r,ak(s,r,e,n));return o=a,l=ak(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(gt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return fN(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=sG(t,i,e),r=$(s),l=K(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=rG(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return fN(c)},rG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&mN(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var aG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new hG(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):Pj(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=Pj(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=Pj(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=Pj(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?Pj(t.quadrant)?"left":"right":Pj(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(Pj(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),Yj(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Gj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}uG.defaultAttributes={pickable:!1};var pG,gG,fG,mG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(vG,ZW),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(pG||(pG={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(gG||(gG={})),function(t){t.dataZoomChange="dataZoomChange"}(fG||(fG={}));const yG="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",_G={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:yG,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:yG,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},bG={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}},xG=0,SG=1,AG=2,kG=3,CG=4,TG=5,MG=5,wG=999,EG=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var BG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:AG},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:AG},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:xG},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,T;const{orient:M,middleHandlerStyle:w={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(w.visible){const t=(null===(i=w.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t,zIndex:TG},null===(s=w.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=w.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=w.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:TG},w.icon),{pickable:!P&&(null===(h=w.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},bG.horizontal),{zIndex:TG}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},bG.horizontal),{zIndex:TG}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:wG},bG.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:wG},bG.horizontal),{pickable:!P}),"rect")}else{if(w.visible){const t=(null===(g=w.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D,zIndex:TG},null===(f=w.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=w.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=w.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:TG},w.icon),{pickable:!P&&(null===(S=null===(x=w.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},bG.vertical),{zIndex:TG}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(C=B.symbolType)&&void 0!==C?C:"square",zIndex:TG},bG.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:wG},bG.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:wG},bG.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:kG},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:kG},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:SG},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:CG},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return kb(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ue).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=BG(c,["formatMethod"]),{formatMethod:g}=d,f=BG(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,T,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},T={textAlign:EG(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:EG(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:EG(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:EG(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),H({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:MG}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),H({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:MG}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new TU(e),s.name=i,t.add(s)),s}}const RG={debounce:St,throttle:At};class OG extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=pG.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=pG.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=pG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=pG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=pG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===e_.env?e_:this.stage,s=MW();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===pG.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===pG.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===pG.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===pG.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(gG.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(gG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(gG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===pG.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(gG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(gG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:RG[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===e_.env?e_:this.stage,e=MW();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===e_.env?e_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===e_.env?e_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:yt(e+t,0,1),end:yt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=pG.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}kU(),NO(),ZO(),AO(),OO();let IG=class t extends Nj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,y;h.visible?this._isHorizontal?(m=p,v=g-f,y={x:a.x,y:a.y+f}):(m=p-f,v=g,y={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,y=a);const _=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(_+b)/2,y={x:y.x+_/2,y:y.y}):(v-=(_+b)/2,y={x:y.x,y:y.y+_/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new PG(this._getRendererAttrs()),this._interaction=new OG(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(gG.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(gG.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(fG.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(gG.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(fG.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var LG,DG,FG,zG;function HG(){EO(),kU(),SD()}IG.defaultAttributes=_G,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(LG||(LG={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(DG||(DG={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(FG||(FG={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(zG||(zG={}));class jG extends Nj{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=MU(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=wU(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=EU(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:H({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:H({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:H({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=DA.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=DA.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=DA.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),Yj(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Gj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=Wj(this);this.markerAnimate("exit");const n=Wj(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},Xj(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function NG(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function UG(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;Vj(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function VG(t,e,i,s){t&&(UG(t.startSymbol,e,i,s),NG(t).forEach((t=>UG(t,e,i,s))),UG(t.endSymbol,e,i,s))}function WG(t,e,i,s){t&&(UG(t.getTextShape(),e,i,s),UG(t.getBgRect(),e,i,s))}function GG(t,e,i,s){var n,r,a,o;t&&(Vj(t,{fillOpacity:0,strokeOpacity:0},{fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function YG(t,e,i,s){t&&(GG(t.startSymbol,e,i,s),NG(t).forEach((t=>GG(t,e,i,s))),GG(t.endSymbol,e,i,s))}function XG(t,e,i,s){t&&(GG(t.getTextShape(),e,i,s),GG(t.getBgRect(),e,i,s))}function KG(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;UG(t.startSymbol,s,r,n);const h=NG(t);h.forEach((t=>Vj(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),UG(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;UG(t.getTextShape(),e,l,n),UG(t.getBgRect(),e,l,n)}))}function $G(t,e,i,s,n){VG(t,s,i,n),Y(e).forEach((t=>{WG(t,s,i,n)}))}function qG(t,e,i,s,n){UG(t,s,i,n),Y(e).forEach((t=>{WG(t,s,i,n)}))}function ZG(t,e,i,s,n){UG(t,s,i,n),Y(e).forEach((t=>{WG(t,s,i,n)}))}function JG(t,e,i,s,n,r){var a;VG(t,n,s,r),UG(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?WG(i,n,s,r):UG(i,n,s,r)}function QG(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;UG(t.startSymbol,n,o,r);const u=NG(t);u.forEach((t=>Vj(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),UG(e,n+o+l,h,r),UG(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(UG(i.getTextShape(),n+o+l+h+c,d,r),UG(i.getBgRect(),n+o+l+c,d,r)):UG(i,n+o+l+c,d,r)}function tY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?KG(t,e,s,r,a):"fadeIn"===i&&$G(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?KG(t,e,s,n,a):"fadeIn"===i&&$G(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){YG(t,s,i,n),Y(e).forEach((t=>{XG(t,s,i,n)}))}(t,e,i,s,n)}}function eY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&qG(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&qG(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){GG(t,s,i,n),Y(e).forEach((t=>{XG(t,s,i,n)}))}(t,e,i,s,n)}}function iY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&ZG(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&ZG(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){GG(t,s,i,n),Y(e).forEach((t=>{XG(t,s,i,n)}))}(t,e,i,s,n)}}function sY(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?JG(n,r,e,i,s,o):"callIn"===t&&QG(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?JG(n,r,e,i,s,a):"callIn"===t&&QG(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;YG(t,n,s,r),GG(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?XG(i,n,s,r):GG(i,n,s,r)}(n,r,e,t,i,s)}}const nY={type:"clipIn",duration:500,easing:"linear",delay:0},rY={type:"fadeIn",duration:500,easing:"linear",delay:0},aY={type:"callIn",duration:500,easing:"linear",delay:0},oY={type:"fadeOut",duration:500,easing:"linear",delay:0};class lY{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=H({},i,s),c=new TU(Object.assign(Object.assign({},h),{state:{panel:H({},NA,null!==(o=a[n])&&void 0!==o?o:X(a)),text:H({},NA,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=H({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:H({},NA,null!==(a=r[s])&&void 0!==a?a:X(r)),text:H({},NA,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class hY extends jG{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=nY,this.defaultExitAnimation=oY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;JA(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(hY,lY);const cY=.001,dY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:LG.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]}},uY={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},pY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:FG.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},gY={interactive:!0,label:{position:DG.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}},fY={interactive:!0,label:{autoRotate:!0,position:FG.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},mY={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},yY={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function _Y(){bY._animate=tY}HG(),bU(),SD();class bY extends hY{markerAnimate(t){bY._animate&&this._animationConfig&&bY._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},bY.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(AA(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return kA(Math.abs(e),Math.PI/2,cY)||kA(Math.abs(e),3*Math.PI/2,cY)?CA(i,e,t):AA(e)?uY.postiveXAxis[t]:uY.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new SU({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:H({},NA,null==a?void 0:a.line),startSymbol:H({},NA,null==a?void 0:a.lineStartSymbol),endSymbol:H({},NA,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:H({},NA,null==a?void 0:a.line),startSymbol:H({},NA,null==a?void 0:a.lineStartSymbol),endSymbol:H({},NA,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",bY.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(bY.defaultAttributes.label)}}function xY(){SY._animate=eY}bY.defaultAttributes=dY,HG(),FO(),SD();class SY extends jG{markerAnimate(t){SY._animate&&this._animationConfig&&SY._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},SY.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=rY,this.defaultExitAnimation=oY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},vY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;JA(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=DA.polygon(Object.assign({points:e},i));n.states=H({},NA,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",SY.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=H({},NA,null==i?void 0:i.area)),this._updateMarkLabels(SY.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}SY.defaultAttributes=gY,G(SY,lY),HG(),xU(),SD();class AY extends hY{markerAnimate(t){AY._animate&&this._animationConfig&&AY._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},AY.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case FG.arcInnerStart:l=n;case FG.arcOuterStart:l=n;break;case FG.arcInnerEnd:l=r;case FG.arcOuterEnd:l=r;break;case FG.center:case FG.arcInnerMiddle:case FG.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return mY[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new AU({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},NA,null==o?void 0:o.line),startSymbol:H({},NA,null==o?void 0:o.lineStartSymbol),endSymbol:H({},NA,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},NA,null==o?void 0:o.line),startSymbol:H({},NA,null==o?void 0:o.lineStartSymbol),endSymbol:H({},NA,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",AY.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(AY.defaultAttributes.label)}}AY.defaultAttributes=pY,HG(),_O(),SD();class kY extends jG{markerAnimate(t){kY._animate&&this._animationConfig&&kY._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},kY.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=rY,this.defaultExitAnimation=oY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case FG.center:h=(s+n)/2,c=(r+a)/2;break;case FG.arcInnerStart:h=s,c=r;break;case FG.arcOuterStart:h=n,c=r;break;case FG.arcInnerEnd:h=s,c=a;break;case FG.arcOuterEnd:h=n,c=a;break;case FG.arcInnerMiddle:h=s,c=(r+a)/2;break;case FG.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},mY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;JA(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=DA.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=H({},NA,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",kY.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=H({},NA,null==o?void 0:o.area)),this._updateMarkLabels(kY.defaultAttributes.label)}isValidPoints(){return!0}}function CY(){TY._animate=sY}kY.defaultAttributes=fY,G(kY,lY),HG(),bU(),xU(),ZO(),PO(),OO(),SD();class TY extends jG{markerAnimate(t){TY._animate&&this._animationConfig&&TY._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},TY.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=aY,this.defaultExitAnimation=oY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return kA(Math.abs(s),Math.PI/2,cY)||kA(Math.abs(s),3*Math.PI/2,cY)?CA(t,s,n):AA(s)?yY.postiveXAxis[n]:yY.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=zG.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:H({},NA,null==p?void 0:p.textBackground),text:H({},NA,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=H({},NA,null==p?void 0:p.itemContent));const v=AA(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=DA.symbol(Object.assign(Object.assign({},i),r)),o.states=H({},NA,null==s?void 0:s.itemContent)):"text"===n?o=new TU(Object.assign(Object.assign({},i),{state:{panel:H({},NA,null==s?void 0:s.textBackground),text:H({},NA,null==s?void 0:s.itemContent)}})):"richText"===n?(o=DA.richtext(Object.assign(Object.assign({},i),r)),o.states=H({},NA,null==s?void 0:s.itemContent)):"image"===n?(o=DA.image(Object.assign(Object.assign({},i),r)),o.states=H({},NA,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=H({},NA,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=kA(c,0,cY)||kA(d,0,cY),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=qA(e-u,t-d),o=qA(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(LY.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(LY.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===LY.focus||"focus"===o){const s=a.hasState(OY.focus);a.toggleState(OY.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[OY.unSelected,OY.unSelectedHover,OY.focus],t),this._setLegendItemState(e,OY.selected,t)})):(this._setLegendItemState(a,OY.selected,t),this._removeLegendItemState(a,[OY.unSelected,OY.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[OY.selected,OY.selectedHover,OY.focus],t),this._setLegendItemState(e,OY.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(OY.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(OY.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(IY.legendItemClick,a,t);i?(this._removeLegendItemState(a,[OY.selected,OY.selectedHover],t),this._setLegendItemState(a,OY.unSelected,t)):(this._setLegendItemState(a,OY.selected,t),this._removeLegendItemState(a,[OY.unSelected,OY.unSelectedHover],t))}else this._setLegendItemState(a,OY.selected,t),this._removeLegendItemState(a,[OY.unSelected,OY.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[OY.selected,OY.selectedHover],t),this._setLegendItemState(e,OY.unSelected,t))}))}this._dispatchLegendEvent(IY.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,OY.selected),this._removeLegendItemState(e,[OY.unSelected,OY.unSelectedHover])):(this._removeLegendItemState(e,[OY.selected,OY.selectedHover]),this._setLegendItemState(e,OY.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=BY,spaceRow:l=PY,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,T=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),M.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=DA.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(y,t,e,i,s),k=this._handleStyle(b,t,e,i,s),C=this._handleStyle(x,t,e,i,s),T=oi(c);let M;!1===x.visible?(M=DA.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,LY.item,t,M)):(M=DA.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,LY.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?OY.selected:OY.unSelected);const w=DA.group({x:0,y:0,pickable:!1});M.add(w);let E,B=0,P=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);P=_(i)?i[0]||0:i,O=R(v,"space",8);const s=DA.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,LY.itemShape,t,M,S.state),s.addState(e?OY.selected:OY.unSelected),w.add(s)}let I=0;if(d){const e=R(g,"size",10);E=DA.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,LY.focus,t,M),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=KA(Object.assign(Object.assign({x:P/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,LY.itemLabel,t,M,A.state),D.addState(e?OY.selected:OY.unSelected),w.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=KA(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,LY.itemValue,t,M,k.state),r.addState(e?OY.selected:OY.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),w.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-O-I),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),w.add(E));const z=w.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;w.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const j=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:H+T[1]+T[3],U=this._itemHeightByUser||j+T[0]+T[2];return M.setAttributes({width:N,height:U}),E&&E.setAttribute("visible",!1),w.translateTo(-z.x1+T[3],-z.y1+T[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new EY(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},H({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new EY(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new EW(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new EW(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=BY,spaceRow:o=PY}=n,l=this._itemsContainer,{space:h=RY,defaultCurrent:c=1}=r,d=HY(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=DA.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=BY,spaceRow:a=PY}=s,o=this._itemsContainer,{space:l=RY,defaultCurrent:h=1}=n,c=HY(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=DA.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=DA.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(yt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(yt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(OY.selected)?this._setLegendItemState(t,OY.selectedHover,e):this._setLegendItemState(t,OY.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===LY.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(IY.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(OY.unSelectedHover)||t.hasState(OY.selectedHover))&&(i=!0),t.removeState(OY.unSelectedHover),t.removeState(OY.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(OY.unSelectedHover)&&!t.hasState(OY.selectedHover)||(i=!0),t.removeState(OY.unSelectedHover),t.removeState(OY.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===LY.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(IY.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(IY.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==LY.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(IY.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==LY.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(IY.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(OY.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=H({},jY,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(OY.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var UY;function VY(t){return _(t)?t:[t,t]}function WY(t){return t?"ew-resize":"ns-resize"}NY.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:BY,spaceRow:PY,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:RY,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"}(UY||(UY={})),FY();class GY extends Nj{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},GY.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=yt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=MW(),n="browser"===e_.env?e_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=yt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=MW(),n="browser"===e_.env?e_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?yt(t+p,h,c):yt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?yt(t+p,0,c-h):yt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:VY(d)[0],endValue:VY(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=DA.group({x:0,y:0});f.name=UY.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=DA.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=UY.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=DA.group({x:g?v:0,y:g?0:v});f.add(y);const _=DA.group({x:0,y:0});let b;if(_.name=UY.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=DA.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=UY.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=DA.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=UY.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=VY(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":WY(p)},r));if(v.name=UY.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=UY.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":WY(p)},r));if(i.name=UY.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=UY.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=yt(h,i,s);const p=this._isHorizontal;e||(c=i);const f=DA.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=UY.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":WY(p);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(d,e?"end":"start"),b=DA.rect(Object.assign({x:p?Math.min(y,_):0,y:p?0:Math.min(y,_),width:p?Math.abs(_-y):r,height:p?n:Math.abs(_-y),cursor:v},a));b.name=UY.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return DA.symbol(t)}_renderHandlerText(t,e){return DA.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":WY(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=DA.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=DA.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===e_.env?e_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=MW(),e="browser"===e_.env?e_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===UY.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===UY.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===UY.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===UY.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===e_.env?e_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}GY.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},zY(),FY();class YY extends DY{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},YY.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip:y,inverse:_,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function XY(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}YY.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},zY(),FY(),LO();class KY extends DY{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},KY.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,sizeBackground:y,disableTriggerEvent:_,inverse:b}=this.attribute,x=DA.group({x:0,y:0});this._innerView.add(x);const S=new GY({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:XY(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:_,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const C=DA.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);const T=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}KY.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)"}},EO(),QO(),GO();let $Y=class t extends Nj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:T,subtextStyle:M={},width:w,height:E,minWidth:B,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=oi(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||p(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:w)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},UA),C),x:h,y:c,width:null!==(s=null!=t?t:w)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:w,heightLimit:null!==(a=C.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,O-j);if("rich"===k||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:T},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},UA),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(T)?T:[T],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const U=this._subTitle?this._subTitle.AABBBounds.height():0,V=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,V),G=j+(null!==(f=M.height)&&void 0!==f?f:U);if(p(w)&&(W=w),p(E)&&(G=E),p(B)&&WP&&(W=P),p(R)&&GO&&(G=O),z.setAttributes({width:W,height:G,boundsPadding:F}),this._mainTitle){if(p(I)||p(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:L,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(I)||p(M.align)){const t=M.align?M.align:I,e=null!==(y=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==y?y:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=this._mainTitle?p(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};$Y.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 qY={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"}}};EO(),QO(),GO();let ZY=class extends Nj{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=H({},R(qY,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=KA(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=GA(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;k(_)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class JY extends Qp{constructor(t){super(t)}}var QY,tX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(QY||(QY={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(tX||(tX={}));class eX extends Nj{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},eX.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"},eX.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"},eX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},eX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},eX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new JY(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new JY(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new JY(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(QY.OnPlay)},this.pause=()=>{this._dispatchEvent(QY.OnPause)},this.forward=()=>{this._dispatchEvent(QY.OnForward)},this.backward=()=>{this._dispatchEvent(QY.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}eX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},eX.defaultAttributes={[tX.Start]:{},[tX.Pause]:{},[tX.Backward]:{},[tX.Forward]:{}};const iX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},sX=[200,10];var nX,rX;!function(t){t.Default="default",t.Reverse="reverse"}(nX||(nX={})),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"}(rX||(rX={}));const aX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===nX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===nX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),oX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===nX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===nX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),lX=t=>"top"===t||"bottom"===t;class hX extends Nj{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},hX.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Yt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(lX(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:sX[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:sX[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new GY(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=lX(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new eX(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=lX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:sX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(lX(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:lX(this._orient)?t+s:(this._size.width-r)/2,y:lX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:lX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:lX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:lX(this._orient)?t+s:(this._size.width-r)/2,y:lX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function cX(){FY(),EO(),ZO()}hX.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({},iX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},iX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},iX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},iX),{key:"backward",position:"start"})}},cX();class dX extends hX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:nX.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(QY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(QY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(QY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(QY.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(rX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(aX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||oX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===nX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(rX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=e_.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(rX.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(rX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=e_.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(),e_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(rX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,e_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(rX.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(rX.change),this.dispatchCustomEvent(rX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var uX,pX=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};cX();class gX extends hX{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(QY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(QY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(QY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(QY.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(rX.change))},this.play=()=>pX(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(rX.play),this._rafId=e_.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=e_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,e_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(rX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,e_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(rX.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(rX.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(rX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}(uX||(uX={}));const fX={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},mX=5;const vX={debounce:St,throttle:At};EO(),FO();let yX=class t extends Nj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=fX.updateTrigger,endTrigger:i=fX.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(Y(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:vX[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(uX.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=fX.trigger,resetTrigger:i=fX.resetTrigger}=this.attribute;Y(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),Y(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(uX.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(uX.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=mX}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(uX.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(uX.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent(uX.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=mX}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(uX.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(uX.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),Y(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=fX.updateTrigger,endTrigger:s=fX.endTrigger}=this.attribute;Y(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),Y(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=DA.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Re(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};yX.defaultAttributes=fX;const _X=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return H(t,...e,{shape:i.every(u)?void 0:H({},...i),key:s.every(u)?void 0:H({},...s),value:n.every(u)?void 0:H({},...n)})},bX=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},xX={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:HA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:HA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:HA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},SX=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];EO(),NO(),ZO(),QO(),GO();let AX=class t extends Nj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=oi(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",H({symbolType:"circle"},u.shape,{visible:SA(u)&&SA(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:SA(u)&&SA(u.value)},bX(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:SA(u)&&SA(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:SA(u)&&SA(u.value)},bX(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},UA),u.value),visible:SA(u)&&SA(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=SA(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=SA(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!SA(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(SA(n.key)?r+n.key.spacing:0)+(SA(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&($A(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:SA(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),$A(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(SA(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Ch(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(SA(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},bX(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},bX(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},UA),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(SA(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},bX(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},bX(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>SX.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&SA(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=SA(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=WA(d),y=WA(u);let _=0;if(SA(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(SA(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return _X({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return _X({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};AX.defaultAttributes=xX;class kX extends dV{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),bk(this._regions,(t=>{qH(this.getOrient())?wN(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):wN(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=aT({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new VF(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=yi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>MN(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>MN(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,lV),t}transformScaleDomain(){}}kX.type=r.cartesianTimeAxis,kX.specKey="axes",kX.builtInTheme={axis:YU,axisX:XU,axisY:KU};class CX extends dV{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new xC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,lV),t}transformScaleDomain(){}}CX.type=r.cartesianLogAxis,CX.specKey="axes",CX.builtInTheme={axis:YU,axisLinear:cV,axisX:XU,axisY:KU},G(CX,rV);class TX extends dV{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new SC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,lV),t}transformScaleDomain(){}}TX.type=r.cartesianSymlogAxis,TX.specKey="axes",TX.builtInTheme={axis:YU,axisLinear:cV,axisX:XU,axisY:KU},G(TX,rV);class MX extends $H{constructor(){super(...arguments),this.type=CC.area,this.transformerConstructor=CW,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),pj)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(MX.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===qz?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return NC(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return NC(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[NT]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),RH("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),RH("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=KH(this);this._symbolMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),RH("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new SW(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}MX.type=CC.area,MX.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},MX.mark=AW,MX.transformerConstructor=CW,G(MX,gj);class wX extends DV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),oF(t)}}class EX extends RV{constructor(){super(...arguments),this.transformerConstructor=wX,this.type="area",this.seriesType=CC.area}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}EX.type="area",EX.seriesType=CC.area,EX.transformerConstructor=wX,G(EX,jV);function BX(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const PX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:BX(t,e)}),RX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:BX(t,e)}),OX={type:"fadeIn"},IX={type:"growCenterIn"};function LX(t,e){if(!1===e)return{};switch(e){case"fadeIn":return OX;case"scaleIn":return IX;default:return PX(t)}}class DX extends pz{constructor(){super(...arguments),this.type=DX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}DX.type="rect";const FX=()=>{XO(),NO(),Zj("rect",oG),oT.registerMark(DX.type,DX),sI.registerBuiltInAnimate("growHeightIn",HI),sI.registerBuiltInAnimate("growHeightOut",jI),sI.registerBuiltInAnimate("growWidthIn",iL),sI.registerBuiltInAnimate("growWidthOut",sL),sI.registerBuiltInAnimate("growCenterIn",DI),sI.registerBuiltInAnimate("growCenterOut",FI),oT.registerGraphicComponent("rect",og)},zX=Object.assign(Object.assign({},AH),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function HX(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=JC(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[kH]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):NC(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[CH]):NC(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=NC(this._dataToPosX(t),e,i),n=NC(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[TH]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):NC(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[MH]):NC(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=NC(this._dataToPosY(t),e,i),n=NC(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),UX)})}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},VX.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:LH(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(VX.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(DM(this._option.dataSet,"addVChartProperty",nH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};DM(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Oa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:_H.bind(this),call:bH}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new VF(this._option,n)}init(t){super.init(t),this.initRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=MH,s=TH,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=CH,s=kH,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=oM(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)HX(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=NC(this[r](t),l,i),u=NC(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!UC(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&u(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[jT],n=e[NT],r=e[UT],d=e[VT];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?TH:kH],i=e[a?MH:CH];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[jT]:s,[NT]:o}),c?{[UT]:u,[VT]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(og(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>NC(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>NC(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=K(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=KH(this);this._barMark.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),RH(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=JC(this._spec.barWidth,a)),l&&(c=Math.max(c,JC(this._spec.barMinWidth,a))),h&&(c=Math.min(c,JC(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=JC(null!==(l=i[r-1])&&void 0!==l?l:X(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*y+(u-1)*p,n+=g*(y+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const _=Mk(g.type||"band");return d(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}VX.type=CC.bar,VX.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},VX.mark=zX,VX.transformerConstructor=NX;const WX=()=>{CV(),FX(),oT.registerAnimation("bar",((t,e)=>({appear:LX(t,e),enter:PX(t,!1),exit:RX(t,!1),disappear:{duration:Ez.disappear.duration}}))),qU(),uV(),oT.registerSeries(VX.type,VX)};class GX extends DV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),oF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class YX extends RV{constructor(){super(...arguments),this.transformerConstructor=GX,this.type="bar",this.seriesType=CC.bar}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}YX.type="bar",YX.seriesType=CC.bar,YX.transformerConstructor=GX,G(YX,jV);const XX=[10,20],KX=Ck.Linear,$X="circle",qX=Ck.Ordinal,ZX=["circle","square","triangle","diamond","star"],JX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},QX=Object.assign(Object.assign({},AH),{point:{name:"point",type:"symbol"}});class tK extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const eK={sizeField:!0};class iK extends $H{constructor(){super(...arguments),this.type=CC.scatter,this.transformerConstructor=tK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),eK)})}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(_(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${PT}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${PT}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:y(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:KX,defaultRange:XX},"size")}getShapeAttribute(t,e){return u(e)?$X:y(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:qX,defaultRange:ZX},"shape")}initMark(){this._symbolMark=this._createMark(iK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:LH(this._spec,iK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=KH(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),RH("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:y(this._shape)||d(this._shape)?this._shape:$X},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ge});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}iK.type=CC.scatter,iK.mark=QX,iK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},iK.transformerConstructor=tK;const sK=()=>{oN(),oT.registerAnimation("scatter",((t,e)=>Object.assign({appear:JX(0,e)},Bz))),qU(),uV(),oT.registerSeries(iK.type,iK)};class nK extends DV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class rK extends RV{constructor(){super(...arguments),this.transformerConstructor=nK,this.type="scatter",this.seriesType=CC.scatter}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}rK.type="scatter",rK.seriesType=CC.scatter,rK.transformerConstructor=nK,G(rK,jV);class aK extends YH{constructor(){super(...arguments),this.type=CC.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${PT}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const oK=(t,e)=>{const i=d(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[LT]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[sM]=a||r})),s};class lK extends dH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class hK extends pz{constructor(){super(...arguments),this.type=hK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}hK.type="path";const cK=()=>{oT.registerMark(hK.type,hK),XO(),LO(),oT.registerGraphicComponent("path",Ug)},dK=Object.assign(Object.assign({},AH),{area:{name:"area",type:"path"}});class uK{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Fa(i,e):La[i]?(Ia[i]||(Ia[i]=Fa(i,La[i])),Ia[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class pK{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class gK{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function fK(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:pK}:fA(e)||mA(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:gK}:null}const mK={debounce:St,throttle:At};class vK{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=fA(this._renderMode)||mA(this._renderMode),fK(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return fK(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:PM.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:PM.chart,consume:!1}];l.on(...c,mK[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,mK[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||fK(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||fK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:PM.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:PM.chart,consume:!1}];l.on(...c,mK[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,mK[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){fK(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||fK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:PM.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:PM.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||fK(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:PM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||fK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:PM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:PM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:PM.chart,source:BM.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:PM.chart,source:BM.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=mK[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=mK[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:PM.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:PM.chart,source:BM.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:PM.chart,source:BM.chart},this._handleDragMouseUp)}))}}class yK extends YN{constructor(){var e,i;super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:(e=this.type,i=this.id,`${PT}_${i}_${e}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=aT(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new uK(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===CC.map||e.type===CC.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),bk(this._regions,(t=>{var e;if(t.type===CC.map||t.type===CC.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==CC.map&&e.type!==CC.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[sM],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}yK.type=r.geoCoordinate,G(yK,vK);const _K=()=>{oT.registerComponent(yK.type,yK)};class bK extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class xK extends aK{constructor(){super(...arguments),this.type=CC.map,this.transformerConstructor=bK,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),zM.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),DM(this._dataSet,"copyDataView",WM),DM(this._dataSet,"map",oK),DM(this._dataSet,"lookup",sH);const s=zM.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Oa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:()=>({nameMap:this._nameMap,nameProperty:this._nameProperty})}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:sM,fields:()=>this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new VF(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(xK.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:LH(this._spec,xK.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:FT])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:FT]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(PH(null===(t=oT.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),RH("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new lK(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[LT]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[LT],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ge}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ge}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return LT}getActiveMarks(){return[this._pathMark]}}xK.type=CC.map,xK.mark=dK,xK.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},xK.transformerConstructor=bK;const SK=`${PT}_waterfall_default_seriesField`,AK=(t,e)=>{if(!t||0===t.length)return t;const i=d(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let c=Array.from(l[s]);"decrease"===a&&(c=c.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return c.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[KT]=!0:delete t[KT]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===c.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=kK([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const f=g[0];let{start:m,end:v}=CK(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=se(y,e)):(t[c]=+_,_=se(_,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,c,e,i,a),void o.push(s)}u=kK(r,t,s,o,u,c,e,i),o.push(s)})),o};function kK(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=CK(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===SK)&&(t[SK]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function CK(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?hA("total.collectCountField error"):n=e[a].start;o<0?hA("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=se(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const TK=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=d(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},MK={type:"fadeIn"},wK={type:"growCenterIn"};function EK(t,e){switch(e){case"fadeIn":return MK;case"scaleIn":return wK;default:return PX(t,!1)}}class BK extends pz{constructor(){super(...arguments),this.type=BK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return sg(t)}}BK.type="rule";const PK=()=>{oT.registerMark(BK.type,BK),XO(),OO(),oT.registerGraphicComponent("line",sg)},RK=Object.assign(Object.assign({},zX),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),OK=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:IK(t.map((t=>t.latestData)).flat(),e.fields,i)}};function IK(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>IK(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class LK{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new Oa(e instanceof Ra?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),DM(e,"dimensionTree",OK),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class DK extends NX{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const FK={rect:VK,symbol:NK,arc:GK,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=NK(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:YK,line:XK,area:XK,rect3d:VK,arc3d:GK,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function zK(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=FK[t])&&void 0!==i?i:FK.point;return e.series.type===CC.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=jK(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:KK(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function HK(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==CC.sankey){const{formatFunc:t,args:n}=eH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function jK(t){return d(t)?e=>t(e.data):t}function NK(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=jK(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:UK(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function UK(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function VK(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=jK(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:WK(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function WK(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function GK(t){var e;const{labelSpec:i}=t,s=null!==(e=jK(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:y(s)&&s.includes("inside"),{position:n,smartInvert:r}}function YK(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=HK(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Kp(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function XK(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[FT]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function KK(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const $K={calculationMode:!0};class qK extends VX{constructor(){super(...arguments),this.type=CC.waterfall,this.transformerConstructor=DK,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&hM(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),$K)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new LK(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=SK)}getSeriesKeys(){return this._seriesField===SK?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),DM(this._dataSet,"waterfallFillTotal",TK),DM(this._dataSet,"waterfall",AK),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=GM(this.getViewData(),this._dataSet,{name:`${PT}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new VF(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:jT,endAs:NT,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=KH(this);this._barMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),RH("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),RH("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(qK.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return YK(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?NC(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):NC(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,y1:t=>this.totalPositionY(t,"index",this._getLeaderLineCategoryPos(!1,e))},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,x1:t=>this.totalPositionX(t,"index",this._getLeaderLineCategoryPos(!1,e)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&UC([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}qK.type=CC.waterfall,qK.mark=RK,qK.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},qK.transformerConstructor=DK;const ZK=()=>{PK(),FX(),oT.registerAnimation("waterfall",((t,e)=>({appear:EK(t,e),enter:PX(t,!1),exit:RX(t,!1),disappear:{duration:Ez.disappear.duration}}))),Oz(),qU(),uV(),oT.registerSeries(qK.type,qK)},JK=`${PT}_BOX_PLOT_OUTLIER_VALUE`;var QK;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(QK||(QK={}));const t$=(t,e)=>{const i=[],s=d(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=_(e)?e:[e];i.push(...s.map((e=>{const i={[JK]:e};return r.forEach((e=>{i[e]=t[e]})),p(a)&&(i[a]=t[a]),i})))})),i};class e$ extends dH{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===QK.OUTLIER)return this.series.getOutliersField();if(t===QK.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case QK.MIN:return this.series.getMinField();case QK.MAX:return this.series.getMaxField();case QK.MEDIAN:return this.series.getMedianField();case QK.Q1:return this.series.getQ1Field();case QK.Q3:return this.series.getQ3Field();case QK.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===QK.OUTLIER)return e[JK];if(t===QK.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case QK.MIN:return e[this.series.getMinField()];case QK.MAX:return e[this.series.getMaxField()];case QK.MEDIAN:return e[this.series.getMedianField()];case QK.Q1:return e[this.series.getQ1Field()];case QK.Q3:return e[this.series.getQ3Field()];case QK.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[JK])}getDefaultContentList(t){return[{key:this.getContentKey(QK.OUTLIER),value:this.getContentValue(QK.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(QK.MAX),value:this.getContentValue(QK.MAX)},{key:this.getContentKey(QK.Q3),value:this.getContentValue(QK.Q3)},{key:this.getContentKey(QK.MEDIAN),value:this.getContentValue(QK.MEDIAN)},{key:this.getContentKey(QK.Q1),value:this.getContentValue(QK.Q1)},{key:this.getContentKey(QK.MIN),value:this.getContentValue(QK.MIN)},{key:this.getContentKey(QK.SERIES_FIELD),value:this.getContentValue(QK.SERIES_FIELD)}]}}const i$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class s$ extends pz{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.context.diffState!==vF.enter&&t.context.diffState!==vF.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{i$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?H(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?H(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=ug(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e),e.addEventListener("afterAttributeUpdate",(t=>{var i;2===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.type)&&this._syncInheritedStyleAttrs(e,e.attribute)}));const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=oT.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const n$=()=>{oT.registerGraphicComponent("glyph",ug),XO(),MO()},r$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],a$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class o$ extends s${constructor(){super(...arguments),this.type=o$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=r$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=a$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}o$.type="boxPlot";const l$=Object.assign(Object.assign({},AH),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),h$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},c$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},d$=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),u$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,C;if(i&&k(i.center))return i.center;let T,M,w,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=d$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=d$(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,w=null===(p=null===(u=null===(d=null===(c=d$(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=d$(t,"box").attribute.width,i=d$(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=d$(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=d$(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,w=null===(C=null===(A=null===(S=null===(x=d$(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===C?void 0:C.y;const e=d$(t,"box").attribute.height,i=d$(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(M)&&k(w)?(M+w)/2:k(w)?w:k(M)?M:NaN},p$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=d$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=d$(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=d$(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=d$(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=d$(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=d$(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=d$(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=d$(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=d$(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=d$(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(y)&&k(_)?(y+_)/2:k(_)?_:k(y)?y:NaN};class g$ extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return h$(u$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class f$ extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return c$(u$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class m$ extends g${computeAttribute(){return h$(p$)(this.target,this.params,this.params.options)}}class v$ extends f${computeAttribute(){return c$(p$)(this.target,this.params,this.params.options)}}class y$ extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const _$={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class b$ extends $H{constructor(){super(...arguments),this.type=CC.boxPlot,this.transformerConstructor=y$,this._bandPosition=0}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}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),_$)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(b$.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(b$.mark.outlier,{key:LT,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.initBoxPlotMarkStyle()}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>NC(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>NC(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>NC(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>NC(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>NC(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>NC(e(this.getDatumPositionValues(t,JK),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>NC(e(this.getDatumPositionValues(t,JK),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;DM(this._dataSet,"foldOutlierData",t$),DM(this._dataSet,"addVChartProperty",nH);const t=new Oa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${PT}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:_H.bind(this),call:bH}},!1),this._outlierData=new VF(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=JC(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,JC(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,JC(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=JC(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=Mk(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=H({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=KH(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=oT.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(RH("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(PH(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(PH(null===(a=oT.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new e$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}b$.type=CC.boxPlot,b$.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},b$.mark=l$,b$.transformerConstructor=y$;const x$=()=>{n$(),OO(),NO(),oT.registerGraphicComponent("line",(t=>sg(t))),oT.registerGraphicComponent("rect",(t=>og(t))),oT.registerMark(o$.type,o$),oN(),Rz(),qU(),uV(),sI.registerBuiltInAnimate("boxplotScaleIn",g$),sI.registerBuiltInAnimate("boxplotScaleOut",f$),sI.registerBuiltInAnimate("barBoxplotScaleIn",m$),sI.registerBuiltInAnimate("barBoxplotScaleOut",v$),oT.registerSeries(b$.type,b$)};class S$ extends pz{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=S$.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Hg(t):Kp(t)}}S$.type="text";const A$=()=>{oT.registerMark(S$.type,S$),XO(),QO(),GO(),oT.registerGraphicComponent("text",Kp),oT.registerGraphicComponent("richtext",Hg)};class k$ extends dH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const C$=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),T$={type:"fadeIn"},M$=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function w$(t,e){return"fadeIn"===e?T$:C$(t)}const E$=Object.assign(Object.assign({},zX),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class B$ extends NX{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class P$ extends VX{constructor(){super(...arguments),this.type=CC.rangeColumn,this._barMarkType="rect",this._barName=CC.bar,this.transformerConstructor=B$}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(P$.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:LH(this._spec,P$.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(P$.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(P$.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=KH(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),RH("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),RH("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(PH(null===(n=oT.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),RH("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new k$(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}P$.type=CC.rangeColumn,P$.mark=E$,P$.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},P$.transformerConstructor=B$;const R$=()=>{FX(),A$(),oT.registerAnimation("rangeColumn",((t,e)=>({appear:w$(t,e),enter:C$(t),exit:M$(t),disappear:{duration:Ez.disappear.duration}}))),Oz(),qU(),uV(),oT.registerSeries(P$.type,P$)};var O$,I$;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(O$||(O$={})),function(t){t.middle="middle",t.start="start",t.end="end"}(I$||(I$={}));class L$ extends dH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const D$=Object.assign({},AW);class F$ extends MX{constructor(){super(...arguments),this.type=CC.rangeArea}initMark(){this._areaMark=this._createMark(F$.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new L$(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}F$.type=CC.rangeArea,F$.mark=D$;class z$ extends YH{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=jN,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Mk(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:[]};Mk(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&XH(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function H$(t){return _A(t)?Number.parseFloat(t):0}const j$=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&N$(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[BN],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[BN]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},N$=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===H$(t[e])))||!i&&0===t.reduce(((t,i)=>t+H$(i[e])),0)));function U$(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const V$=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:U$(t,!0,$M.appear)}),W$={type:"fadeIn"},G$=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:U$(t,!0,$M.enter)}),Y$=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:U$(t,!0,$M.exit)});function X$(t,e){if(!1===e)return{};switch(e){case"fadeIn":return W$;case"growRadius":return V$(Object.assign(Object.assign({},t),{growField:"radius"}));default:return V$(Object.assign(Object.assign({},t),{growField:"angle"}))}}class K$ extends pz{constructor(t,e){super(t,e),this.type=$$.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[LN])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class $$ extends K${constructor(){super(...arguments),this.type=$$.type}}$$.type="arc";const q$=()=>{XO(),_O(),Zj("arc",cG),sI.registerBuiltInAnimate("growRadiusIn",QI),sI.registerBuiltInAnimate("growRadiusOut",tL),sI.registerBuiltInAnimate("growAngleIn",II),sI.registerBuiltInAnimate("growAngleOut",LI),oT.registerGraphicComponent("arc",Kg),oT.registerMark($$.type,$$)},Z$=Object.assign(Object.assign({},AH),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class J$ extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=aT({},this._theme,i,t);const n=(t,e)=>aT({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const Q$=`${PT}_LABEL_VISIBLE`,tq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},eq={outerRadius:!0};class iq extends z${constructor(){super(...arguments),this.transformerConstructor=J$,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:XC(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:XC(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=zN,this._endAngle=HN,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[LN];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;DM(this._dataSet,"pie",j$),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:RN,asEndAngle:ON,asRatio:PN,asMiddleAngle:LN,asRadian:FN,asQuadrant:DN,asK:IN,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Oa(this._dataSet,{name:`${PT}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new VF(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},iq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:DT,groupKey:this._seriesField,isSeriesMark:!0},{morph:LH(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Ak(RN)(t)}endAngleScale(t){return Ak(ON)(t)}_computeLayoutRadius(){return NN((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:VC(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:VC(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Ak(Q$).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),eq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),tq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[LN];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===$M.appear)return this._startAngle;if(i===$M.disappear)return this._endAngle;const r=[$M.disappear,$M.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[LT];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[LT]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[LT])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[LT])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[LN]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[LN]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[LN]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[LN]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=PH(null===(i=oT.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}iq.transformerConstructor=J$,iq.mark=Z$,iq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class sq extends iq{constructor(){super(...arguments),this.type=CC.pie}}sq.type=CC.pie;const nq=()=>{q$(),oT.registerAnimation("pie",((t,e)=>({appear:X$(t,e),enter:G$(t),exit:Y$(t),disappear:{duration:Ez.disappear.duration}}))),oT.registerAnimation("emptyCircle",((t,e)=>({appear:X$(t,e)}))),oT.registerSeries(sq.type,sq)};function rq(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const aq=t=>({type:rq(t.growField),options:{overall:!0}}),oq={type:"fadeIn"},lq=t=>({type:rq(t.growField)}),hq=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function cq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return oq;case"growAngle":return aq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return aq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const dq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class uq extends z${_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),dq)})}getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(NT),this.setInnerRadiusField(jT)}setValueFieldToPercent(){this.setRadiusField(VT),this.setInnerRadiusField(UT)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const pq=Object.assign(Object.assign({},AH),{rose:{name:"rose",type:"arc"}});class gq extends HH{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class fq extends iU{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=oT.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=zN,this._endAngle=HN,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),bk(this._regions,(t=>{"radius"===this.getOrient()?wN(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):wN(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:XC(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:XC(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:AN(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){bk(this._regions,(t=>{"radius"===this.getOrient()?wN(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):wN(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Mk(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Mk(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>MN(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ae.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return NN((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=jN,e=0;const i=this.getChart().getSpec();return bk(this.getRegions(),(s=>{const n=s;if(r=n.type,[CC.rose,CC.radar,CC.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(aT({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(aT({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}fq.type=r.polarAxis,fq.specKey="axes";const mq={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},vq={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class yq extends fq{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new vC}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,lV),t}}yq.type=r.polarLinearAxis,yq.specKey="axes",yq.builtInTheme={axis:YU,axisLinear:cV,axisAngle:vq,axisRadius:mq},G(yq,rV);const _q=()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),oT.registerGraphicComponent(XN.circleAxis,((t,e)=>new iG(t,e))),oT.registerGraphicComponent(KN.circleAxisGrid,((t,e)=>new vG(t,e))),sU(),oT.registerComponent(yq.type,yq)};class bq extends fq{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new qk}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,nG),t}transformScaleDomain(){}}bq.type=r.polarBandAxis,bq.specKey="axes",bq.builtInTheme={axis:YU,axisBand:GU,axisAngle:vq,axisRadius:mq},G(bq,aU);const xq=()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),oT.registerGraphicComponent(XN.circleAxis,((t,e)=>new iG(t,e))),oT.registerGraphicComponent(KN.circleAxisGrid,((t,e)=>new vG(t,e))),sU(),oT.registerComponent(bq.type,bq)};class Sq extends uq{constructor(){super(...arguments),this.type=CC.rose,this.transformerConstructor=gq,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(Sq.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:LH(this._spec,Sq.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>NC(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=NC(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),RH("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}Sq.type=CC.rose,Sq.mark=pq,Sq.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},Sq.transformerConstructor=gq;const Aq=()=>{oT.registerSeries(Sq.type,Sq),q$(),oT.registerAnimation("rose",((t,e)=>({appear:cq(t,e),enter:lq(t),exit:hq(t),disappear:{duration:Ez.disappear.duration}}))),xq(),_q()};class kq extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,dk(this._fromAngle,this._toAngle)&&dk(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Cq extends Tz{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!_k(t)&&!_k(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const Tq=t=>({type:"in"===t?"fadeIn":"fadeOut"});function Mq(t,e,i){return"fadeIn"===e?Tq(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function wq(t,e,i){return"fadeIn"===e?Tq(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const Eq=(t,e)=>({custom:kz,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),Bq=Object.assign(Object.assign(Object.assign({},AH),uj),{area:{name:"area",type:"area"}});class Pq extends uq{constructor(){super(...arguments),this.type=CC.radar,this.transformerConstructor=lN,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(Pq.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:Zz,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?oe(this._spec.startAngle):zN},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(PH(null===(s=oT.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),RH("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=oT.getAnimationInKey(e);t.setAnimationConfig(PH(null==i?void 0:i(n,r),RH(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&_(a)?a[0]:a}}}Pq.type=CC.radar,Pq.mark=Bq,Pq.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Pq.transformerConstructor=lN,G(Pq,gj);const Rq=()=>{oT.registerSeries(Pq.type,Pq),xW(),rN(),oN(),oT.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:Mq(t,e,"in"),enter:Mq(t,e,"in"),exit:Mq(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:Ez.disappear.duration},update:[{channel:["points","center"],custom:Cq,customParameters:t,duration:Ez.update.duration,easing:Ez.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),oT.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:wq(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:Ez.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:kq,customParameters:t,duration:Ez.update.duration,easing:Ez.update.easing}]}))),oT.registerAnimation("radarGroup",((t,e)=>({appear:Eq(t,"in"),disappear:{duration:Ez.disappear.duration}}))),_O(),xq(),_q()};class Oq extends dH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>yi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const Iq=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(PT)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[LT]:r,[DT]:`${s}_${e}`})),r++}))})),n},Lq={fill:"#bbb",fillOpacity:.2},Dq=Object.assign(Object.assign({},AH),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),Fq={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},zq={grid:{background:!0}};class Hq extends $H{constructor(){super(...arguments),this.type=CC.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Fq),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),zq)})}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),DM(this._option.dataSet,"objFlat",Iq),DM(this._option.dataSet,"copyDataView",WM),FM(this._option.dataSet,"dataview",Ea),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(aT(Lq,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(Hq.mark.group),this._containerMark=this._createMark(Hq.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(Hq.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(Hq.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(Hq.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(Hq.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(Hq.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(Hq.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!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",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:FT}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new zC).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:FT}}initTooltip(){this._tooltipHelper=new Oq(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}Hq.type=CC.dot,Hq.mark=Dq,Hq.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class jq extends dH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>yi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const Nq=Object.assign(Object.assign({},AH),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),Uq=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class Vq extends $H{constructor(){super(...arguments),this.type=CC.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),DM(this._option.dataSet,"linkDotInfo",Uq),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(Vq.mark.group),this._containerMark=this._createMark(Vq.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(Vq.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(Vq.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:FT}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new jq(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}Vq.type=CC.link,Vq.mark=Nq,Vq.builtInTheme={link:{arrow:{style:{size:10}}}};const Wq=Object.assign(Object.assign({},AH),{group:{name:"group",type:"group"}}),Gq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class Yq extends z${constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?jT:tM],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?NT:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Gq)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?oe(n):zN;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):HN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=NC(this.angleAxisHelper.dataToPosition([t[jT]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=NC(this.angleAxisHelper.dataToPosition([t[NT]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?NC(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(Yq.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return Kg(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[og({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const qq=()=>{oT.registerAnimation("circularProgress",((t,e)=>({appear:$q(t,e),enter:{type:"growAngleIn"},disappear:{duration:Ez.disappear.duration}})))};class Zq extends HH{constructor(){super(...arguments),this._supportStack=!0}}const Jq={cornerRadius:!0,roundCap:!0};class Qq extends Yq{constructor(){super(...arguments),this.type=CC.circularProgress,this.transformerConstructor=Zq,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Jq)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(Qq.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:LH(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(Qq.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?jT:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?NT:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),RH("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),RH("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}Qq.type=CC.circularProgress,Qq.mark=Xq,Qq.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},Qq.transformerConstructor=Zq;const tZ=()=>{oT.registerSeries(Qq.type,Qq),q$(),qq(),Oz(),xq(),_q()};function eZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const iZ={type:"fadeIn"};function sZ(t,e="grow"){return!1===e?{}:"fadeIn"===e?iZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:eZ(t)}))(t)}class nZ extends dH{enableByType(t){return"dimension"!==t}}const rZ=Object.assign(Object.assign({},AH),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),aZ={bandWidth:!0,cornerRadius:!0,clamp:!0},oZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class lZ extends $H{constructor(){super(...arguments),this.type=CC.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),aZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),oZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(lZ.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return NC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return NC(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?NC(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return NC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return NC(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?NC(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(lZ.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return NC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return NC(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),RH("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),RH("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new nZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}lZ.type=CC.linearProgress,lZ.mark=rZ,lZ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const hZ=()=>{FX(),oT.registerAnimation("linearProgress",((t,e)=>({appear:sZ(t,e),enter:sZ(t),disappear:{duration:Ez.disappear.duration}}))),Oz(),oT.registerSeries(lZ.type,lZ)},cZ=[0],dZ=[20,40],uZ=[200,500],pZ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},gZ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class fZ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const mZ=`${PT}_WORD_CLOUD_TEXT`,vZ=Object.assign(Object.assign({},AH),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),yZ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class _Z extends YH{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=dZ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:uZ,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:cZ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?mZ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:pZ},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||gA(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:cZ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!gZ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new fZ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(_Z.mark.word,{key:DT,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(_Z.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(PH(oT.getAnimationInKey("wordCloud")(n,s),RH("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new zC).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:FT])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new vC).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new vC).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[LT])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:DT,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:e_.createCanvas.bind(e_),getTextBounds:xf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Rg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}_Z.mark=vZ,_Z.builtInTheme={wordCloud:yZ};function bZ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||Ez.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=xZ(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},SZ=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=SZ(t.children,e,t,n))})),s},AZ=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=AZ(t.children,e,t,n)),n=e(t,s,i,n)})),n},kZ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):kZ(t.children,e,i)))})),e};function CZ(t,e){let i,s;if(wZ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function wZ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*T*w))/(2*T):w/M);return{x:s+S+A*E,y:n+k+C*E,radius:E}}function RZ(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function OZ(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function IZ(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function LZ(t){return{_:t,next:null,prev:null}}function DZ(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];RZ(n,s,r);let a,o,l,h,c,d,u,p=LZ(s),g=LZ(n),f=LZ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=xZ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:jZ.defaultOpionts.nodeSort;SZ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)SZ([o],FZ(h)),AZ([o],zZ(this._getPadding,.5,a)),SZ([o],HZ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);SZ([o],FZ(jZ.defaultOpionts.setRadius)),AZ([o],zZ(Ot,1,a)),c&&AZ([o],zZ(this._getPadding,o.radius/t,a)),SZ([o],HZ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}jZ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const NZ=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=NZ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function UZ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){NZ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function VZ(t){return t.depth}function WZ(t,e){return e-1-t.endDepth}const GZ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),YZ=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},XZ={left:VZ,right:WZ,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:VZ,end:WZ},KZ=bt(0,1);class $Z{constructor(t){this._ascendingSourceBreadth=(t,e)=>GZ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>GZ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},$Z.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):XZ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return UZ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[YZ(s[t.source]),YZ(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=$(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(y(e)){const t=yt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*KZ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(GZ),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(GZ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];qZ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),ZZ);const s=_(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},JZ.defaultOpionts,t):Object.assign({},JZ.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Rt(this.options.center[0],t.width),s=t.y0+Rt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Rt(t,n))):Rt(r,n),h=_(a),c=this.options.gapRadius,d=h?a.map((t=>Rt(t,n))):Rt(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Rt(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(_(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=xZ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ce({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function QZ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,y=Math.max(v/x,x/m),y>_){f-=h;break}_=y}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:qZ,slice:QZ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?QZ:qZ)(t,e,i,s,n)}};class iJ{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},iJ.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?tJ(this.options.aspectRatio):null!==(e=eJ[this.options.splitType])&&void 0!==e?e:eJ.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=xZ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function sJ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ui?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=sJ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=nJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function dJ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*uJ({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},gJ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||aJ,s=e.lossFunction||rJ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];pi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:pJ(f),arcs:f})}))},fJ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:mJ,triangle:mJ,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 mJ(){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 vJ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const yJ=t=>fJ[t]?fJ[t]():fJ.circle(),_J=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function bJ(t){return d(t)?t:function(){return t}}class xJ{constructor(t){var e,i;switch(this.options=H({},xJ.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=yJ(this.options.shape),this.getText=null!==(e=bJ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=bJ(this.options.fontWeight),this.getTextFontSize=bJ(this.options.fontSize),this.getTextFontStyle=bJ(this.options.fontStyle),this.getTextFontFamily=bJ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>_J(10,50);break;case"random-light":this.getTextColor=()=>_J(50,90);break;default:this.getTextColor=bJ(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return oe(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():Mt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class AJ extends xJ{constructor(t){var e;super(H({},AJ.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<=AJ.defaultOptions.minFontSize&&(this.options.minFontSize=AJ.defaultOptions.minFontSize),this.spiral=y(this.options.spiral)?null!==(e=SJ[this.options.spiral])&&void 0!==e?e:SJ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=bJ(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=vJ(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,y=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;y[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(MJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(TJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}MJ(p,this._size)&&(p=wJ(p,this._size))}else if(MJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||CJ(p,i))&&(!i||!kJ(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function kJ(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function CJ(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,MJ=(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 wJ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},BJ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},PJ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},RJ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=vJ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=yJ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)PJ(n,BJ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)PJ(n,BJ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)PJ(n,BJ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)PJ(n,BJ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)PJ(n,BJ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=BJ({x:l,y:h},o,-Math.PI/2,5),e=BJ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);PJ(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let YG=class t extends OG{constructor(e){super(j({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)B(C,w,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?NG(t,o,l.width,l.height,h):"geometric"===t.type&&GG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=BG(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};YG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class XG extends OG{constructor(t){super(j({},XG.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}XG.defaultOptions={enlarge:!1};const KG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},qG=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.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?ZG(t.fontFamily):"sans-serif",d=t.fontStyle?ZG(t.fontStyle):"normal",u=t.fontWeight?ZG(t.fontWeight):"normal",p=t.rotate?ZG(t.rotate):0,g=ZG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?ZG(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},KG),t.as):KG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?ZG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=QG(tY(t,l),C);w=i=>e(t(i))}let E=DG;"fast"===t.layoutType?E=XG:"grid"===t.layoutType&&(E=YG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},ZG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],JG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),QG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=JG(t[0]),n=JG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(JG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},tY=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function eY(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{sO.registerGrammarTransform("wordcloud",{transform:qG}),GN(),sO.registerAnimation("wordCloud",((t,e)=>({appear:RW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:$D.disappear.duration}}))),sO.registerSeries(iY.type,iY)},nY=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:f=!1,isCone:m=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(y*v)&&0!==v?y/v:0,S=k(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},rY=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},aY=`${wO}_FUNNEL_TRANSFORM_RATIO`,oY=`${wO}_FUNNEL_REACH_RATIO`,lY=`${wO}_FUNNEL_HEIGHT_RATIO`,hY=`${wO}_FUNNEL_VALUE_RATIO`,cY=`${wO}_FUNNEL_LAST_VALUE_RATIO`,dY=`${wO}_FUNNEL_NEXT_VALUE_RATIO`,uY=`${wO}_FUNNEL_LAST_VALUE`,pY=`${wO}_FUNNEL_CURRENT_VALUE`,gY=`${wO}_FUNNEL_NEXT_VALUE`,fY=`${wO}_FUNNEL_TRANSFORM_LEVEL`;class mY extends TF{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[oY])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class vY extends jD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class _Y extends vY{constructor(){super(...arguments),this.type=_Y.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}_Y.type="polygon";const yY=()=>{sO.registerMark(_Y.type,_Y),hM(),sM(),kw.registerBuiltInAnimate("growPointsOut",xC),sO.registerGraphicComponent("polygon",cf)},bY=Object.assign(Object.assign({},zF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class xY extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class SY extends ez{constructor(){super(...arguments),this.type=xR.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=xY,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;EI(this._dataSet,"funnel",nY),EI(this._dataSet,"funnelTransform",rY);const t=new Pa(this._dataSet,{name:`${wO}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new OD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:pY,asTransformRatio:aY,asReachRatio:oY,asHeightRatio:lY,asValueRatio:hY,asNextValueRatio:dY,asLastValueRatio:cY,asLastValue:uY,asNextValue:gY,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:fY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},SY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:qF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},SY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(SY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(SY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new mY(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&qy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&qy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*_R(oY).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),XF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(YF(sO.getAnimationInKey("fadeInOut")(),XF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(YF(sO.getAnimationInKey("funnel")({},o),XF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(YF(null===(a=sO.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),XF("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[cY])/2:this._getSecondaryAxisLength(t[hY])/2,n=this._getSecondaryAxisLength(t[hY])/2):(s=this._getSecondaryAxisLength(t[hY])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[dY])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[fY])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[LO]===t[LO]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{yY(),GN(),iN(),sO.registerSeries(SY.type,SY),sO.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},qD))),sO.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:sC,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),JD()},kY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},MY=t=>{const e=t.filter((t=>t.context.diffState===lD.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},TY=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=$(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},wY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MY(i.parent.children),a=TY(r,s,n);return kY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MY(i.parent.children),a=TY(r,s,n);return kY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),CY=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=$(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},EY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MY(i.parent.children),a=CY(r);return kY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MY(i.parent.children),a=CY(r);return kY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),BY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},PY=(t,e={})=>{if(!t)return[];const i=[];return FW(t,i,e),i},LY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new dG(i).layout(t,{width:s,height:n})};class RY extends TF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var OY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(OY||(OY={}));const IY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===OY.DrillDown){return Y(hI(t,n,s,"children"))}if(i.type===OY.DrillUp){const e=cI(t,n,s,"children");if(e)return Y(e)}return t};class DY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=jV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;EI(t,"drillFilter",IY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:OY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:OY.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:OY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:OY.DrillUp},model:this}),r}}const FY=Object.assign(Object.assign({},zF),{sunburst:{name:"sunburst",type:"arc"}}),zY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:PF,operations:["max","min","values"]}),t.push({key:LF,operations:["values"]}),t),jY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class HY extends aU{constructor(){super(...arguments),this.type=xR.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:LF),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:LO},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),EI(this._dataSet,"sunburstLayout",LY),EI(this._dataSet,"flatten",PY),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return zY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(EI(t.dataSet,"addVChartProperty",yF),t.transform({type:"addVChartProperty",options:{beforeCall:DF.bind(this),call:FF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(HY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(HY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new RY(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),XF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),XF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}HY.type=xR.sunburst,HY.mark=FY,HY.builtInTheme={sunburst:jY},G(HY,DY);const VY=()=>{sO.registerSeries(HY.type,HY),_U(),GN(),JD(),sO.registerAnimation("sunburst",((t,e)=>({appear:BY(0,e),enter:wY(t),exit:EY(t),disappear:{duration:$D.disappear.duration}})))},NY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new QW(i).layout(t,{width:s,height:n})};class UY extends TF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const WY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},GY=Object.assign(Object.assign({},zF),{circlePacking:{name:"circlePacking",type:"arc"}});class YY extends nz{constructor(){super(...arguments),this.type=xR.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:LF),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:LO},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),EI(this._dataSet,"circlePackingLayout",NY),EI(this._dataSet,"flatten",PY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(EI(t.dataSet,"addVChartProperty",yF),t.transform({type:"addVChartProperty",options:{beforeCall:DF.bind(this),call:FF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(YY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(YY.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return zY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new UY(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),XF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),XF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}YY.type=xR.circlePacking,YY.mark=GY,YY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(YY,DY);const XY=()=>{sO.registerSeries(YY.type,YY),_U(),GN(),ZD(),sO.registerAnimation("circlePacking",((t,e)=>({appear:WY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:$D.disappear.duration}})))},$Y=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&$Y(t,e.children,i)}))},KY=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},qY=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new lG(e),r=[];return r.push(n.layout(s,i)),r},ZY=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},JY=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class QY extends TF{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const tX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),eX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:tX(t),iX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class sX extends Iw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class nX extends Iw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const rX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},aX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class oX extends TN{constructor(){super(...arguments),this.type=oX.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?aX:rX,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}oX.type="linkPath";const lX=Object.assign(Object.assign({},zF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class hX extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const cX=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class dX extends nz{constructor(){super(...arguments),this.type=xR.sankey,this.transformerConstructor=hX,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ve,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=vI(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=vI(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=vI(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),cX(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=vI(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=vI(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=vI(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=vI(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=vI(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void cX(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void cX(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(vI(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=vI(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=vI(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void cX(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void cX(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void cX(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){EI(this._dataSet,"sankeyLayout",qY),EI(this._dataSet,"sankeyFormat",KY),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;EI(o,"sankeyNodes",ZY),EI(o,"flatten",PY);const l=new Pa(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:OF.bind(this),call:IF}},!1),this._nodesSeriesData=l,EI(o,"sankeyLinks",JY);const h=new Pa(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:OF.bind(this),call:IF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(dX.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(dX.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=mF(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),XF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),XF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:kI.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(vI(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new QY(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new OR;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return $Y(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}dX.type=xR.sankey,dX.transformerConstructor=hX,dX.mark=lX,dX.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const uX=()=>{hV(),wN(),eM(),sO.registerGraphicComponent("path",(t=>tf(t))),sO.registerMark(oX.type,oX),GN(),sO.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:eX(t,e)},qD))),sO.registerAnimation("sankeyLinkPath",((t,e)=>({appear:iX(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:$D.disappear.duration}}))),kw.registerBuiltInAnimate("linkPathGrowOut",nX),kw.registerBuiltInAnimate("linkPathGrowIn",sX),JD(),sO.registerSeries(dX.type,dX)},pX=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=PY(n);return i=CF([{latestData:r}],e),i};class gX extends TF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const fX=Object.assign(Object.assign({},zF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),mX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class vX extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const _X=(t,e)=>{if(e.getViewBox()){const i=new fG(e).layout(t,e.getViewBox()),s=[];return FW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[LF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class yX extends nz{constructor(){super(...arguments),this.type=xR.treemap,this.transformerConstructor=vX,this._categoryField="name",this._valueField="value",this._viewBox=new Ve,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:LF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new We),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:LO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),EI(this._dataSet,"treemap",_X),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(EI(this._rawData.dataSet,"addVChartProperty",yF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:DF.bind(this),call:FF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=pX([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){EI(this._dataSet,"hierarchyDimensionStatistics",pX),EI(this._dataSet,"flatten",PY);const i=new Pa(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 zY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(yX.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(yX.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("treemap"))||void 0===e?void 0:e(),XF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new gX(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(bI.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(bI.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}yX.type=xR.treemap,yX.mark=fX,yX.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},yX.transformerConstructor=vX,G(yX,DY),G(yX,VV);const bX=()=>{sO.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),sO.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),hV(),GN(),sO.registerAnimation("treemap",((t,e)=>({appear:mX(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:$D.disappear.duration}}))),JD(),sO.registerSeries(yX.type,yX)},xX=Object.assign(Object.assign({},oW),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),SX=Object.assign(Object.assign({},zF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),AX={type:"fadeIn"};function kX(t,e){return"fadeIn"===e?AX:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class MX extends tz{constructor(){super(...arguments),this._supportStack=!1}}class TX extends TF{enableByType(t){return"dimension"!==t}}const wX="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",CX={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:wX,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:wX,fill:"#ddd"}}};class EX extends lW{constructor(){super(...arguments),this.type=xR.gaugePointer,this.transformerConstructor=MX,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(EX.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},EX.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(EX.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new TX(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=$(e),s=K(e),n=_t(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),XF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}EX.type=xR.gaugePointer,EX.mark=SX,EX.builtInTheme={gaugePointer:CX},EX.transformerConstructor=MX;const BX=()=>{sO.registerSeries(EX.type,EX),OV(),hV(),sO.registerAnimation("gaugePointer",((t,e)=>{const i=kX(t,e);return{appear:i,enter:i,disappear:{duration:$D.disappear.duration}}})),HU(),zU()};class PX extends tz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class LX extends lW{constructor(){super(...arguments),this.type=xR.gauge,this.transformerConstructor=PX,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();EI(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[ZO]=t[this._angleField[0]],t[qO]=e>0?i[e-1][ZO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(LX.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(LX.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?FR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?FR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[qO])?this.angleAxisHelper.dataToPosition([t[qO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[ZO]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),XF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}LX.type=xR.gauge,LX.mark=xX,LX.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},LX.transformerConstructor=PX;class RX extends jD{constructor(){super(...arguments),this.type=RX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Eg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}RX.type="cell";function OX(t){return!1===t?{}:{type:"fadeIn"}}class IX extends TF{enableByType(t){return"dimension"!==t}}const DX=Object.assign(Object.assign({},zF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class FX extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class zX extends nz{constructor(){super(...arguments),this.type=xR.heatmap,this.transformerConstructor=FX}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(zX.mark.cell,{isSeriesMark:!0},{morph:qF(this._spec,zX.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(zX.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ai(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=sz(this);this._cellMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),XF("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new IX(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}zX.type=xR.heatmap,zX.mark=DX,zX.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},zX.transformerConstructor=FX;const jX=()=>{GN(),sO.registerMark(RX.type,RX),sO.registerGraphicComponent("symbol",Eg),hM(),dM(),IB(),sO.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},qD),{appear:OX(e)}))),jj(),Ij(),sO.registerSeries(zX.type,zX)},HX=Object.assign(Object.assign({},zF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),VX=`${wO}_CORRELATION_X`,NX=`${wO}_CORRELATION_Y`,UX=`${wO}_CORRELATION_SIZE`,WX=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=oe(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=oe(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Lt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Lt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Lt(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+Lt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Pt(e.field),C=t.map(w),[E,B]=Ot(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Pt(e.radiusField),R=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>R;if(L){const[i,s]=L!==w?Ot(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=GX(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),YX({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,a>D?a=I:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},YX=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[PO]:null==n?void 0:n[PO],[RO]:null==n?void 0:n[RO]}};class $X extends TN{constructor(){super(...arguments),this.type=$X.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=_t(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}$X.type="ripple";const KX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class qX extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class ZX extends aU{constructor(){super(...arguments),this.type=xR.correlation,this.transformerConstructor=qX,this._viewBox=new Ve}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;EI(this._dataSet,"correlation",WX);const s=new Ba;BI(s,"dataview",wa),EI(s,"correlationCenter",XX);const n=new Pa(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new OD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const e=this._createMark(ZX.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:PO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(ZX.mark.ripplePoint,{key:PO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(ZX.mark.centerPoint,{key:PO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[VX],y:t=>t[NX],size:t=>t[UX],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),XF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}ZX.type=xR.correlation,ZX.mark=HX,ZX.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},ZX.transformerConstructor=qX;const JX=()=>{Bz(),wN(),dM(),sO.registerMark($X.type,$X),sO.registerGraphicComponent("symbol",(t=>Eg(t))),sO.registerSeries(ZX.type,ZX),sO.registerAnimation("correlation",((t,e)=>Object.assign({appear:KX(0,e)},KD)))},QX=Object.assign(Object.assign({},zF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class t$ extends TN{constructor(){super(...arguments),this.type=t$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}t$.type="liquid";const e$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class i$ extends TF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class s$ extends ez{constructor(){super(...arguments),this.type=xR.liquid,this.transformerConstructor=Pz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Dg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Eg({x:s,y:n,size:r,symbolType:e$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=YR(this._spec.outlineMargin),this._paddingSpec=YR(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(s$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(s$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(s$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(s$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new i$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),XF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),XF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=IM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}s$.type=xR.liquid,s$.mark=QX,s$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},s$.transformerConstructor=Pz;const n$=t=>Y(t).join(",");class r$ extends TF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>n$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>n$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const a$=Object.assign(Object.assign({},zF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class o$ extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const l$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?wG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class h$ extends ez{constructor(){super(...arguments),this.type=xR.venn,this.transformerConstructor=o$,this._viewBox=new Ve}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:LO)}initData(){var t;super.initData(),EI(this._dataSet,"venn",l$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(h$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(h$.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>n$(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>n$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new r$(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:n$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return n$(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[n$(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(n$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),XF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),XF(t.name,this._spec,this._markAttributeContext)))}))}}h$.type=xR.venn,h$.mark=a$,h$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},h$.transformerConstructor=o$;class c$ extends gV{constructor(){super(...arguments),this.type=xR.mosaic,this.transformerConstructor=pV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(XO),this.setFieldX2(YO)),this.setFieldY(KO),this.setFieldY2($O)):(t&&(this.setFieldY(XO),this.setFieldY2(YO)),this.setFieldX(KO),this.setFieldX2($O)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}c$.type=xR.mosaic,c$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},c$.transformerConstructor=pV;class d$ extends lH{_isValidSeries(t){return t===xR.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class u$ extends aH{constructor(){super(...arguments),this.transformerConstructor=d$,this.type="map",this.seriesType=xR.map}}u$.type="map",u$.seriesType=xR.map,u$.transformerConstructor=d$;class p$ extends lH{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class g$ extends p${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=Uz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,iO({},s,l)),n&&Object.assign(o,iO({},n,o))}}class f$ extends p${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class m$ extends p${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class v$ extends aH{constructor(){super(...arguments),this.transformerConstructor=m$}}v$.transformerConstructor=m$;class _$ extends v${constructor(){super(...arguments),this.transformerConstructor=m$,this.type="pie",this.seriesType=xR.pie}}_$.type="pie",_$.seriesType=xR.pie,_$.transformerConstructor=m$;class y$ extends f${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:rj,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:rj,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>iO({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const b$=(t,e)=>{if(!t)return null;const i=_z(t,(t=>"angle"===t.getOrient()),e),s=_z(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&tE(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=uR({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=$(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=pR(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=mz(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&tE(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=uR({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=pR(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=mz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class x$ extends aH{constructor(){super(...arguments),this.transformerConstructor=y$,this.type="rose",this.seriesType=xR.rose}_setModelOption(){this._modelOption.getDimensionInfo=b$}}x$.type="rose",x$.seriesType=xR.rose,x$.transformerConstructor=y$,G(x$,pH);class S$ extends f${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=iO({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>iO({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class A$ extends aH{constructor(){super(...arguments),this.transformerConstructor=S$,this.type="radar",this.seriesType=xR.radar}_setModelOption(){this._modelOption.getDimensionInfo=b$}}A$.type="radar",A$.seriesType=xR.radar,A$.transformerConstructor=S$,G(A$,pH);class k$ extends lH{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{L(e,"trimPadding")&&iO(e,nD(this.type,t))})),this._transformAxisSpec(t)}}class M$ extends aH{constructor(){super(...arguments),this.transformerConstructor=k$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=AH(t,e,i))&&void 0!==s?s:[],...null!==(n=b$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}M$.type="common",M$.transformerConstructor=k$,G(M$,pH);class T$ extends hH{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class w$ extends aH{constructor(){super(...arguments),this.transformerConstructor=T$}}w$.transformerConstructor=T$,G(w$,pH);class C$ extends T${transformSpec(t){super.transformSpec(t),eD(t)}}class E$ extends w${constructor(){super(...arguments),this.transformerConstructor=C$,this.type="histogram",this.seriesType=xR.bar}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}E$.type="histogram",E$.seriesType=xR.bar,E$.transformerConstructor=C$;class B$ extends g${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class P$ extends aH{constructor(){super(...arguments),this.transformerConstructor=B$,this.type="circularProgress",this.seriesType=xR.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=b$}}P$.type="circularProgress",P$.seriesType=xR.circularProgress,P$.transformerConstructor=B$,G(P$,pH);class L$ extends g${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=xR.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===xR.gauge||t.type===xR.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===xR.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class R$ extends aH{constructor(){super(...arguments),this.transformerConstructor=L$,this.type="gauge",this.seriesType=xR.gaugePointer}}R$.type="gauge",R$.seriesType=xR.gaugePointer,R$.transformerConstructor=L$;class O$ extends lH{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class I$ extends aH{constructor(){super(...arguments),this.transformerConstructor=O$,this.type="wordCloud",this.seriesType=xR.wordCloud}}I$.transformerConstructor=O$;class D$ extends I${constructor(){super(...arguments),this.transformerConstructor=O$,this.type="wordCloud",this.seriesType=xR.wordCloud}}D$.type="wordCloud",D$.seriesType=xR.wordCloud,D$.transformerConstructor=O$;class F$ extends lH{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class z$ extends aH{constructor(){super(...arguments),this.transformerConstructor=F$,this.type="funnel",this.seriesType=xR.funnel}}z$.type="funnel",z$.seriesType=xR.funnel,z$.transformerConstructor=F$;class j$ extends hH{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=Uz(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=Uz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class H$ extends aH{constructor(){super(...arguments),this.transformerConstructor=j$,this.type="linearProgress",this.seriesType=xR.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}H$.type="linearProgress",H$.seriesType=xR.linearProgress,H$.transformerConstructor=j$,G(H$,pH);class V$ extends hH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),eD(t)}}class N$ extends aH{constructor(){super(...arguments),this.transformerConstructor=V$,this.type="rangeColumn",this.seriesType=xR.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}N$.type="rangeColumn",N$.seriesType=xR.rangeColumn,N$.transformerConstructor=V$;class U$ extends lH{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class W$ extends aH{constructor(){super(...arguments),this.transformerConstructor=U$,this.type="sunburst",this.seriesType=xR.sunburst}}W$.type="sunburst",W$.seriesType=xR.sunburst,W$.transformerConstructor=U$;class G$ extends lH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class Y$ extends aH{constructor(){super(...arguments),this.transformerConstructor=G$,this.type="circlePacking",this.seriesType=xR.circlePacking}}Y$.type="circlePacking",Y$.seriesType=xR.circlePacking,Y$.transformerConstructor=G$;class X$ extends lH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class $$ extends aH{constructor(){super(...arguments),this.transformerConstructor=X$,this.type="treemap",this.seriesType=xR.treemap}}$$.type="treemap",$$.seriesType=xR.treemap,$$.transformerConstructor=X$;class K$ extends mV{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),eD(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class q$ extends vV{constructor(){super(...arguments),this.transformerConstructor=K$,this.type="waterfall",this.seriesType=xR.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}q$.type="waterfall",q$.seriesType=xR.waterfall,q$.transformerConstructor=K$;class Z$ extends hH{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),eD(t)}}class J$ extends aH{constructor(){super(...arguments),this.transformerConstructor=Z$,this.type="boxPlot",this.seriesType=xR.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}J$.type="boxPlot",J$.seriesType=xR.boxPlot,J$.transformerConstructor=Z$;class Q$ extends lH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class tK extends aH{constructor(){super(...arguments),this.transformerConstructor=Q$,this.type="sankey",this.seriesType=xR.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=vI(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}tK.type="sankey",tK.seriesType=xR.sankey,tK.transformerConstructor=Q$;class eK extends hH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),eD(t)}}class iK extends aH{constructor(){super(...arguments),this.transformerConstructor=eK,this.type="rangeArea",this.seriesType=xR.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}iK.type="rangeArea",iK.seriesType=xR.rangeArea,iK.transformerConstructor=eK;class sK extends hH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class nK extends aH{constructor(){super(...arguments),this.transformerConstructor=sK,this.type="heatmap",this.seriesType=xR.heatmap}}nK.type="heatmap",nK.seriesType=xR.heatmap,nK.transformerConstructor=sK;class rK extends lH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class aK extends aH{constructor(){super(...arguments),this.transformerConstructor=rK,this.type="correlation",this.seriesType=xR.correlation}}aK.type="correlation",aK.seriesType=xR.correlation,aK.transformerConstructor=rK;function oK(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=fI(t.style)),P(t.textStyle)||iO(s.textStyle,fI(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&fI(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&fI(s.background.style),s}const lK=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},hK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:RO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class cK extends dj{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{fR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),fR(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=HR(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new OD(this._option,e),this._initSelectedData(),fR(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(fR(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(iO({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(iO({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(iO({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}cK.specKey="legends";class dK extends cK{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),fR(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){EI(this._option.dataSet,"discreteLegendFilter",hK),EI(this._option.dataSet,"discreteLegendDataMake",lK);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return fR(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!hb(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=iI(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=oK(n):l.title={visible:!1},P(r.focusIconStyle)||fI(r.focusIconStyle),r.shape&&(r.shape=uI(r.shape)),r.label&&(r.label=uI(r.label)),r.value&&(r.value=uI(r.value)),r.background&&(r.background=uI(r.background)),VR(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),VR(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),VR(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(P(a.railStyle)||fI(a.railStyle),P(a.sliderStyle)||fI(a.sliderStyle)):(P(a.textStyle)||fI(a.textStyle),a.handler&&uI(a.handler)),l.pager=a,o.visible&&!P(o.style)&&(iO(l,o.style),p(o.padding)&&(l.padding=o.padding)),l}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return AL}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(mL.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(mL.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(mL.legendItemUnHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=mF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=mF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}dK.specKey="legends",dK.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},dK.type=r.discreteLegend;const uK=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},pK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?dI(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function gK(t){const i=iO({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:_,data:y,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:M,seriesId:T,padding:w}=i,C=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?C.title=oK(s):C.title={visible:!1},C.showHandler=!1!==n.visible,P(n.style)||(C.handlerStyle=fI(n.style)),p(r.width)&&(C.railWidth=r.width),p(r.height)&&(C.railHeight=r.height),P(r.style)||(C.railStyle=fI(r.style)),P(a.style)||(C.trackStyle=fI(a.style)),C.startText=uI(o),C.endText=uI(l),C.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>fI(i(t,e,s)):P(i)||(e.style=fI(i)),e}(h),P(c)||(C.sizeBackground=fI(c)),u.visible&&!P(u.style)&&(iO(C,u.style),p(u.padding)&&(C.padding=u.padding)),C}const fK={color:CL,size:BL},mK={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},vK=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},mK),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},_K={horizontal:vK(!0),vertical:vK(!1)},yK=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},mK),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},bK={horizontal:yK(!0),vertical:yK(!1)},xK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],SK=[2,10];class AK extends cK{static getSpecInfo(t){const e=vF(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),fR(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){EI(this._option.dataSet,"continuousLegendFilter",pK),EI(this._option.dataSet,"continuousLegendDataMake",uK);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>mR(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=iI(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!hb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=iI(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?xK:SK);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 h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},gK(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return fK[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}AK.specKey="legends",AK.builtInTheme={colorLegend:_K,sizeLegend:bK},AK.type=r.continuousLegend;const kK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,MK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),TK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function wK(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=CK(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>MK(i,s)(t)&&MK(n,r)(t)&&(u(a)||MK([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:AI.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return dF.globalConfig.uniqueTooltip&&dF.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:AI.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return dF.globalConfig.uniqueTooltip&&dF.hideTooltip(a.id),m}return"none"}const CK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=kK(c,t);let _=kK(d,t);const y=TK(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(MK(c,v));if(!y&&(_=kK(d,i),!TK(_)))return;const n=e.type===xR.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=tE(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(MK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=kK(d,o),!TK(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(MK(c,n));if(!y&&(_=kK(d,r),!TK(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===xR.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(MK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=kK(d,i),!TK(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(MK(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=kK(d,a),h=_,!TK(_)&&!a)return;TK(_)||(_=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},EK=t=>p(t)&&!y(t),BK=t=>p(t)&&y(t),PK=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class LK extends cj{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=iO({},...PK.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=iO({},s);PK.forEach((t=>{delete r[t]})),delete r.style;const a=iO({},r,i);return a.style=iO({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:rb(this._option.mode)||!sb(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=I_.getElementById(t.parentElement)):sb(this._option.mode)&&(t.parentElement=null==ib?void 0:ib.body)}}const RK={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class OK extends dj{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=LK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=sb(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&EK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&dF.globalConfig.uniqueTooltip&&l&&dF.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:AI.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:AI.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?IH.canvas:IH.dom,n=sO.getComponentPluginInType(t);n||Qy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=sO.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(nb(s)||rb(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=wK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(BK(t)){if(EK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>gz(t,e[i])))}if(BK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}OK.type=r.tooltip,OK.transformerConstructor=LK,OK.builtInTheme={tooltip:RK},OK.specKey="tooltip";var IK,DK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(IK||(IK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(DK||(DK={}));const FK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class zK extends dj{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{tE(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:kI.chart}:{source:AI.chart};y(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:nb(e)||rb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:AI.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:AI.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:AI.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{FK[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}zK.specKey="crosshair";const jK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class HK extends zK{static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=rz(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){rz(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:az(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=vR(this._regions,"cartesian");e&&(TH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=EH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new yT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new bT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}HK.specKey="crosshair",HK.builtInTheme={crosshair:jK},HK.type=r.cartesianCrosshair;class VK extends zK{static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=vR(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Nz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=mF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=_e([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=_t(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new yT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new ST(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new AT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new xT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}VK.specKey="crosshair",VK.builtInTheme={crosshair:jK},VK.type=r.polarCrosshair;const NK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},UK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},WK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},GK=(t,e,i)=>{const s=e.domain();if(JC(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},YK=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&JC(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},XK=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},$K=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},KK=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),qK=(t,e,i)=>{if(JC(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class ZK{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=_t(this.getState().start+f,0,1),_=_t(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ut(s/n)>=.5:Ut(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===hz(lz(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(ZK,VV);class JK extends dj{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:YK(t,this._stateScale,this._isHorizontal),a="percent"===n?e:YK(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=XK(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=qK(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&$K(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else fR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),fR(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=lz(t),this._isHorizontal="horizontal"===hz(this._orient),this._dataFilterEvent=new ZK(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(JC(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>hz(t._orient)===hz(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!JC(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};fR(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=JC(d.getScale(0).type),p=JC(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else fR(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;BI(r,"dataview",wa),EI(r,"dataFilterComputeDomain",WK);const a=new Pa(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new OD(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(EI(this._option.dataSet,"dataFilterWithNewDomain",UK),EI(this._option.dataSet,"lockStatisticsFilter",NK),fR(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>JC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>JC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(JC(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;KK("start",i,this._spec)&&KK("end",s,this._spec)&&(t="percent"===i?this._spec.start:YK(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:YK(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?YK(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?YK(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=GK(this._start,this._stateScale,XK(i,this._isHorizontal)),this._endValue=GK(this._end,this._stateScale,XK(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,JC(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=qK(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&fR(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new NE:new xE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),$(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=$K(h);if(!this._dataUpdating&&tE(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,tE(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(JK,VV);class QK extends cj{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=iO({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const tq=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),eq={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:tq(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:tq(!0)};class iq extends JK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=QK,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=GK(e,this._stateScale,XK(s,this._isHorizontal)),a=GK(i,this._stateScale,XK(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new NE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(XK(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=XK(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new NE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(XK(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),$(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!JC(t.type)||e[0]!==X(e))&&(!tE(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:XK(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>GK(t,this._stateScale,XK(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new vP(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>GK(t,this._stateScale,XK(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:fI(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:fI(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:fI(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:fI(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:fI(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:fI(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:fI(g.style)},selectedBackgroundStyle:fI(this._spec.selectedBackground.style),dragMaskStyle:fI(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:iO(fI(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},fI(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:iO(fI(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},fI(null===(d=m.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=mF(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(XK(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}iq.type=r.dataZoom,iq.transformerConstructor=QK,iq.builtInTheme={dataZoom:eq},iq.specKey="dataZoom";const sq={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class nq extends JK{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=aR(this._start,e)&&aR(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=XK(n,this._isHorizontal),a=GK(e,this._stateScale,r),o=GK(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new kM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=fI(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=fI(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}nq.type=r.scrollBar,nq.builtInTheme={scrollBar:sq},nq.specKey="scrollBar";const rq=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},aq=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),oq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:aq("l1FontSize","primaryFontColor")},content:{visible:!0,style:aq("l2FontSize","tertiaryFontColor")}};class lq extends dj{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(vI(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(vI(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){EI(this._option.dataSet,"indicatorFilter",rq);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new OD(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=iO({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},gI(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?$R(l,this._computeLayoutRadius()):0,dy:h?$R(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},gI(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new RL(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}lq.type=r.indicator,lq.builtInTheme={indicator:oq},lq.specKey="indicator";const hq=["sum","average","min","max","variance","standardDeviation","median"];function cq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=$(s);return er}function dq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&cq(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=VR(t.x)?fq(t.x,n)+r.x:mq(l.getXAxisHelper(),[t.x])+r.x,h}function uq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&cq(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=VR(t.y)?fq(t.y,n)+r.y:mq(l.getYAxisHelper(),[t.y])+r.y,h}function pq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&cq(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),mq(a.angleAxisHelper,[t.angle])}function gq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&cq(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),mq(a.radiusAxisHelper,[t.radius])}function fq(t,e){return Number(t.substring(0,t.length-1))*e/100}function mq(t,e){const i=t.getScale(0);return JC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function vq(t){return hq.includes(t)}function _q(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=dq(t,_,n,u,c,o),r=uq(t,y,n,u,d,o),yq(s,b,S,g.length),yq(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=dq(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);yq(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=uq(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);yq(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function yq(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=pq(t,l,n,r),i=gq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=pq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=gq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function xq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=VR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=VR(i)?Number(i.substring(0,i.length-1))*f/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&cq(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&cq(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:mq(d.getXAxisHelper(),b)+p.x+m,y:mq(d.getYAxisHelper(),x)+p.y+v})})),n}function Sq(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&cq(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&cq(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:mq(l.angleAxisHelper,d),radius:mq(l.radiusAxisHelper,u)})})),s}function Aq(t,e,i){let{x:s,y:n}=t;return VR(s)&&(s=fq(s,e)),VR(n)&&(n=fq(n,i)),{x:s,y:n}}function kq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=Aq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>Aq(t,n,r)))}function Mq(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function Tq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},fI(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Cq(fI(n.style),i,s)),p(n.padding)&&(t.padding=ai(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Cq(fI(r),i,s)),t}return{visible:!1}}function wq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function Cq(t,e,i){return d(t)?t(e,i):t}function Eq(t,e){return d(t)?t(e):t}function Bq(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function Pq(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function Lq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=Pq(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function Rq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=Pq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function Oq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function Iq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&vq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&vq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&vq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&vq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Fq(i,t,e))):i.x=Fq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Fq(i,t,e))):i.y=Fq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Fq(i,t,e))):i.angle=Fq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Fq(i,t,e))):i.radius=Fq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Fq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const Dq={min:(t,e)=>oR(t[0].latestData,e.field),max:(t,e)=>lR(t[0].latestData,e.field),sum:function(t,e){return hR(t[0].latestData,e.field)},average:function(t,e){return cR(t[0].latestData,e.field)},variance:function(t,e){return dR(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(dR(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Fq(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(m(t)){const{aggrType:i,field:s}=t;return Dq[i](e,{field:s})}return t}function zq(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class jq extends dj{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&vq(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ba;return e.registerParser("array",s),new Pa(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=vR(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=UR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=UR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();EI(this._option.dataSet,"markerAggregation",Iq),EI(this._option.dataSet,"markerFilter",zq);const i=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function Hq(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=oR(t,e),r=lR(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Vq extends jq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=Lq(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Cq(fI(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>Tq(t,this._markerData,this._markAttributeContext))),state:{line:wq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:wq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:wq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return wq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return wq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:Cq(fI(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:Cq(fI(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=Mq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=Lq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;EI(this._option.dataSet,"markerAggregation",Iq),EI(this._option.dataSet,"markerRegression",Hq),EI(this._option.dataSet,"markerFilter",zq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Pa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}Vq.specKey="markLine";const Nq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Uq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},Wq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:Nq(!1),endSymbol:Nq(!0),label:Uq};class Gq extends Vq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new iL(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=Lq(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=_q(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=xq(i,r,d,e.coordinatesOffset):c&&(y=kq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(VR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=Lq(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}Gq.type=r.markLine,Gq.coordinateType="cartesian",Gq.builtInTheme={markLine:Wq};class Yq extends Vq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=Lq(this._spec);return e||i?new rL(t):new iL(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=Lq(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=bq(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=Sq(i,r,a),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=Lq(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}Yq.type=r.polarMarkLine,Yq.coordinateType="polar",Yq.builtInTheme={polarMarkLine:Wq};class Xq extends dj{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=HR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return vF(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=UR(this._spec.width,a.width,null,a.width),l=UR(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new PL(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}Xq.type=r.title,Xq.specKey=r.title,Xq.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class $q extends jq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=Rq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:Cq(fI(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>Tq(t,this._markerData,this._markAttributeContext))),state:{area:wq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>wq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return wq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=Mq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=Rq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}$q.specKey="markArea";const Kq={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class qq extends $q{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new nL(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=Rq(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=_q(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=_q(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=xq(s,a,u,i.coordinatesOffset):d&&(f=kq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=Rq(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}qq.type=r.markArea,qq.coordinateType="cartesian",qq.builtInTheme={markArea:Kq};class Zq extends $q{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=Rq(this._spec);return i||e||s?new aL(t):new nL(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=Rq(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=bq(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=Sq(i,r,c),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=Rq(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Zq.type=r.polarMarkArea,Zq.coordinateType="polar",Zq.builtInTheme={polarMarkArea:Kq};const Jq=t=>fI(Object.assign({},t)),Qq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},fI(t.style))}),tZ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=Jq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Jq(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},fI(Object.assign({},y)));var y;const b=Qq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Qq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Qq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=Qq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},eZ=t=>"left"===t||"right"===t,iZ=t=>"top"===t||"bottom"===t,sZ={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class nZ extends dj{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},tZ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},tZ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new XL(t):this._playerComponent=new qL(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=eZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=eZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(VL.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(VL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(VL.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(VL.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(VL.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(VL.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=eZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=iZ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):eZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):iZ(this._orient)?this._maxSize():t.height}_computeDx(t){return eZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return iZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}nZ.builtInTheme={player:sZ},nZ.specKey="player",nZ.type=r.player;class rZ extends dj{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=ER({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==lD.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}rZ.type=r.label;class aZ extends WN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}aZ.type="text",aZ.constructorType="label";const oZ=()=>{GN(),sO.registerMark(aZ.constructorType,aZ)};class lZ extends cj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class hZ extends rZ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=lZ,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(bI.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(bI.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),fR(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=iO({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},hN(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[GO])):t=>t.filter((t=>t.data[WO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?cN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}hZ.type=r.label,hZ.specKey="label",hZ.transformerConstructor=lZ;class cZ extends rZ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[NO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return iO({textStyle:{pickable:!0===this._spec.interactive},position:dZ(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[GO]:t.data[WO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>cN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function dZ(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}cZ.type=r.totalLabel,cZ.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},cZ.specKey="totalLabel";class uZ extends jq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Oq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R,O;const{itemContent:I={},itemLine:D={},targetSymbol:F={}}=this._spec,z=I,{type:H="text",text:V,symbol:N,image:U,richText:W,customMark:G,textStyle:Y,symbolStyle:X,imageStyle:$,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=z,Q=e(z,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:J,it={dx:0,dy:0},et=Tq(Object.assign(Object.assign({},V),{style:j(it,null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==W?void 0:W.state)&&void 0!==r?r:J,it={width:100,height:100},et=Cq(j(it,null!==(o=null!==(a=null==W?void 0:W.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==N?void 0:N.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=fI(Cq(j(it,null!==(c=null!==(h=null==N?void 0:N.style)&&void 0!==h?h:X)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==U?void 0:U.state)&&void 0!==d?d:J,it={width:80,height:80},et=Cq(j(it,null!==(p=null!==(u=null==U?void 0:U.style)&&void 0!==u?u:$)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=Cq(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:Eq(I.offsetX,this._relativeSeries.getRegion()),offsetY:Eq(I.offsetX,this._relativeSeries.getRegion())},Q),{style:Cq(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(A=F.size)&&void 0!==A?A:20,style:Cq(F.style,this._markerData,this._markAttributeContext)},state:{line:wq(null!==(M=null===(k=this._spec.itemLine.line)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:wq(null!==(w=null===(T=this._spec.itemLine.startSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:wq(null!==(E=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext),itemContent:wq(tt,this._markerData,this._markAttributeContext),textBackground:wq(null===(P=null===(B=this._spec.itemContent.text)||void 0===B?void 0:B.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:wq(null!==(R=null===(L=this._spec.targetSymbol)||void 0===L?void 0:L.state)&&void 0!==R?R:{},this._markerData,this._markAttributeContext)},animation:null!==(O=this._spec.animation)&&void 0!==O&&O,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=e(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:fI(rt.style)}):{visible:!1};return new lL(st)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Mq([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:Bq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:Bq(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=Oq(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}uZ.specKey="markPoint";const pZ={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class gZ extends uZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=_q(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=xq(n,r,h,s.coordinatesOffset)[0]:l&&(c=kq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Oq(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}gZ.type=r.markPoint,gZ.coordinateType="cartesian",gZ.builtInTheme={markPoint:pZ};class fZ extends uZ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=bq(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}fZ.type=r.polarMarkPoint,fZ.coordinateType="polar",fZ.builtInTheme={polarMarkPoint:pZ};class mZ extends uZ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}mZ.type=r.geoMarkPoint,mZ.coordinateType="geo",mZ.builtInTheme={geoMarkPoint:pZ};const vZ="inBrush",_Z="outOfBrush";class yZ extends dj{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),vZ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),_Z,t.AttributeLevel.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new tR(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:fI(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener($L.brushActive,(s=>{this._initMarkBrushState(i,_Z),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener($L.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($L.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($L.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($L.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($L.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener($L.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener($L.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},fI(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(vZ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(vZ),i.addState(_Z,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(vZ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(vZ),i.addState(_Z,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(vZ),s.removeState(_Z),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}yZ.type=r.brush,yZ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},yZ.specKey="brush";class bZ extends dj{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${wO}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=YF({},XF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ve).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ve;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}bZ.type=r.customMark,bZ.specKey="customMark";class xZ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>SZ(t))),a=n.filter((t=>!SZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>SZ(t))),h=o.filter((t=>!SZ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function SZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}xZ.type="grid";const AZ="vchart-tooltip",kZ=`${AZ}-container`,MZ=`${AZ}-title`,TZ=`${AZ}-content-box`,wZ={offsetX:10,offsetY:10},CZ="99999999999999";function EZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const BZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,PZ=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?EZ(t):"",LZ=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},RZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},OZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=RZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class IZ extends jz{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=xF(null==T?void 0:T.position,b,e),C=null!==(r=xF(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:CO,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:EO;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=sb(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=BZ(e,F),V=BZ(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(OZ(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},$=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=LZ(t,_),W.top=LZ(i,_),W.right=LZ(e,_),W.bottom=LZ(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&$.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=LZ(e,_):X(e,t)}));else p(w)&&(X({orient:w,mode:C},"x"),X({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=OZ(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",FZ=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=DZ(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=DZ(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},zZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?UR(e,t.fontSize):0},jZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=ai(r),a.padding=DZ(o)),{panelStyle:a,panelPadding:o}};function HZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class VZ extends IZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(VZ.type),this.type=IH.dom,this._tooltipContainer=null==ib?void 0:ib.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(ib&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=jZ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:DZ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=FZ(h),x=FZ(d),S=FZ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=DZ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=DZ(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=DZ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(zZ(p),zZ(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(MZ))),l=a.find((t=>t.className.includes(TZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(MZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(HZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${AZ}-column`),e.classList.add(`${AZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(TZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];HZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));HZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${AZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=PZ(e.key),e.keyStyle&&FZ(e.keyStyle,l)):"value"===i?(o.innerHTML=PZ(e.value),e.valueStyle&&FZ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?EZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?EZ(c):m,y=p,b=t=>new Cg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ve));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=vh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?EZ(u):"currentColor",`\n \n \n \n `;const w=T?vh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),HZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(TZ))),h=[...o.children].find((t=>t.className.includes(MZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(MZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=UR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,HZ(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},ff||(ff=pf.CreateGraphic("richtext",{})),ff.setAttributes(a),ff.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function WZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:NZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const GZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class YZ extends IZ{constructor(){super(YZ.type),this.type=IH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new rR({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ai(d.padding),b=YR(d.padding),x=WZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=WZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=WZ(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},M={panel:GZ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=iO({},S,WZ(b,void 0,{})),{width:s,height:n,text:r}=UZ(h,i);T.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(m)){const t=iO({},A,WZ(x,void 0,{})),{width:e,height:s,text:n}=UZ(m,t);T.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=iO({},x,WZ(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=UZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-I-L-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}YZ.type=IH.canvas;const XZ=/\{([^}]+)\}/,$Z=/\{([^}]+)\}/g,KZ=/:/;class qZ extends jz{constructor(){super(qZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:mi.getInstance().timeUTCFormat,local:mi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=ki.getInstance().format,this._numericSpecifier=ki.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[qZ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),sO.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=XZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace($Z,((t,i)=>{if(!KZ.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(xi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}qZ.pluginType="chart",qZ.specKey="formatter",qZ.type="formatterPlugin";dF.useRegisters([()=>{HH(),NH(),WH(),vH(),mH(),eH(),Yj(),Cz(),Bz(),tF(),ZD(),jj(),Ij(),sO.registerSeries(iH.type,iH),sO.registerChart(GH.type,GH)},()=>{HH(),NH(),WH(),mH(),eH(),Yj(),Cz(),$H(),Bz(),ZH(),jj(),Ij(),sO.registerSeries(QH.type,QH),vH(),sO.registerChart(eV.type,eV)},()=>{HH(),NH(),WH(),mH(),fV(),vH(),sO.registerChart(vV.type,vV)},()=>{HH(),NH(),vH(),mH(),wV(),sO.registerChart(EV.type,EV)},()=>{NH(),kU(),sO.registerChart(_$.type,_$)},()=>{HH(),NH(),vH(),mH(),NU(),sO.registerChart(x$.type,x$)},()=>{HH(),NH(),WH(),vH(),mH(),ZU(),sO.registerChart(A$.type,A$)},()=>{HH(),NH(),WH(),vH(),mH(),fV(),sO.registerTransform("bin",Kr),sO.registerChart(E$.type,E$)},()=>{NH(),WV(),OV(),sO.registerSeries(YV.type,YV),sO.registerImplement("registerMap",OI),sO.registerImplement("unregisterMap",II),JD(),sO.registerChart(u$.type,u$)},()=>{NH(),BX(),sO.registerSeries(LX.type,LX),_U(),uW(),zU(),fW(),sO.registerChart(R$.type,R$)},()=>{NH(),sY(),sO.registerChart(D$.type,D$)},()=>{NH(),AY(),sO.registerChart(z$.type,z$)},()=>{HH(),NH(),WH(),vH(),mH(),xN(),sO.registerChart(q$.type,q$)},()=>{HH(),NH(),vH(),mH(),UN(),sO.registerTransform("boxplot",qr),sO.registerChart(J$.type,J$)},()=>{HH(),NH(),vH(),mH(),fW(),sO.registerChart(P$.type,P$)},()=>{HH(),NH(),vH(),mH(),SW(),sO.registerChart(H$.type,H$)},()=>{HH(),NH(),vH(),mH(),tU(),sO.registerChart(N$.type,N$)},()=>{HH(),NH(),WH(),vH(),mH(),$H(),jj(),Ij(),sO.registerSeries(rU.type,rU),sO.registerChart(iK.type,iK)},()=>{NH(),VY(),sO.registerChart(W$.type,W$)},()=>{NH(),XY(),sO.registerChart(Y$.type,Y$)},()=>{NH(),bX(),sO.registerChart($$.type,$$)},()=>{NH(),xo.load(CM),uX(),sO.registerChart(tK.type,tK)},()=>{NH(),jX(),sO.registerChart(nK.type,nK)},()=>{NH(),JX(),sO.registerChart(aK.type,aK)},()=>{HH(),NH(),WH(),vH(),sO.registerChart(M$.type,M$),mH()},Ij,jj,()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),_j(),sO.registerComponent(Hj.type,Hj)},()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),_j(),sO.registerComponent(Vj.type,Vj)},()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),_j(),sO.registerComponent(Nj.type,Nj)},HU,zU,()=>{sO.registerComponent(dK.type,dK)},()=>{sO.registerComponent(AK.type,AK)},()=>{sO.registerComponent(OK.type,OK)},()=>{sO.registerComponent(HK.type,HK)},()=>{sO.registerComponent(VK.type,VK)},()=>{sO.registerComponent(iq.type,iq)},()=>{sO.registerComponent(nq.type,nq)},()=>{sO.registerComponent(lq.type,lq)},WV,()=>{sO.registerComponent(Gq.type,Gq),eL()},()=>{sO.registerComponent(qq.type,qq),sL()},()=>{sO.registerComponent(gZ.type,gZ),oL()},()=>{sO.registerComponent(Yq.type,Yq),rL._animate=DP,eL()},()=>{sO.registerComponent(Zq.type,Zq),aL._animate=zP,sL()},()=>{sO.registerComponent(fZ.type,fZ),oL()},()=>{sO.registerComponent(mZ.type,mZ),oL()},()=>{sO.registerComponent(Xq.type,Xq)},()=>{sO.registerComponent(nZ.type,nZ)},()=>{sO.registerGraphicComponent(hZ.type,(t=>new GB(t))),oZ(),fj(),sO.registerComponent(hZ.type,hZ,!0,1/0)},()=>{sO.registerGraphicComponent(cZ.type,(t=>new GB(t))),oZ(),fj(),sO.registerComponent(cZ.type,cZ,!0)},()=>{sO.registerComponent(yZ.type,yZ)},()=>{sO.registerComponent(bZ.type,bZ)},()=>{xo.load(vT)},()=>{sO.registerLayout(xZ.type,xZ)},()=>{var t;t=YZ,sO.registerComponentPlugin(t.type,t)},()=>{var t;t=qZ,sO.registerChartPlugin(t.type,t)},aF,hF]),dF.useRegisters([()=>{iA(xo)}]),t.DEFAULT_CHART_HEIGHT=EO,t.DEFAULT_CHART_WIDTH=CO,t.DEFAULT_CLOSE_STROKE_JOIN=gF,t.DEFAULT_DATA_INDEX=PO,t.DEFAULT_DATA_KEY=LO,t.DEFAULT_DATA_SERIES_FIELD=RO,t.DEFAULT_KEY=JO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=pF,t.DEFAULT_MAP_LOOK_UP_KEY=QO,t.DEFAULT_MEASURE_CANVAS_ID=BO,t.DEFAULT_SERIES_STYLE_NAME=OO,t.DEFAULT_SMOOTH_INTERPOLATE=uF,t.Factory=sO,t.MOSAIC_CAT_END_PERCENT=KO,t.MOSAIC_CAT_START_PERCENT=$O,t.MOSAIC_VALUE_END_PERCENT=XO,t.MOSAIC_VALUE_START_PERCENT=YO,t.ManualTicker=class extends bw{constructor(t){super(t),this.lastFrameTime=0,this.status=Ro.RUNNING}setupTickHandler(){const t=new xw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,!0}},t.PREFIX=wO,t.SEGMENT_FIELD_END=ZO,t.SEGMENT_FIELD_START=qO,t.STACK_FIELD_END=FO,t.STACK_FIELD_END_OffsetSilhouette=VO,t.STACK_FIELD_END_PERCENT=jO,t.STACK_FIELD_KEY=IO,t.STACK_FIELD_START=DO,t.STACK_FIELD_START_OffsetSilhouette=HO,t.STACK_FIELD_START_PERCENT=zO,t.STACK_FIELD_TOTAL=NO,t.STACK_FIELD_TOTAL_BOTTOM=GO,t.STACK_FIELD_TOTAL_PERCENT=UO,t.STACK_FIELD_TOTAL_TOP=WO,t.StreamLight=class extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Ao.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Wl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Ao.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=cl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=cl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),y=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=y*this.gridSize;const _=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,_,b);const C=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let M,w=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;w--;)for(M=x;M--;)B(w,M,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:_,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?EJ(t,o,l.width,l.height,h):"geometric"===t.type&&RJ(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=vJ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};OJ.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class IJ extends xJ{constructor(t){super(H({},IJ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}IJ.defaultOptions={enlarge:!1};const DJ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},FJ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.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?zJ(t.fontFamily):"sans-serif",d=t.fontStyle?zJ(t.fontStyle):"normal",u=t.fontWeight?zJ(t.fontWeight):"normal",p=t.rotate?zJ(t.rotate):0,g=zJ(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?zJ(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",y=null!==(r=t.shrink)&&void 0!==r&&r,_=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},DJ),t.as):DJ,C=t.depth_3d,T=t.postProjection;let M=t.fontSize?zJ(t.fontSize):14;const w=t.fontSizeRange;if(w&&!S(M)){const t=M,e=jJ(NJ(t,l),w);M=i=>e(t(i))}let E=AJ;"fast"===t.layoutType?E=IJ:"grid"===t.layoutType&&(E=OJ);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:M,shrink:y,clip:b,enlarge:_,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},zJ=t=>y(t)||S(t)||d(t)||_(t)?t:e=>e[t.field],HJ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),jJ=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=HJ(t[0]),n=HJ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(HJ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},NJ=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function UJ(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{oT.registerGrammarTransform("wordcloud",{transform:FJ}),A$(),oT.registerAnimation("wordCloud",((t,e)=>({appear:bZ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:Ez.disappear.duration}}))),oT.registerSeries(VJ.type,VJ)},GJ=t=>d(t)?t():t,YJ=(t,e)=>{var i,s,n,r;const a=t.map((t=>Object.assign({},t)));if(!a||0===a.length)return a;const{asTransformRatio:o,asReachRatio:l,asHeightRatio:h,asValueRatio:c,asNextValueRatio:d,asLastValueRatio:u,asLastValue:p,asCurrentValue:g,asNextValue:f}=e,m=GJ(e.valueField),v=null!==(i=GJ(e.heightVisual))&&void 0!==i&&i,y=null===(s=GJ(e.isCone))||void 0===s||s,_=GJ(e.range),b=a.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[m])||-1/0)),-1/0),x=a.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[m])||1/0)),1/0),S=[null!==(n=null==_?void 0:_.min)&&void 0!==n?n:x,null!==(r=null==_?void 0:_.max)&&void 0!==r?r:b];return a.forEach(((t,e)=>{var i,s;const n=Number.parseFloat(t[m]),r=Number.parseFloat(null===(i=a[e-1])||void 0===i?void 0:i[m]),_=Number.parseFloat(null===(s=a[e+1])||void 0===s?void 0:s[m]),b=k(_*n)&&0!==n?_/n:0,x=k(n*r)&&0!==r?n/r:0;p&&(t[p]=r),f&&(t[f]=_),o&&(t[o]=b),l&&(t[l]=0===e?1:x),h&&(t[h]=!0===v?b:1/a.length),c&&(t[c]=n/S[1]),d&&(t[d]=e===a.length-1?y?0:t[c]:_/S[1]),u&&(t[u]=0===e?1:r/S[1]),g&&(t[g]=n)})),a},XJ=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},KJ=`${PT}_FUNNEL_TRANSFORM_RATIO`,$J=`${PT}_FUNNEL_REACH_RATIO`,qJ=`${PT}_FUNNEL_HEIGHT_RATIO`,ZJ=`${PT}_FUNNEL_VALUE_RATIO`,JJ=`${PT}_FUNNEL_LAST_VALUE_RATIO`,QJ=`${PT}_FUNNEL_NEXT_VALUE_RATIO`,tQ=`${PT}_FUNNEL_LAST_VALUE`,eQ=`${PT}_FUNNEL_CURRENT_VALUE`,iQ=`${PT}_FUNNEL_NEXT_VALUE`,sQ=`${PT}_FUNNEL_TRANSFORM_LEVEL`;class nQ extends dH{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[$J])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class rQ extends pz{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class aQ extends rQ{constructor(){super(...arguments),this.type=aQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}aQ.type="polygon";const oQ=()=>{oT.registerMark(aQ.type,aQ),XO(),FO(),sI.registerBuiltInAnimate("growPointsOut",WI),oT.registerGraphicComponent("polygon",af)},lQ=Object.assign(Object.assign({},AH),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class hQ extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class cQ extends YH{constructor(){super(...arguments),this.type=CC.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=hQ,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;DM(this._dataSet,"funnel",YJ),DM(this._dataSet,"funnelTransform",XJ);const t=new Oa(this._dataSet,{name:`${PT}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new VF(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:()=>this.getValueField(),isCone:()=>this._spec.isCone,asCurrentValue:eQ,asTransformRatio:KJ,asReachRatio:$J,asHeightRatio:qJ,asValueRatio:ZJ,asNextValueRatio:QJ,asLastValueRatio:JJ,asLastValue:tQ,asNextValue:iQ,range:()=>this._spec.range}}),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.transform({type:"funnelTransform",options:{asIsTransformLevel:sQ}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},cQ.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:LH(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},cQ.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(cQ.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(cQ.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new nQ(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&oA(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&oA(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*Ak($J).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),RH("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(PH(oT.getAnimationInKey("fadeInOut")(),RH(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(PH(oT.getAnimationInKey("funnel")({},o),RH(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(PH(null===(a=oT.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),RH("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[JJ])/2:this._getSecondaryAxisLength(t[ZJ])/2,n=this._getSecondaryAxisLength(t[ZJ])/2):(s=this._getSecondaryAxisLength(t[ZJ])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[QJ])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[sQ])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[DT]===t[DT]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_{oQ(),A$(),PK(),oT.registerSeries(cQ.type,cQ),oT.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},Pz))),oT.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Cz,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),Oz()},uQ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},pQ=t=>{const e=t.filter((t=>t.context.diffState===vF.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},gQ=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},fQ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pQ(i.parent.children),a=gQ(r,s,n);return uQ(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pQ(i.parent.children),a=gQ(r,s,n);return uQ(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),mQ=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},vQ=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pQ(i.parent.children),a=mQ(r);return uQ(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pQ(i.parent.children),a=mQ(r);return uQ(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),yQ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},_Q=(t,e={})=>{if(!t)return[];const i=[];return kZ(t,i,e),i},bQ=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new JZ(i).layout(t,{width:s,height:n})};class xQ extends dH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var SQ;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(SQ||(SQ={}));const AQ=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===SQ.DrillDown){return Y(pM(t,n,s,"children"))}if(i.type===SQ.DrillUp){const e=gM(t,n,s,"children");if(e)return Y(e)}return t};class kQ{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=fK(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;DM(t,"drillFilter",AQ),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!_(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:SQ.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:SQ.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!_(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:SQ.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:SQ.DrillUp},model:this}),r}}const CQ=Object.assign(Object.assign({},AH),{sunburst:{name:"sunburst",type:"arc"}}),TQ=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:mH,operations:["max","min","values"]}),t.push({key:vH,operations:["values"]}),t),MQ={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class wQ extends z${constructor(){super(...arguments),this.type=CC.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:vH),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:DT},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(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),DM(this._dataSet,"sunburstLayout",bQ),DM(this._dataSet,"flatten",_Q),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return TQ(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(DM(t.dataSet,"addVChartProperty",nH),t.transform({type:"addVChartProperty",options:{beforeCall:xH.bind(this),call:SH}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(wQ.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(wQ.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new xQ(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),RH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),RH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}wQ.type=CC.sunburst,wQ.mark=CQ,wQ.builtInTheme={sunburst:MQ},G(wQ,kQ);const EQ=()=>{oT.registerSeries(wQ.type,wQ),q$(),A$(),Oz(),oT.registerAnimation("sunburst",((t,e)=>({appear:yQ(0,e),enter:fQ(t),exit:vQ(t),disappear:{duration:Ez.disappear.duration}})))},BQ=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new jZ(i).layout(t,{width:s,height:n})};class PQ extends dH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const RQ=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},OQ=Object.assign(Object.assign({},AH),{circlePacking:{name:"circlePacking",type:"arc"}});class IQ extends $H{constructor(){super(...arguments),this.type=CC.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:vH),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:DT},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),DM(this._dataSet,"circlePackingLayout",BQ),DM(this._dataSet,"flatten",_Q),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(DM(t.dataSet,"addVChartProperty",nH),t.transform({type:"addVChartProperty",options:{beforeCall:xH.bind(this),call:SH}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(IQ.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(IQ.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return TQ(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new PQ(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),RH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),RH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}IQ.type=CC.circlePacking,IQ.mark=OQ,IQ.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(IQ,kQ);const LQ=()=>{oT.registerSeries(IQ.type,IQ),q$(),A$(),Rz(),oT.registerAnimation("circlePacking",((t,e)=>({appear:RQ(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:Ez.disappear.duration}})))},DQ=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&DQ(t,e.children,i)}))},FQ=t=>{var e;if(!t||!_(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},zQ=(t,e)=>{const i=d(e)?e():e;if(!t||!(null==i?void 0:i.view)||!t.length)return[];const s=i.view();if(s.x1-s.x0==0||s.y1-s.y0==0||s.x1-s.x0==-1/0||s.x1-s.x0==1/0||s.y1-s.y0==-1/0||s.y1-s.y0==1/0)return[];const n=t[0],r=HQ(n,i),a=new $Z(i),o=[];return o.push(a.layout(r,s)),o},HQ=(t,e)=>{if("source"===e.sourceField&&"target"===e.targetField&&"value"===e.valueField)return t;const i=t.links;return i?Object.assign(Object.assign({},t),{links:i.map((t=>{const i={};return Object.keys(t).forEach((s=>{s===e.sourceField?i.source=t[e.sourceField]:s===e.targetField?i.target=t[e.targetField]:s===e.valueField?i.value=t[e.valueField]:i[s]=t[s]})),i}))}):t},jQ=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},NQ=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class UQ extends dH{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const VQ=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),WQ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:VQ(t),GQ=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class YQ extends SI{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class XQ extends SI{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const KQ=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},$Q=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class qQ extends s${constructor(){super(...arguments),this.type=qQ.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?$Q:KQ,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}qQ.type="linkPath";const ZQ=Object.assign(Object.assign({},AH),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class JQ extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const QQ=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&dz(t,e),cz(t,e,s,n)};class t0 extends $H{constructor(){super(...arguments),this.type=CC.sankey,this.transformerConstructor=JQ,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ue,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{dz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),n.forEach((e=>{dz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=kM(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=kM(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=kM(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(dz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),QQ(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(dz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),cz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=kM(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=kM(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=kM(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=kM(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=kM(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return dz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QQ(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),dz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QQ(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});dz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),cz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(kM(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{dz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._nodeMark&&i.forEach((e=>{dz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])}));else{const n=kM(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=kM(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QQ(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QQ(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QQ(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){super.initData();const e=this.getViewData(),i=this.getRawData();if(i&&e){DM(this._dataSet,"sankeyLayout",zQ),DM(this._dataSet,"sankeyFormat",FQ),i.transform({type:"sankeyFormat"},!1),e.transform({type:"sankeyLayout",options:()=>{var t,e,i,s;return{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse}},level:t.TransformLevel.sankeyLayout});const{dataSet:s}=this._option;DM(s,"sankeyNodes",jQ),DM(s,"flatten",_Q);const n=new Oa(s,{name:`sankey-node-${this.id}-data`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyNodes"}),n.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),n.transform({type:"addVChartProperty",options:{beforeCall:_H.bind(this),call:bH}},!1),this._nodesSeriesData=n,DM(s,"sankeyLinks",NQ);const r=new Oa(s,{name:`sankey-link-${this.id}-data`});r.parse([this.getViewData()],{type:"dataview"}),r.transform({type:"sankeyLinks"}),r.transform({type:"addVChartProperty",options:{beforeCall:_H.bind(this),call:bH}},!1),this._linksSeriesData=r}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(t0.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(t0.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=eH(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),RH("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),RH("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:PM.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{dz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(kM(e).key)?cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new UQ(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new zC;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return DQ(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}t0.type=CC.sankey,t0.transformerConstructor=JQ,t0.mark=ZQ,t0.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const e0=()=>{FX(),n$(),LO(),oT.registerGraphicComponent("path",(t=>Ug(t))),oT.registerMark(qQ.type,qQ),A$(),oT.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:WQ(t,e)},Pz))),oT.registerAnimation("sankeyLinkPath",((t,e)=>({appear:GQ(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:Ez.disappear.duration}}))),sI.registerBuiltInAnimate("linkPathGrowOut",XQ),sI.registerBuiltInAnimate("linkPathGrowIn",YQ),Oz(),oT.registerSeries(t0.type,t0)},i0=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=_Q(n);return i=pH([{latestData:r}],e),i};class s0 extends dH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const n0=Object.assign(Object.assign({},AH),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),r0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class a0 extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const o0=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();if(s){const e=new iJ(i).layout(t,s),n=[];return kZ(e,n,{maxDepth:null==i?void 0:i.maxDepth}),n.forEach((t=>{t&&[vH,"name"].forEach((e=>{t[e]=t.datum[t.depth][i.nameField]}))})),n}return[]};class l0 extends $H{constructor(){super(...arguments),this.type=CC.treemap,this.transformerConstructor=a0,this._categoryField="name",this._valueField="value",this._viewBox=new Ue,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:vH),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ge),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:DT},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t;super.initData(),DM(this._dataSet,"treemap",o0),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:()=>{var t,e,i,s;return{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(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!==(s=this._spec.minVisibleArea)&&void 0!==s?s:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(DM(this._rawData.dataSet,"addVChartProperty",nH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:xH.bind(this),call:SH}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=i0([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=H(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){DM(this._dataSet,"hierarchyDimensionStatistics",i0),DM(this._dataSet,"flatten",_Q);const i=new Oa(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 TQ(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(l0.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(l0.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("treemap"))||void 0===e?void 0:e(),RH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new s0(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(MM.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(MM.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}l0.type=CC.treemap,l0.mark=n0,l0.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},l0.transformerConstructor=a0,G(l0,kQ),G(l0,vK);const h0=()=>{oT.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),oT.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),FX(),A$(),oT.registerAnimation("treemap",((t,e)=>({appear:r0(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:Ez.disappear.duration}}))),Oz(),oT.registerSeries(l0.type,l0)},c0=Object.assign(Object.assign({},Wq),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),d0=Object.assign(Object.assign({},AH),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),u0={type:"fadeIn"};function p0(t,e){return"fadeIn"===e?u0:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class g0 extends HH{constructor(){super(...arguments),this._supportStack=!1}}class f0 extends dH{enableByType(t){return"dimension"!==t}}const m0="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",v0={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:m0,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:m0,fill:"#ddd"}}};class y0 extends Yq{constructor(){super(...arguments),this.type=CC.gaugePointer,this.transformerConstructor=g0,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(y0.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},y0.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(y0.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new f0(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=K(e),s=$(e),n=yt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),RH("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}y0.type=CC.gaugePointer,y0.mark=d0,y0.builtInTheme={gaugePointer:v0},y0.transformerConstructor=g0;const _0=()=>{oT.registerSeries(y0.type,y0),cK(),FX(),oT.registerAnimation("gaugePointer",((t,e)=>{const i=p0(t,e);return{appear:i,enter:i,disappear:{duration:Ez.disappear.duration}}})),xq(),_q()};class b0 extends HH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class x0 extends Yq{constructor(){super(...arguments),this.type=CC.gauge,this.transformerConstructor=b0,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();DM(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[eM]=t[this._angleField[0]],t[tM]=e>0?i[e-1][eM]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(x0.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(x0.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?NC(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?NC(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[tM])?this.angleAxisHelper.dataToPosition([t[tM]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[eM]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),RH("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}x0.type=CC.gauge,x0.mark=c0,x0.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},x0.transformerConstructor=b0;class S0 extends pz{constructor(){super(...arguments),this.type=S0.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return tg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}S0.type="cell";function A0(t){return!1===t?{}:{type:"fadeIn"}}class k0 extends dH{enableByType(t){return"dimension"!==t}}const C0=Object.assign(Object.assign({},AH),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class T0 extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}const M0={valueField:!0};class w0 extends $H{constructor(){super(...arguments),this.type=CC.heatmap,this.transformerConstructor=T0}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),M0)})}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(w0.mark.cell,{isSeriesMark:!0},{morph:LH(this._spec,w0.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(w0.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=oi(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=KH(this);this._cellMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),RH("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new k0(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}w0.type=CC.heatmap,w0.mark=C0,w0.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},w0.transformerConstructor=T0;const E0=()=>{A$(),oT.registerMark(S0.type,S0),oT.registerGraphicComponent("symbol",tg),XO(),ZO(),sN(),oT.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},Pz),{appear:A0(e)}))),qU(),uV(),oT.registerSeries(w0.type,w0)},B0=Object.assign(Object.assign({},AH),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),P0=`${PT}_CORRELATION_X`,R0=`${PT}_CORRELATION_Y`,O0=`${PT}_CORRELATION_SIZE`,I0=t=>d(t)?t():t,L0=(t,e)=>{var i,s,n,r,a,o,l,h;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const c=t,d=e.view();if(d.x1-d.x0==0||d.y1-d.y0==0||d.x1-d.x0==-1/0||d.x1-d.x0==1/0||d.y1-d.y0==-1/0||d.y1-d.y0==1/0)return t;const p=oe(null!==(i=I0(e.startAngle))&&void 0!==i?i:-90),g=oe(null!==(s=I0(e.endAngle))&&void 0!==s?s:270),f=Math.max((d.x1-d.x0)/2,(d.y1-d.y0)/2),m=Rt(null!==(n=I0(e.innerRadius))&&void 0!==n?n:0,f),v=Rt(I0(e.outerRadius),f),y=I0(e.center),b=[S(null==y?void 0:y[0])?y[0]:d.x0+Rt(null!==(r=null==y?void 0:y[0])&&void 0!==r?r:"50%",d.x1-d.x0),S(null==y?void 0:y[1])?y[1]:d.y0+Rt(null!==(a=null==y?void 0:y[1])&&void 0!==a?a:"50%",d.y1-d.y0)],x=Pt(I0(e.field)),A=c.map(x),[k,C]=It(A),T=k===C?t=>(m+v)/2:t=>m+(v-m)*(t-k)/(C-k),M=I0(e.radiusField),w=I0(e.radiusRange),E=u(M)?x:Pt(M),B=null!==(o=null==w?void 0:w[1])&&void 0!==o?o:5;let P=t=>B;if(E){const[t,e]=E!==x?It(c.map(E)):[k,C],i=null!==(l=null==w?void 0:w[0])&&void 0!==l?l:5,s=null!==(h=null==w?void 0:w[1])&&void 0!==h?h:5;t!==e&&(P=n=>i+(s-i)*(E(n)-t)/(e-t))}const R=Math.min(p,g),O=Math.max(p,g),I=D0(R,O,c.length),L=[],D=(O-R)/60;return c.forEach(((t,e)=>{const i=T(A[e]),s=P(t);let n,r,a=I[e];for(let t=0;t<60&&(n=b[0]+i*Math.cos(a),r=b[1]+i*Math.sin(a),F0({x:n,y:r,size:s},L)||n-sd.x1||r-sd.y1);t++)t<59&&(a+=D,a>O?a=R:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},F0=(t,e)=>!(!e||!e.length)&&e.some((e=>{const i=e.x,s=e.y,n=e.size;return Math.pow(t.x-i,2)+Math.pow(t.y-s,2)d(t)?t():t,H0=(t,e)=>{if(!t||!_(t))return[];const i=z0(e.keyword),s=z0(e.categoryField),n=t[0].latestData[0];return{[s]:i,[LT]:null==n?void 0:n[LT],[FT]:null==n?void 0:n[FT]}};class j0 extends s${constructor(){super(...arguments),this.type=j0.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=yt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}j0.type="ripple";const N0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class U0 extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class V0 extends z${constructor(){super(...arguments),this.type=CC.correlation,this.transformerConstructor=U0,this._viewBox=new Ue}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){if(super.initData(),!this._data)return;DM(this._dataSet,"correlation",L0);const t=new Ra;FM(t,"dataview",Ea),DM(t,"correlationCenter",H0);const e=new Oa(t,{name:`${this.type}_${this.id}_center`});e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"correlationCenter",options:{keyword:()=>{var t,e,i;return null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:""},categoryField:()=>this._spec.categoryField}}),this._centerSeriesData=new VF(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:()=>this._spec.valueField,radiusRange:()=>this._spec.sizeRange,radiusField:()=>this._spec.sizeField,center:()=>[this._spec.centerX,this._spec.centerY],innerRadius:()=>this._spec.innerRadius,outerRadius:()=>this._spec.outerRadius,startAngle:()=>this._spec.startAngle,endAngle:()=>this._spec.endAngle}})}initMark(){const e=this._createMark(V0.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:LT});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(V0.mark.ripplePoint,{key:LT,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(V0.mark.centerPoint,{key:LT,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[P0],y:t=>t[R0],size:t=>t[O0],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),RH("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}V0.type=CC.correlation,V0.mark=B0,V0.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},V0.transformerConstructor=U0;const W0=()=>{oN(),n$(),ZO(),oT.registerMark(j0.type,j0),oT.registerGraphicComponent("symbol",(t=>tg(t))),oT.registerSeries(V0.type,V0),oT.registerAnimation("correlation",((t,e)=>Object.assign({appear:N0(0,e)},Bz)))},G0=Object.assign(Object.assign({},AH),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class Y0 extends s${constructor(){super(...arguments),this.type=Y0.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}Y0.type="liquid";const X0=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class K0 extends dH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class $0 extends YH{constructor(){super(...arguments),this.type=CC.liquid,this.transformerConstructor=lN,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=og({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=tg({x:s,y:n,size:r,symbolType:X0(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=qC(this._spec.outlineMargin),this._paddingSpec=qC(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark($0.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark($0.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark($0.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark($0.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new K0(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),RH("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),RH("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=MA(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}$0.type=CC.liquid,$0.mark=G0,$0.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},$0.transformerConstructor=lN;const q0=t=>Y(t).join(",");class Z0 extends dH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>q0(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>q0(null==t?void 0:t[this.series.getDimensionField()[0]])}}const J0=Object.assign(Object.assign({},AH),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class Q0 extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const t1=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();return s&&(null==t?void 0:t.length)?gJ(Object.assign({setField:i.setField,valueField:i.valueField},s),t):[]};class e1 extends YH{constructor(){super(...arguments),this.type=CC.venn,this.transformerConstructor=Q0,this._viewBox=new Ue}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:DT)}initData(){var t;super.initData(),DM(this._dataSet,"venn",t1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:()=>({getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField})})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(e1.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(e1.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>q0(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>q0(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Z0(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:q0(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return q0(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[q0(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(q0(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),RH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),RH(t.name,this._spec,this._markAttributeContext)))}))}}e1.type=CC.venn,e1.mark=J0,e1.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},e1.transformerConstructor=Q0;class i1 extends VX{constructor(){super(...arguments),this.type=CC.mosaic,this.transformerConstructor=NX}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(ZT),this.setFieldX2(qT)),this.setFieldY(QT),this.setFieldY2(JT)):(t&&(this.setFieldY(ZT),this.setFieldY2(qT)),this.setFieldX(QT),this.setFieldX2(JT)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}i1.type=CC.mosaic,i1.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},i1.transformerConstructor=NX;class s1 extends LV{_isValidSeries(t){return t===CC.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class n1 extends RV{constructor(){super(...arguments),this.transformerConstructor=s1,this.type="map",this.seriesType=CC.map}}n1.type="map",n1.seriesType=CC.map,n1.transformerConstructor=s1;class r1 extends LV{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class a1 extends r1{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY","clamp"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=kN(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,aT({},s,l)),n&&Object.assign(o,aT({},n,o))}}class o1 extends r1{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class l1 extends r1{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class h1 extends RV{constructor(){super(...arguments),this.transformerConstructor=l1}}h1.transformerConstructor=l1;class c1 extends h1{constructor(){super(...arguments),this.transformerConstructor=l1,this.type="pie",this.seriesType=CC.pie}}c1.type="pie",c1.seriesType=CC.pie,c1.transformerConstructor=l1;class d1 extends o1{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["radius","outerRadius","innerRadius"]),n.radius=null!==(e=t.radius)&&void 0!==e?e:jN,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:jN,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>aT({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const u1=(t,e)=>{if(!t)return null;const i=hj(t,(t=>"angle"===t.getOrient()),e),s=hj(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Ek(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=vk({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=K(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=yk(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=oj(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Ek(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=vk({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=yk(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=oj(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class p1 extends RV{constructor(){super(...arguments),this.transformerConstructor=d1,this.type="rose",this.seriesType=CC.rose}_setModelOption(){this._modelOption.getDimensionInfo=u1}}p1.type="rose",p1.seriesType=CC.rose,p1.transformerConstructor=d1,G(p1,jV);class g1 extends o1{_getDefaultSeriesSpec(t){var e,i,s,n;const r=super._getDefaultSeriesSpec(t),a=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e,"series","radar","area");return this._addSeriesRelatedSpecKeys(["line","point","area"]),r.line=t.line,r.point=t.point,r.stack=t.stack,r.percent=t.percent,r.area=aT({visible:null!==(s=null==a?void 0:a.visible)&&void 0!==s&&s},t.area),r.seriesMark=null!==(n=t.seriesMark)&&void 0!==n?n:"area",r.activePoint=t.activePoint,r.pointDis=t.pointDis,r.pointDisMul=t.pointDisMul,r.markOverlap=t.markOverlap,r}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>aT({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class f1 extends RV{constructor(){super(...arguments),this.transformerConstructor=g1,this.type="radar",this.seriesType=CC.radar}_setModelOption(){this._modelOption.getDimensionInfo=u1}}f1.type="radar",f1.seriesType=CC.radar,f1.transformerConstructor=g1,G(f1,jV);class m1 extends LV{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&aT(e,pF(this.type,t))})),this._transformAxisSpec(t)}}class v1 extends RV{constructor(){super(...arguments),this.transformerConstructor=m1,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=qV(t,e,i))&&void 0!==s?s:[],...null!==(n=u1(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}v1.type="common",v1.transformerConstructor=m1,G(v1,jV);class y1 extends DV{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class _1 extends RV{constructor(){super(...arguments),this.transformerConstructor=y1}}_1.transformerConstructor=y1,G(_1,jV);class b1 extends y1{transformSpec(t){super.transformSpec(t),oF(t)}}class x1 extends _1{constructor(){super(...arguments),this.transformerConstructor=b1,this.type="histogram",this.seriesType=CC.bar}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}x1.type="histogram",x1.seriesType=CC.bar,x1.transformerConstructor=b1;class S1 extends a1{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["cornerRadius","progress","track","roundCap"]),s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class A1 extends RV{constructor(){super(...arguments),this.transformerConstructor=S1,this.type="circularProgress",this.seriesType=CC.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=u1}}A1.type="circularProgress",A1.seriesType=CC.circularProgress,A1.transformerConstructor=S1,G(A1,jV);class k1 extends a1{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["pin","pinBackground","pointer"]),e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=CC.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===CC.gauge||t.type===CC.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===CC.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class C1 extends RV{constructor(){super(...arguments),this.transformerConstructor=k1,this.type="gauge",this.seriesType=CC.gaugePointer}}C1.type="gauge",C1.seriesType=CC.gaugePointer,C1.transformerConstructor=k1;class T1 extends LV{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class M1 extends RV{constructor(){super(...arguments),this.transformerConstructor=T1,this.type="wordCloud",this.seriesType=CC.wordCloud}}M1.transformerConstructor=T1;class w1 extends M1{constructor(){super(...arguments),this.transformerConstructor=T1,this.type="wordCloud",this.seriesType=CC.wordCloud}}w1.type="wordCloud",w1.seriesType=CC.wordCloud,w1.transformerConstructor=T1;class E1 extends LV{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class B1 extends RV{constructor(){super(...arguments),this.transformerConstructor=E1,this.type="funnel",this.seriesType=CC.funnel}}B1.type="funnel",B1.seriesType=CC.funnel,B1.transformerConstructor=E1;class P1 extends DV{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",this._addSeriesRelatedSpecKeys(["cornerRadius"]),s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=kN(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=kN(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class R1 extends RV{constructor(){super(...arguments),this.transformerConstructor=P1,this.type="linearProgress",this.seriesType=CC.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}R1.type="linearProgress",R1.seriesType=CC.linearProgress,R1.transformerConstructor=P1,G(R1,jV);class O1 extends DV{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),oF(t)}}class I1 extends RV{constructor(){super(...arguments),this.transformerConstructor=O1,this.type="rangeColumn",this.seriesType=CC.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}I1.type="rangeColumn",I1.seriesType=CC.rangeColumn,I1.transformerConstructor=O1;class L1 extends LV{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class D1 extends RV{constructor(){super(...arguments),this.transformerConstructor=L1,this.type="sunburst",this.seriesType=CC.sunburst}}D1.type="sunburst",D1.seriesType=CC.sunburst,D1.transformerConstructor=L1;class F1 extends LV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class z1 extends RV{constructor(){super(...arguments),this.transformerConstructor=F1,this.type="circlePacking",this.seriesType=CC.circlePacking}}z1.type="circlePacking",z1.seriesType=CC.circlePacking,z1.transformerConstructor=F1;class H1 extends LV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class j1 extends RV{constructor(){super(...arguments),this.transformerConstructor=H1,this.type="treemap",this.seriesType=CC.treemap}}j1.type="treemap",j1.seriesType=CC.treemap,j1.transformerConstructor=H1;class N1 extends GX{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),oF(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["bar","stackLabel","leaderLine","total","calculationMode"]),e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class U1 extends YX{constructor(){super(...arguments),this.transformerConstructor=N1,this.type="waterfall",this.seriesType=CC.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}U1.type="waterfall",U1.seriesType=CC.waterfall,U1.transformerConstructor=N1;class V1 extends DV{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),oF(t)}}class W1 extends RV{constructor(){super(...arguments),this.transformerConstructor=V1,this.type="boxPlot",this.seriesType=CC.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}W1.type="boxPlot",W1.seriesType=CC.boxPlot,W1.transformerConstructor=V1;class G1 extends LV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class Y1 extends RV{constructor(){super(...arguments),this.transformerConstructor=G1,this.type="sankey",this.seriesType=CC.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=kM(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}Y1.type="sankey",Y1.seriesType=CC.sankey,Y1.transformerConstructor=G1;class X1 extends DV{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["area","point","line"]),s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),oF(t)}}class K1 extends RV{constructor(){super(...arguments),this.transformerConstructor=X1,this.type="rangeArea",this.seriesType=CC.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}K1.type="rangeArea",K1.seriesType=CC.rangeArea,K1.transformerConstructor=X1;class $1 extends DV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class q1 extends RV{constructor(){super(...arguments),this.transformerConstructor=$1,this.type="heatmap",this.seriesType=CC.heatmap}}q1.type="heatmap",q1.seriesType=CC.heatmap,q1.transformerConstructor=$1;class Z1 extends LV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class J1 extends RV{constructor(){super(...arguments),this.transformerConstructor=Z1,this.type="correlation",this.seriesType=CC.correlation}}J1.type="correlation",J1.seriesType=CC.correlation,J1.transformerConstructor=Z1;function Q1(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=xM(t.style)),P(t.textStyle)||aT(s.textStyle,xM(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&xM(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&xM(s.background.style),s}function t2(t){const e=t=>function(t){return p(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:p(t.texturePadding)?t.texturePadding:1,textureSize:p(t.textureSize)?t.textureSize:4}):t}(t);if(d(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else P(t.style)||(t.style=e(t.style));return P(t.state)||Object.keys(t.state).forEach((i=>{if(d(t.state[i])){const s=t.state[i];t.state[i]=(...t)=>e(s(...t))}else P(t.state[i])||(t.state[i]=e(t.state[i]))})),t}const e2=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},i2=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:FT;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)},s2={position:!0,item:!0,title:!0,pager:!0,background:!0};class n2 extends YN{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{bk(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),bk(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=WC(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const s=!V(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):s&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(s&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,s=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>V(null==i?void 0:i[t],null==s?void 0:s[t])||s2[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new VF(this._option,e),this._initSelectedData(),bk(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(bk(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(aT({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(aT({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(aT({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}n2.specKey="legends";class r2 extends n2{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),bk(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){DM(this._option.dataSet,"discreteLegendFilter",i2),DM(this._option.dataSet,"discreteLegendDataMake",e2);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return bk(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!bA(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=aM(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i,s){const{title:n={},item:r={},pager:a={},background:o={},type:l,id:h,visible:c,orient:u,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=t,S=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:k={},pager:C={},background:T={}}=t;A=L(A),k=L(k),C=L(C),T=L(T);const M=S;if(d(M.maxRow)||d(M.maxCol)){const t=WC(s)?s:WC(u)?u:"left";d(M.maxRow)&&(M.maxRow=M.maxRow({rect:i,orient:t,id:h})),d(M.maxCol)&&(M.maxCol=M.maxCol({rect:i,orient:t,id:h}))}return A.visible?M.title=Q1(A):M.title={visible:!1},P(k.focusIconStyle)||xM(k.focusIconStyle),k.shape&&(k.shape=t2(yM(k.shape))),k.label&&(k.label=yM(k.label)),k.value&&(k.value=yM(k.value)),k.background&&(k.background=yM(k.background)),GC(k.maxWidth)&&(k.maxWidth=Number(k.maxWidth.substring(0,k.maxWidth.length-1))*i.width/100),GC(k.width)&&(k.width=Number(k.width.substring(0,k.width.length-1))*i.width/100),GC(k.height)&&(k.height=Number(k.height.substring(0,k.height.length-1))*i.width/100),M.item=k,"scrollbar"===C.type?(P(C.railStyle)||xM(C.railStyle),P(C.sliderStyle)||xM(C.sliderStyle)):(P(C.textStyle)||xM(C.textStyle),C.handler&&yM(C.handler)),M.pager=C,T.visible&&!P(T.style)&&(aT(M,T.style),p(T.padding)&&(M.padding=T.padding)),M}(this._spec,t,this.layoutOrient)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return NY}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(IY.legendItemClick,(i=>{const s=R(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(IY.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(IY.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,datum:t.datum,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=eH(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=eH(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}r2.specKey="legends",r2.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},r2.type=r.discreteLegend;const a2=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},o2=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?fM(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function l2(t){const i=aT({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:y,data:_,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:C,seriesId:T,padding:M}=i,w=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?w.title=Q1(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=xM(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=xM(r.style)),P(a.style)||(w.trackStyle=xM(a.style)),w.startText=yM(o),w.endText=yM(l),w.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>xM(i(t,e,s)):P(i)||(e.style=xM(i)),e}(h),P(c)||(w.sizeBackground=xM(c)),u.visible&&!P(u.style)&&(aT(w,u.style),p(u.padding)&&(w.padding=u.padding)),w}const h2={color:YY,size:KY},c2={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},d2=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},c2),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},u2={horizontal:d2(!0),vertical:d2(!1)},p2=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},c2),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},g2={horizontal:p2(!0),vertical:p2(!1)},f2=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],m2=[2,10];class v2 extends n2{static getSpecInfo(t){const e=iH(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),bk(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){DM(this._option.dataSet,"continuousLegendFilter",o2),DM(this._option.dataSet,"continuousLegendDataMake",a2);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>xk(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=aM(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!bA(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=aM(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?f2:m2);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 h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},l2(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return h2[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}v2.specKey="legends",v2.builtInTheme={colorLegend:u2,sizeLegend:g2},v2.type=r.continuousLegend;const y2=(t,e)=>p(e)?t.map((t=>e[t])):void 0,_2=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),b2=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function x2(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=S2(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>_2(i,s)(t)&&_2(n,r)(t)&&(u(a)||_2([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:BM.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return $z.globalConfig.uniqueTooltip&&$z.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:BM.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return $z.globalConfig.uniqueTooltip&&$z.hideTooltip(a.id),m}return"none"}const S2=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=y2(c,t);let y=y2(d,t);const _=b2(y),b=!_&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(_2(c,v));if(!_&&(y=y2(d,i),!b2(y)))return;const n=e.type===CC.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=Ek(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(_2(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=y2(d,o),!b2(y))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(_2(c,n));if(!_&&(y=y2(d,r),!b2(y)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===CC.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(_2(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=y2(d,i),!b2(y))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(_2(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=y2(d,a),h=y,!b2(y)&&!a)return;b2(y)||(y=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},A2=t=>p(t)&&!_(t),k2=t=>p(t)&&_(t),C2=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class T2 extends GN{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=aT({},...C2.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=aT({},s);C2.forEach((t=>{delete r[t]})),delete r.style;const a=aT({},r,i);return a.style=aT({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:mA(this._option.mode)||!gA(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=e_.getElementById(t.parentElement)):gA(this._option.mode)&&(t.parentElement=null==pA?void 0:pA.body)}}const M2={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class w2 extends YN{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=T2,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=gA(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&A2(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&$z.globalConfig.uniqueTooltip&&l&&$z.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:BM.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:BM.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?lW.canvas:lW.dom,n=oT.getComponentPluginInType(t);n||cA("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=oT.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(fA(s)||mA(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=x2(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(k2(t)){if(A2(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>rj(t,e[i])))}if(k2(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}w2.type=r.tooltip,w2.transformerConstructor=T2,w2.builtInTheme={tooltip:M2},w2.specKey="tooltip";var E2,B2;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(E2||(E2={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(B2||(B2={}));const P2={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},R2={labelZIndex:!0,gridZIndex:!0},O2={xField:!0,yField:!0,categoryField:!0,valueField:!0},I2={visible:!0,width:!0,style:!0};class L2 extends YN{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Ek(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!V(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||R2[i]||O2[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||I2[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:PM.chart}:{source:BM.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:fA(e)||mA(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:BM.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:BM.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:BM.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{P2[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}L2.specKey="crosshair";const D2={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class F2 extends L2{static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=qH(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){qH(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:ZH(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=Sk(this._regions,"cartesian");e&&(QV(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=iW(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new YW(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new XW(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}F2.specKey="crosshair",F2.builtInTheme={crosshair:D2},F2.type=r.cartesianCrosshair;class z2 extends L2{static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=Sk(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=AN(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=eH(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=ye([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=yt(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new YW(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new $W(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new qW(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new KW(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}z2.specKey="crosshair",z2.builtInTheme={crosshair:D2},z2.type=r.polarCrosshair;const H2=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},j2=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},N2=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},U2=(t,e,i)=>{const s=e.domain();if(Mk(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},V2=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&Mk(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},W2=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},G2=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},Y2=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),X2=(t,e,i)=>{if(Mk(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class K2{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=yt(this.getState().start+f,0,1),y=yt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===tj(QH(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=H({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=H({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=H({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(K2,vK);class $2 extends YN{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:V2(t,this._stateScale,this._isHorizontal),a="percent"===n?e:V2(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=W2(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=X2(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&G2(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else bk(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),bk(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=QH(t),this._isHorizontal="horizontal"===tj(this._orient),this._dataFilterEvent=new K2(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.change=!0,i.reRender=!0,!i.reCompile&&this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0),i}_getComponentOnlySpecKeys(){return null}_isComponentOnlySpecChange(t,e){const i=this._getComponentOnlySpecKeys();if(!i)return!1;return Object.keys(Object.assign(Object.assign({},e),t)).every((s=>V(null==e?void 0:e[s],null==t?void 0:t[s])||i[s]))}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(Mk(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>tj(t._orient)===tj(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Mk(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};bk(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=Mk(d.getScale(0).type),p=Mk(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else bk(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;FM(r,"dataview",Ea),DM(r,"dataFilterComputeDomain",N2);const a=new Oa(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new VF(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(DM(this._option.dataSet,"dataFilterWithNewDomain",j2),DM(this._option.dataSet,"lockStatisticsFilter",H2),bk(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Mk(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Mk(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(Mk(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!V(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;Y2("start",i,this._spec)&&Y2("end",s,this._spec)&&(t="percent"===i?this._spec.start:V2(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:V2(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?V2(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?V2(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=U2(this._start,this._stateScale,W2(i,this._isHorizontal)),this._endValue=U2(this._end,this._stateScale,W2(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Mk(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=X2(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&bk(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new vC:new qk,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),K(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=G2(h);if(!this._dataUpdating&&Ek(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,Ek(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G($2,vK);class q2 extends GN{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=aT({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const Z2=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),J2={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:Z2(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:Z2(!0)},Q2={width:!0,height:!0,showDetail:!0,middleHandler:!0,background:!0,startHandler:!0,endHandler:!0,startText:!0,endText:!0,dragMask:!0,selectedBackground:!0,backgroundChart:!0,selectedBackgroundChart:!0,showBackgroundChart:!0};class t5 extends $2{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=q2,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=U2(e,this._stateScale,W2(s,this._isHorizontal)),a=U2(i,this._stateScale,W2(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new vC),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(W2(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=W2(t,this._isHorizontal),this.effect.onZoomChange())}_getComponentOnlySpecKeys(){return Q2}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new vC;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(W2(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),K(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Mk(t.type)||e[0]!==X(e))&&(!Ek(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:W2(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>U2(t,this._stateScale,W2(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new IG(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>U2(t,this._stateScale,W2(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:xM(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:xM(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:xM(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:xM(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:xM(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:xM(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:xM(g.style)},selectedBackgroundStyle:xM(this._spec.selectedBackground.style),dragMaskStyle:xM(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:aT(xM(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},xM(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:aT(xM(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},xM(null===(d=m.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=eH(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(W2(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}t5.type=r.dataZoom,t5.transformerConstructor=q2,t5.builtInTheme={dataZoom:J2},t5.specKey="dataZoom";const e5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},i5={width:!0,height:!0,rail:!0,slider:!0,round:!0,innerPadding:!0,minSliderSize:!0};class s5 extends $2{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=dk(this._start,e)&&dk(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=W2(n,this._isHorizontal),a=U2(e,this._stateScale,r),o=U2(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentOnlySpecKeys(){return i5}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new EW(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=xM(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=xM(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}s5.type=r.scrollBar,s5.builtInTheme={scrollBar:e5},s5.specKey="scrollBar";const n5=(t,e)=>{const{datum:i,title:s,content:n}=d(e)?e():e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},r5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),a5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:r5("l1FontSize","primaryFontColor")},content:{visible:!0,style:r5("l2FontSize","tertiaryFontColor")}};class o5 extends YN{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(kM(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(kM(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){DM(this._option.dataSet,"indicatorFilter",n5);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:()=>({title:this._title,content:this._content,datum:()=>this._activeDatum})}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new VF(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=aT({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},bM(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?JC(l,this._computeLayoutRadius()):0,dy:h?JC(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},bM(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)V(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new ZY(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}o5.type=r.indicator,o5.builtInTheme={indicator:a5},o5.specKey="indicator";const l5=["sum","average","min","max","variance","standardDeviation","median"];function h5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=K(s);return er}function c5(t,e){return t?`${t}_${e}_extend`:`marker_${e}_extend`}function d5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.x)&&h5(e,t.x,i)&&(null===(l=null==h?void 0:(o=h.getXAxisHelper()).setExtendDomain)||void 0===l||l.call(o,c5(a,"xAxis"),t.x)),c=GC(t.x)?f5(t.x,n)+r.x:m5(h.getXAxisHelper(),[t.x])+r.x,c}function u5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.y)&&h5(e,t.y,i)&&(null===(l=null===(o=h.getYAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,c5(a,"yAxis"),t.y)),c=GC(t.y)?f5(t.y,n)+r.y:m5(h.getYAxisHelper(),[t.y])+r.y,c}function p5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.angle)&&h5(e,t.angle,i)&&(null===(a=null===(r=o.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,c5(n,"angleAxis"),t.angle)),m5(o.angleAxisHelper,[t.angle])}function g5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.radius)&&h5(e,t.radius,i)&&(null===(a=null===(r=o.radiusAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,c5(n,"radiusAxis"),t.radius)),m5(o.radiusAxisHelper,[t.radius])}function f5(t,e){return Number(t.substring(0,t.length-1))*e/100}function m5(t,e){const i=t.getScale(0);return Mk(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function v5(t){return l5.includes(t)}function y5(t,e,i,s,n,r=!1,a){const o=e.getRegion(),l=o.getLayoutStartPoint(),h=i.getRegion(),c=h.getLayoutStartPoint(),d=Math.abs(Math.min(l.x,c.x)-Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width)),u=Math.abs(Math.min(l.y,c.y)-Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height)),g={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},f=[],m=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,v=s.getXAxisHelper(),y=s.getYAxisHelper(),_=v.getScale(0).domain(),b=y.getScale(0).domain(),x=r&&!v.isContinuous&&!!v.getBandwidth,S=r&&!y.isContinuous&&!!y.getBandwidth,A={min:null,max:null},k={min:null,max:null};return m.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=d5(t,_,n,g,d,l,a),r=u5(t,b,n,g,u,l,a),_5(s,x,A,f.length),_5(r,S,k,f.length),f.push([{x:s,y:r}]);else if(e){s=d5(t,_,n,g,d,l,a),r=Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height);const e=Math.min(l.y,c.y);_5(s,x,A,f.length),f.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(l.x,c.x),r=u5(t,b,n,g,u,l,a);const e=Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width);_5(r,S,k,f.length),f.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(f,v,y,A,k),f}function _5(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=p5(t,h,n,a,r),i=g5(t,c,n,a,r);o.push([{angle:e,radius:i}])}else if(e){const e=p5(t,h,n,a,r);o.push([{angle:e,radius:-d},{angle:e,radius:d}])}else if(i){const e=g5(t,c,n,a,r);o.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),o}function x5(t,e){return(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e}function S5(t,e,i,s,n){const r=[],a=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,o=_(s);return i&&a.forEach((t=>{!function(t,e,i,s){var n,r,a,o;const l=e.getXAxisHelper().getScale(0).domain(),h=e.getYAxisHelper().getScale(0).domain(),c=Y(t.x),d=Y(t.y);1===c.length&&S(c[0])&&h5(l,c[0],i)&&(null===(r=null===(n=e.getXAxisHelper())||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,c5(s,"xAxis"),c[0])),1===d.length&&S(d[0])&&h5(h,d[0],i)&&(null===(o=null===(a=e.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,c5(s,"yAxis"),d[0]))}(t,x5(t,e),i,n)})),a.forEach(((t,i)=>{const n=x5(t,e),a=n.getRegion(),l=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();let d=0,u=0;if(s){const t=o?s[i]:s,e=t.x,n=t.y;e&&(d=GC(e)?Number(e.substring(0,e.length-1))*h/100:e),n&&(u=GC(n)?Number(n.substring(0,n.length-1))*c/100:n)}const p=Y(t.x),g=Y(t.y);r.push({x:m5(n.getXAxisHelper(),p)+l.x+d,y:m5(n.getYAxisHelper(),g)+l.y+u})})),r}function A5(t,e,i,s){const n=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var r,a,o,l;const h=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,c=h.angleAxisHelper.getScale(0).domain(),d=h.radiusAxisHelper.getScale(0).domain(),u=Y(t.angle),p=Y(t.radius);1===u.length&&S(u[0])&&h5(c,u[0],i)&&(null===(a=null===(r=h.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,c5(s,"angleAxis"),u[0])),1===p.length&&S(p[0])&&h5(d,p[0],i)&&(null===(l=null===(o=h.radiusAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,c5(s,"radiusAxis"),p[0])),n.push({angle:m5(h.angleAxisHelper,u),radius:m5(h.radiusAxisHelper,p)})})),n}function k5(t,e,i){let{x:s,y:n}=t;return GC(s)&&(s=f5(s,e)),GC(n)&&(n=f5(n,i)),{x:s,y:n}}function C5(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=k5(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>k5(t,n,r)))}function T5(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function M5(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},xM(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},E5(xM(n.style),i,s)),p(n.padding)&&(t.padding=oi(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=E5(xM(r),i,s)),t}return{visible:!1}}function w5(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function E5(t,e,i){return d(t)?t(e,i):t}function B5(t,e){return d(t)?t(e):t}function P5(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function R5(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function O5(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=R5(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function I5(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=R5(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function L5(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function D5(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),y(t[c])&&v5(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),y(t[d])&&v5(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),y(t[a])&&v5(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),y(t[l])&&v5(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;_(s)?i.x=s.map((i=>z5(i,t,e))):i.x=z5(s,t,e)}if(p(e.y)){const s=e.y;_(s)?i.y=s.map((i=>z5(i,t,e))):i.y=z5(s,t,e)}if(p(e.angle)){const s=e.angle;_(s)?i.angle=s.map((i=>z5(i,t,e))):i.angle=z5(s,t,e)}if(p(e.radius)){const s=e.radius;_(s)?i.radius=s.map((i=>z5(i,t,e))):i.radius=z5(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=z5(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const F5={min:(t,e)=>uk(t[0].latestData,e.field),max:(t,e)=>pk(t[0].latestData,e.field),sum:function(t,e){return gk(t[0].latestData,e.field)},average:function(t,e){return fk(t[0].latestData,e.field)},variance:function(t,e){return mk(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(mk(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function z5(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(m(t)){const{aggrType:i,field:s}=t;return F5[i](e,{field:s})}return t}function H5(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}const j5=t=>{var e;const i=null===(e=null==t?void 0:t.dataSet)||void 0===e?void 0:e.dataViewMap;return i?Object.values(i).filter(Boolean):[]},N5=(t,e)=>{var i,s;null===(i=null==t?void 0:t.target)||void 0===i||i.removeListener("change",e.reRunAllTransform),null===(s=null==t?void 0:t.target)||void 0===s||s.removeListener("markRunning",e.markRunning)},U5=t=>{if(!t)return;j5(t).forEach((e=>{N5(e,t)}));const e=null==t?void 0:t.rawData;Array.isArray(e)&&e.forEach((e=>{N5(e,t)}))},V5=(t,e)=>{if(!t)return;const i=new Set(j5(t)),s=[],n=t=>{const r=null==t?void 0:t.rawData;Array.isArray(r)&&r.forEach((t=>{i.has(t)&&e(t)&&!s.includes(t)&&(s.push(t),n(t))}))};n(t),(t=>{const e=Array.from(new Set(t.filter(Boolean)));e.length&&(e.forEach(U5),e.forEach((t=>{var e;null===(e=t.destroy)||void 0===e||e.call(t)})))})([t,...s])},W5="__vchart_marker_coordinate__",G5=["coordinate","coordinates","x","y","x1","y1","angle","angle1","radius","radius1"],Y5=["position","positions","coordinatesOffset","regionRelative"],X5=["offsetX","offsetY","confine"],K5=t=>Array.isArray(t)?t.map(K5):t&&"object"==typeof t?"function"!=typeof t.formatMethod?t:Object.assign(Object.assign({},t),{formatMethod:"__vchart_marker_format_method__"}):t,$5=t=>{if(Array.isArray(t))return t.map($5);if(!t||"object"!=typeof t)return t;const e=Object.assign({},t);return Object.keys(e).forEach((t=>{"style"===t||t.endsWith("Style")?e[t]="__vchart_marker_style__":e[t]=$5(e[t])})),e},q5=(t,e)=>{if(!t||"object"!=typeof t)return t;const i=Object.assign({},t);e.normalizeDomainPosition&&G5.forEach((t=>{i[t]=W5})),e.normalizeAutoRange&&"autoRange"in i&&(i.autoRange="__vchart_marker_auto_range__"),Y5.forEach((t=>{t in i&&(i[t]=W5)})),"label"in i&&(i.label=K5(i.label)),Object.keys(i).forEach((t=>{i[t]=$5(i[t])}));const s=i.itemContent;if(s&&"object"==typeof s){i.itemContent=Object.assign({},s),X5.forEach((t=>{t in i.itemContent&&(i.itemContent[t]=W5)}));const t=i.itemContent.text;t&&"object"==typeof t&&(i.itemContent.text=Object.assign(Object.assign({},K5(t)),{text:"__vchart_marker_text__"}))}return i};class Z5 extends YN{constructor(){super(...arguments),this.layoutType="none",this._markerDataChangeHandler=null,this._markerDataOwned=!1,this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getAutoRangeExtendDomainKeyPrefix(){return`marker_${this.type}_${this.id}`}_getAutoRangeExtendDomainKey(t){return`${this._getAutoRangeExtendDomainKeyPrefix()}_${t}_extend`}_clearAutoRangeExtendDomain(){var t,e;Y(null===(e=(t=this._option).getAllSeries)||void 0===e?void 0:e.call(t)).forEach((t=>{var e,i,s,n,r,a,o,l,h,c;null===(s=null===(i=null===(e=null==t?void 0:t.getXAxisHelper)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.setExtendDomain)||void 0===s||s.call(i,this._getAutoRangeExtendDomainKey("xAxis"),void 0),null===(a=null===(r=null===(n=null==t?void 0:t.getYAxisHelper)||void 0===n?void 0:n.call(t))||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,this._getAutoRangeExtendDomainKey("yAxis"),void 0),null===(l=null===(o=null==t?void 0:t.angleAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,this._getAutoRangeExtendDomainKey("angleAxis"),void 0),null===(c=null===(h=null==t?void 0:t.radiusAxisHelper)||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,this._getAutoRangeExtendDomainKey("radiusAxis"),void 0)}))}_updateMarkerLayout(){this._clearAutoRangeExtendDomain(),this._markerLayout()}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return y(e)&&v5(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ra;return e.registerParser("array",s),new Oa(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}_setMarkerData(t,e=!1){this._releaseMarkerData(),this._markerData=t,this._markerDataOwned=e}_bindMarkerDataChange(){var t;(null===(t=this._markerData)||void 0===t?void 0:t.target)&&(this._markerDataChangeHandler=()=>{this._updateMarkerLayout()},this._markerData.target.on("change",this._markerDataChangeHandler))}_releaseMarkerData(){const t=this._markerData;(null==t?void 0:t.target)&&this._markerDataChangeHandler&&t.target.removeListener("change",this._markerDataChangeHandler),this._markerDataChangeHandler=null,this._markerDataOwned&&V5(t,(t=>t.name===`${this.type}_${this.id}_data`)),this._markerData=null,this._markerDataOwned=!1}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._updateMarkerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._updateMarkerLayout.bind(this)))}clear(){super.clear(),this._markerComponent=null,this._firstSeries=null}release(){this._releaseMarkerData(),super.release()}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=Sk(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=XC(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=XC(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reRender=!0,i.change=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake||i.reCompile||!this._isAutoRangeSpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,scaleDomain:!0,layout:!0,render:!0}):i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){const i=!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange);return V(q5(e,{normalizeDomainPosition:i}),q5(t,{normalizeDomainPosition:i}))}_isAutoRangeSpecChange(t,e){return!(!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange))&&V(q5(e,{normalizeDomainPosition:!0,normalizeAutoRange:!0}),q5(t,{normalizeDomainPosition:!0,normalizeAutoRange:!0}))}reInit(t){super.reInit(t),this._releaseMarkerData(),this._bindSeries(),this._initDataView(),this._buildMarkerAttributeContext(),this._markerComponent&&this._updateMarkerLayout()}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();DM(this._option.dataSet,"markerAggregation",D5),DM(this._option.dataSet,"markerFilter",H5),this._releaseMarkerData();const i=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(i,!0),this._bindMarkerDataChange()}}function J5(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=uk(t,e),r=pk(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Q5 extends Z5{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=O5(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:E5(xM(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>M5(t,this._markerData,this._markAttributeContext))),state:{line:w5(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:w5(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:w5(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return w5(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return w5(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:E5(xM(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:E5(xM(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=T5([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=O5(t);if(this._setMarkerData(this._getRelativeDataView()),!(i||s||n||r||a||o||l||h||c||d||e))return;DM(this._option.dataSet,"markerAggregation",D5),DM(this._option.dataSet,"markerRegression",J5),DM(this._option.dataSet,"markerFilter",H5);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Oa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(m,!0),this._bindMarkerDataChange()}}Q5.specKey="markLine";const t3=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),e3={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},i3={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:t3(!1),endSymbol:t3(!0),label:e3};class s3 extends Q5{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new bY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:y}=O5(e);let _=[];if(u||f||g||m||v||a&&l||a&&h){const t=y5(i,s,n,r,d,!1,this._getAutoRangeExtendDomainKeyPrefix());_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=S5(i,r,d,e.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):c&&(_=C5(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n,r,a,o,l;const h=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const l=this._startRelativeSeries,c=this._endRelativeSeries,{multiSegment:u,mainSegmentIndex:g}=this._spec.line||{},{connectDirection:f}=this._spec;let{expandDistance:m=0}=this._spec;const{points:v,limitRect:y}=h,_=Y(v).filter(Boolean);if(d(m)){const n=null===(t=null==l?void 0:l.getRegion)||void 0===t?void 0:t.call(l),r=null===(e=null==c?void 0:c.getRegion)||void 0===e?void 0:e.call(c);m=m(this._markerData,Object.assign(Object.assign({},this.getMarkAttributeContext()),{region:null===(s=null===(i=this._relativeSeries)||void 0===i?void 0:i.getRegion)||void 0===s?void 0:s.call(i),startRegion:n,endRegion:r,coordinatePoints:_}))}let b;if(GC(m)){const t=l.getRegion(),e=t.getLayoutStartPoint(),i=c.getRegion(),s=i.getLayoutStartPoint();if("bottom"===f||"top"===f){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));b=Number(m.substring(0,m.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));b=Number(m.substring(0,m.length-1))*n/100}}else b=m;if(!v||v.length<2)return void(null===(n=this._markerComponent)||void 0===n||n.setAttributes(h));const x=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(v[0],v[1],f,b);let S;S=u&&p(g)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(v[0],v[1],f,b));const A=Y((null!==(a=null===(r=this._markerComponent)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{}).label),C=Y(h.label),T=Y(this._spec.label);null===(o=this._markerComponent)||void 0===o||o.setAttributes({points:u?[[x[0],x[1]],[x[1],x[2]],[x[2],x[3]]]:x,label:C.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=S.dx)&&void 0!==i?i:0,h=null!==(s=S.dy)&&void 0!==s?s:0;const c=null!==(n=T[e])&&void 0!==n?n:T[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),S),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=A[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:y,multiSegment:u,mainSegmentIndex:g,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(l=this._markerComponent)||void 0===l||l.setAttributes(h)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=O5(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}s3.type=r.markLine,s3.coordinateType="cartesian",s3.builtInTheme={markLine:i3};class n3 extends Q5{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=O5(this._spec);return e||i?new AY(t):new bY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=O5(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=b5(i,s,n,r,a,this._getAutoRangeExtendDomainKeyPrefix());p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=A5(i,r,a,this._getAutoRangeExtendDomainKeyPrefix()),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=O5(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}n3.type=r.polarMarkLine,n3.coordinateType="polar",n3.builtInTheme={polarMarkLine:i3};class r3 extends YN{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=WC(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return iH(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,s&&!i.reMake&&(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=XC(this._spec.width,a.width,null,a.width),l=XC(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)V(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new $Y(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}r3.type=r.title,r3.specKey=r.title,r3.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class a3 extends Z5{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=I5(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:E5(xM(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>M5(t,this._markerData,this._markAttributeContext))),state:{area:w5(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>w5(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return w5(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=T5([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=I5(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}a3.specKey="markArea";const o3={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class l3 extends a3{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new SY(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=I5(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=y5(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=y5(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=S5(s,a,u,i.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):d&&(f=C5(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=I5(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}l3.type=r.markArea,l3.coordinateType="cartesian",l3.builtInTheme={markArea:o3};class h3 extends a3{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=I5(this._spec);return i||e||s?new kY(t):new SY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=I5(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=b5(i,s,n,r,c,this._getAutoRangeExtendDomainKeyPrefix());l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=A5(i,r,c,this._getAutoRangeExtendDomainKeyPrefix()),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=I5(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}h3.type=r.polarMarkArea,h3.coordinateType="polar",h3.builtInTheme={polarMarkArea:o3};const c3=t=>xM(Object.assign({},t)),d3=t=>Object.assign(Object.assign({},t),{style:Object.assign({},xM(t.style))}),u3=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=c3(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=c3(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),y=(_=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},xM(Object.assign({},_)));var _;const b=d3(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=d3(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=d3(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=d3(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:y}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},p3=t=>"left"===t||"right"===t,g3=t=>"top"===t||"bottom"===t,f3={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class m3 extends YN{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},u3(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},u3(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?V(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new dX(t):this._playerComponent=new gX(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=p3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=p3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(rX.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(rX.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(rX.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(rX.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(rX.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(rX.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.type)!==(null==t?void 0:t.type)?(i.reMake=!0,i):(!s||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i)}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=p3(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=g3(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):p3(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):g3(this._orient)?this._maxSize():t.height}_computeDx(t){return p3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return g3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}m3.builtInTheme={player:f3},m3.specKey="player",m3.type=r.player;class v3 extends YN{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,V(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=OC({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==vF.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}v3.type=r.label;class y3 extends S${constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}y3.type="text",y3.constructorType="label";const _3=()=>{A$(),oT.registerMark(y3.constructorType,y3)};class b3 extends GN{_initTheme(t,e){return{spec:t,theme:this._theme}}}class x3 extends v3{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=b3,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(MM.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(MM.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),bk(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=aT({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},zK(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[$T])):t=>t.filter((t=>t.data[KT]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?HK(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}x3.type=r.label,x3.specKey="label",x3.transformerConstructor=b3;class S3 extends v3{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[YT]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return aT({textStyle:{pickable:!0===this._spec.interactive},position:A3(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[$T]:t.data[KT]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>HK({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function A3(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}S3.type=r.totalLabel,S3.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},S3.specKey="totalLabel";class k3 extends Z5{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=L5(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b,x,S,A,k,C,T,M,w,E,B,P,R,O,I,L;const{itemContent:D={},itemLine:F={},targetSymbol:z={}}=this._spec,j=this._relativeSeries.getRegion(),N=D,{type:U="text",text:V,symbol:W,image:G,richText:Y,customMark:X,textStyle:K,symbolStyle:$,imageStyle:q,richTextStyle:Z,customMarkStyle:J,style:Q={},state:tt={}}=N,et=e(N,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let it=null,st=null,nt=U,rt={};if("text"===U){it=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:tt;const r=null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:K)&&void 0!==n?n:Q;(t=>"rich"===(null==t?void 0:t.type))(r)?(nt="richText",rt={width:100,height:100},st=E5(H(rt,(t=>{if(!t)return t;const{type:i,text:s,textConfig:n}=t,r=e(t,["type","text","textConfig"]),a=Object.assign({},r),o=p(n)?n:s;return p(o)&&(a.textConfig=o),a})(r)),this._markerData,this._markAttributeContext)):(rt={dx:0,dy:0},st=M5(Object.assign(Object.assign({},V),{style:H(rt,r)}),this._markerData,this._markAttributeContext))}else"richText"===U?(it=null!==(r=null==Y?void 0:Y.state)&&void 0!==r?r:tt,rt={width:100,height:100},st=E5(H(rt,null!==(o=null!==(a=null==Y?void 0:Y.style)&&void 0!==a?a:Z)&&void 0!==o?o:Q),this._markerData,this._markAttributeContext)):"symbol"===U?(it=null!==(l=null==W?void 0:W.state)&&void 0!==l?l:tt,rt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},st=xM(E5(H(rt,null!==(c=null!==(h=null==W?void 0:W.style)&&void 0!==h?h:$)&&void 0!==c?c:Q),this._markerData,this._markAttributeContext))):"image"===U?(it=null!==(d=null==G?void 0:G.state)&&void 0!==d?d:tt,rt={width:80,height:80},st=E5(H(rt,null!==(g=null!==(u=null==G?void 0:G.style)&&void 0!==u?u:q)&&void 0!==g?g:Q),this._markerData,this._markAttributeContext)):"custom"===U&&(it=null!==(f=null==X?void 0:X.state)&&void 0!==f?f:tt,st=E5(null!==(v=null!==(m=null==X?void 0:X.style)&&void 0!==m?m:J)&&void 0!==v?v:Q,this._markerData,this._markAttributeContext));const at={zIndex:this.layoutZIndex,interactive:null===(y=this._spec.interactive)||void 0===y||y,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(b=this._spec.interactive)||void 0===b||b,position:{x:0,y:0},clipInRange:null!==(x=this._spec.clip)&&void 0!==x&&x,itemContent:Object.assign(Object.assign({type:nt,offsetX:B5(D.offsetX,j),offsetY:B5(D.offsetY,j)},et),{style:E5(st,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(S=z.offset)&&void 0!==S?S:0,visible:null!==(A=z.visible)&&void 0!==A&&A,size:null!==(k=z.size)&&void 0!==k?k:20,style:E5(z.style,this._markerData,this._markAttributeContext)},state:{line:w5(null!==(T=null===(C=this._spec.itemLine.line)||void 0===C?void 0:C.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineStartSymbol:w5(null!==(w=null===(M=this._spec.itemLine.startSymbol)||void 0===M?void 0:M.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:w5(null!==(B=null===(E=this._spec.itemLine.endSymbol)||void 0===E?void 0:E.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:w5(it,this._markerData,this._markAttributeContext),textBackground:w5(null===(R=null===(P=this._spec.itemContent.text)||void 0===P?void 0:P.labelBackground)||void 0===R?void 0:R.state,this._markerData,this._markAttributeContext),targetItem:w5(null!==(I=null===(O=this._spec.targetSymbol)||void 0===O?void 0:O.state)&&void 0!==I?I:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:ot,line:lt={}}=F,ht=e(F,["visible","line"]);at.itemLine=!1!==ot?Object.assign(Object.assign({},ht),{visible:!0,lineStyle:xM(lt.style)}):{visible:!1};return new TY(at)}_markerLayout(){var t,i,s,n,r,a,o,l,h,c,d,u,g;const f=this._spec,m=this._markerData,v=this._relativeSeries,{point:y}=this._computePointsAttr(),_=this._getRelativeDataView().latestData,b=m?m.latestData[0]&&m.latestData[0].latestData?m.latestData[0].latestData:m.latestData:_,{itemLine:x={},itemContent:S={}}=this._spec,A=this._relativeSeries.getRegion(),{visible:k,line:C={}}=x,T=e(x,["visible","line"]),M=!1!==k?Object.assign(Object.assign({},T),{visible:!0,lineStyle:xM(C.style)}):{visible:!1},w=M5(Object.assign(Object.assign({},S.text),{style:H({dx:0,dy:0},null!==(i=null===(t=S.text)||void 0===t?void 0:t.style)&&void 0!==i?i:S.style)}),m,this._markAttributeContext);let E;if(f.clip||(null===(s=f.itemContent)||void 0===s?void 0:s.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=T5([v.getRegion()]);E={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(n=this._markerComponent.attribute)&&void 0!==n?n:{},e=null!==(a=null===(r=t.itemContent)||void 0===r?void 0:r.textStyle)&&void 0!==a?a:{},i=null===(o=this._spec.itemContent.text)||void 0===o?void 0:o.text,s=B5(S.offsetX,A),f=B5(S.offsetY,A);this._markerComponent.setAttributes({position:void 0===y?{x:null,y:null}:y,itemContent:Object.assign(Object.assign({},t.itemContent),{panel:null!==(l=w.panel)&&void 0!==l?l:null===(h=t.itemContent)||void 0===h?void 0:h.panel,padding:null!==(c=w.padding)&&void 0!==c?c:null===(d=t.itemContent)||void 0===d?void 0:d.padding,textStyle:Object.assign(Object.assign(Object.assign({},e),null!==(u=w.textStyle)&&void 0!==u?u:{}),{text:(null===(g=this._spec.itemContent.text)||void 0===g?void 0:g.formatMethod)?this._spec.itemContent.text.formatMethod(b,_):p(i)?i:e.text}),offsetX:P5(y,s,A),offsetY:P5(y,f,A)}),itemLine:M,limitRect:E,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=L5(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}k3.specKey="markPoint";const C3={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class T3 extends k3{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=y5(n,r,r,r,h,!1,this._getAutoRangeExtendDomainKeyPrefix()))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=S5(n,r,h,s.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix())[0]:l&&(c=C5(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=L5(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}T3.type=r.markPoint,T3.coordinateType="cartesian",T3.builtInTheme={markPoint:C3};class M3 extends k3{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=b5(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e,this._getAutoRangeExtendDomainKeyPrefix())[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}M3.type=r.polarMarkPoint,M3.coordinateType="polar",M3.builtInTheme={polarMarkPoint:C3};class w3 extends k3{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}w3.type=r.geoMarkPoint,w3.coordinateType="geo",w3.builtInTheme={geoMarkPoint:C3};const E3="inBrush",B3="outOfBrush",P3={style:!0,inBrush:!0,outOfBrush:!0};class R3 extends YN{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),E3,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),B3,t.AttributeLevel.Series))}))}))}reInit(t){super.reInit(t),this.init()}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return V(e,t)||(i.change=!0,i.reRender=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||P3[i]))}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){var i;const s=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(Object.assign({brushStyle:xM(null===(i=this._spec)||void 0===i?void 0:i.style)},s)),this._initMarkBrushState(e,""),n.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new yX(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:xM(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(uX.brushActive,(s=>{this._initMarkBrushState(i,B3),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(uX.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(uX.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(uX.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(uX.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(uX.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(uX.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(a&&this._handleBrushChange(e,s),null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(uX.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec;n&&this._handleBrushChange(e,i);const r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},xM(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_setBrushState(t,e){var i;const s=null!==(i=t.currentStates)&&void 0!==i?i:[];hz(t,[...s.filter((t=>t!==E3&&t!==B3)),e])}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(this._setBrushState(i,E3),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(this._setBrushState(i,B3),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(this._setBrushState(i,E3),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(this._setBrushState(i,B3),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;dz(s,[E3,B3]),i&&cz(s,i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}R3.type=r.brush,R3.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},R3.specKey="brush";const O3={style:!0,state:!0};class I3 extends YN{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${PT}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=PH({},RH(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i.change=!0,i.reRender=!0,i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||O3[i]))}reInit(t){super.reInit(t),this._updateMarkStyleWithSpec(this._spec,this.getMarks()[0]),this.getMarks().forEach((t=>{t.commit(!1,!0)}))}_updateMarkStyleWithSpec(t,e){var i,s,n,r;if(t&&e&&(this.initMarkStyleWithSpec(e,t),"group"===t.type)){const a=null!==(n=null===(s=(i=e).getMarks)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[];null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._updateMarkStyleWithSpec(t,a[e])}))}}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ue).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ue;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}I3.type=r.customMark,I3.specKey="customMark";class L3{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>D3(t))),a=n.filter((t=>!D3(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>D3(t))),h=o.filter((t=>!D3(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function D3(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}L3.type="grid";const F3="vchart-tooltip",z3=`${F3}-container`,H3=`${F3}-title`,j3=`${F3}-content-box`,N3={offsetX:10,offsetY:10},U3="99999999999999";function V3(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const W3=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,G3=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?V3(t):"",Y3=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},X3={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},K3=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=X3[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class $3 extends bN{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:C}=this._option,T=m[_],M=aH(null==T?void 0:T.position,b,e),w=null!==(r=aH(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:RT,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:OT;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},H={x:0,y:0},j=1,N=1;const U=gA(this._env);if(U&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),U&&!P){const t=this._getParentElement(m);H=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-H.x,y:F.y-H.y},j=W3(e,F),N=W3(t,H)}const V=N/j,W={},G={x:M,y:M},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:C;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?E:B;switch(K3(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},K=["x","y"];if(g(M))if((t=>g(t)&&(p(t.left)||p(t.right)||p(t.top)||p(t.bottom)))(M)){const{left:t,right:e,top:i,bottom:s}=M;W.left=Y3(t,y),W.top=Y3(i,y),W.right=Y3(e,y),W.bottom=Y3(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(M)&&K.forEach((t=>{const e=M[t];S(e)||d(e)?W[Y[t][0]]=Y3(e,y):X(e,t)}));else p(M)&&(X({orient:M,mode:w},"x"),X({orient:M,mode:w},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?O:I,n="x"===t?A:C,r=K3(G[t],t);if(k(W[Y[t][0]]))$[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))$[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}$[t]*=j,U&&($[t]+=z[t]),$[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(H[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/N:-H[t]/N,l=a/N+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(L?$[t]=l:($[t]-=0===r?n+i/2:2*n+i,$[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",Z3=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=q3(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=q3(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},J3=(t={})=>{const{lineHeight:e}=t;return t.fontSize?XC(e,t.fontSize):0},Q3=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=oi(r),a.padding=q3(o)),{panelStyle:a,panelPadding:o}};function t4(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class e4 extends $3{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(e4.type),this.type=lW.dom,this._tooltipContainer=null==pA?void 0:pA.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(pA&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=Q3(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(y.marginBottom=`${g}px`);const _={width:q3(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=Z3(h),x=Z3(d),S=Z3(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[A]=q3(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=q3(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=q3(null!==(n=p.spacing)&&void 0!==n?n:0);const C=Math.max(J3(p),J3(d));return y.lineHeight=C>0?`${C}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(H3))),l=a.find((t=>t.className.includes(j3)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(H3),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(t4(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${F3}-column`),e.classList.add(`${F3}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(j3),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];t4(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));t4(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${F3}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=G3(e.key),e.keyStyle&&Z3(e.keyStyle,l)):"value"===i?(o.innerHTML=G3(e.value),e.valueStyle&&Z3(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?V3(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?V3(c):m,_=p,b=t=>new Qp({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ue));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=nu.IsGradientStr(u);if(!u||y(u)&&!T||d)return m=d?"none":u?V3(u):"currentColor",`\n \n \n \n `;const M=T?nu.Parse(u):g(u)?u:null;if(M){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=M.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===M.gradient?t=`\n ${i}\n `:"linear"===M.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),t4(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(j3))),h=[...o.children].find((t=>t.className.includes(H3)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(H3)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=XC(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,t4(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=Sf({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n});return{width:r.width(),height:r.height(),text:s}};function n4(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:i4),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const r4=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class a4 extends $3{constructor(){super(a4.type),this.type=lW.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new AX({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=oi(d.padding),b=qC(d.padding),x=n4(Object.assign({textAlign:"right"===y?"right":"left"},u),i),S=n4(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=n4(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},C={panel:r4(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:M=[]}=t;let w=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!M.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;C.content=M.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:C}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=aT({},S,n4(b,void 0,{})),{width:s,height:n,text:r}=s4(h,i);T.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),y?e.push(s):t.push(s),o=Math.max(o,n)}if(p(m)){const t=aT({},A,n4(x,void 0,{})),{width:e,height:s,text:n}=s4(m,t);T.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};C?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(H){V=aT({},x,n4(N,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=s4(j,V);C.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=C.title.value.width,F=C.title.value.height,z=F+(P?C.title.spaceRow:0)}return E+=z,C.title.width=D,C.title.height=F,W()?w+=B||D:w+=Math.max(D,B),P&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=w-b.left-b.right-L-R-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=w,C.panel.height=E,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}a4.type=lW.canvas;const o4=/\{([^}]+)\}/,l4=/\{([^}]+)\}/g,h4=/:/;class c4 extends bN{constructor(){super(c4.type),this.type="formatterPlugin",this._timeModeFormat={utc:yi.getInstance().timeUTCFormat,local:yi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ti.getInstance().format,this._numericSpecifier=Ti.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[c4.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),oT.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=o4.test(i),this._isNumericFormatterCache.set(i,s))),s){return i.replace(l4,((t,i)=>{if(!h4.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}))}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ai.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}c4.pluginType="chart",c4.specKey="formatter",c4.type="formatterPlugin";$z.useRegisters([()=>{pW(),fW(),vW(),WV(),VV(),CV(),mV(),rN(),oN(),Lz(),Rz(),qU(),uV(),oT.registerSeries(TV.type,TV),oT.registerChart(yW.type,yW)},()=>{pW(),fW(),vW(),VV(),CV(),mV(),rN(),xW(),oN(),kW(),qU(),uV(),oT.registerSeries(MX.type,MX),WV(),oT.registerChart(EX.type,EX)},()=>{pW(),fW(),vW(),VV(),WX(),WV(),oT.registerChart(YX.type,YX)},()=>{pW(),fW(),WV(),VV(),sK(),oT.registerChart(rK.type,rK)},()=>{fW(),nq(),oT.registerChart(c1.type,c1)},()=>{pW(),fW(),WV(),VV(),Aq(),oT.registerChart(p1.type,p1)},()=>{pW(),fW(),vW(),WV(),VV(),Rq(),oT.registerChart(f1.type,f1)},()=>{pW(),fW(),vW(),WV(),VV(),WX(),oT.registerTransform("bin",Zr),oT.registerChart(x1.type,x1)},()=>{fW(),_K(),cK(),oT.registerSeries(xK.type,xK),oT.registerImplement("registerMap",NM),oT.registerImplement("unregisterMap",UM),Oz(),oT.registerChart(n1.type,n1)},()=>{fW(),_0(),oT.registerSeries(x0.type,x0),q$(),qq(),_q(),tZ(),oT.registerChart(C1.type,C1)},()=>{fW(),WJ(),oT.registerChart(w1.type,w1)},()=>{fW(),dQ(),oT.registerChart(B1.type,B1)},()=>{pW(),fW(),vW(),WV(),VV(),ZK(),oT.registerChart(U1.type,U1)},()=>{pW(),fW(),WV(),VV(),x$(),oT.registerTransform("boxplot",Jr),oT.registerChart(W1.type,W1)},()=>{pW(),fW(),WV(),VV(),tZ(),oT.registerChart(A1.type,A1)},()=>{pW(),fW(),WV(),VV(),hZ(),oT.registerChart(R1.type,R1)},()=>{pW(),fW(),WV(),VV(),R$(),oT.registerChart(I1.type,I1)},()=>{pW(),fW(),vW(),WV(),VV(),xW(),qU(),uV(),oT.registerSeries(F$.type,F$),oT.registerChart(K1.type,K1)},()=>{fW(),EQ(),oT.registerChart(D1.type,D1)},()=>{fW(),LQ(),oT.registerChart(z1.type,z1)},()=>{fW(),h0(),oT.registerChart(j1.type,j1)},()=>{fW(),PW(),e0(),oT.registerChart(Y1.type,Y1)},()=>{fW(),E0(),oT.registerChart(q1.type,q1)},()=>{fW(),W0(),oT.registerChart(J1.type,J1)},()=>{pW(),fW(),vW(),WV(),oT.registerChart(v1.type,v1),VV()},uV,qU,()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),sU(),oT.registerComponent(kX.type,kX)},()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),sU(),oT.registerComponent(CX.type,CX)},()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),sU(),oT.registerComponent(TX.type,TX)},xq,_q,()=>{oT.registerComponent(r2.type,r2)},()=>{oT.registerComponent(v2.type,v2)},()=>{oT.registerComponent(w2.type,w2)},()=>{oT.registerComponent(F2.type,F2)},()=>{oT.registerComponent(z2.type,z2)},()=>{oT.registerComponent(t5.type,t5)},()=>{oT.registerComponent(s5.type,s5)},()=>{oT.registerComponent(o5.type,o5)},_K,()=>{oT.registerComponent(s3.type,s3),_Y()},()=>{oT.registerComponent(l3.type,l3),xY()},()=>{oT.registerComponent(T3.type,T3),CY()},()=>{oT.registerComponent(n3.type,n3),AY._animate=tY,_Y()},()=>{oT.registerComponent(h3.type,h3),kY._animate=iY,xY()},()=>{oT.registerComponent(M3.type,M3),CY()},()=>{oT.registerComponent(w3.type,w3),CY()},()=>{oT.registerComponent(r3.type,r3)},()=>{oT.registerComponent(m3.type,m3)},()=>{oT.registerGraphicComponent(x3.type,(t=>new uG(t))),_3(),qN(),oT.registerComponent(x3.type,x3,!0,1/0)},()=>{oT.registerGraphicComponent(S3.type,(t=>new uG(t))),_3(),qN(),oT.registerComponent(S3.type,S3,!0)},()=>{oT.registerComponent(R3.type,R3)},()=>{oT.registerComponent(I3.type,I3)},()=>{WW(Zy()),WW(vb()),yb()},()=>{oT.registerLayout(L3.type,L3)},()=>{var t;t=a4,oT.registerComponentPlugin(t.type,t)},()=>{var t;t=c4,oT.registerChartPlugin(t.type,t)},Nz,Wz]),$z.useRegisters([()=>{wP(i_)}]),t.DEFAULT_CHART_HEIGHT=OT,t.DEFAULT_CHART_WIDTH=RT,t.DEFAULT_CLOSE_STROKE_JOIN=Jz,t.DEFAULT_DATA_INDEX=LT,t.DEFAULT_DATA_KEY=DT,t.DEFAULT_DATA_SERIES_FIELD=FT,t.DEFAULT_KEY=iM,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=Zz,t.DEFAULT_MAP_LOOK_UP_KEY=sM,t.DEFAULT_MEASURE_CANVAS_ID=IT,t.DEFAULT_SERIES_STYLE_NAME=zT,t.DEFAULT_SMOOTH_INTERPOLATE=qz,t.Factory=oT,t.MOSAIC_CAT_END_PERCENT=QT,t.MOSAIC_CAT_START_PERCENT=JT,t.MOSAIC_VALUE_END_PERCENT=ZT,t.MOSAIC_VALUE_START_PERCENT=qT,t.ManualTicker=class extends bD{constructor(t){super(t),this.lastFrameTime=0,this.status=Rl.RUNNING}setupTickHandler(){const t=new Qz;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Rl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Rl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Rl.RUNNING,!0}},t.PREFIX=PT,t.SEGMENT_FIELD_END=eM,t.SEGMENT_FIELD_START=tM,t.STACK_FIELD_END=NT,t.STACK_FIELD_END_OffsetSilhouette=GT,t.STACK_FIELD_END_PERCENT=VT,t.STACK_FIELD_KEY=HT,t.STACK_FIELD_START=jT,t.STACK_FIELD_START_OffsetSilhouette=WT,t.STACK_FIELD_START_PERCENT=UT,t.STACK_FIELD_TOTAL=YT,t.STACK_FIELD_TOTAL_BOTTOM=$T,t.STACK_FIELD_TOTAL_PERCENT=XT,t.STACK_FIELD_TOTAL_TOP=KT,t.StreamLight=sD,t.ThemeManager=AT,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=$z,t.boundsInRect=$C,t.builtinThemes=uT,t.calcLayoutNumber=XC,t.calcPadding=KC,t.computeActualDataScheme=PC,t.convertPoint=ZC,t.createArc=Kg,t.createArea=Gg,t.createGroup=sf,t.createLine=sg,t.createRect=og,t.createRichText=Hg,t.createSymbol=tg,t.createText=Kp,t.darkTheme=nT,t.dataScheme=QC,t.default=$z,t.defaultThemeName=pT,t.getActualColor=OC,t.getActualNumValue=JC,t.getColorSchemeBySeries=FC,t.getDataScheme=BC,t.getFunnelTheme=cT,t.getMergedTheme=xT,t.getSpecInfo=iH,t.getTheme=yT,t.hasThemeMerged=mT,t.isColorKey=IC,t.isPercent=GC,t.isPercentOffset=YC,t.isProgressiveDataColorScheme=LC,t.isTokenKey=eT,t.isValidOrient=WC,t.lightTheme=sT,t.lookup=sH,t.measureText=BT,t.normalizeLayoutPaddingSpec=qC,t.queryColorFromColorScheme=RC,t.queryToken=tT,t.registerDataSetInstanceParser=FM,t.registerDataSetInstanceTransform=DM,t.registerTheme=vT,t.removeTheme=_T,t.themeExist=bT,t.themes=gT,t.token=iT,t.transformColorSchemeToStandardStruct=DC,t.transformToGraphic=xM,t.version="2.1.0",t.vglobal=e_,t.warn=hA,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/harmony_vchart/library/CHANGELOG.md b/packages/harmony_vchart/library/CHANGELOG.md index 435bd5e8a8..7f1f72b0ad 100644 --- a/packages/harmony_vchart/library/CHANGELOG.md +++ b/packages/harmony_vchart/library/CHANGELOG.md @@ -1,3 +1,30 @@ +# v2.1.0 + +2026-06-23 + +**🆕 New Features** + +- **@visactor/vchart**: markLine expandDistancesupport callback. close#4568 +- **@visactor/vchart**: support function type for `maxRow` / `maxCol` of the discrete legend, evaluated during layout against the legend's allocated rect, so the row / column count can adapt to the available space + +**🐛 Bug Fixes** + +- **@visactor/vchart**: waterfall lead line bug. fix#4580 +- **@visactor/vchart**: preserve discrete legend filtering after updateSpec when `legends.data` is a callback (Issue #4566) +- **@visactor/vchart**: re-nice the cartesian linear axis with the real plot-area length after layout when `tick.tickCount` is a function, so the length-based tick count and nice ceiling match the final plot area instead of the pre-layout chart viewRect +- **@visactor/vchart**: vchart relayout api not work bug. fix#4537 +- **@visactor/vchart**: label not follow when drag. fix#4547 +- **@visactor/vchart**: prcoess render error. fix#4578 + +**🔨 Chores** + +- **@visactor/vchart**: update changes for 009-fix-map-roam-pointer-drag: This plan fixes a map roam drag bug where mobile browsers lose stable vertical dragging after supportsTouchEvents is forced to false +- **@visactor/vchart**: introduce scoped updateSpec effects to make chart, component, series, data, layout, render, and animation update ranges explicit; local component updates such as marker exit, title text, legend appearance, axis appearance, mark style, field, label, animation, and layout-related series changes now avoid unnecessary chart remake/recompile paths when the existing chart model can be updated in place +- **@visactor/vchart**: align VChart with the VRender 1.1.0 app-scoped runtime, state resolver, and animation contracts while keeping standard VChart spec usage compatible; consolidate mark shared-state handling, glyph sub-graphic state isolation, word-cloud scaleIn initialization, and interaction-state behavior for Sankey, brush, legend textures, marker rich text, and circular progress tick masks + +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.20...v2.1.0 + +[more detail about v2.1.0](https://github.com/VisActor/VChart/releases/tag/v2.1.0) # v2.0.22 2026-04-13 diff --git a/packages/harmony_vchart/library/CHANGELOG.md.bak b/packages/harmony_vchart/library/CHANGELOG.md.bak index aa84f8b9c9..435bd5e8a8 100644 --- a/packages/harmony_vchart/library/CHANGELOG.md.bak +++ b/packages/harmony_vchart/library/CHANGELOG.md.bak @@ -1,3 +1,18 @@ +# v2.0.22 + +2026-04-13 + +**🐛 Bug Fixes** + +- **@visactor/vchart**: correct stacked bar corner clipping when barMinHeight is applied (Issue #4543) +- **@visactor/vchart**: relayout api not work bug. fix#4537 +- **@visactor/vchart**: custom mark not release after update spec. fix#4537 +- **@visactor/vchart**: map error when roam or drag canvas. fix#4547 +- **@visactor/vchart**: handle sankey tooltip labels when source index is 0 (Issue #4488) + +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.20...v2.0.22 + +[more detail about v2.0.22](https://github.com/VisActor/VChart/releases/tag/v2.0.22) # v2.0.21 2026-04-03 diff --git a/packages/harmony_vchart/library/oh-package.json5 b/packages/harmony_vchart/library/oh-package.json5 index ee584baa30..6ae7472b0c 100644 --- a/packages/harmony_vchart/library/oh-package.json5 +++ b/packages/harmony_vchart/library/oh-package.json5 @@ -1,6 +1,6 @@ { name: '@visactor/harmony-vchart', - version: '2.0.22', + version: '2.1.0', description: '@visactor/vchart 针对 harmonyOS 打造的图表库,拥有非常酷炫的动画能力,近20种图表类型,以及原生的渲染性能', main: 'Index.ets', author: { diff --git a/packages/harmony_vchart/library/src/main/ets/index-harmony-simple.es.min.js b/packages/harmony_vchart/library/src/main/ets/index-harmony-simple.es.min.js index 4551f32099..4e142f2485 100644 --- a/packages/harmony_vchart/library/src/main/ets/index-harmony-simple.es.min.js +++ b/packages/harmony_vchart/library/src/main/ets/index-harmony-simple.es.min.js @@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -function t(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(n||(n={}));var a={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var _=t=>Array.isArray?Array.isArray(t):l(t,"Array");var y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>x(t)&&Number.isFinite(t);var A=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var M=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const T=Object.prototype;var C=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||T)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(y(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(C(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var P=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function L(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!u(n[a])||"object"!=typeof n[a]||s&&_(t[a])?F(t,a,n[a]):D(t,e,a,i,s)}}}}function D(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(y(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function H(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function N(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(H(t)!==H(e))return!1;if(c(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!N(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!N(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function tt(t){return Number(t)}function et(t,e,i=tt){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const it="undefined"!=typeof console;function st(t,e,i){const s=[e].concat([].slice.call(i));it&&console[t].apply(console,s)}var nt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(nt||(nt={}));class rt{static getInstance(t,e){return rt._instance&&x(t)?rt._instance.level(t):rt._instance||(rt._instance=new rt(t,e)),rt._instance}static setInstance(t){return rt._instance=t}static setInstanceLevel(t){rt._instance?rt._instance.level(t):rt._instance=new rt(t)}static clearInstance(){rt._instance=null}constructor(t=nt.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=nt.Info}canLogDebug(){return this._level>=nt.Debug}canLogError(){return this._level>=nt.Error}canLogWarn(){return this._level>=nt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):st(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=nt.Warn&&st(this._method||"warn","WARN",t),this}info(...t){return this._level>=nt.Info&&st(this._method||"log","INFO",t),this}debug(...t){return this._level>=nt.Debug&&st(this._method||"log","DEBUG",t),this}}function at(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(t[n],e)>0?s=n:i=n+1}return i}rt._instance=null;const ot=(t,e)=>lt(0,t.length,(i=>e(t[i]))),lt=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ht=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(Q)),et(i,.5)},ct=1e-10,dt=1e-10;function ut(t,e,i=dt,s=ct){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function pt(t,e,i,s){return t>e&&!ut(t,e,i,s)}function gt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var mt=function(t,e,i){return ti?i:t};var vt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function _t(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let yt=!1;try{yt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){yt=!1}function bt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&yt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=m(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function xt(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),bt(t,e,{leading:s,trailing:n,maxWait:e})}function St(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function At(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}yt=!1;const wt=4294967296;const Tt=t=>e=>P(e,t),Ct=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||Tt)(i)},Bt=(t,e={})=>{if(_(t)){const i=t.map((t=>Ct(t,e)));return t=>i.map((e=>e(t)))}return Ct(t,e)},Et=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Pt=t=>0,Rt=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function It(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Lt(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!d(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:u,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)u+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!d(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!d(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:u,b:p},predict:g,rSquared:It(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Ot(f.min,f);for(let r=0;r=1?zt:t<=-1?-zt:Math.asin(t)}function qt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Zt(t,e){return t[0]*e[1]-t[1]*e[0]}function Jt(t,e){let i=0;for(let s=0;s0?i:0}function ee(t,e){return Qt(t+e,10**Math.max(te(t),te(e)))}function ie(t,e){return Qt(t-e,10**Math.max(te(t),te(e)))}class se{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new se(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ne{static distancePP(t,e){return Xt($t(t.x-e.x,2)+$t(t.y-e.y,2))}static distanceNN(t,e,i,s){return Xt($t(t-i,2)+$t(e-s,2))}static distancePN(t,e,i){return Xt($t(e-t.x,2)+$t(i-t.y,2))}static pointAtPP(t,e,i){return new se((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function re(t){return t*(Math.PI/180)}function ae(t){return 180*t/Math.PI}const oe=(t=0)=>{if(t<0)for(;t<-jt;)t+=jt;else if(t>0)for(;t>jt;)t-=jt;return t};function le(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function he(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ce(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function de(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ue(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=de(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function pe(t){return(t=de(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function ge(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function fe(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ve(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ye(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var _e;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(_e||(_e={}));const ye=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function be(t,e,i){if(!t||!e)return _e.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ye(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Ae({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?re(t.angle):t.angle,s=Me(t);return[Ae({x:t.x1,y:t.y1},i,s),Ae({x:t.x2,y:t.y1},i,s),Ae({x:t.x2,y:t.y2},i,s),Ae({x:t.x1,y:t.y2},i,s)]}function Te(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?re(t.angle):t.angle;let u=i?re(90-t.angle):t.angle+zt;const p=i?re(e.angle):e.angle;let g=i?re(90-e.angle):e.angle+zt;u>Ht&&(u-=Ht),g>Ht&&(g-=Ht);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ce=1e-8;function Be(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function Ie(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Le{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=Ie(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(v(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(d(t))return{width:0,height:0};if(d(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(d(this._numberCharSize)){const t=this._standardMethod(Le.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Le.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Le.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Le.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Le.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Le.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Le.NUMBERS_CHAR_SET="0123456789",Le.FULL_SIZE_CHAR="字";const De=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),Fe=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return ze(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class He extends je{}class Ve extends je{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ve(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Ae({x:this.x1,y:this.y1},this.angle,t),Ae({x:this.x2,y:this.y1},this.angle,t),Ae({x:this.x1,y:this.y2},this.angle,t),Ae({x:this.x2,y:this.y2},this.angle,t)]}}class Ne{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ne,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ne;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ne(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=ae(r.rotateDeg),r}}class We{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Ue(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Ge(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Ye=/^#([0-9a-f]{3,8})$/,Xe={transparent:4294967040},$e={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ke(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function qe(t){return x(t)?new ei(t>>16,t>>8&255,255&t,1):_(t)?new ei(t[0],t[1],t[2]):new ei(255,255,255)}function Ze(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Je(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Qe=(t,e)=>{const i=Ye.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ei((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?qe(t):8===e?new ei(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ti{static Brighter(t,e=1){return 1===e?t:new ti(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ti(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ti?t:new ti(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u(Xe[t]))return function(t){return x(t)?new ei(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ei(t[0],t[1],t[2],t[3]):new ei(255,255,255,1)}(Xe[t]);if(u($e[t]))return qe($e[t]);const e=`${t}`.trim().toLowerCase(),i=Qe(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ei(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Ue(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ei(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ti.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ei(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Ge(this.color.r,this.color.g,this.color.b),r=Ue(d(t)?n.h:mt(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ei(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Qe(e,!0);return null!=i?i:this}setColorName(t){const e=$e[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ti(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Ze(t.color.r),this.color.g=Ze(t.color.g),this.color.b=Ze(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ei{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Ke(this.r)+Ke(this.g)+Ke(this.b)+(1===this.opacity?"":Ke(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Ge(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ii(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new ei(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Ge});function ni(t){if(k(t))return[t,t,t,t];if(_(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(p(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ri(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function ai(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function oi(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const li=1e-10;function hi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+li)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=pi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ne.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ci(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-li,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ci(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function di(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ci(t,t-(i*i-e*e+t*t)/(2*i))+ci(e,s)}function ui(t,e){const i=ne.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function pi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let mi;function vi(t,e){const i=fi(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class _i{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const yi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function bi(t){let e;if(e=yi.exec(t))return new _i({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});rt.getInstance().error("invalid format: "+t)}const xi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Si{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return Si.instance||(Si.instance=new Si),Si.instance}newFormat(t){const e=bi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):ki[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=ki[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,k=p,A=t;if("c"===d)k=g(A)+k,A="";else{A=+A;let t=A<0||1/A<0;if(A=isNaN(A)?m:g(Math.abs(A),h),c&&(A=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(A)),t&&0==+A&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,k=("s"===d?xi[8+mi/3]:"")+k+(t&&"("===n?")":""),f)for(e=-1,r=A.length;++ex||x>57){k=(46===x?_+A.slice(e+1):A.slice(e))+k,A=A.slice(0,e);break}}l&&!a&&(A=y(A,1/0));let M=S.length+A.length+k.length,w=M>1)+S+A+k+w.slice(M);break;default:A=w+S+A+k}return b(A)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=bi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=fi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=xi[8+n/3];return function(t){return s(r*t)+a}}}const ki={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>vi(100*t,e),r:vi,s:function(t,e){const i=fi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(mi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+fi(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function Ai(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ci(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ci(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Jt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Pi(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ti(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Ji=Math.sqrt,Qi=Math.tan;function ts(t){return t>1?0:t<-1?Fi:Math.acos(t)}function es(t){return t>1?zi:t<-1?-zi:Math.asin(t)}function is(){}function ss(t,e){t&&rs.hasOwnProperty(t.type)&&rs[t.type](t,e)}var ns={Feature:function(t,e){ss(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sFi?t+Math.round(-t/Hi)*Hi:t,e]}function _s(t,e,i){return(t%=Hi)?e||i?ms(bs(t),xs(e,i)):bs(t):e||i?xs(e,i):vs}function ys(t){return function(e,i){return[(e+=t)>Fi?e-Hi:e<-Fi?e+Hi:e,i]}}function bs(t){var e=ys(t);return e.invert=ys(-t),e}function xs(t,e){var i=Yi(t),s=qi(t),n=Yi(e),r=qi(e);function a(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*i+o*s;return[Gi(l*n-c*r,o*i-h*s),es(c*n+l*r)]}return a.invert=function(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*n-l*r;return[Gi(l*n+h*r,o*i+c*s),es(c*i-o*s)]},a}function Ss(t,e){(e=cs(e))[0]-=t,fs(e);var i=ts(-e[1]);return((-e[2]<0?-i:i)+Hi-Di)%Hi}function ks(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:is,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function As(t,e){return Wi(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function Ts(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Os(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function Is(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ks(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Os(a);var t=function(t,e){var i=Ps(e),s=e[1],n=qi(s),r=[qi(i),-Yi(i),0],a=0,o=0;Es.reset(),1===n?s=zi+Di:-1===n&&(s=-zi-Di);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Fi,T=f*x;if(Es.add(Gi(T*A*qi(M),m*S+T*Yi(M))),a+=w?k+A*Hi:k,w^p>=i^y>=i){var C=us(cs(u),cs(_));fs(C);var B=us(r,C);fs(B);var E=(w^k>=0?-1:1)*es(B[2]);(s>E||s===E&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-Di||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Ls))}return u}}function Ls(t){return t.length>1}function Ds(t,e){return((t=t.x)[0]<0?t[1]-zi-Di:zi-t[1])-((e=e.x)[0]<0?e[1]-zi-Di:zi-e[1])}1===(Cs=Rs).length&&(Bs=Cs,Cs=function(t,e){return Rs(Bs(t),e)});var Fs=Is((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Fi:-Fi,l=Wi(r-i);Wi(l-Fi)0?zi:-zi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Fi&&(Wi(i-n)Di?Ui((qi(e)*(r=Yi(s))*qi(i)-qi(s)*(n=Yi(e))*qi(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*zi,s.point(-Fi,n),s.point(0,n),s.point(Fi,n),s.point(Fi,0),s.point(Fi,-n),s.point(0,-n),s.point(-Fi,-n),s.point(-Fi,0),s.point(-Fi,n);else if(Wi(t[0]-e[0])>Di){var r=t[0]0,n=Wi(e)>Di;function r(t,i){return Yi(t)*Yi(i)>e}function a(t,i,s){var n=[1,0,0],r=us(cs(t),cs(i)),a=ds(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=us(n,r),u=gs(n,h);ps(u,gs(r,c));var p=d,g=ds(u,p),f=ds(p,p),m=g*g-f*(ds(u,u)-1);if(!(m<0)){var v=Ji(m),_=gs(p,(-g-v)/f);if(ps(_,u),_=hs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Wi(_[0]-b)Fi^(b<=_[0]&&_[0]<=x)){var w=gs(p,(-g+v)/f);return ps(w,u),[_,hs(w)]}}}function o(e,i){var n=s?t:Fi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Is(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Fi:-Fi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||As(e,p)||As(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&As(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Yi(e),o=qi(e),l=s*i;null==n?(n=e+s*Hi,r=e-l/2):(n=Ss(a,n),r=Ss(a,r),(s>0?nr)&&(n+=s*Hi));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Wi(s[0]-t)0?0:3:Wi(s[0]-i)0?2:1:Wi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,_,y=a,b=ks(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(k(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=Os(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ws(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function k(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&m)y.point(r,a);else{var l=[g=Math.max(Hs,Math.min(js,g)),f=Math.max(Hs,Math.min(js,f))],b=[r=Math.max(Hs,Math.min(js,r)),a=Math.max(Hs,Math.min(js,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ns(t){return t}var Ws,Us,Gs,Ys,Xs=Ri(),$s=Ri(),Ks={point:is,lineStart:is,lineEnd:is,polygonStart:function(){Ks.lineStart=qs,Ks.lineEnd=Qs},polygonEnd:function(){Ks.lineStart=Ks.lineEnd=Ks.point=is,Xs.add(Wi($s)),$s.reset()},result:function(){var t=Xs/2;return Xs.reset(),t}};function qs(){Ks.point=Zs}function Zs(t,e){Ks.point=Js,Ws=Gs=t,Us=Ys=e}function Js(t,e){$s.add(Ys*t-Gs*e),Gs=t,Ys=e}function Qs(){Js(Ws,Us)}var tn=Ks,en=1/0,sn=en,nn=-en,rn=nn;var an,on,ln,hn,cn={point:function(t,e){tnn&&(nn=t);ern&&(rn=e)},lineStart:is,lineEnd:is,polygonStart:is,polygonEnd:is,result:function(){var t=[[en,sn],[nn,rn]];return nn=rn=-(sn=en=1/0),t}},dn=0,un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn={point:xn,lineStart:Sn,lineEnd:Mn,polygonStart:function(){bn.lineStart=wn,bn.lineEnd=Tn},polygonEnd:function(){bn.point=xn,bn.lineStart=Sn,bn.lineEnd=Mn},result:function(){var t=yn?[vn/yn,_n/yn]:mn?[gn/mn,fn/mn]:pn?[dn/pn,un/pn]:[NaN,NaN];return dn=un=pn=gn=fn=mn=vn=_n=yn=0,t}};function xn(t,e){dn+=t,un+=e,++pn}function Sn(){bn.point=kn}function kn(t,e){bn.point=An,xn(ln=t,hn=e)}function An(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,xn(ln=t,hn=e)}function Mn(){bn.point=xn}function wn(){bn.point=Cn}function Tn(){Bn(an,on)}function Cn(t,e){bn.point=Bn,xn(an=ln=t,on=hn=e)}function Bn(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,vn+=(n=hn*t-ln*e)*(ln+t),_n+=n*(hn+e),yn+=3*n,xn(ln=t,hn=e)}var En=bn;function Pn(t){this._context=t}Pn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Hi)}},result:is};var Rn,On,In,Ln,Dn,Fn=Ri(),zn={point:is,lineStart:function(){zn.point=jn},lineEnd:function(){Rn&&Hn(On,In),zn.point=is},polygonStart:function(){Rn=!0},polygonEnd:function(){Rn=null},result:function(){var t=+Fn;return Fn.reset(),t}};function jn(t,e){zn.point=Hn,On=Ln=t,In=Dn=e}function Hn(t,e){Ln-=t,Dn-=e,Fn.add(Ji(Ln*Ln+Dn*Dn)),Ln=t,Dn=e}var Vn=zn;function Nn(){this._string=[]}function Wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Un(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ls(t,i(s))),s.result()}return r.area=function(t){return ls(t,i(tn)),tn.result()},r.measure=function(t){return ls(t,i(Vn)),Vn.result()},r.bounds=function(t){return ls(t,i(cn)),cn.result()},r.centroid=function(t){return ls(t,i(En)),En.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ns):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Nn):new Pn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Gn(t){return function(e){var i=new Yn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Yn(){}function Xn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ls(i,t.stream(cn)),e(cn.result()),null!=s&&t.clipExtent(s),t}function $n(t,e,i){return Xn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Kn(t,e,i){return $n(t,[[0,0],e],i)}function qn(t,e,i){return Xn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Zn(t,e,i){return Xn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Nn.prototype={_radius:4.5,_circle:Wn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Wn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Yn.prototype={constructor:Yn,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Jn=16,Qn=Yi(30*Ni);function tr(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,k=Ji(b*b+x*x+S*S),A=es(S/=k),M=Wi(Wi(S)-1)e||Wi((v*B+_*E)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ni:0,B()):[m*Vi,v*Vi,_*Vi]},T.angle=function(t){return arguments.length?(y=t%360*Ni,B()):y*Vi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},T.precision=function(t){return arguments.length?(a=tr(o,w=t*t),E()):Ji(w)},T.fitExtent=function(t,e){return $n(T,t,e)},T.fitSize=function(t,e){return Kn(T,t,e)},T.fitWidth=function(t,e){return qn(T,t,e)},T.fitHeight=function(t,e){return Zn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,B()}}function ar(t){var e=0,i=Fi/3,s=rr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ni,i=t[1]*Ni):[e*Vi,i*Vi]},n}function or(t,e){var i=qi(t),s=(i+qi(e))/2;if(Wi(s)2?t[2]*Ni:0),e.invert=function(e){return(e=t.invert(e[0]*Ni,e[1]*Ni))[0]*=Vi,e[1]*=Vi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===gr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function mr(t){return Qi((zi+t)/2)}function vr(t,e){var i=Yi(t),s=t===e?qi(t):$i(i/Yi(e))/$i(mr(e)/mr(t)),n=i*Ki(mr(t),s)/s;if(!s)return gr;function r(t,e){n>0?e<-zi+Di&&(e=-zi+Di):e>zi-Di&&(e=zi-Di);var i=n/Ki(mr(e),s);return[i*qi(s*t),n-i*Yi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Zi(s)*Ji(t*t+i*i),a=Gi(t,Wi(i))*Zi(i);return i*s<0&&(a-=Fi*Zi(t)*Zi(i)),[a/s,2*Ui(Ki(n/r,1/s))-zi]},r}function _r(t,e){return[t,e]}function yr(t,e){var i=Yi(t),s=t===e?qi(t):(i-Yi(e))/(e-t),n=i/s+t;if(Wi(s)Di&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Cr.invert=dr(es),Br.invert=dr((function(t){return 2*Ui(t)})),Er.invert=function(t,e){return[-e,2*Ui(Xi(t))-zi]};var Or={exports:{}},Ir=function(t,e){this.p1=t,this.p2=e};Ir.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ir.prototype.run=function(){return this.p2[0]-this.p1[0]},Ir.prototype.slope=function(){return this.rise()/this.run()},Ir.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ir.prototype.isVertical=function(){return!isFinite(this.slope())},Ir.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ir.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ir.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ir.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},Ir.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Lr=Ir,Dr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Lr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Dr(t.slice(0,s),e),o=Dr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Fr=Dr;!function(t){var e=Fr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=jr(Nr,e),{tolerance:s}=i;return zr(t,s)};var Ur;!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"}(Ur||(Ur={}));const Gr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],k=new Set,A=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),k.has(i)||(k.add(i),S.push(i),_(m)?A.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):A.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let M=0;const w=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/M:0,w.push(y[t])}return w},Xr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",k=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",A=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(u=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==u?u:"percentage",w=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],T=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=T.length?T:void 0,B=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:k,percentageName:M,valuesName:A,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!w.length)return Yr(t,B);const E={};return t.forEach((t=>{const e=w.map((e=>null==t?void 0:t[e])).join("-&&-");E[e]?E[e].push(t):E[e]=[t]})),Object.values(E).map((t=>{const e=[...T,...w];return Yr(t,Object.assign(Object.assign({},B),{groupField:e.length?e:void 0,n:t.length}))})).flat()},$r=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const k=!!(null==e?void 0:e.includeValues),A=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=A.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",w=null!==(a=A.count)&&void 0!==a?a:"count",T=null!==(o=A.mean)&&void 0!==o?o:"mean",C=null!==(l=A.q1)&&void 0!==l?l:"q1",B=null!==(h=A.median)&&void 0!==h?h:"median",E=null!==(c=A.q3)&&void 0!==c?c:"q3",P=null!==(u=A.iqr)&&void 0!==u?u:"iqr",R=null!==(p=A.min)&&void 0!==p?p:"min",O=null!==(g=A.max)&&void 0!==g?g:"max",I=null!==(f=A.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=A.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=A.outliers)&&void 0!==v?v:"outliers",F=null!==(y=A.values)&&void 0!==y?y:"values",z=new Map,j=new Map,H=new Map,V=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),k&&j.set(r,[]),_(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),k){const t=j.get(r);t&&t.push(i)}}_(S)&&(S=[mt(Math.min.apply(null,S),0,1),mt(Math.max.apply(null,S),0,1)]);const N=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[w]=s,f[T]=o,f[C]=l,f[B]=h,f[E]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,k&&(f[F]=j.get(t)||[]),N.push(f)}return N};var Kr={},qr={};function Zr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Jr(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function Qr(t,e){var i=t+"",s=i.length;return s9999?"+"+Qr(e,6):Qr(e,4))+"-"+Qr(t.getUTCMonth()+1,2)+"-"+Qr(t.getUTCDate(),2)+(r?"T"+Qr(i,2)+":"+Qr(s,2)+":"+Qr(n,2)+"."+Qr(r,3)+"Z":n?"T"+Qr(i,2)+":"+Qr(s,2)+":"+Qr(n,2)+"Z":s||i?"T"+Qr(i,2)+":"+Qr(s,2)+"Z":"")}function ea(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return qr;if(h)return h=!1,Kr;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a0}function ua(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=ra(t));var r=[];switch(t.type){case"GeometryCollection":return pa(t,(function(t){fa(t,s)})),t;case"FeatureCollection":return ua(t,(function(t){ua(fa(t,s),(function(t){r.push(t)}))})),oi(r)}return fa(t,s)}function fa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return pa(t,(function(t){fa(t,e)})),t;case"LineString":return ma(ca(t),e),t;case"Polygon":return va(ca(t),e),t;case"MultiLineString":return ca(t).forEach((function(t){ma(t,e)})),t;case"MultiPolygon":return ca(t).forEach((function(t){va(t,e)})),t;case"Point":case"MultiPoint":return t}}function ma(t,e){da(t)===e&&t.reverse()}function va(t,e){da(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=_a(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Sa=(t,e={},i)=>{i.type=Ur.GEO;const s=jr(ba,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(xa(t))})):e.push(xa(t))})),e})(t);let l=t.features;return o&&(l=ga(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=ya.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=ya.bounds(t);t.bbox=e}})),t.features=l,t},ka={},Aa=(t,e,i)=>{i.type=Ur.GEO;const s=jr(ba,ka,e),{object:n}=s;if(!v(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Rr(a,t)}))}:Rr(a,o));var a,o;return Sa(r,s,i)},Ma=(t,e,i)=>{const s=!h(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!_(t))throw new TypeError("Invalid data: must be DataView array!");return _(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let wa=0;function Ta(t="dataset"){return wa>1e8&&(wa=0),t+"_"+wa++}class Ca{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:Ta("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:rt.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Ba{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&N(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ta("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&N(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Ba||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Gr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Un();const Ea={},Pa={albers:hr,albersusa:function(){var t,e,i,s,n,r,a=hr(),o=lr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=lr().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}},Ra=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Oa(t,e){return function i(){const s=e();return s.type=t,s.path=Un().projection(s),s.copy=s.copy||function(){const t=i();return Ra.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Ia{static GenAutoIncrementId(){return Ia.auto_increment_id++}}Ia.auto_increment_id=0;class La{constructor(t){this.id=Ia.GenAutoIncrementId(),this.registry=t}}const Da="named",Fa="inject",za="multi_inject",ja="inversify:tagged",Ha="inversify:paramtypes";class Va{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Da?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Na=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Wa(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Na.hasOwnMetadata(t,e)&&(r=Na.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Na.defineMetadata(t,r,e)}(ja,t,i.toString(),s)}function Ua(t){return(e,i,s)=>{Wa(e,0,s,t)}}function Ga(t){return e=>(i,s,n)=>Ua(new Va(t,e))(i,s,n)}const Ya=Ga(Fa),Xa=Ga(za);function $a(){return function(t){return Na.defineMetadata(Ha,null,t),t}}function Ka(t){return Ua(new Va(Da,t))}const qa="Singleton",Za="Transient",Ja="ConstantValue",Qa="DynamicValue",to="Factory",eo="Function",io="Instance",so="Invalid";class no{constructor(t,e){this.id=Ia.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=so,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new no(this.serviceIdentifier,this.scope);return t.activated=t.scope===qa&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class ro{getConstructorMetadata(t){return{compilerGeneratedMetadata:Na.getMetadata(Ha,t),userGeneratedMetadata:Na.getMetadata(ja,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const ao=(oo=Da,t=>{const e=e=>{if(null==e)return!1;if(e.key===oo&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const co=Symbol("ContributionProvider");class uo{constructor(t,e){this.serviceIdentifier=t,this.container=e,go.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function po(t,e){t(co).toDynamicValue((({container:t})=>new uo(e,t))).inSingletonScope().whenTargetNamed(e)}class go{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}go.store=new Map;class fo{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class mo extends fo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const vo=Symbol.for("EnvContribution"),_o=Symbol.for("VGlobal"),yo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Za,this.options=e,this.id=Ia.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new ro}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,Da,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new no(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new ho(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[Fa],multiInject:s[za]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ja:case eo:e=t.cache;break;case io:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===qa&&(t.cache=e,t.activated=!0)}},bo=Symbol.for("RenderService");const xo=new class{get renderService(){return this._renderService||(this._renderService=yo.get(bo)),this._renderService}};let So=0;class ko{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=xo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++So,t),this.tryRunAnimationFrameNextFrame(),So}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class Ao{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Mo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},To=function(t,e){return function(i,s){e(i,s,t)}},Co=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let Bo=class extends Ao{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Ia.GenAutoIncrementId(),this.hooks={onSetEnv:new mo(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new ko);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Co(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Eo,Po,Ro,Oo;Bo=Mo([$a(),To(0,Ya(co)),To(0,Ka(vo)),wo("design:paramtypes",[Object])],Bo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Eo||(Eo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Po||(Po={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Ro||(Ro={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Oo||(Oo={}));const Io=jt-1e-8;class Lo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Io)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=jt)<0&&(s+=jt),(n%=jt)<0&&(n+=jt),nn;++o,a-=zt)g(a);else for(a=s-s%zt+zt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Fo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,zo={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},jo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Ho,Vo,No,Wo,Uo,Go;var Yo,Xo,$o,Ko,qo,Zo;function Jo(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),f=Math.cos(n),m=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,k=i+m,A=S+y*m,M=k-y*f;return[h*b+c*x,d*b+u*x,h*A+c*M,d*A+u*M,h*S+c*k,d*S+u*k]}function Qo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=re(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let k=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;k<0&&(k=0);let A=Math.sqrt(k);r===n&&(A=-A);const M=.5*(y+x)-A*(S-b),w=.5*(b+S)+A*(x-y),T=Math.atan2(b-w,y-M);let C=Math.atan2(S-w,x-M)-T;C<0&&1===r?C+=jt:C>0&&0===r&&(C-=jt);const B=Math.ceil(Math.abs(C/(zt+.001))),E=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function el(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=ll(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function cl(t,e){const{p0:i,p1:s}=t,n=ne.pointAtPP(i,s,e);return[new dl(i,n),new dl(n,s)]}class dl extends il{constructor(t,e){super(),this.type=qo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ne.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Nt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ne.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Ko.ROW?Vt(this.p0.x-this.p1.x):t===Ko.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class ul{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new hl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new dl(new se(this._lastX,this._lastY),new se(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Ko.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===Ko.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class pl extends ul{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function gl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function fl(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?Ko.ROW:Ko.COLUMN;return"monotoneY"===t?new pl(t,s):new ul(t,s)}class ml{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 vl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=fl("linear",i,t);return function(t,e){gl(t,e,1)}(new ml(n,s),t),n}function _l(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class yl{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&_l(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:_l(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 bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("basis",i,t);return function(t,e){gl(t,e,2)}(new yl(n,s),t),n}function xl(t){return t<0?-1:1}function Sl(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(xl(r)+xl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function kl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Al(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class Ml{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Al(this,this._t0,kl(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Al(this,kl(this,e=Sl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Al(this,this._t0,e=Sl(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class wl extends Ml{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Tl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("monotoneX",i,t);return function(t,e){gl(t,e,2)}(new Ml(n,s),t),n}function Cl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("monotoneY",i,t);return function(t,e){gl(t,e,2)}(new wl(n,s),t),n}let Bl=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class El extends Bl{lineEnd(){this.context.closePath()}}function Pl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ul("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ko.ROW:Ko.COLUMN);return Rl(new Bl(r,e,n),t),r}function Rl(t,e){return gl(t,e,1)}class Ol extends ml{lineEnd(){this.context.closePath()}}function Il(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=fl("linear",i,t);return function(t,e){gl(t,e,1)}(new Ol(n,s),t),n}function Ll(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Dt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Dt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function Dl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return vl(i,n);const o=fl(t,r,i);return gl(new e(o,s,a),i,2),o}}const Fl=Dl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const zl=Dl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class jl extends il{constructor(t,e,i){super(),this.type=qo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return ol(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,sl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Ko.ROW?Vt(this.p0.x-this.p2.x):t===Ko.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Ut(t-.01,0),i=Gt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Nt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=ol(i,s,n,e),a=ne.pointAtPP(i,s,e),o=ne.pointAtPP(s,n,e);return[new jl(i,a,r),new jl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Hl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new dl(new se(this._lastX,this._lastY),new se(t,e))}quadraticCurveTo(t,e,i,s){const n=new jl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new hl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Vl(t,e,i){var s,n;switch(e){case"linear":default:return vl(t,i);case"basis":return bl(t,i);case"monotoneX":return Tl(t,i);case"monotoneY":return Cl(t,i);case"step":return Pl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ul("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ko.ROW:Ko.COLUMN);return Rl(new El(r,e,n),t),r}(t,.5,i);case"stepBefore":return Pl(t,0,i);case"stepAfter":return Pl(t,1,i);case"catmullRom":return Fl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return zl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Il(t,i)}}class Nl extends Do{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Lo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([jo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([jo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([jo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([jo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([jo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([jo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([jo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([jo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([jo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Hl(this);el(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[jo.M]=t=>`M${t[1]} ${t[2]}`,t[jo.L]=t=>`L${t[1]} ${t[2]}`,t[jo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[jo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[jo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[jo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tGo){let t,e=No;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),el(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Ko.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===Ko.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{rt.getInstance().warn("空函数")}}),ah=Object.assign(Object.assign({},Jl),{points:[],cornerRadius:0,closePath:!0}),oh=Object.assign(Object.assign({},Jl),{width:100,height:100,spikes:5,thickness:.5}),lh=Object.assign(Object.assign({},Jl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Jl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const hh=Object.assign(Object.assign({},Jl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),ch=Object.assign(Object.assign(Object.assign({},Jl),Kl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),dh=Object.assign(Object.assign(Object.assign({},Jl),Kl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),uh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Jl),{fill:!0,cornerRadius:0,cornerType:"round"}),ph=Object.assign(Object.assign({},uh),{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}),gh=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=m("shape",/^(circle)/i,0);return t&&(t.style=f()||h()),t}()||function(){const t=m("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return m("extent-keyword",t.extentKeywords,1)}function c(){if(m("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=m("hex",t.hexColor,1)||m("rgba",t.rgbaColor,1)||m("rgb",t.rgbColor,1)||m("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return m("%",t.percentageValue,1)||m("position-keyword",t.positionKeywords,1)||f()}function f(){return m("px",t.pixelValue,1)||m("em",t.emValue,1)}function m(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class fh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(fh.IsGradientStr(t))try{const e=gh(t)[0];if(e){if("linear"===e.type)return fh.ParseLinear(e);if("radial"===e.type)return fh.ParseRadial(e);if("conic"===e.type)return fh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2,n=parseFloat(e.value)/180*Ft-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ht,stops:fh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:fh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2;let n="angular"===e.type?parseFloat(e.value)/180*Ft:0;for(;n<0;)n+=Ht;for(;n>=Ht;)n-=Ht;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const _h={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"}},yh=!0,bh=!1,xh=/\w|\(|\)|-/,Sh=/[.?!,;:/,。?!、;:]/,kh=/\S/,Ah=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Mh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=xo.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=wh(t,a)),a}function wh(t,e,i=!1){let s=e;for(;xh.test(t[s-1])&&xh.test(t[s])||Sh.test(t[s]);)if(s--,s<=0)return i?Th(t,e):e;return s}function Th(t,e){let i=e;for(;xh.test(t[i+1])&&xh.test(t[i])||Sh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Ch(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=xo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Bh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Eh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=ch.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wh(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){rt.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=wh(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};Eh=Bh([$a()],Eh);var Ph=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Rh=Symbol.for("TextMeasureContribution");let Oh=class extends Eh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Oh=Ph([$a()],Oh);const Ih=Symbol.for("CanvasFactory"),Lh=Symbol.for("Context2dFactory");function Dh(t){return yo.getNamed(Ih,xo.global.env)(t)}const Fh=1e-4,zh=Math.sqrt(3),jh=1/3;function Hh(t){return t>-Qh&&tQh||t<-Qh}const Nh=[0,0],Wh=[0,0],Uh=[0,0];function Gh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Yh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Xh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function $h(t){return(t%=Ht)<0&&(t+=Ht),t}function Kh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Ht);let d=Math.atan2(l,o);return d<0&&(d+=Ht),d>=s&&d<=n||d+Ht>=s&&d+Ht<=n}function Jh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(Hh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const ec=[-1,-1,-1],ic=[-1,-1];function sc(){const t=ic[0];ic[0]=ic[1],ic[1]=t}function nc(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Hh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,jh):Math.pow(i,jh),s=s<0?-Math.pow(-s,jh):Math.pow(s,jh);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+zh*Math.sin(e)))/(3*a),h=(-o+i*(s-zh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,ec);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&sc(),p=Xh(e,s,r,o,ic[0]),u>1&&(g=Xh(e,s,r,o,ic[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Hh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,ec);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=Yh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);ec[0]=-l,ec[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ht-1e-4){s=0,n=Ht;const e=r?1:-1;return a>=ec[0]+t&&a<=ec[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ht,n+=Ht);let c=0;for(let e=0;e<2;e++){const i=ec[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ht+t),(t>=s&&t<=n||t+Ht>=s&&t+Ht<=n)&&(t>Ft/2&&t<1.5*Ft&&(e=-e),c+=e)}}return c}function oc(t){return Math.round(t/Ft*1e8)/1e8%2*Ft}function lc(t,e){let i=oc(t[0]);i<0&&(i+=Ht);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ht?n=i+Ht:e&&i-n>=Ht?n=i-Ht:!e&&i>n?n=i+(Ht-oc(i-n)):e&&i1&&(i||(h+=Pe(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;hc[0]=S,hc[1]=k,lc(hc,Boolean(a[6])),S=hc[0],k=hc[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-m)*_/_+m;switch(f){case jo.M:u=m,p=v,c=u,d=p;break;case jo.L:if(i){if(Jh(c,d,m,v,e,s,n))return!0}else h+=Pe(c,d,m,v,s,n)||0;c=m,d=v;break;case jo.C:if(i){if(qh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=nc(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case jo.Q:if(i){if(Kh(c,d,m,v,_,y,e,s,n))return!0}else h+=rc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case jo.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Pe(c,d,o,l,s,n),i){if(Zh(m,v,_,A,A+M,w,e,T,n))return!0}else h+=ac(m,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+m,d=Math.sin(A+M)*_+v;break;case jo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Jh(u,p,o,p,e,s,n)||Jh(o,p,o,l,e,s,n)||Jh(o,l,u,l,e,s,n)||Jh(u,l,u,p,e,s,n))return!0}else h+=Pe(o,p,o,l,s,n),h+=Pe(u,l,u,p,s,n);break;case jo.Z:if(i){if(Jh(c,d,u,p,e,s,n))return!0}else h+=Pe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const gc=Symbol.for("VWindow"),fc=Symbol.for("WindowHandlerContribution");let mc=class extends Ao{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){super(),this.hooks={onChange:new mo(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(yo.getNamed(fc,t.env).configure(this,t),this.actived=!0)},this._uid=Ia.GenAutoIncrementId(),this.global=xo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&ut(this.width,t.width())&&ut(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};mc=uc([$a(),pc("design:paramtypes",[])],mc);var vc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_c=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yc=function(t,e){return function(i,s){e(i,s,t)}};let bc=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=xo.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=dc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Kl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Le(Object.assign({defaultFontParams:{fontFamily:Kl.fontFamily,fontSize:Kl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=yo.get(gc),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var xc;bc=vc([$a(),yc(0,Ya(co)),yc(0,Ka(Rh)),_c("design:paramtypes",[Object])],bc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(xc||(xc={}));const Sc=new Ne;let kc=class{constructor(){this.matrix=new Ne}init(t){return this.mode=xc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=xc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Sc.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Sc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}scale(t,e,i){return this.mode===xc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===xc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Sc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}translate(t,e){return this.mode===xc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===xc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};kc=vc([$a(),_c("design:paramtypes",[])],kc);const Ac={arc:Ql,area:th,circle:eh,line:nh,path:rh,symbol:hh,text:ch,rect:lh,polygon:ah,star:oh,richtext:dh,richtextIcon:ph,image:uh,group:ih,glyph:sh},Mc=Object.keys(Ac);function wc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Tc={arc:Object.assign({},Ac.arc),area:Object.assign({},Ac.area),circle:Object.assign({},Ac.circle),line:Object.assign({},Ac.line),path:Object.assign({},Ac.path),symbol:Object.assign({},Ac.symbol),text:Object.assign({},Ac.text),rect:Object.assign({},Ac.rect),polygon:Object.assign({},Ac.polygon),star:Object.assign({},Ac.star),richtext:Object.assign({},Ac.richtext),richtextIcon:Object.assign({},Ac.richtextIcon),image:Object.assign({},Ac.image),group:Object.assign({},Ac.group),glyph:Object.assign({},Ac.glyph)};class Cc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Mc.forEach((t=>{this._defaultTheme[t]=Object.create(Tc[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,rt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Mc.forEach((s=>{const n=Object.create(Tc[s]);t&&t[s]&&wc(n,t[s]),i[s]&&wc(n,i[s]),e[s]&&wc(n,e[s]),this.combinedTheme[s]=n})),e.common&&Mc.forEach((t=>{wc(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Bc=new Cc;function Ec(t,e){return t.glyphHost?Ec(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)):Bc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Ec(t.attachedThemeGraphic)||Bc.getTheme()}var Pc=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Rc extends o{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=Ia.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Pc(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&rt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(jc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=jc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=jc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=jc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=zc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(jc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(jc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,jc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):jc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof Dc))return void rt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=zc.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Hc(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Lc,this.rootWheelEvent=new Dc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&v(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class Uc{static GetImage(t,e){var i;const s=Uc.cache.get(t);s?"fail"===s.loadState?xo.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Uc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Uc.cache.get(t);s?"fail"===s.loadState?xo.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Uc.cache.set(t,s),s.dataPromise=xo.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Uc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Uc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=xo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=xo.global.loadBlob(t):"json"===e&&(i.dataPromise=xo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Uc.isLoading&&Uc.toLoadAueue.length){Uc.isLoading=!0;const t=Uc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Uc.cache.set(i,n),n.dataPromise=xo.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Uc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Uc.loading()})).catch((t=>{console.error(t),Uc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Uc.loading()}))}}),0)}static loadImage(t,e){const i=Gc(t,Uc.toLoadAueue);if(-1!==i)return Uc.toLoadAueue[i].marks.push(e),void Uc.loading();Uc.toLoadAueue.push({url:t,marks:[e]}),Uc.loading()}static improveImageLoading(t){const e=Gc(t,Uc.toLoadAueue);if(-1!==e){const t=Uc.toLoadAueue.splice(e,1);Uc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Gc(t,e){for(let i=0;it?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?($c[0]=t[0],$c[2]=t[0],$c[1]=t[1],$c[3]=t[1],$c):t:t:0,qc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Zc=[1,2,3,0,1,2,3,0];function Jc(t,e,i,s){for(;t>=Ht;)t-=Ht;for(;t<0;)t+=Ht;for(;t>e;)e+=Ht;qc[0].x=i,qc[1].y=i,qc[2].x=-i,qc[3].y=-i;const n=Math.ceil(t/zt)%4,r=Math.ceil(e/zt)%4;if(s.add(Wt(t)*i,Yt(t)*i),s.add(Wt(e)*i,Yt(e)*i),n!==r||e-t>Ft){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}id.TimeOut=1e3/60;const sd=new id,nd=(t,e)=>{const i=((t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class rd{bounds(t,e){if(x(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}}function ad(t,e,i,s,n){return n?t.arc(i,s,e,0,jt,!1,n):t.arc(i,s,e,0,jt),!1}var od=new class extends rd{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return ad(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ad(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var ld=new class extends rd{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function hd(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var cd=new class extends rd{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return hd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return hd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return hd(t,this.parseSize(e)/2+n,i,s,r)}};function dd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var ud=new class extends rd{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return dd(t,this.parseSize(e)/2+n,i,s)}};function pd(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class gd extends rd{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return pd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return pd(t,this.parseSize(e)/2,i,s,n)}}var fd=new gd;var md=new class extends gd{constructor(){super(...arguments),this.type="triangle"}};const vd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),_d=Math.sin(jt/10)*vd,yd=-Math.cos(jt/10)*vd;function bd(t,e,i,s){const n=_d*e,r=yd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=jt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var xd=new class extends rd{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return bd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return bd(t,this.parseSize(e)/2+n,i,s)}};const Sd=Xt(3);function kd(t,e,i,s){const n=e,r=n/Sd,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Ad=new class extends rd{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return kd(t,this.parseSize(e)/2+n,i,s)}};function Md(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var wd=new class extends rd{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};function Td(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Cd=new class extends rd{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Td(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Td(t,this.parseSize(e)/2+n,i,s)}};const Bd=-.5,Ed=Xt(3)/2,Pd=1/Xt(12);function Rd(t,e,i,s){const n=e/2,r=e*Pd,a=n,o=e*Pd+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Bd*n-Ed*r+i,Ed*n+Bd*r+s),t.lineTo(Bd*a-Ed*o+i,Ed*a+Bd*o+s),t.lineTo(Bd*l-Ed*h+i,Ed*l+Bd*h+s),t.lineTo(Bd*n+Ed*r+i,Bd*r-Ed*n+s),t.lineTo(Bd*a+Ed*o+i,Bd*o-Ed*a+s),t.lineTo(Bd*l+Ed*h+i,Bd*h-Ed*l+s),t.closePath(),!1}var Od=new class extends rd{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/2+n,i,s)}};function Id(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var Ld=new class extends rd{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return Id(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s,n)}};function Dd(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var Fd=new class extends rd{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return Dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};function zd(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var jd=new class extends rd{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2,i,s,n)}};const Hd=Xt(3);function Vd(t,e,i,s){const n=e*Hd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Nd=new class extends rd{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Vd(t,this.parseSize(e)/2/Hd,i,s)}drawOffset(t,e,i,s,n){return Vd(t,this.parseSize(e)/2/Hd+n,i,s)}};function Wd(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var Ud=new class extends rd{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return Wd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Wd(t,this.parseSize(e)/4+n,i,s)}};function Gd(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var Yd=new class extends rd{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function Xd(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var $d=new class extends rd{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return Xd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Xd(t,this.parseSize(e)/4+n,i,s)}};function Kd(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var qd=new class extends rd{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return Kd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Kd(t,this.parseSize(e)/4+n,i,s)}};function Zd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Jd=new class extends rd{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Zd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function Qd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var tu=new class extends rd{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function eu(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var iu=new class extends rd{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return eu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return eu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function su(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function nu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ru=new class extends rd{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return x(e)?nu(t,e,i,s):su(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?nu(t,e+2*n,i,s):su(t,[e[0]+2*n,e[1]+2*n],i,s)}};const au=new He;class ou{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),el(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(el(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{au.x1=i.bounds.x1*t,au.y1=i.bounds.y1*t,au.x2=i.bounds.x2*t,au.y2=i.bounds.y2*t,e.union(au)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const lu={};[od,ld,cd,ud,Nd,md,xd,Ad,wd,Cd,Od,Ld,Fd,fd,jd,Ud,Yd,$d,qd,ru,Jd,tu,iu].forEach((t=>{lu[t.type]=t}));const hu={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class cu{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function du(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function uu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=uu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=du(t,"--\x3e",r+4,"Comment is not closed.");else{const a=uu(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new cu(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new cu(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function fu(t,e){return mu(t)}function mu(t,e){const i={};for(let e=0;eMu.set(t,!0)));const wu=new Map;function Tu(t){if(Mu.has(t))return!0;if(wu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>wu.set(t,!0)));const Cu=ku(),Bu=ku(),Eu=ku(),Pu=ku(),Ru=ku(),Ou=ku(),Iu=ku(),Lu=ku(),Du=ku(),Fu=ku();ku();const zu=ku();ku();const ju=ku();ku();const Hu=ku(),Vu=ku(),Nu=Symbol.for("GraphicService"),Wu=Symbol.for("GraphicCreator"),Uu={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Gu=Object.keys(Uu),Yu={duration:200,easing:"cubicOut"};function Xu(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function $u(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Ku(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 qu(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*f,t[1]=y*n+b*l+x*u+S*m,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*f,t[5]=y*n+b*l+x*u+S*m,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*f,t[9]=y*n+b*l+x*u+S*m,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Zu(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class Ju{constructor(){this.pools=[]}static identity(t){return Xu(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return Ju.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ip=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const sp=new Ne(1,0,0,1,0,0),np={x:0,y:0};let rp=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this.path=new Nl,this._clearMatrix=new Ne(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Qu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},np),function(t,e,i){return cc(t,0,!1,e,i)}(this.path.commandList,np.x,np.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},np);const i=mh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return cc(t,e,!0,i,s)}(this.path.commandList,i,np.x,np.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(sp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Qu.free(t))),this.stack.length=0}};rp=ep([$a(),ip("design:paramtypes",[Object,Number])],rp);const ap={WIDTH:500,HEIGHT:500,DPR:1};class op{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=ap.WIDTH,height:n=ap.HEIGHT,dpr:r=ap.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var lp;op.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(lp||(lp={}));class hp{static Get(t,e=lp.Color1,i=[0,0,0,1]){if(e===lp.Color1){const e=hp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ti.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];hp.store1[t]=e,hp.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=hp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ti.parseColorString(t);return n&&(hp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],hp.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===lp.Color1){if(hp.store1[t])return;hp.store1[t]=i,hp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(hp.store255[t])return;hp.store255[t]=i,hp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function cp(t,e=!1){return Array.isArray(t)&&x(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function dp(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return up(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):up(t,e,i,s,n)}function up(t,e,i,s,n){if(!t||!e)return t&&cp(t)||e&&cp(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=hp.Get(t,lp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=hp.Get(e,lp.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:cp(a)})))});return o?dp(r,l,i,s,n):dp(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:mp(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:mp(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:mp(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),cp(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}function pp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}hp.store255={},hp.store1={};const gp=[0,0,0,0],fp=[0,0,0,0];function mp(t,e,i){return hp.Get(t,lp.Color255,gp),hp.Get(e,lp.Color255,fp),`rgba(${Math.round(gp[0]+(fp[0]-gp[0])*i)},${Math.round(gp[1]+(fp[1]-gp[1])*i)},${Math.round(gp[2]+(fp[2]-gp[2])*i)},${gp[3]+(fp[3]-gp[3])*i})`}class vp{static GetCanvas(){try{return vp.canvas||(vp.canvas=xo.global.createCanvas({})),vp.canvas}catch(t){return null}}static GetCtx(){if(!vp.ctx){const t=vp.GetCanvas();vp.ctx=t.getContext("2d")}return vp.ctx}}class _p extends We{static getInstance(){return _p._instance||(_p._instance=new _p),_p._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=vp.GetCanvas(),s=vp.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new _p(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class yp{static GetSize(t){for(let e=0;e=t)return yp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=yp.GenKey(t,e,i,s,n),l=yp.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=yp.GenKey(t,e,i,s,n);yp.cache[l]?yp.cache[l].push({width:a,height:o,pattern:r}):yp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}yp.cache={},yp.ImageSize=[20,40,80,160,320,640,1280,2560];const bp=new He,xp=new Ne;new He;const Sp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],kp=["x","y"],Ap=["scaleX","scaleY"],Mp=["angle"],wp=new se,Tp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Cp extends Rc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=lu[t];if(e)return e;if(e=Cp.userSymbolMap[t],e)return e;if(!0===((i=t=hu[t]||t).startsWith("{const e=(new Nl).fromString(t.d),i={};Gu.forEach((e=>{t[e]&&(i[Uu[e]]=t[e])})),n.push({path:e,attribute:i}),bp.union(e.bounds)}));const r=bp.width(),a=bp.height(),o=1/Ut(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new ou(t,n,!0);return Cp.userSymbolMap[t]=l,l}var i;const s=(new Nl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Ut(n,r);s.transform(0,0,a,a);const o=new ou(t,s);return Cp.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Kc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Lo(t);return el(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ne),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Yo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Yo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Yo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Yo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Yo.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&Yo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Yo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Xo.GLOBAL){const i=new se(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i))}_setAttributes(t,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Yu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:$o.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:$o.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:$o.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if(this.currentStates){const i=_(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stateSort&&(t=t.sort(this.stateSort));const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=Yo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Yo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Yo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Yo.UPDATE_SHAPE_AND_BOUNDS)===Yo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Yo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Yo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Yo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Yo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Yo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Yo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Yo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Yo.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Gl.x,y:e=Gl.y,scaleX:i=Gl.scaleX,scaleY:s=Gl.scaleY,angle:n=Gl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Wt(a),f=Yt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,k=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+d*v-x*_-k*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),xo.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Gl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=xp.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:$o.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:xo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return v(t,!0)?this.pathProxy=(new Nl).fromString(t):this.pathProxy=new Nl,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),xo.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Fc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||xo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new rp(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Bp;Cp.userSymbolMap={},Cp.mixin(Vc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Bp||(Bp={}));let Ep=class t extends Cp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ou,this._childUpdateTag=Yo.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 Cc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Cc)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Xo.GLOBAL){const i=new se(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&Yo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Gl.x,y:e=Gl.y,dx:i=Gl.dx,dy:s=Gl.dy,scaleX:n=Gl.scaleX,scaleY:r=Gl.scaleY,angle:a=Gl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Ec(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return xo.graphicService.updateTempAABBBounds(i),xo.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Yo.CLEAR_BOUNDS,this._childUpdateTag&=Yo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Yo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Yo.UPDATE_BOUNDS||(this._childUpdateTag|=Yo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&Yo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=xo.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Pp(t){return new Ep(t)}Ep.NOWORK_ANIMATE_ATTR=Tp;class Rp extends Ep{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Cc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{xo.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{xo.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Op=Symbol.for("TransformUtil"),Ip=Symbol.for("GraphicUtil"),Lp=Symbol.for("LayerService"),Dp=Symbol.for("StaticLayerHandlerContribution"),Fp=Symbol.for("DynamicLayerHandlerContribution"),zp=Symbol.for("VirtualLayerHandlerContribution");var jp,Hp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Np=jp=class{static GenerateLayerId(){return`${jp.idprefix}_${jp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=xo.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?yo.get(Dp):"dynamic"===t?yo.get(Fp):yo.get(zp),e}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Rp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:jp.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};Np.idprefix="visactor_layer",Np.prefix_count=0,Np=jp=Hp([$a(),Vp("design:paramtypes",[])],Np);var Wp=new La((t=>{t(_o).to(Bo).inSingletonScope(),t(gc).to(mc),t(Ip).to(bc).inSingletonScope(),t(Op).to(kc).inSingletonScope(),t(Lp).to(Np).inSingletonScope()}));function Up(t,e){return!(!t&&!e)}function Gp(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Yp(t,e,i){return i&&t*e>0}function Xp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function $p(t,e){return t*e>0}function Kp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function qp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,k=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let A=(S*y-_*k)/b,M=(-S*_-y*k)/b;const w=(S*y+_*k)/b,T=(-S*_+y*k)/b,C=A-m,B=M-v,E=w-m,P=T-v;return C*C+B*B>E*E+P*P&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function Zp(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const k=n*Wt(c),A=n*Yt(c),M=s*Wt(u),w=s*Yt(u);let T,C,B,E;if((b>Dt||y>Dt)&&(T=n*Wt(d),C=n*Yt(d),B=s*Wt(p),E=s*Yt(p),r1?0:P<-1?Ft:Math.acos(P))/2),l=Xt(t[0]*t[0]+t[1]*t[1]);S=Gt(b,(s-l)/(o-1)),x=Gt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:k,yors:A,xirs:B,yirs:E,xore:T,yore:C,xire:M,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Jp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ht-Dt)e.moveTo(i+n*Wt(o),s+n*Yt(o)),e.arc(i,s,n,o,l,!c),r>Dt&&(e.moveTo(i+r*Wt(l),s+r*Yt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Zp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Dt){const t=Gt(v,m),r=Gt(_,m),o=qp(g,f,u,p,n,t,Number(c)),l=qp(b,x,S,k,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,n,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Wt(Nt(l.y01,l.x01)),s+l.cy+r*Yt(Nt(l.y01,l.x01))):e.moveTo(i+b,s+n*Yt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Wt(M),s+n*Yt(M));if(!(r>Dt)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Dt){const t=Gt(E,w),n=Gt(P,w),o=qp(S,k,b,x,r,-n,Number(c)),l=qp(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,r,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Wt(Nt(l.y01,l.x01)),s+l.cy+t*Yt(Nt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),!a||a[2]?e.arc(i,s,r,C,B,c):e.moveTo(i+r*Wt(B),s+r*Yt(B))}return a?a[3]&&e.lineTo(i+n*Wt(o),s+n*Yt(o)):e.closePath(),d}const Qp=Symbol.for("ArcRenderContribution"),tg=Symbol.for("AreaRenderContribution"),eg=Symbol.for("CircleRenderContribution"),ig=Symbol.for("GroupRenderContribution"),sg=Symbol.for("ImageRenderContribution"),ng=Symbol.for("PathRenderContribution"),rg=Symbol.for("PolygonRenderContribution"),ag=Symbol.for("RectRenderContribution"),og=Symbol.for("SymbolRenderContribution"),lg=Symbol.for("TextRenderContribution"),hg=Symbol.for("InteractiveSubRenderContribution");function cg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function dg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var ug=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gg=function(t,e){return function(i,s){e(i,s,t)}};function fg(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Xu(t),$u(t,t,[n+o,r+l,a+h]),$u(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),$u(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=tp.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}$u(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,f),$u(i,i,[-s[0],-s[1],0]),qu(t,t,i)}}let mg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new mo(["graphic"]),onSetStage:new mo(["graphic","stage"]),onRemove:new mo(["graphic"]),onRelease:new mo(["graphic"]),onAddIncremental:new mo(["graphic","group","stage"]),onClearIncremental:new mo(["graphic","group","stage"]),beforeUpdateAABBBounds:new mo(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new mo(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new mo(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new He,this.tempAABBBounds2=new He}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Lo(t);return el(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=dg(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=cg(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){xu(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;xu(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&ze(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};mg=ug([$a(),gg(0,Ya(Wu)),pg("design:paramtypes",[Object])],mg);const vg=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},_g=["radius","startAngle","endAngle",...Sp];class yg extends Cp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Pu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Ec(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ht-Dt?i.set(-r,-r,r,r):Jc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,_g)}needUpdateTag(t){return super.needUpdateTag(t,_g)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Nl,s.arc(0,0,r,a,o),s}clone(){return new yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yg.NOWORK_ANIMATE_ATTR}}function bg(t){return new yg(t)}yg.NOWORK_ANIMATE_ATTR=Tp;class xg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Eo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Vu,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Ec(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new kg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Ae(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=xo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){xu(n,o/Math.abs(r+a),!0,l),i.union(n)}return xo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||xo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ze(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=xo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),k=new xg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:A}=k;return this.cache.layoutData=k,this.clearUpdateShapeTag(),this._AABBBounds.set(A.xOffset,A.yOffset,A.xOffset+A.width,A.yOffset+A.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,k=m?0:this.guessLineHeightBuf(h),A=this.getLineHeight(this.attribute,r,k);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const M=xo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),w={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:A},T=new xg(a,w,M),C=_(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/A),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Ut(e,a)}));const t=cg(_,a),e=this.cache.verticalList.length*v,i=dg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Au.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Ut(e,a)}));const x=cg(_,a),S=this.cache.verticalList.length*v,k=dg(y,S,d);return this._AABBBounds.set(k,x,k+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=nd(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Sg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Sg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return kg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return kg.baselineMapAlign}getAlignMapBaseline(){return kg.alignMapBaseline}}function Ag(t){return new kg(t)}kg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Tp),kg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},kg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Mg=["symbolType","size",...Sp];let wg=class t extends Cp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Hu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Ec(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;xu(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Nl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Nl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Tg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Tp);const Cg=["segments","points","curveType","curveTension",...Sp];let Bg=class t extends Cp{constructor(t={}){super(t),this.type="line",this.numberType=Lu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=td(i,s,e))}getGraphicTheme(){return Ec(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),xo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Cg)}needUpdateTag(t){return super.needUpdateTag(t,Cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Nl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Eg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const Pg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},Rg=["width","x1","y1","height","cornerRadius",...Sp];class Og extends Cp{constructor(t){super(t),this.type="rect",this.numberType=zu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Ec(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Rg)}needUpdateTag(t){return super.needUpdateTag(t,Rg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Pg(e);return t=new Nl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Og(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Og.NOWORK_ANIMATE_ATTR}}function Ig(t){return new Og(t)}Og.NOWORK_ANIMATE_ATTR=Tp;class Lg extends Cp{constructor(t){super(t),this.type="glyph",this.numberType=Ru,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Ec(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Lg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Lg.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Lg(t)}Lg.NOWORK_ANIMATE_ATTR=Tp;class Fg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=_h[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function zg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class jg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=nd(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Ch(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Ch(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=zg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Mh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Hg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...Sp];class Vg extends Cp{constructor(t){super(t),this.type="image",this.numberType=Iu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Ec(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return uh[t]}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}clone(){return new Vg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Ng(t){return new Vg(t)}Vg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Tp);class Wg extends Vg{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Kc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Kc(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=uh.width,height:e=uh.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Ug{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Wg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=_h[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof jg){const e=kh.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Wg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Ch(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||bh;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Ah(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||yh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?vh(t,s,{AABBBounds:i}):s,Ah(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Wg)break;const{width:n}=Ch(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Wg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Gg{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=_h[this.direction]}store(t){if(t instanceof Wg){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 Ug(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Wg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Mh(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new jg(i,t.newLine,t.character,t.ascentDescentMode),new jg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Yg=!1;try{Yg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Yg=!1}const Xg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Sp];class $g extends Cp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ju,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:dh.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:dh.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:dh.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:dh.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:dh.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:dh.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:dh.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:dh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Ec(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&$g.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&$g.splitText(t.text).length>1)))}static splitText(t){if(Yg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=$g.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),xo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||xo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Xg)}needUpdateTag(t){return super.needUpdateTag(t,Xg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!$g.AllSingleCharacter(_)&&(_=$g.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,k="number"==typeof s&&Number.isFinite(s)&&s>0,A="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!k||r<=s),w=new Fg(0,0,(A?n:S?i:0)||0,(M?r:k?s:0)||0,a,o,l,h,c,d||"horizontal",!A&&S,!M&&k,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),T=new Gg(w);if(T.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new $g(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return $g.NOWORK_ANIMATE_ATTR}}function Kg(t){return new $g(t)}$g.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Tp);const qg=["path","customPath",...Sp];class Zg extends Cp{constructor(t){super(t),this.type="path",this.numberType=Du}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Nl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Nl?this.cache:t.path)}getGraphicTheme(){return Ec(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new Nl).fromString(t.path):t.customPath&&(this.cache=new Nl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}toCustomPath(){return(new Nl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Tp);const Qg=["segments","points","curveType","curveTension",...Sp];class tf extends Cp{constructor(t){super(t),this.type="area",this.numberType=Eu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Ec(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),xo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=td(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Nl;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new tf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tf.NOWORK_ANIMATE_ATTR}}function ef(t){return new tf(t)}tf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const sf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Sp];class nf extends Cp{constructor(t){super(t),this.type="arc",this.numberType=Cu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(x(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=oe(e),i=e+r,s&&Vt(r)Dt&&o>Dt)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=Xt(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Dt&&l>Dt){const i=e>t?1:-1;let s=Kt(Number(l)/o*Yt(g)),n=Kt(Number(l)/a*Yt(g));return(f-=2*s)>Dt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Dt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Ec(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);vg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Dt?i.set(0,0,0,0):Math.abs(o-l)>Ht-Dt?i.set(-s,-s,s,s):(Jc(l,o,s,i),Jc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,sf)}needUpdateTag(t){return super.needUpdateTag(t,sf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ht-Dt)n.moveTo(0+h*Wt(a),0+h*Yt(a)),n.arc(0,0,h,a,o,!d),l>Dt&&(n.moveTo(0+l*Wt(o),0+l*Yt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Wt(a),e=h*Yt(a),i=l*Wt(o),s=l*Yt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new nf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nf.NOWORK_ANIMATE_ATTR}}function rf(t){return new nf(t)}nf.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Tp);const af=["points","cornerRadius",...Sp];class of extends Cp{constructor(t){super(t),this.type="polygon",this.numberType=Fu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Ec(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),xo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=td(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,af)}needUpdateTag(t){return super.needUpdateTag(t,af)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Nl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new of(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return of.NOWORK_ANIMATE_ATTR}}function lf(t){return new of(t)}of.NOWORK_ANIMATE_ATTR=Tp;class hf extends Ep{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function cf(t){return new hf(t)}const df=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let uf,pf;function gf(t){return uf||(uf=df.CreateGraphic("text",{})),uf.initAttributes(t),uf.AABBBounds}var ff=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vf=function(t,e){return function(i,s){e(i,s,t)}};class _f{constructor(){this.time=Zo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:k=l.backgroundClip,backgroundPosition:A=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(xf(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Ec(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}k&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:A}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){Tf(t,e,i,s)}}const yf=new _f,bf=new Set(["top","center","bottom"]);function xf(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Sf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const kf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Af(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Mf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:bf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Af(s,e,"left","center","right"),y:Af(n,i,"top","center","bottom")}}function wf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Tf(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=function(t){if(!t)return null;const e=wf(t.naturalWidth,t.videoWidth,t.width),i=wf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}(e),{backgroundRepeatMode:m,backgroundSizing:v}=function({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=kf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Sf({backgroundFit:e,backgroundKeepAspectRatio:i})}}({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let _=p,y=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Mf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(_=i*(g/s),y=g):"repeat-y"===m&&(y=s*(p/i),_=p);const n=t.dpr,r=dc.allocate({width:_,height:y,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,_,y),a.drawImage(e,0,0,_,y),e=r.nativeCanvas),dc.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}let Cf=class{constructor(t){this.subRenderContribitions=t,this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Cf=ff([$a(),vf(0,Ya(co)),vf(0,Ka(hg)),mf("design:paramtypes",[Object])],Cf);const Bf=new class{constructor(){this.time=Zo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Ef=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class Pf{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=dc.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),dc.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Ht),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=dc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),k=u.gutterColumn?u.gutterColumn:2*y,A=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Tg({}));const M=u.columns?v/u.columns:b,w=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-k,w-A],symbolType:t});const T=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:mh(e,o,e.dpr),c=o/T,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:T+u*h,innerRadius:w-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),Jp(t,e,i,s,T+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/k,(S-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},If=Rf,Lf=yf;const Df=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:mh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Ff=Rf,zf=yf;const jf=new class extends _f{constructor(){super(...arguments),this.time=Zo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:_=l.backgroundScale,backgroundOffsetX:y=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(xf(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:_,backgroundOffsetX:y,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Hf=Ft/2;function Vf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],k=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!K(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Hf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Hf,!1)}if(o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),!K(S,k)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Hf,Ft,!1)}if(o&&o[3]?o[3](k[0],k[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ft,Ft+Hf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Nf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Wf{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,x1:A,y1:M,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:A-i)||0,C=(null!=C?C:M-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:mh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,T-o*g,C-o*g)):(e.beginPath(),Vf(e,u,p,T-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}let Uf=class{constructor(){this.time=Zo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Uf=Nf([$a()],Uf);let Gf=class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Vf(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Gf=Nf([$a()],Gf);const Yf=new Wf,Xf=Rf,$f=yf;const Kf=new class extends Wf{constructor(){super(...arguments),this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},qf=yf;const Zf=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,A=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:mh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&A(p,"outerBorder"),m&&A(g,"innerBorder")}},Jf=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Qf=Rf,tm=yf;const em={x:0,y:0,z:0,lastModelMatrix:null};class im{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Bf),this.builtinContributions.push(Ef),this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Zo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Zo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Ec(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,_=Yp(d,u,h),y=$p(d,g),b=Up(h),x=Gp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return el(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Yp(o,l,n),p=$p(o,c),g=Up(n,r),f=Gp(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;em.x=n,em.y=r,em.z=a,em.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=tp.allocate(),n=tp.allocate();fg(n,t,e),qu(s,d||s,n),em.x=0,em.y=0,em.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),tp.free(n)}if(g&&!d){const s=t.getOffsetXY(e);em.x+=s.x,em.y+=s.y,em.z=a,i.setTransformForCurrent()}else if(p)em.x=0,em.y=0,em.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);em.x+=s.x,em.y+=s.y,this.transformWithoutTranslate(i,em.x,em.y,em.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),em.x=0,em.y=0,em.z=0;return em}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,f,m,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&tp.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var sm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rm=function(t,e){return function(i,s){e(i,s,t)}};let am=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Cu,this.builtinContributions=[Of,Lf,If],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nDt){const t=Gt(b,y),r=Gt(x,y),a=qp(v,_,f,m,n,t,Number(u)),o=qp(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Nt(o.y11,o.x11),Nt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Dt)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Dt){const t=Gt(E,T),n=Gt(P,T),a=qp(M,w,k,A,r,-n,Number(u)),o=qp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),T0&&e.arc(i+a.cx,s+a.cy,n,Nt(a.y01,a.x01),Nt(a.y11,a.x11),!u);const t=Nt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Wt(B),s+r*Yt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Ec(t,null==r?void 0:r.theme).arc;const{fill:c=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:k=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;A+=b,M-=x;let w=0;const T=(h(S)&&S||S[0])&&"conical"===c.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i){var e;let i=!0;if(h(t,!0)){for(let s=0;s<4;s++)Xc[s]=t,i&&(i=!(null!==(e=Xc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Xc[e]=!!t[e],i&&(i=!!Xc[e]);else Xc[0]=!1,Xc[1]=!1,Xc[2]=!1,Xc[3]=!1;return{isFullStroke:i,stroke:Xc}})(d);if((_||B)&&(e.beginPath(),Jp(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,B,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,B,v,o))),!B&&y&&(e.beginPath(),Jp(t,e,i,s,A,M,E),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(h(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Vt(h-r)>=Ht-Dt){e.beginPath();const r=Math.abs(A-M)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,A,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Ht;for(;i>Ht;)i-=Ht;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),dp(o.color,l.color,h,!1)}(0,0,h,n);a||Yp&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),T&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};am=sm([$a(),rm(0,Ya(co)),rm(0,Ka(Qp)),nm("design:paramtypes",[Object])],am);var om=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hm=function(t,e){return function(i,s){e(i,s,t)}};let cm=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pu,this.builtinContributions=[Df,zf,Ff],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function dm(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=ll(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function um(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function pm(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=um(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),dm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Ko.ROW:"y"===s?u=Ko.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let fm=class extends im{constructor(){super(...arguments),this.numberType=Lu}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();pm(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Vl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Gt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function mm(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),dm(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),dm(t,l,1,s),o=!1):o=!0}t.closePath()}fm=gm([$a()],fm);const vm=new class extends Pf{constructor(){super(...arguments),this.time=Zo.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:ed(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:ed(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:ed(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:ed(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},_m=yf;var ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xm=function(t,e){return function(i,s){e(i,s,t)}};let Sm=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eu,this.builtinContributions=[vm,_m],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Ec(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:k}=S,A=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:w,points:T,segments:C}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===M&&!C&&!T.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,A,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Vl(E(t.points,x),B,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Vl(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(T,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Vl(e,B,{curveTension:b}),n=Vl(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,k,v,A,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,k,v,A,y,r[u],[g,t.attribute],Gt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,A,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=Ko.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),k=Vt(y.y-b.y);x=null==y.x1?Ko.ROW:null==y.y1?Ko.COLUMN:Number.isFinite(S+k)?S>k?Ko.ROW:Ko.COLUMN:Ko.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Ko.ROW:Ko.COLUMN,Number.isFinite(c)||(o=Ko.COLUMN),Number.isFinite(d)||(o=Ko.ROW);const u=i*(o===Ko.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),pm(t,i[0]?e.top:e.bottom,l,x===Ko.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,A-h,M-c,o),t.stroke()}})(),!1}};Sm=ym([$a(),xm(0,Ya(co)),xm(0,Ka(tg)),bm("design:paramtypes",[Object])],Sm);const km=Rf,Am=yf;var Mm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tm=function(t,e){return function(i,s){e(i,s,t)}};let Cm=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[Am,km],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Ec(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)el(t.pathShape.commandList,e,i,s,1,1,f);else{el((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Cm=Mm([$a(),Tm(0,Ya(co)),Tm(0,Ka(ng)),wm("design:paramtypes",[Object])],Cm);var Bm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Em=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pm=function(t,e){return function(i,s){e(i,s,t)}};let Rm=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=zu,this.builtinContributions=[Yf,$f,Xf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Ec(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:k=l.y,fillStrokeOrder:A=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:b-S)||0,T=(null!=T?T:x-k)||0;const C=Xp(g,f,w,T,h),B=Kp(g,v,w,T,M),E=Up(h,c),P=Gp(d,m);if(!t.valid||!y)return;if(!E&&!P)return;if(!(C||B||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,T)):(e.beginPath(),Vf(e,i,s,w,T,u,"bevel"!==p));const R={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,P,C,B,l,n,a,o,R),A?(this._runStroke(t,e,i,s,l,R,B,S,k,o),this._runFill(t,e,i,s,l,R,C,S,k,a)):(this._runFill(t,e,i,s,l,R,C,S,k,a),this._runStroke(t,e,i,s,l,R,B,S,k,o)),this.afterRenderStep(t,e,i,s,E,P,C,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Rm=Bm([$a(),Pm(0,Ya(co)),Pm(0,Ka(ag)),Em("design:paramtypes",[Object])],Rm);var Om=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Im=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lm=function(t,e){return function(i,s){e(i,s,t)}};let Dm=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Hu,this.builtinContributions=[Zf,tm,Qf,Jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Ec(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,k=t.getParsedPath();if(!k)return;const{keepDirIn3d:A=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,T=s,C=M;const B=e.camera;if(A&&B&&e.project){const t=e.project(i,s,M);e.camera=null,_(c)&&(c[0],c[1]),w=t.x,T=t.y,C=void 0}!1===k.draw(e,c,w,T,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,k,a)):(this._runFill(t,e,i,s,l,x,y,d,u,k,a),this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Dm=Om([$a(),Lm(0,Ya(co)),Lm(0,Ka(og)),Im("design:paramtypes",[Object])],Dm);const Fm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new He)}allocate(t,e,i,s){if(!this.pools.length)return(new He).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new He(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const zm=new class extends _f{constructor(){super(...arguments),this.time=Zo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,_,y,b,x,S;const{backgroundOpacity:k=l.backgroundOpacity,opacity:A=l.opacity,backgroundMode:M=l.backgroundMode,backgroundFit:w=l.backgroundFit,backgroundKeepAspectRatio:T=l.backgroundKeepAspectRatio,backgroundScale:C=l.backgroundScale,backgroundOffsetX:B=l.backgroundOffsetX,backgroundOffsetY:E=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:R=l.backgroundClip,backgroundCornerRadius:O=l.backgroundCornerRadius}=t.attribute;let I,{background:L}=t.attribute;if(!L)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=p(L)&&L.background?L:null,j=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(g=z.dx)&&void 0!==g?g:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(_=z.height)&&void 0!==_?_:e.height();if(F=Fm.allocate(i,s,i+n,s+r),L=z.background,!j){const t=F.width(),e=F.height();F.set((null!==(y=z.x)&&void 0!==y?y:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,j||(F=gf(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const i=t.resources.get(L);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),j&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=k*A,R&&(e.beginPath(),O?Vf(e,F.x1,F.y1,F.width(),F.height(),O,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:M,backgroundFit:w,backgroundKeepAspectRatio:T,backgroundScale:C,backgroundOffsetX:B,backgroundOffsetY:E,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=k*A,e.fillStyle=L,O?(Vf(e,F.x1,F.y1,F.width(),F.height(),O,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Fm.free(F),D()}};var jm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vm=function(t,e){return function(i,s){e(i,s,t)}};let Nm=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Vu,this.builtinContributions=[zm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Ec(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=nd(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:k,sVisible:A,doFill:M,doStroke:w}=S,T=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,w,k,A,d,n,a,o),T&&this.transformUseContext2d(t,d,C,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Qu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Qu.free(t)}w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Ut(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}T&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,w,k,A,d,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!d(c),y=_?c.width:i.clipedWidth,b=_?0:cg(u,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Wm(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Km=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qm=function(t,e){return function(i,s){e(i,s,t)}};let Zm=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[Xm,Ym],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:b}=f;e.beginPath(),c<=0||_(c)&&c.every((t=>0===t))?Wm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Wm(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=Um(d,u),b=Um(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Gm(h,_,y,d,u),k=Gm(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=Um(A,M),T=Gm(h,Um(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const B=Math.atan2(k.y-T.y,k.x-T.x);let E=B-C;E<0&&(C=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&t.arcTo(h.x+i,h.y+s,k.x+i,k.y+s,v),t.lineTo(k.x+i,k.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Zm=$m([$a(),qm(0,Ya(co)),qm(0,Ka(rg)),Km("design:paramtypes",[Object])],Zm);var Jm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tv=function(t,e){return function(i,s){e(i,s,t)}};let ev=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Ou}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(jf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Ec(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:k=l.fillStrokeOrder,cornerType:A=l.cornerType,x:M=l.x,y:w=l.y}=t.attribute,T=Xp(p,m,g,f,c),C=Kp(p,v,g,f),B=Up(c,u),E=Gp(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(T||C||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Vf(e,i,s,g,f,y,"bevel"!==A));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(jf));const P={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Zo.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,T,C,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):T&&(e.setCommonStyle(t,t.attribute,M-i,w-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,w-s,l),e.stroke()))};k?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===Zo.afterFillStroke&&r.drawShape(t,e,i,s,B,E,T,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=xo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Ec(t,null==s?void 0:s.theme).group,i=tp.allocate(),n=tp.allocate();fg(n,t,e),qu(i,p||i,n),a.modelMatrix=i,tp.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&tp.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};ev=Jm([$a(),tv(0,Ya(co)),tv(0,Ka(ig)),Qm("design:paramtypes",[Object])],ev);var iv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nv=function(t,e){return function(i,s){e(i,s,t)}};const rv=["","repeat-x","repeat-y","repeat"];function av({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=function(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?rv[i]:"no-repeat"}(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const ov={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function lv(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=av({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?function(t){return{backgroundMode:ov[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Tf(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}let hv=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Iu,this.builtinContributions=[Kf,qf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,k=this.valid(t,l,a);if(!k)return;const{fVisible:A,sVisible:M,doFill:w,doStroke:T}=k;if(!S||!t.resources)return;const C=t.resources.get(S);if("success"!==C.state)return;const B=t.width,E=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,B,E):(Vf(e,i,s,B,E,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{w&&(a?a(e,t.attribute,l):A&&(e.setCommonStyle(t,t.attribute,i,s,l),lv(e,C.data,i,s,B,E,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},O=()=>{T&&(o?o(e,t.attribute,l):M&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=function({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0,imagePosition:a="top-left"}){const{repeatMode:o,sizingMode:l}=av({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===o&&("cover"===l||"auto"===l||1!==s||0!==n||0!==r)}({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),L=P||I;g?(O(),L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,A,!1,l,n,a),R(),L&&e.restore()):(L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,A,!1,l,n,a),R(),L&&e.restore(),O()),this.afterRenderStep(t,e,i,s,w,!1,A,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&v(s))return void Uc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Ec(t).image;this._draw(t,a,!1,i)}};hv=iv([$a(),nv(0,Ya(co)),nv(0,Ka(sg)),sv("design:paramtypes",[Object])],hv);const cv=Symbol.for("IncrementalDrawContribution"),dv=Symbol.for("ArcRender"),uv=Symbol.for("AreaRender"),pv=Symbol.for("CircleRender"),gv=Symbol.for("GraphicRender"),fv=Symbol.for("GroupRender"),mv=Symbol.for("LineRender"),vv=Symbol.for("PathRender"),_v=Symbol.for("PolygonRender"),yv=Symbol.for("RectRender"),bv=Symbol.for("SymbolRender"),xv=Symbol.for("TextRender"),Sv=Symbol.for("RichTextRender"),kv=Symbol.for("GlyphRender"),Av=Symbol.for("ImageRender"),Mv=Symbol.for("DrawContribution"),wv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Bu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Ht;for(;o<0;)o+=Ht;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var Tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Bv=Symbol.for("DrawItemInterceptor"),Ev=new He,Pv=new He;class Rv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Ev.copy(s.dirtyBounds),Pv.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Qu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Ev),s.backupDirtyBounds.copy(Pv)),!0}}class Ov{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Iv=class{constructor(){this.order=1,this.interceptors=[new Rv,new Dv,new Lv,new Ov]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&tp.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Fv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jv=function(t,e){return function(i,s){e(i,s,t)}};let Hv=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Hv=Fv([$a(),jv(0,Ya(Mv)),zv("design:paramtypes",[Object])],Hv);var Vv=new La((t=>{t(bo).to(Hv)}));const Nv=Symbol.for("PickerService"),Wv=Symbol.for("GlobalPickerService"),Uv=Symbol.for("PickItemInterceptor"),Gv=Symbol.for("PickServiceInterceptor");var Yv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Xv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Xv=Yv([$a()],Xv);let $v=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Ec(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Qu.allocateByObj(a),u=new se(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};$v=Yv([$a()],$v);let Kv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new se(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Kv=Yv([$a()],Kv);let qv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=wv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};qv=Yv([$a()],qv);var Zv=new La(((t,e,i)=>{i(Nv)||(t(Wv).toSelf(),t(Nv).toService(Wv)),t(qv).toSelf().inSingletonScope(),t(Uv).toService(qv),t($v).toSelf().inSingletonScope(),t(Uv).toService($v),t(Kv).toSelf().inSingletonScope(),t(Uv).toService(Kv),po(t,Uv),t(Xv).toSelf().inSingletonScope(),t(Gv).toService(Xv),po(t,Gv)})),Jv=new La((t=>{t(Nu).to(mg),t(Wu).toConstantValue(df)}));const Qv=Symbol.for("AutoEnablePlugins"),t_=Symbol.for("PluginService");var e_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},i_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s_=function(t,e){return function(i,s){e(i,s,t)}};let n_=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&&yo.isBound(Qv)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};n_=e_([$a(),s_(0,Ya(co)),s_(0,Ka(Qv)),i_("design:paramtypes",[Object])],n_);var r_=new La((t=>{t(t_).to(n_),function(t,e){t(co).toDynamicValue((({container:t})=>new uo(e,t))).whenTargetNamed(e)}(t,Qv)})),a_=new La((t=>{po(t,vo)})),o_=new La((t=>{t(Rh).to(Oh).inSingletonScope(),po(t,Rh)})),l_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},h_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let c_=class{constructor(){this.type="static",this.offscreen=!1,this.global=xo.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Dh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};c_=l_([$a(),h_("design:paramtypes",[])],c_);var d_=new La((t=>{t(c_).toSelf(),t(Dp).toService(c_)}));var u_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function p_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function g_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=p_(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=p_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var v_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},__=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},y_=function(t,e){return function(i,s){e(i,s,t)}};let b_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):g_(e,Jl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new je,this.backupDirtyBounds=new je,this.global=xo.global,this.layerService=xo.layerService,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ve(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Jl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Qu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=m_(e,i,Jl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!xe(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Fm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Qu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Fm.free(n),Qu.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||yo.get(cv);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let S_=class extends fm{constructor(){super(...arguments),this.numberType=Lu}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Ec(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=Yp(u,p,c),_=$p(u,g),y=Up(c),b=Gp(d,f);if(!t.valid||!m)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};S_=x_([$a()],S_);var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let A_=class extends Sm{constructor(){super(...arguments),this.numberType=Eu}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Ec(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Yp(u,d,c),f=Up(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};A_=k_([$a()],A_);var M_,w_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},T_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},C_=function(t,e){return function(i,s){e(i,s,t)}},B_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(M_||(M_={}));let E_=class extends b_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=M_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new mo([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return B_(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Jl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return B_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return B_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>B_(this,void 0,void 0,(function*(){if(2!==t.count)yield f_(t,Jl.zIndex,((i,s)=>{if(this.status===M_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return B_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return B_(this,void 0,void 0,(function*(){this.rendering&&(this.status=M_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=M_.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 B_(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:()=>B_(this,void 0,void 0,(function*(){yield f_(t,Jl.zIndex,(t=>B_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};E_=w_([$a(),C_(0,Xa(gv)),C_(1,Ya(S_)),C_(2,Ya(A_)),C_(3,Ya(co)),C_(3,Ka(Bv)),T_("design:paramtypes",[Array,Object,Object,Object])],E_);var P_=new La((t=>{t(_f).toSelf().inSingletonScope(),t(Pf).toSelf().inSingletonScope(),t(Mv).to(b_),t(cv).to(E_),t(fv).to(ev).inSingletonScope(),t(gv).toService(fv),po(t,ig),t(Cf).toSelf().inSingletonScope(),po(t,hg),po(t,gv),t(Iv).toSelf().inSingletonScope(),t(Bv).toService(Iv),po(t,Bv)}));function R_(){R_.__loaded||(R_.__loaded=!0,yo.load(Wp),yo.load(Jv),yo.load(Vv),yo.load(Zv),yo.load(r_),function(t){t.load(a_),t.load(o_),t.load(d_)}(yo),function(t){t.load(P_)}(yo))}R_.__loaded=!1,R_();const O_=yo.get(_o);xo.global=O_;const I_=yo.get(Ip);xo.graphicUtil=I_;const L_=yo.get(Op);xo.transformUtil=L_;const D_=yo.get(Nu);xo.graphicService=D_;const F_=yo.get(Lp);xo.layerService=F_;class z_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class j_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=xo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=xo.global.getRequestAnimationFrame();this.rafId=t((()=>{xo.global.devicePixelRatio!==this.dpr&&(this.dpr=xo.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=xo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class H_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,xo.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const V_=new He;class N_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()}));const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(V_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(V_,t.parent&&t.parent.globalTransMatrix)))})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let W_;function U_(){!function(){if(null==W_)try{const t=document.createElement("canvas"),e=t.getContext("2d");W_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),W_&&(W_=!!document.createElement)}catch(t){W_=!1}}();const t=xo.global&&xo.global.env;return t?"browser"===t:W_}let G_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};G_._pluginClasses={};const Y_="white";class X_ extends Ep{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:Y_}set background(t){this._background=t,this.syncBackgroundImage(t)}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}syncBackgroundImage(t){var e;const i=null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t;this.backgroundImg=!1,this.isImageBackgroundSource(i)&&this.loadImage(i,!0)}isImageBackgroundSource(t){if(!t)return!1;if("string"==typeof t)return t.startsWith("{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Cc,this.hooks={beforeRender:new mo(["stage"]),afterRender:new mo(["stage"]),afterClearScreen:new mo(["stage"]),afterClearRect:new mo(["stage"])},this.global=xo.global,!this.global.env&&U_()&&this.global.setEnv("browser"),this.window=yo.get(gc),this.renderService=yo.get(bo),this.pluginService=yo.get(t_),this.layerService=yo.get(Lp),this.graphicService=yo.get(Nu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:Y_,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&this.syncBackgroundImage(this._background),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Wc(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,k=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,k=Math.cos(d)*Math.cos(u)*1);const A=G_.getPlugin("DirectionalLight");A&&(this.light=new A(f,m,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,k],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=G_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=G_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new z_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new j_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new H_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new je;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new N_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=G_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=G_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=G_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new se(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=yo.get(gc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=yo.get(Nv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var $_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},K_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let q_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new He}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return K_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};q_=$_([$a()],q_);var Z_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},J_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Q_=class{constructor(){this._uid=Ia.GenAutoIncrementId(),this.viewBox=new He,this.modelMatrix=new Ne(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};Q_=Z_([$a(),J_("design:paramtypes",[])],Q_);var ty=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ey=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iy=function(t,e){return function(i,s){e(i,s,t)}};let sy=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=xo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new He).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ne(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new se(e.x,e.y),a=Ec(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new se(e.x,e.y);l.transformPoint(a,a);const o=Ec(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&tp.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Qu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function ny(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function ry(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function dy(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),my=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},vy=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new je;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return my(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return my(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);vy(n[0],s,i),vy(n[1],e-s,i)}};let _y=!1;const yy=new La((t=>{_y||(_y=!0,t(am).toSelf().inSingletonScope(),t(dv).to(am).inSingletonScope(),t(gv).toService(dv),t(Qp).toService(Cf),po(t,Qp))}));let by=!1;const xy=new La((t=>{by||(by=!0,t(Rm).toSelf().inSingletonScope(),t(yv).to(Rm).inSingletonScope(),t(gv).toService(yv),t(Gf).toSelf(),t(Uf).toSelf(),t(ag).toService(Gf),t(ag).toService(Uf),t(ag).toService(Cf),po(t,ag))}));let Sy=!1;const ky=new La((t=>{Sy||(Sy=!0,t(fm).toSelf().inSingletonScope(),t(S_).toSelf().inSingletonScope(),t(mv).to(fm).inSingletonScope(),t(gv).toService(mv))}));let Ay=!1;const My=new La((t=>{Ay||(Ay=!0,t(Sm).toSelf().inSingletonScope(),t(uv).to(Sm).inSingletonScope(),t(gv).toService(uv),t(tg).toService(Cf),po(t,tg),t(A_).toSelf().inSingletonScope())}));let wy=!1;const Ty=new La((t=>{wy||(wy=!0,t(Dm).toSelf().inSingletonScope(),t(bv).to(Dm).inSingletonScope(),t(gv).toService(bv),t(og).toService(Cf),po(t,og))}));let Cy=!1;const By=new La((t=>{Cy||(Cy=!0,t(cm).toSelf().inSingletonScope(),t(pv).to(cm).inSingletonScope(),t(gv).toService(pv),t(eg).toService(Cf),po(t,eg))}));let Ey=!1;const Py=new La((t=>{Ey||(Ey=!0,t(xv).to(Nm).inSingletonScope(),t(gv).toService(xv),t(lg).toService(Cf),po(t,lg))}));let Ry=!1;const Oy=new La((t=>{Ry||(Ry=!0,t(Cm).toSelf().inSingletonScope(),t(vv).to(Cm).inSingletonScope(),t(gv).toService(vv),t(ng).toService(Cf),po(t,ng))}));let Iy=!1;const Ly=new La((t=>{Iy||(Iy=!0,t(_v).to(Zm).inSingletonScope(),t(gv).toService(_v),t(rg).toService(Cf),po(t,rg))}));var Dy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Fy=class{constructor(){this.numberType=Ru}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Ec(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Fy=Dy([$a()],Fy);let zy=!1;const jy=new La((t=>{zy||(zy=!0,t(kv).to(Fy).inSingletonScope(),t(gv).toService(kv))}));var Hy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ny=class extends im{constructor(){super(),this.numberType=ju,this.builtinContributions=[zm],this.init()}drawShape(t,e,i,s,n){const r=Ec(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Yp(o,l,!0),d=Yp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Ec(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Vf(e,i-t,s-n,v,_,f,!0)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Ec(t).richtext;this._draw(t,s,!1,i)}};Ny=Hy([$a(),Vy("design:paramtypes",[])],Ny);let Wy=!1;const Uy=new La((t=>{Wy||(Wy=!0,t(Sv).to(Ny).inSingletonScope(),t(gv).toService(Sv))}));let Gy=!1;const Yy=new La((t=>{Gy||(Gy=!0,t(Av).to(hv).inSingletonScope(),t(gv).toService(Av),t(sg).toService(Cf),po(t,sg))}));function Xy(t){const e=[];for(let i=0;i=0&&n>=0&&srt.getInstance().info(`[VChart log]: ${t}`,...e),qy=(t,e)=>(c(Jy.warnHandler)&&Jy.warnHandler.call(null,t,e),e?rt.getInstance().warn(`[VChart warn]: ${t}`,e):rt.getInstance().warn(`[VChart warn]: ${t}`)),Zy=(t,e,i)=>{if(!c(Jy.errorHandler))throw new Error(t);Jy.errorHandler.call(null,t,e)},Jy={silent:!1,warnHandler:!1,errorHandler:!1},Qy=U_(),tb=Qy&&globalThis?globalThis.document:void 0;function eb(t){return("desktop-browser"===t||"mobile-browser"===t)&&Qy}function ib(t){return sb(t)||"mobile-browser"===t}function sb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let nb=0;function rb(){return nb>=9999999&&(nb=0),nb++}function ab(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function ob(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}const lb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class hb extends Ep{constructor(t,e){super(t),this._skipRenderAttributes=lb,(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){d(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},Fb=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class zb extends o{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=zc.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=zc.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||Db(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=Fb(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=zc.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=Fb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Db(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=zc.now()-i>this.config.press.time&&Fb(s[0],t){xo.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Vb=[0,0,0];let Nb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Yl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},$l),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Kl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this._clearMatrix=new Ne(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&rt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Qu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Ht;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*y),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&yp.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Zu(Vb,[t,e,i],this.modelMatrix),t=Vb[0],e=Vb[1],i=Vb[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(Zu(Vb,[t,e,i],this.modelMatrix),t=Vb[0],e=Vb[1],i=Vb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Zu(Vb,[e,i,s],this.modelMatrix),e=Vb[0],i=Vb[1],s=Vb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t,e=xo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=xo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Kl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Kl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Zu(Vb,[e,i,s],this.modelMatrix),e=Vb[0],i=Vb[1],s=Vb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=vh(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:mh(this,a,this.dpr),r.strokeStyle=vh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Ie(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=Ie(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Qu.free(t))),this.stack.length=0}};Nb.env="browser",Nb=jb([$a(),Hb("design:paramtypes",[Object,Number])],Nb);var Wb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ub=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Gb=class extends op{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=xo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Nb(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function Yb(t,e){return new La((i=>{i(Ih).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Lh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Gb.env="browser",Gb=Wb([$a(),Ub("design:paramtypes",[Object])],Gb);const Xb=Yb(Gb,Nb);var $b=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qb=function(t,e){return function(i,s){e(i,s,t)}};let Zb=class extends sy{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=dc.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Qb=class{constructor(){this.type="group",this.numberType=Ou}contains(t,e,i){return!1}};Qb=Jb([$a()],Qb);const tx=new La(((t,e,i,s)=>{tx.__vloaded||(tx.__vloaded=!0,t(Ib).to(Qb).inSingletonScope(),t(Lb).toService(Ib),po(t,Lb))}));tx.__vloaded=!1;var ex=tx;const ix=new La(((t,e,i,s)=>{i(Zb)||t(Zb).toSelf().inSingletonScope(),i(Nv)?s(Nv).toService(Zb):t(Nv).toService(Zb)}));var sx,nx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ax=sx=class extends Q_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${sx.idprefix}_${sx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=xo.global,this.viewBox=new He,this.modelMatrix=new Ne(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:sx.GenerateCanvasId(),canvasControled:!0};this.canvas=new Gb(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new Gb({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};ax.env="browser",ax.idprefix="visactor_window",ax.prefix_count=0,ax=sx=nx([$a(),rx("design:paramtypes",[])],ax);const ox=new La((t=>{t(ax).toSelf(),t(fc).toDynamicValue((t=>t.container.get(ax))).whenTargetNamed(ax.env)}));var lx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cx=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class dx{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function ux(t,e=!1){const i=document.createElement("img");if(xo.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let px=class extends q_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new dx(t)}return new He}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return ux(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return ux(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:Ia.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return cx(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};px=lx([$a(),hx("design:paramtypes",[])],px);const gx=new La((t=>{gx.isBrowserBound||(gx.isBrowserBound=!0,t(px).toSelf().inSingletonScope(),t(vo).toService(px))}));function fx(t,e=!0){fx.__loaded||(fx.__loaded=!0,t.load(gx),t.load(Xb),t.load(ox),e&&function(t){t.load(ex),t.load(ix)}(t))}gx.isBrowserBound=!1,fx.__loaded=!1;var mx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_x=function(t,e){return function(i,s){e(i,s,t)}};let yx=class extends sy{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new rp(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};yx=mx([$a(),_x(0,Ya(co)),_x(0,Ka(cb)),_x(1,Ya(co)),_x(1,Ka(Uv)),_x(2,Ya(co)),_x(2,Ka(Gv)),vx("design:paramtypes",[Object,Object,Object])],yx);const bx=new La((t=>{bx.__vloaded||(bx.__vloaded=!0,po(t,cb))}));bx.__vloaded=!1;var xx=bx;class Sx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:mh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mx=function(t,e){return function(i,s){e(i,s,t)}};let wx=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Cu}};wx=kx([$a(),Mx(0,Ya(dv)),Ax("design:paramtypes",[Object])],wx);let Tx=!1;const Cx=new La(((t,e,i,s)=>{Tx||(Tx=!0,t(db).to(wx).inSingletonScope(),t(cb).toService(db))}));var Bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ex=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Px=function(t,e){return function(i,s){e(i,s,t)}};let Rx=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Eu}};Rx=Bx([$a(),Px(0,Ya(uv)),Ex("design:paramtypes",[Object])],Rx);let Ox=!1;const Ix=new La(((t,e,i,s)=>{Ox||(Ox=!0,t(ub).to(Rx).inSingletonScope(),t(cb).toService(ub))}));var Lx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fx=function(t,e){return function(i,s){e(i,s,t)}};let zx=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Pu}};zx=Lx([$a(),Fx(0,Ya(pv)),Dx("design:paramtypes",[Object])],zx);let jx=!1;const Hx=new La(((t,e,i,s)=>{jx||(jx=!0,t(pb).to(zx).inSingletonScope(),t(cb).toService(pb))}));class Vx{constructor(){this.type="glyph",this.numberType=Ru}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var Nx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ux=function(t,e){return function(i,s){e(i,s,t)}};let Gx=class extends Vx{constructor(t){super(),this.canvasRenderer=t}};Gx=Nx([$a(),Ux(0,Ya(kv)),Wx("design:paramtypes",[Object])],Gx);let Yx=!1;const Xx=new La(((t,e,i,s)=>{Yx||(Yx=!0,t(xb).to(Gx).inSingletonScope(),t(Gx).toService(xb))}));var $x=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Kx=class{constructor(){this.type="image",this.numberType=Iu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Kx=$x([$a()],Kx);let qx=!1;const Zx=new La(((t,e,i,s)=>{qx||(qx=!0,t(gb).to(Kx).inSingletonScope(),t(Kx).toService(gb))}));var Jx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tS=function(t,e){return function(i,s){e(i,s,t)}};let eS=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};eS=Jx([$a(),tS(0,Ya(mv)),Qx("design:paramtypes",[Object])],eS);let iS=!1;const sS=new La(((t,e,i,s)=>{iS||(iS=!0,t(fb).to(eS).inSingletonScope(),t(cb).toService(fb))}));var nS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aS=function(t,e){return function(i,s){e(i,s,t)}};let oS=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Fu}};oS=nS([$a(),aS(0,Ya(_v)),rS("design:paramtypes",[Object])],oS);let lS=!1;const hS=new La(((t,e,i,s)=>{lS||(lS=!0,t(bb).to(oS).inSingletonScope(),t(cb).toService(bb))}));var cS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uS=function(t,e){return function(i,s){e(i,s,t)}};let pS=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Du}};pS=cS([$a(),uS(0,Ya(vv)),dS("design:paramtypes",[Object])],pS);let gS=!1;const fS=new La(((t,e,i,s)=>{gS||(gS=!0,t(mb).to(pS).inSingletonScope(),t(cb).toService(mb))})),mS=new He;class vS{constructor(){this.type="rect",this.numberType=zu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||x(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:mh(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;mS.setValue(i.x1,i.y1,i.x2,i.y2),mS.expand(-r/2),h=!mS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var _S=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bS=function(t,e){return function(i,s){e(i,s,t)}};let xS=class extends vS{constructor(t){super(),this.canvasRenderer=t}};xS=_S([$a(),bS(0,Ya(yv)),yS("design:paramtypes",[Object])],xS);let SS=!1;const kS=new La(((t,e,i,s)=>{SS||(SS=!0,t(vb).to(xS).inSingletonScope(),t(cb).toService(vb))}));let AS=!1;const MS=new La(((t,e,i,s)=>{AS||(AS=!0,t(gb).to(Kx).inSingletonScope(),t(Kx).toService(gb))}));var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CS=function(t,e){return function(i,s){e(i,s,t)}};let BS=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Hu}};BS=wS([$a(),CS(0,Ya(bv)),TS("design:paramtypes",[Object])],BS);let ES=!1;const PS=new La(((t,e,i,s)=>{ES||(ES=!0,t(_b).to(BS).inSingletonScope(),t(cb).toService(_b))}));var RS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let OS=class{constructor(){this.type="text",this.numberType=Vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};OS=RS([$a()],OS);let IS=!1;const LS=new La(((t,e,i,s)=>{IS||(IS=!0,t(yb).to(OS).inSingletonScope(),t(cb).toService(yb))})),DS=new La(((t,e,i,s)=>{i(yx)||t(yx).toSelf().inSingletonScope(),i(Nv)?s(Nv).toService(yx):t(Nv).toService(yx)}));class FS{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var zS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let HS=class extends Nb{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ne(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};HS.env="node",HS=zS([$a(),jS("design:paramtypes",[Object,Number])],HS);var VS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let WS=class extends op{constructor(t){super(t)}init(){this._context=new HS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}};WS.env="node",WS=VS([$a(),NS("design:paramtypes",[Object])],WS);const US=Yb(WS,HS);var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XS=function(t,e){return function(i,s){e(i,s,t)}};let $S=class extends Q_{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:Ia.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new WS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new WS({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};$S.env="node",$S=GS([$a(),XS(0,Ya(_o)),YS("design:paramtypes",[Object])],$S);const KS=new La((t=>{t($S).toSelf(),t(fc).toDynamicValue((t=>t.container.get($S))).whenTargetNamed($S.env)}));var qS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZS=class extends q_{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return sd.call(t)}}getCancelAnimationFrame(){return t=>{sd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};ZS=qS([$a()],ZS);const JS=new La((t=>{JS.isNodeBound||(JS.isNodeBound=!0,t(ZS).toSelf().inSingletonScope(),t(vo).toService(ZS))}));function QS(t,e=!0){QS.__loaded||(QS.__loaded=!0,t.load(JS),t.load(US),t.load(KS))}JS.isNodeBound=!1,QS.__loaded=!1;var tk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ek=class extends Nb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:mh(this,l,this.dpr),r.strokeStyle=vh(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=xo.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,xo.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:Ie(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:Ie(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}};ek.env="harmony",ek=tk([$a()],ek);var ik=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let nk=class extends op{constructor(t){super(t)}init(){this._context=new ek(this,this._dpr)}resize(t,e){}release(...t){}};nk.env="harmony",nk=ik([$a(),sk("design:paramtypes",[Object])],nk);var rk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ok=function(t,e){return function(i,s){e(i,s,t)}};class lk{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 hk=class extends Q_{get container(){return null}constructor(t){super(),this.global=t,this.type="harmony",this.eventManager=new lk}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Ia.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new nk(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}this.canvas=new nk({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};hk.env="harmony",hk=rk([$a(),ok(0,Ya(_o)),ak("design:paramtypes",[Object])],hk);const ck=new La((t=>{t(hk).toSelf(),t(fc).toDynamicValue((t=>t.container.get(hk))).whenTargetNamed(hk.env)})),dk=Yb(nk,ek);var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let gk=class extends q_{constructor(){super(),this.type="harmony",this.supportEvent=!0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0,this.rafSTO=new id(0)}configure(t,e){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){}loadSvg(t){return Promise.reject()}createCanvas(t){return function(t,e,i){const s=new OffscreenCanvas(t,e),n=s.getContext("2d");return new FS({width:t,height:e,context:n,_c:s,getBoundingClientRect:()=>({width:t,height:e}),getContext:()=>n},n,1,t,e,i)}(t.width,t.height,t.id)}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return null}getRootElement(){return null}getDocument(){return null}release(...t){}};gk=uk([$a(),pk("design:paramtypes",[])],gk);const fk=new La((t=>{fk.isHarmonyBound||(fk.isHarmonyBound=!0,t(gk).toSelf().inSingletonScope(),t(vo).toService(gk))}));function mk(t,e=!0){mk.__loaded||(mk.__loaded=!0,t.load(fk),t.load(dk),t.load(ck),e&&function(t){t.load(xx),t.load(DS),t.load(Cx),t.load(Ix),t.load(Hx),t.load(Xx),t.load(Zx),t.load(sS),t.load(hS),t.load(fS),t.load(kS),t.load(MS),t.load(PS),t.load(LS)}(t))}fk.isHarmonyBound=!1,mk.__loaded=!1;var vk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_k=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yk=function(t,e){return function(i,s){e(i,s,t)}};let bk=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Cu}};bk=vk([$a(),yk(0,Ya(dv)),_k("design:paramtypes",[Object])],bk);let xk=!1;const Sk=new La(((t,e,i,s)=>{xk||(xk=!0,t(Sb).to(bk).inSingletonScope(),t(Lb).toService(Sb))}));var kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mk=function(t,e){return function(i,s){e(i,s,t)}};let wk=class extends vS{constructor(t){super(),this.canvasRenderer=t}};wk=kk([$a(),Mk(0,Ya(yv)),Ak("design:paramtypes",[Object])],wk);let Tk=!1;const Ck=new La(((t,e,i,s)=>{Tk||(Tk=!0,t(Cb).to(wk).inSingletonScope(),t(Lb).toService(Cb))}));class Bk extends im{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:mh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&tp.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var Ek=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rk=function(t,e){return function(i,s){e(i,s,t)}};let Ok=class extends Bk{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};Ok=Ek([$a(),Rk(0,Ya(mv)),Pk("design:paramtypes",[Object])],Ok);let Ik=!1;const Lk=new La(((t,e,i,s)=>{Ik||(Ik=!0,t(wb).to(Ok).inSingletonScope(),t(Lb).toService(wb))}));var Dk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zk=function(t,e){return function(i,s){e(i,s,t)}};let jk=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Eu}};jk=Dk([$a(),zk(0,Ya(uv)),Fk("design:paramtypes",[Object])],jk);let Hk=!1;const Vk=new La(((t,e,i,s)=>{Hk||(Hk=!0,t(kb).to(jk).inSingletonScope(),t(Lb).toService(kb))}));class Nk extends im{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&tp.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var Wk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gk=function(t,e){return function(i,s){e(i,s,t)}};let Yk=class extends Nk{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Hu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:mh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&tp.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Yk=Wk([$a(),Gk(0,Ya(bv)),Uk("design:paramtypes",[Object])],Yk);let Xk=!1;const $k=new La(((t,e,i,s)=>{Xk||(Xk=!0,t(Bb).to(Yk).inSingletonScope(),t(Lb).toService(Bb))}));var Kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zk=function(t,e){return function(i,s){e(i,s,t)}};let Jk=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Pu}};Jk=Kk([$a(),Zk(0,Ya(pv)),qk("design:paramtypes",[Object])],Jk);let Qk=!1;const tA=new La(((t,e,i,s)=>{Qk||(Qk=!0,t(Ab).to(Jk).inSingletonScope(),t(Lb).toService(Ab))}));var eA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sA=function(t,e){return function(i,s){e(i,s,t)}};let nA=class extends Nk{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Vu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=dg(a,u,n),v=cg(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&tp.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};nA=eA([$a(),sA(0,Ya(xv)),iA("design:paramtypes",[Object])],nA);let rA=!1;const aA=new La(((t,e,i,s)=>{rA||(rA=!0,t(Eb).to(nA).inSingletonScope(),t(Lb).toService(Eb))}));var oA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hA=function(t,e){return function(i,s){e(i,s,t)}};let cA=class extends Bk{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Du}};cA=oA([$a(),hA(0,Ya(vv)),lA("design:paramtypes",[Object])],cA);let dA=!1;const uA=new La(((t,e,i,s)=>{dA||(dA=!0,t(Tb).to(cA).inSingletonScope(),t(Lb).toService(Tb))}));var pA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fA=function(t,e){return function(i,s){e(i,s,t)}};let mA=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Fu}};mA=pA([$a(),fA(0,Ya(_v)),gA("design:paramtypes",[Object])],mA);let vA=!1;const _A=new La(((t,e,i,s)=>{vA||(vA=!0,t(Pb).to(mA).inSingletonScope(),t(Lb).toService(Pb))}));var yA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xA=function(t,e){return function(i,s){e(i,s,t)}};let SA=class extends Vx{constructor(t){super(),this.canvasRenderer=t}};SA=yA([$a(),xA(0,Ya(kv)),bA("design:paramtypes",[Object])],SA);let kA=!1;const AA=new La(((t,e,i,s)=>{kA||(kA=!0,t(Ob).to(SA).inSingletonScope(),t(Lb).toService(Ob))}));var MA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TA=function(t,e){return function(i,s){e(i,s,t)}};let CA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ju}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};CA=MA([$a(),TA(0,Ya(Sv)),wA("design:paramtypes",[Object])],CA);let BA=!1;const EA=new La(((t,e,i,s)=>{BA||(BA=!0,t(Rb).to(CA).inSingletonScope(),t(Lb).toService(Rb))}));var PA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OA=function(t,e){return function(i,s){e(i,s,t)}};let IA=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Iu}};IA=PA([$a(),OA(0,Ya(Av)),RA("design:paramtypes",[Object])],IA);let LA=!1;const DA=new La(((t,e,i,s)=>{LA||(LA=!0,t(Mb).to(IA).inSingletonScope(),t(Lb).toService(Mb))})),FA=U_();function zA(){zA.__loaded||(zA.__loaded=!0,df.RegisterGraphicCreator("arc",rf),yo.load(yy),yo.load(FA?Sk:Cx))}zA.__loaded=!1;const jA=zA;function HA(){HA.__loaded||(HA.__loaded=!0,df.RegisterGraphicCreator("area",ef),yo.load(My),yo.load(FA?Vk:Ix))}HA.__loaded=!1;const VA=HA;function NA(){NA.__loaded||(NA.__loaded=!0,df.RegisterGraphicCreator("circle",bg),yo.load(By),yo.load(FA?tA:Hx))}NA.__loaded=!1;const WA=NA;function UA(){UA.__loaded||(UA.__loaded=!0,df.RegisterGraphicCreator("glyph",Dg),yo.load(jy),yo.load(FA?AA:Xx))}UA.__loaded=!1;const GA=UA;function YA(){YA.__loaded||(YA.__loaded=!0,df.RegisterGraphicCreator("group",Pp))}YA.__loaded=!1;const XA=YA;function $A(){$A.__loaded||($A.__loaded=!0,df.RegisterGraphicCreator("image",Ng),yo.load(Yy),yo.load(FA?DA:Zx))}$A.__loaded=!1;const KA=$A;function qA(){qA.__loaded||(qA.__loaded=!0,df.RegisterGraphicCreator("line",Eg),yo.load(ky),yo.load(FA?Lk:sS))}qA.__loaded=!1;const ZA=qA;function JA(){JA.__loaded||(JA.__loaded=!0,df.RegisterGraphicCreator("path",Jg),yo.load(Oy),yo.load(FA?uA:fS))}JA.__loaded=!1;const QA=JA;function tM(){tM.__loaded||(tM.__loaded=!0,df.RegisterGraphicCreator("polygon",lf),yo.load(Ly),yo.load(FA?_A:hS))}tM.__loaded=!1;const eM=tM;function iM(){iM.__loaded||(iM.__loaded=!0,df.RegisterGraphicCreator("rect",Ig),yo.load(xy),yo.load(FA?Ck:kS))}iM.__loaded=!1;const sM=iM;function nM(){nM.__loaded||(nM.__loaded=!0,df.RegisterGraphicCreator("richtext",Kg),yo.load(Uy),yo.load(FA?EA:MS))}nM.__loaded=!1;const rM=nM;function aM(){aM.__loaded||(aM.__loaded=!0,df.RegisterGraphicCreator("shadowRoot",cf))}aM.__loaded=!1;const oM=aM;function lM(){lM.__loaded||(lM.__loaded=!0,df.RegisterGraphicCreator("symbol",Tg),yo.load(Ty),yo.load(FA?$k:PS))}lM.__loaded=!1;const hM=lM;function cM(){cM.__loaded||(cM.__loaded=!0,df.RegisterGraphicCreator("text",Ag),yo.load(Py),yo.load(FA?aA:LS))}cM.__loaded=!1;const dM=cM;function uM(){XA(),sM()}const pM=-.5*Math.PI,gM=1.5*Math.PI,fM="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var mM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(mM||(mM={}));const vM={[mM.selectedReverse]:{},[mM.selected]:{},[mM.hover]:{},[mM.hoverReverse]:{}},_M={container:"",width:30,height:30,style:{}},yM="scrollDrag";function bM(){return"browser"===O_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const xM={debounce:bt,throttle:xt};uM();let SM=class t extends hb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=mt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=mt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=bM(),a="browser"===O_.env?O_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=mt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:xM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:vt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=vt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(yM,{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",xM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===O_.env?O_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(vt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ni(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ni(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=mt(t[0],0,1),c=mt(t[1],0,1),d=mt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=vt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?vt([a+i*n,a+s*n],a,n-l):vt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=bM(),e="browser"===O_.env?O_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===O_.env?O_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};SM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};var kM,AM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let MM=kM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new je).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new He,e.addEventListener("wheel",this.scroll),this.params=kM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(yM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new SM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(MM)||(t(MM).toSelf(),t(Qv).toService(MM))}));function TM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&TM(t,e)}))}const CM=t=>!d(t)&&!1!==t.visible;function BM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function EM(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const RM=["#ffffff","#000000"];function OM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ti(t).toHex(),o=new ti(e).toHex();return IM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...RM);for(const n of a)if(t!==n&&IM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function IM(t,e,i,s,n){if("lightness"===n){const i=ti.getColorBrightness(new ti(e));return ti.getColorBrightness(new ti(t))<.5?i>=.5:i<.5}return s?LM(t,e)>s:"largeText"===i?LM(t,e)>3:LM(t,e)>4.5}function LM(t,e){const i=DM(t),s=DM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function DM(t){const e=ii(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function FM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function zM(t,e){return[t[0]*e,t[1]*e]}function jM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function HM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Zt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const VM=(t,e,i,s)=>new Le(Object.assign({defaultFontParams:Object.assign({fontFamily:fM,fontSize:14},s),getTextBounds:i?void 0:gf,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function NM(t,e,i={}){if(!t)return{width:0,height:0};const s=gf({text:t,fontFamily:e.fontFamily||i.fontFamily||fM,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function WM(t,e="type"){var i,s;return p(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function UM(t){var e,i;return u(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function GM(t,e="type"){const i=WM(t,e);return"rich"===i?df.richtext(UM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),df.text(t))}function YM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const XM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function $M(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function KM(t,e){const{dx:i,dy:s}=$M(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function qM(){XA(),sM(),hM(),rM(),dM()}var ZM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nc&&(w=c,O.setAttribute("maxLineWidth",c-b[1]-b[2]))),A=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):H>0&&S.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,W=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:G(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=w-b[1]-b[3],e=I+B,i=1===H?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),k){const t=i-I/2-B+F/2;k.setAttributes({x:t})}}if(N&&1!==H){const t=w-b[1]-b[3],e=0===H?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),k){const t=e+F/2;k.setAttributes({x:t})}}if(V&&-1!==H){const t=w-b[1]-b[3],e=0===H?t/2+B/2:t;if(W(e,"right"),k){const t=e-I-B+F/2;k.setAttributes({x:t})}}"middle"===j?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===j?(M-=T,k&&k.setAttribute("y",-L/2),S.setAttribute("y",-b[2])):"top"===j&&(S.setAttribute("y",b[0]),k&&k.setAttribute("y",L/2)),E(null==m?void 0:m.text)||(O.states=m.text);const{visible:U}=a,Y=ZM(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:T,x:A,y:M}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new Nl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},JM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}JM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const QM={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}},tw={poptip:z({},QM)};var ew=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nk?q=k:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Gt(Ut(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Gt(Ut(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ft/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ft/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ft,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}lw.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};var hw=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let cw=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,lw.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new lw(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,tw.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};cw=hw([$a()],cw);var dw=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class uw{constructor(){this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let pw=class extends uw{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};pw=dw([$a()],pw);let gw=class extends uw{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};gw=dw([$a()],gw);const fw=new La(((t,e,i,s)=>{i(cw)||(t(cw).toSelf().inSingletonScope(),t(hg).toService(cw)),i(pw)||(t(pw).toSelf(),t(Qv).toService(pw)),i(gw)||(t(gw).toSelf(),t(Qv).toService(gw))}));class mw extends hb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}XA(),ZA();class vw extends mw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vw.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}vw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},XA(),sM();class _w extends mw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},_w.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}_w.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},XA(),jA();class yw extends mw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yw.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ne.distancePP(t,e);this.setAttribute("radius",i)}}yw.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},XA(),jA();class bw extends mw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},bw.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=pM,endAngle:s=gM}=this.attribute,n=s-i,r=ae(ce(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}bw.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},XA(),QA();class xw extends mw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},xw.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=le(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ne.distancePP(t,e);this.setAttribute("radius",i)}}function Sw(){XA(),ZA(),eM(),hM()}function kw(){XA(),ZA(),jA(),hM()}xw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Sw();class Aw extends hb{getStartAngle(){return de(this._startAngle)}getEndAngle(){return de(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Aw.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(Z(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=df.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),E(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=df.line;G(i)[0].cornerRadius&&(t=df.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=df.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:Z(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}Aw.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}}},kw();class Mw extends Aw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Aw.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=df.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),E(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var ww,Tw;!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.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(ww||(ww={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Tw||(Tw={}));const Cw={[Tw.selectedReverse]:{},[Tw.selected]:{},[Tw.hover]:{},[Tw.hoverReverse]:{}},Bw={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},Ew={size:8,stroke:"#000",lineWidth:1,zIndex:1};const Pw=Math.sin(Math.PI/10);function Rw(t,e=Pw){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function Ow(t,e=Pw){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function Iw(t){const e={};return TM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function Lw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Dw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return zM(r,(s?-1:1)*(n?-1:1)*t/jM(r))}function Fw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function jw(t,e,i){var s;if(Ow(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>De(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>De(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>Fe(n,r)}function Hw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!E(s.states)?(s.addState(mM.hover,!0),TM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(mM.hoverReverse,!0)})),s):i},Nw=(t,e,i)=>i?(TM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(mM.hoverReverse),t.removeState(mM.hover))})),null):i,Ww=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(mM.selected)?(TM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(mM.selectedReverse),t.removeState(mM.selected))})),null):s.name&&!E(s.states)?(s.addState(mM.selected,!0),TM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(mM.selectedReverse,!0)})),s):i};class Uw extends hb{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=p(e)?e:{};this._animationConfig={enter:!1!==i&&z({},t,r,null!=i?i:{}),exit:!1!==s&&z({},t,r,null!=s?s:{}),update:!1!==n&&(_(n)?n:z({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const Gw={type:"default",duration:300,easing:"linear"};class Yw extends Uw{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Vw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Nw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Ww(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=df.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prepare(),this._prevInnerView=this._innerView&&Iw(this._innerView),this.removeAllChild(!0),this._innerView=df.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(Gw)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=df.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=ww.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=df.group({x:0,y:0,pickable:!1});t.name=ww.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=df.group({x:0,y:0,pickable:!1});i.name=ww.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=df.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=ww.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=vM;else{const t=this.data[s],e=z({},vM,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=df.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=ww.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=vM;else{const i=z({},vM,s.state);Object.keys(i).forEach((s=>{c(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=df.group({x:0,y:0,pickable:!1});return r.name=`${ww.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=GM(this._getLabelAttribute(t,e,n,i));if(a.name=ww.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=vM;else{const s=z({},vM,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new JM(Object.assign({},e));i.name=ww.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return Lw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&c(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=Ft/2*(l.x>e.x?1:-1):h=Ft/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+P(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+P(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=c(_)?z({},Bw.label.style,_(t,e,i,s)):_;_=z(this.getLabelAlign(m,o,_.angle),_),c(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return c(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=d?d:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},TM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&N(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Xw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&jw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function $w(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function Kw(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=c(n)?n:Xw[n]||Xw.parity;if(s.length>=3&&Hw(s,r)){do{s=a(s,r)}while(s.length>=3&&Hw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);jw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),Kw(l,s,n,(t=>jw(t,l,r))),Kw(h,s,o,(t=>jw(t,h,r)||!(!n||t===l)&&jw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function Zw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},tT(t,e.attribute.angle)),{angle:Qw(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({},eT(t,e.attribute.angle)),{angle:Qw(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Ae({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function Qw(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function tT(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Qw(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function eT(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=Qw(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function iT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(E(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=Ow(h),m=Rw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function sT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class nT{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=jM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return zM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class rT{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-rT.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*rT.bounceIn(2*t):.5*rT.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ht/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ht*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ht/e)*.5+1}}static registerFunc(t,e){rT[t]=e}}function aT(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}rT.quadIn=rT.getPowIn(2),rT.quadOut=rT.getPowOut(2),rT.quadInOut=rT.getPowInOut(2),rT.cubicIn=rT.getPowIn(3),rT.cubicOut=rT.getPowOut(3),rT.cubicInOut=rT.getPowInOut(3),rT.quartIn=rT.getPowIn(4),rT.quartOut=rT.getPowOut(4),rT.quartInOut=rT.getPowInOut(4),rT.quintIn=rT.getPowIn(5),rT.quintOut=rT.getPowOut(5),rT.quintInOut=rT.getPowInOut(5),rT.backIn=rT.getBackIn(1.7),rT.backOut=rT.getBackOut(1.7),rT.backInOut=rT.getBackInOut(1.7),rT.elasticIn=rT.getElasticIn(1,.3),rT.elasticOut=rT.getElasticOut(1,.3),rT.elasticInOut=rT.getElasticInOut(1,.3*1.5),rT.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),rT.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},rT.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)rT[`flicker${t}`]=e=>aT(e,t);for(let t=2;t<10;t++)rT[`aIn${t}`]=e=>t*e*e+(1-t)*e;function oT(t,e,i){return t+(e-t)*i}const lT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=oT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=oT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=oT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=oT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=oT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=oT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=oT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=oT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=oT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=dp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?pp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=dp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?pp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=oT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=oT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=oT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=oT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=oT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=oT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=oT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=oT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=oT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=oT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=oT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=oT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=oT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=oT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=oT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=oT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=td(e,i,s),r.addUpdateBoundTag()}}};function hT(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=rT[s])&&void 0!==n?n:rT.linear:rT.linear,"wait"===t&&(this.onUpdate=cT),this.id=Ia.GenAutoIncrementId(),this.syncAttributeUpdate=cT}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=hp.Get(i,lp.Color255),r=hp.Get(s,lp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(lT["fill"===e?"fillPure":"strokePure"])}else lT[e]?t.push(lT[e]):t.push(hT)}else lT[e]?t.push(lT[e]):t.push(hT)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class uT extends dT{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class pT extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Ia.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Oo.END?this.removeAnimate(t,!0):t.status!==Oo.RUNNING&&t.status!==Oo.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const gT=new pT;gT.isGlobal=!0;class fT{constructor(t=Ia.GenAutoIncrementId(),e=gT,i){this.id=t,this.status=Oo.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new dT(Ro.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new uT(Ro.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new dT(Ro.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Oo.RUNNING&&(this.status=Oo.PAUSED)}resume(){this.status===Oo.PAUSED&&(this.status=Oo.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Oo.END&&this.onEnd(),this.status=Oo.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Oo.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Oo.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Oo.END);this.status=Oo.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const mT=new ko;class vT{constructor(){this.released=!1}tick(t,e){mT.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class _T extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Po.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Po.INITIAL,xo.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),xo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new vT;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Po.INITIAL&&(this.status=Po.PAUSE,!0)}resume(){return this.status!==Po.INITIAL&&(this.status=Po.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Po.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Po.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Po.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Po.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Po.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Po.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,xo.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function ST(t){if(!t||!c(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}xT.getInstance();class kT{static registerBuiltInAnimate(t,e){kT.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:kT.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=ST(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:kT.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=ST(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:k,priority:A=0,options:M,custom:w,customType:T,controlOptions:C}=t,B=e.animate();B.priority=A;const E=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),B.startAt(b);const O=i*x+E;O>0&&B.wait(O);let I=null,L=t.to,D=t.from;L||(I||(I=this.createPropsFromChannel(g,e)),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e)),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,w,T,D,L,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=c(_)?_(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&B.wait(F),S&&S>0&&B.loop(S),k&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,_,y,b;if(e&&i){i=ST(e);let d=this.resolveValue(o,u);"function"==typeof d&&(d=d(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),d=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},d);const x=c(h)?h.call(null,null!==(_=d&&(null===(v=d.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,d):h;d.options=x,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:kT.builtInAnimateMap[r],f=t.custom?t.customType:ST(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Oo.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}kT.builtInAnimateMap={};const AT="appear",MT="disappear",wT="update",TT="highlight",CT="unhighlight";class BT{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class ET{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=xT.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new kT(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new kT(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([AT],[{name:AT,animation:t}],e)}applyDisappearState(t,e){this.applyState([MT],[{name:MT,animation:t}],e)}applyUpdateState(t,e){this.applyState([wT],[{name:wT,animation:t}],e)}applyHighlightState(t,e){this.applyState([TT],[{name:TT,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([CT],[{name:CT,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class PT{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new ET(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new BT(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new PT)._getAnimationStateManager(t),t}}class RT{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new fT(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:gT,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new pT}createTicker(t){return new _T(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new kT(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function OT(){U(Cp,PT),U(Cp,RT)}class IT extends dT{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class LT extends IT{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class DT extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Oo.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class FT{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new kT(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function zT(t){return new FT(t)}class jT extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const HT=1e3,VT="quadInOut",NT=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],WT=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=dp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},UT=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?cy(t):[],n=cy(e);i&&s&&(i.fromTransform&&dy(s,i.fromTransform.clone().getInverse()),dy(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},YT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],XT=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!YT.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?hp.Get(t,lp.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class $T extends IT{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;UT(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&WT(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const KT=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=GT(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=XT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new $T({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:HT,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:VT);return c.play(d),c};class qT extends IT{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;UT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&WT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const ZT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>NT.includes(t))(i)||(e[i]=t[i])})),e},JT=(t,e,i)=>{const s=ZT(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=xo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},QT=(t,e,i)=>{const s=[],n=i?null:ZT(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:ZT(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Pg(t.attribute),n=py(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(xo.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=py(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(xo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=py(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(xo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return gy(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return gy(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(xo.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:fy(i)}];const s=[];return vy(i,e,s),s})(t,e).forEach((t=>{s.push(xo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return vy(l,e,h),h})(t,e).forEach((t=>{s.push(xo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=cy(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(xo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(xo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&JT(t,s,e),s};class eC extends IT{constructor(t,e,i,s,n){super(null,{},i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){super.onBind(),this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:$o.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:$o.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:$o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class iC extends eC{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let k=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(k=x,A="out"===b?x+2*Math.PI:x);const M=xo.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:k,endAngle:A,fill:!0});let w,T;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},T={startAngle:x}):(w={endAngle:x},T={endAngle:x+2*Math.PI}),super("in"===b?w:T,"in"===b?T:w,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class sC extends eC{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=xo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class nC extends IT{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=mt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new se(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=Qc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class oC extends rC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class lC extends aC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class hC extends rC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class cC extends aC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const dC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class uC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class pC extends uC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=dC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class gC extends uC{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class fC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class mC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const vC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class _C extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const bC=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class xC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>Qc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class SC extends xC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:bC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class kC extends xC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:bC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const AC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class MC extends xC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:AC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class wC extends xC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:AC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const TC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class CC extends xC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:TC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class BC extends xC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:TC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const EC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class PC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class RC extends PC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=EC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class OC extends PC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const IC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class LC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=IC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class DC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class FC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c;let d,u;super.onBind();const p=this.target.getFinalAttribute(),g=null!==(t=this.target.attribute)&&void 0!==t?t:{};switch(null===(e=this.params)||void 0===e?void 0:e.direction){case"x":d={scaleX:null!==(i=g.scaleX)&&void 0!==i?i:0},u={scaleX:null!==(s=null==p?void 0:p.scaleX)&&void 0!==s?s:1},this._updateFunction=this.updateX;break;case"y":d={scaleY:null!==(n=g.scaleY)&&void 0!==n?n:0},u={scaleY:null!==(r=null==p?void 0:p.scaleY)&&void 0!==r?r:1},this._updateFunction=this.updateY;break;default:d={scaleX:null!==(a=g.scaleX)&&void 0!==a?a:0,scaleY:null!==(o=g.scaleY)&&void 0!==o?o:0},u={scaleX:null!==(l=null==p?void 0:p.scaleX)&&void 0!==l?l:1,scaleY:null!==(h=null==p?void 0:p.scaleY)&&void 0!==h?h:1},this._updateFunction=this.updateXY}const f=this.target.getFinalAttribute();f&&this.target.setAttributes(f),this.props=u,this.from=d,this.to=u,!1!==(null===(c=this.params.controlOptions)||void 0===c?void 0:c.immediatelyApply)&&this.target.setAttributes(d)}onEnd(t){super.onEnd(t)}updateX(t){this.target.attribute.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t}updateY(t){this.target.attribute.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t}updateXY(t){this.updateX(t),this.updateY(t)}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:"scaleX"===this.propKeys[0]?this._updateFunction=this.updateX:"scaleY"===this.propKeys[0]?this._updateFunction=this.updateY:this._updateFunction=null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class zC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class jC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class HC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e;super.onBind();let{diffAttrs:i={}}=null!==(t=this.target.context)&&void 0!==t?t:{};const{options:s}=this.params;i=Object.assign({},i),(null===(e=null==s?void 0:s.excludeChannels)||void 0===e?void 0:e.length)&&s.excludeChannels.forEach((t=>{delete i[t]})),this.props=i}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i)}}class VC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class NC extends VC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),_=t.getGraphicAttribute("y"),y=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?_:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:y},to:{x:v}};case"y":return{from:{y:b},to:{y:_}};default:return{from:{x:y,y:b},to:{x:v,y:_}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class WC extends VC{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,_=v&&k(v.x)?v.x:f,y=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:_}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:y}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:_,y:y}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class UC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class GC extends UC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=ut(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class YC extends UC{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=ut(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class XC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}onBind(){var t,e;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))}));const i=this.target.getFinalAttribute();"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&i&&this.target.setAttributes(i),!1!==(null===(e=this.params.controlOptions)||void 0===e?void 0:e.immediatelyApply)&&this.target.setAttributes(this.from)}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.target.setAttributes(this.from)}deleteSelfAttr(t){super.deleteSelfAttr(t),delete this.from[t]}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.from,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.from[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class $C extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=xo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Nl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=xo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:$o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:$o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=ll(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=ll(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=df.group({zIndex:999});e.name=ww.axisBreak,e.id=this._getNodeId(`${ww.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},Ew,s),a=null!==(e=r.size)&&void 0!==e?e:Ew.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=df.symbol(Object.assign({x:s.x,y:s.y},o));l.name=ww.axisBreakSymbol;const h=df.symbol(Object.assign({x:n.x,y:n.y},o));h.name=ww.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=df.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=ww.background,n.id=this._getNodeId("background"),n.states=z({},Cw,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new JM(Object.assign({},t));e.name=ww.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=JC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:z({},Cw,l),symbol:z({},Cw,l)});const d=new Aw(c);d.name=ww.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return ut(t[0],0)?ut(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=s,p=JC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+P(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let w,T,{angle:C}=p;if(w="start"===n?"start":"end"===n?"end":"center",d(C)&&o){C=HM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else w=this.getTextAlign(M),T=this.getTextBaseline(M,!1);let B=u;if(d(B)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(C!==Math.PI/2){const t=Math.abs(Math.cos(null!=C?C:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=s-S;else if(C&&0!==C){const t=Math.abs(Math.sin(C));B=t<1e-6?1/0:this.attribute.end.y/t}else B=s-S}const E=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:B,textStyle:Object.assign({textAlign:w,textBaseline:T},a),state:{text:z({},Cw,c.text),shape:z({},Cw,c.shape),panel:z({},Cw,c.background)}});return E.angle=C,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=s,p=JC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(d(b)&&a){b=HM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=u,k=h?h(c):c,A=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:k});return A.angle=b,l&&l.visible&&(A.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),A}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return ut(t[1],0)?i=!ut(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return tT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return eT(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=Y(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(E(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=re(e)})),Jw(i,t),!Zw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!k(i))return;const a=t[0].attribute.angle,o=Ow(a),l=Rw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=sT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Gt(c,i))}}else{if(l){const i=sT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Gt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);iT(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&qw(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=df.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=ww.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=NM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ni(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}QC.defaultAttributes=Bw,U(QC,nT);class tB{isInValidValue(t){const{startAngle:e=pM,endAngle:i=gM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=pM,endAngle:i=gM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return le(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return Dw(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function eB(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=eB(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var nB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=Fw(n,l,c,e,i);h=df.path(Object.assign(Object.assign({},a.style),{path:zw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=df.circle(t)}h.name=ww.line,h.id=this._getNodeId("line"),E(a.state)||(h.states=z({},Cw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:u={}}=a,p=nB(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=P(this.attribute.label,"style.fontSize",12)+P(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let _="middle",{position:y}=this.attribute.title;d(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},Cw,u.text),shape:z({},Cw,u.shape),panel:z({},Cw,u.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(ut(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=eB(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&iB(e,c,i)}else e.AABBBounds.width()>r&&iB(e,r,i)}else o>a.x&&h.x2>n.x2?(iB(e,n.x2-o,i),r&&sB(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return ut(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}rB.defaultAttributes=Bw,U(rB,tB);const aB=t=>t.map(((t,e)=>({index:e,value:t}))),oB=(t,e,i=0)=>{const s=new He(t).expand(i/2),n=new He(e).expand(i/2);return s.intersects(n)},lB=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=re(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=VM(a),_=t.range();let y=[];for(let i=0;i{dB[t]=!0}));const mB=t=>-Math.log(-t),vB=t=>-Math.exp(-t),_B=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,yB=t=>10===t?_B:t===Math.E?Math.exp:e=>Math.pow(t,e),bB=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),xB=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),SB=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function kB(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 AB(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function MB(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function wB(t,e,i,s){return 1===i&&(i=0),MB(t,i,s)*(e/(1-i))}function TB(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function CB(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class EB{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=TB(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=mt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const PB=Symbol("implicit");class RB extends EB{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=cB.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=PB}clone(){const t=(new RB).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==PB)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return OB(t,e,r,n)}class LB extends RB{constructor(t){super(),this.type=cB.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=wB(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[tt(t[0]),tt(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[tt(t[0]),tt(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:IB(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return IB(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=_t(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&x(this._userBandwidth)}clone(){var t,e,i;return new LB(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:DB}=si;function FB(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return St(t,e);if("string"===i){if(s=ti.parseColorString(e)){const e=DB(ti.parseColorString(t),s);return t=>e(t).formatRgb()}return St(Number(t),Number(e))}return e instanceof ei?DB(t,e):e instanceof ti?DB(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):St(Number(t),Number(e))}class zB extends EB{constructor(t=fB,e=fB){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=fB,this._piecewise=AB,this._interpolate=FB}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),St)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,tt);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=_t(i[0],i[r-1])),this._piecewise=r>2?CB:AB,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:fB),this.rescale(i)):this._clamp!==fB}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const jB=Math.sqrt(50),HB=Math.sqrt(10),VB=Math.sqrt(2),NB=[1,2,5,10],WB=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=XB(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),J(0,e).map((t=>n+t*s))):t>0?GB(0,-(e-1)/s,s):GB((e-1)/s,0,s)},UB=ft(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return WB(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return WB(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=GB(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=GB(t,e,l);return n&&r.reverse(),r})),XB=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=NB[0];return i>=jB?s=NB[3]:i>=HB?s=NB[2]:i>=VB&&(s=NB[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function $B(t,e,i){const s=(e-t)/Math.max(0,i);return XB(s)}function KB(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=$B(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function ZB(t,e){const i=x(e.forceMin),s=x(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const JB=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),QB=ft(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),tE=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=YB(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?JB(t,e,n):JB(t,e,BB(n)),h=JB(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),eE=ft(((t,e,i,s,n)=>KB(s(t),s(e),i).map((t=>BB(n(t))))));class iE extends zB{constructor(){super(...arguments),this.type=cB.Linear}clone(){var t;const e=new iE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return UB(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=YB(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return KB(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function nE(t){return e=>-t(-e)}function rE(t=Number.EPSILON){return e=>Math.max(e,t)}class aE extends zB{constructor(){super(bB(10),yB(10)),this.type=cB.Log,this._limit=rE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new aE).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=bB(this._base),s=yB(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=nE(i),this._pows=nE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=mB,this.untransformer=vB):(this._logs=i,this._pows=s,this._limit=rE(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return fB}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return QB(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return tE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return eE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return eE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(aE,sE);class oE extends iE{constructor(){super(xB(1),SB(1)),this.type=cB.Symlog,this._const=1}clone(){return(new oE).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=xB(t),this.untransformer=SB(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return QB(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return tE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return eE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return eE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(oE,sE);class lE{constructor(){this.type=cB.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!d(t)&&k(+t)?this._range[at(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new lE).domain(this._domain).range(this._range).unknown(this._unknown)}}function hE(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function cE(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!uB(t.type))return aB(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return aB([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(u(h))m=hE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=hE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=hE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=hB(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=hB(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?uE.greedy:uE.parity;for(;l.length>=3&&Hw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;jw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),cE(t,l,a,(e=>jw(e,t,i))),cE(n,l,o,(e=>jw(e,n,i)||!(!a||e===t)&&jw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return aB(m)},uE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&jw(i,t,e)||(i=t,0))))}},pE=(t,e,i,s)=>{const n=hB(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},gE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,fE=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?aB([s[s.length-1]]):aB([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(g),a=X(g);if(s.length<=f/n){const i=pE(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=vE(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=pE(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!gE(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?fE(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=VM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=le({x:0,y:0},i,t),a=Lw(r,Dw(s,r,e,n));return o=a,l=Dw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(ut(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return aB(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=_E(t,i,e),r=$(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=bE(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return aB(d)},bE=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&oB(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},xE=new Uint32Array(33),SE=new Uint32Array(33);SE[0]=0,xE[0]=~SE[0];for(let t=1;t<=32;++t)SE[t]=SE[t-1]<<1|1,xE[t]=~SE[t];function kE(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&xE[31&o]&SE[1+(31&l)])return!0}else{if(i[h]&xE[31&o])return!0;if(i[c]&SE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,xE[31&o]&SE[1+(31&l)]);else for(s(h,xE[31&o]),s(c,SE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,SE[31&a]|xE[1+(31&o)]);else for(n(l,SE[31&a]),n(h,xE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function AE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=mt(i,-o,t.width+l),d=mt(s,-o,t.width+l),u=mt(n,-a,t.height+h),p=mt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function ME(t,e,i=!1){return i?AE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function wE(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=ME(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=AE(t,r)),e.getRange(r)))}function TE(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>u(t))),p=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return TE(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return TE(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return TE(t,e,n,s,h,d)}return!1}const BE=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],EE=["top","inside-top","inside"];function PE(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const RE={mode:"same-time",duration:300,easing:"linear"};function OE(t){return 3===t||4===t}function IE(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const LE=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function DE(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}var FE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const HE=(t,e)=>Math.ceil(t)>Math.floor(e),VE=([t,e],[i,s])=>s>t&&e>i;function NE(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var WE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(mM.hover,!0),TM(this,(t=>{t===e||E(t.states)||t.addState(mM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(TM(this,(t=>{E(t.states)||(t.removeState(mM.hoverReverse),t.removeState(mM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void TM(this,(t=>{E(t.states)||(t.removeState(mM.selectedReverse),t.removeState(mM.selected))}));E(e.states)||(e.addState(mM.selected,!0),TM(this,(t=>{t===e||E(t.states)||t.addState(mM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===$o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===$o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(xe(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[DE(g,f,c,d,a,o),DE(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=df.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Nl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(c(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=c(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],u=o;if(!h(e)&&c(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?u.push(i):l.push(i)}))}c(r)?o=r(u,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(u).concat(l)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return GM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=c(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&HE(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&HE(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(ut(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(NE([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!VE([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(ME(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{v(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(ME(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(ME(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{GE[t]=e};var XE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}$E.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const KE=()=>{YE("symbol",$E),YE("line-data",$E)};var qE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}ZE.tag="rect-label",ZE.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var JE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};QE.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const tP=()=>{YE("line",QE),YE("area",QE)};var eP=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=pe(h.endAngle-d/2),g=le(c,h.outerRadius,o),f=le(c,a+e.line.line1MinLength,o),m=new iP(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=le(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):OE(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=le(t.circleCenter,v,t.middleAngle),t.labelLimit=f,pt(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=OE(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=OE(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(gt(t.pointB.x,this._line2MinLength+h)||pt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=OE(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?d(h)||"auto"===h?"edge"===c?OE(t.quadrant)?"left":"right":OE(t.quadrant)?"right":"left":h:d(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(OE(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(ut(l/2,u))g=0,f=1,m=-p;else if(ut(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?ut(v[0].y,v[1].y)?pt(t.middleAngle,-Math.PI)&>(t.middleAngle,0)||pt(t.middleAngle,Math.PI)&>(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function aP(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ne.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function oP(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=zw(t,!!n),o=zw(r,!!n);const h=ne.distancePP(s,l),c=ne.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=aP(e,t,!1,!!n),o=aP(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=zw(t,!!n),o=zw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}rP.defaultAttributes={pickable:!1};class lP extends hb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&Iw(this._innerView),this.removeAllChild(!0),this._innerView=df.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return Lw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${ww.grid}-sub`:`${ww.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=zw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=aP(t,o,!1,!!a)}const u=df.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:lP.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=zw(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),_=df.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ft/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:lP.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!ut(a.value,0)&&!ut(l.value,0),d=!ut(a.value,1)&&!ut(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}lP.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},XA(),QA();class hP extends lP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lP.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=pM,endAngle:r=gM}=this.attribute;i=Fw(t,s,ne.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(hP,nT);var cP,dP,uP,pP=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(gP,tB),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(cP||(cP={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(dP||(dP={})),function(t){t.dataZoomChange="dataZoomChange"}(uP||(uP={}));const fP="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",mP={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:fP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:fP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},vP={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}},_P=0,yP=1,bP=2,xP=3,SP=4,kP=5,AP=5,MP=999,wP=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var TP=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:bP},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:bP},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:_P},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w;const{orient:T,middleHandlerStyle:C={},startHandlerStyle:B={},endHandlerStyle:E={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=B.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=E.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t,zIndex:kP},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:kP},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=B.symbolType)&&void 0!==c?c:"square"},vP.horizontal),{zIndex:kP}),B),{pickable:!P&&(null===(d=B.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=E.symbolType)&&void 0!==u?u:"square"},vP.horizontal),{zIndex:kP}),E),{pickable:!P&&(null===(p=E.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:MP},vP.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:MP},vP.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===T?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D,zIndex:kP},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===T?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:kP},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(k=B.symbolType)&&void 0!==k?k:"square"},vP.vertical),{zIndex:kP}),B),{pickable:!P&&(null===(A=B.pickable)||void 0===A||A)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(M=E.symbolType)&&void 0!==M?M:"square",zIndex:kP},vP.vertical),E),{pickable:!P&&(null===(w=E.pickable)||void 0===w||w)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:MP},vP.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:MP},vP.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:xP},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:xP},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:yP},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:SP},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new je).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=TP(c,["formatMethod"]),{formatMethod:g}=d,f=TP(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,k={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let A,M,w,T;this._isHorizontal?(A={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},w={textAlign:wP(k,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},T={textAlign:wP(k,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:wP(k,t,"start",this._isHorizontal)?"top":"bottom"},T={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:wP(k,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),z({},p,{text:x,x:A.x,y:A.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:AP}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),z({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:AP}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new JM(e),s.name=i,t.add(s)),s}}const BP={debounce:bt,throttle:xt};class EP extends o{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=cP.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=cP.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=cP.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=cP.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=cP.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===O_.env?O_:this.stage,s=bM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===cP.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===cP.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===cP.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===cP.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(dP.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(dP.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(dP.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===cP.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(dP.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(dP.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:BP[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===O_.env?O_:this.stage,e=bM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===O_.env?O_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===O_.env?O_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:mt(e+t,0,1),end:mt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=cP.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}qM(),sM(),hM(),VA(),ZA();let PP=class t extends hb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new CP(this._getRendererAttrs()),this._interaction=new EP(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(dP.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(dP.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(uP.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(dP.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;u(t)&&u(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(uP.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...G(a))}setPreviewPointsX(t){c(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._renderer.statePointToData=t)}};var RP,OP,IP,LP;function DP(){XA(),qM(),OT()}PP.defaultAttributes=mP,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(RP||(RP={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(OP||(OP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(IP||(IP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(LP||(LP={}));class FP extends hb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Vw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Nw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Ww(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=df.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=df.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=df.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function zP(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function jP(t,e,i,s){t&&(zP(t.startSymbol,e,i,s),t.lines.forEach((t=>zP(t,e,i,s))),zP(t.line,e,i,s),zP(t.endSymbol,e,i,s))}function HP(t,e,i,s){t&&(zP(t.getTextShape(),e,i,s),zP(t.getBgRect(),e,i,s))}function VP(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function NP(t,e,i,s){t&&(VP(t.startSymbol,e,i,s),t.lines.forEach((t=>VP(t,e,i,s))),VP(t.line,e,i,s),VP(t.endSymbol,e,i,s))}function WP(t,e,i,s){t&&(VP(t.getTextShape(),e,i,s),VP(t.getBgRect(),e,i,s))}function UP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;zP(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),zP(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;zP(t.getTextShape(),e,l,n),zP(t.getBgRect(),e,l,n)}))}function GP(t,e,i,s,n){jP(t,s,i,n),G(e).forEach((t=>{HP(t,s,i,n)}))}function YP(t,e,i,s,n){zP(t,s,i,n),G(e).forEach((t=>{HP(t,s,i,n)}))}function XP(t,e,i,s,n){zP(t,s,i,n),G(e).forEach((t=>{HP(t,s,i,n)}))}function $P(t,e,i,s,n,r){var a;jP(t,n,s,r),zP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?HP(i,n,s,r):zP(i,n,s,r)}function KP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;zP(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),zP(e,n+o+l,h,r),zP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(zP(i.getTextShape(),n+o+l+h+c,d,r),zP(i.getBgRect(),n+o+l+c,d,r)):zP(i,n+o+l+c,d,r)}function qP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?UP(t,e,s,r,a):"fadeIn"===i&&GP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?UP(t,e,s,n,a):"fadeIn"===i&&GP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){NP(t,s,i,n),G(e).forEach((t=>{WP(t,s,i,n)}))}(t,e,i,s,n)}}function ZP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&YP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&YP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){VP(t,s,i,n),G(e).forEach((t=>{WP(t,s,i,n)}))}(t,e,i,s,n)}}function JP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&XP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&XP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){VP(t,s,i,n),G(e).forEach((t=>{WP(t,s,i,n)}))}(t,e,i,s,n)}}function QP(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?$P(n,r,e,i,s,o):"callIn"===t&&KP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?$P(n,r,e,i,s,a):"callIn"===t&&KP(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;NP(t,n,s,r),VP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?WP(i,n,s,r):VP(i,n,s,r)}(n,r,e,t,i,s)}}const tR={type:"clipIn",duration:500,easing:"linear",delay:0},eR={type:"fadeIn",duration:500,easing:"linear",delay:0},iR={type:"callIn",duration:500,easing:"linear",delay:0},sR={type:"fadeOut",duration:500,easing:"linear",delay:0};class nR{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new JM(Object.assign(Object.assign({},h),{state:{panel:z({},vM,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},vM,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},vM,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},vM,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class rR extends FP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=tR,this.defaultExitAnimation=sR}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;KM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U(rR,nR);const aR=.001,oR={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:RP.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]}},lR={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},hR={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:IP.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},cR={interactive:!0,label:{position:OP.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}},dR={interactive:!0,label:{autoRotate:!0,position:IP.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},uR={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},pR={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},gR={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function fR(){mR._animate=qP}DP(),Sw(),OT();class mR extends rR{markerAnimate(t){mR._animate&&this._animationConfig&&mR._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mR.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(BM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return EM(Math.abs(e),Math.PI/2,aR)||EM(Math.abs(e),3*Math.PI/2,aR)?PM(i,e,t):BM(e)?lR.postiveXAxis[t]:lR.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new Aw({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},vM,null==a?void 0:a.line),startSymbol:z({},vM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},vM,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},vM,null==a?void 0:a.line),startSymbol:z({},vM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},vM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",mR.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(mR.defaultAttributes.label)}}function vR(){_R._animate=ZP}mR.defaultAttributes=oR,DP(),eM(),OT();class _R extends FP{markerAnimate(t){_R._animate&&this._animationConfig&&_R._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},_R.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=eR,this.defaultExitAnimation=sR}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},pR[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;KM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=df.polygon(Object.assign({points:e},i));n.states=z({},vM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",_R.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},vM,null==i?void 0:i.area)),this._updateMarkLabels(_R.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}_R.defaultAttributes=cR,U(_R,nR),DP(),kw(),OT();class yR extends rR{markerAnimate(t){yR._animate&&this._animationConfig&&yR._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yR.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case IP.arcInnerStart:l=n;case IP.arcOuterStart:l=n;break;case IP.arcInnerEnd:l=r;case IP.arcOuterEnd:l=r;break;case IP.center:case IP.arcInnerMiddle:case IP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return uR[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new Mw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},vM,null==o?void 0:o.line),startSymbol:z({},vM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},vM,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},vM,null==o?void 0:o.line),startSymbol:z({},vM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},vM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",yR.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(yR.defaultAttributes.label)}}yR.defaultAttributes=hR,DP(),jA(),OT();class bR extends FP{markerAnimate(t){bR._animate&&this._animationConfig&&bR._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},bR.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=eR,this.defaultExitAnimation=sR}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case IP.center:h=(s+n)/2,c=(r+a)/2;break;case IP.arcInnerStart:h=s,c=r;break;case IP.arcOuterStart:h=n,c=r;break;case IP.arcInnerEnd:h=s,c=a;break;case IP.arcOuterEnd:h=n,c=a;break;case IP.arcInnerMiddle:h=s,c=(r+a)/2;break;case IP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},uR[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;KM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=df.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},vM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",bR.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},vM,null==o?void 0:o.area)),this._updateMarkLabels(bR.defaultAttributes.label)}isValidPoints(){return!0}}function xR(){SR._animate=QP}bR.defaultAttributes=dR,U(bR,nR),DP(),Sw(),kw(),hM(),KA(),ZA(),OT();class SR extends FP{markerAnimate(t){SR._animate&&this._animationConfig&&SR._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},SR.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=iR,this.defaultExitAnimation=sR,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return EM(Math.abs(s),Math.PI/2,aR)||EM(Math.abs(s),3*Math.PI/2,aR)?PM(t,s,n):BM(s)?gR.postiveXAxis[n]:gR.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=LP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},vM,null==p?void 0:p.textBackground),text:z({},vM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},vM,null==p?void 0:p.itemContent));const v=BM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=df.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},vM,null==s?void 0:s.itemContent)):"text"===n?o=new JM(Object.assign(Object.assign({},i),{state:{panel:z({},vM,null==s?void 0:s.textBackground),text:z({},vM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=df.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},vM,null==s?void 0:s.itemContent)):"image"===n?(o=df.image(Object.assign(Object.assign({},i),r)),o.states=z({},vM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},vM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=EM(c,0,aR)||EM(d,0,aR),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=XM(e-u,t-d),o=XM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(PR.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(PR.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===PR.focus||"focus"===o){const s=a.hasState(BR.focus);a.toggleState(BR.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[BR.unSelected,BR.unSelectedHover,BR.focus],t),this._setLegendItemState(e,BR.selected,t)})):(this._setLegendItemState(a,BR.selected,t),this._removeLegendItemState(a,[BR.unSelected,BR.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[BR.selected,BR.selectedHover,BR.focus],t),this._setLegendItemState(e,BR.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(BR.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(BR.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(ER.legendItemClick,a,t);i?(this._removeLegendItemState(a,[BR.selected,BR.selectedHover],t),this._setLegendItemState(a,BR.unSelected,t)):(this._setLegendItemState(a,BR.selected,t),this._removeLegendItemState(a,[BR.unSelected,BR.unSelectedHover],t))}else this._setLegendItemState(a,BR.selected,t),this._removeLegendItemState(a,[BR.unSelected,BR.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[BR.selected,BR.selectedHover],t),this._setLegendItemState(e,BR.unSelected,t))}))}this._dispatchLegendEvent(ER.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,BR.selected),this._removeLegendItemState(e,[BR.unSelected,BR.unSelectedHover])):(this._removeLegendItemState(e,[BR.selected,BR.selectedHover]),this._setLegendItemState(e,BR.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=wR,spaceRow:l=TR,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:k,pages:A}=this._itemContext,M=0,w=0;const T=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(A=Math.ceil((S+g)/s),b=A>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||T.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),A+=1,S=0,k+=w+l,w=0,T.length=0))),0===S&&0===k||i.setAttributes({x:S,y:k}),S+=o+g,w=Math.max(w,m),T.push(i)):(u(v)&&(f&&a?(A=Math.ceil((k+m)/v),b=A>1):v<=m?(A+=1,b=!0,k=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=k,this._itemContext.maxWidthInCol=x,this._itemContext.pages=A,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=A),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=df.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=$(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";p(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";p(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:p,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),k=this._handleStyle(y,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=ni(c);let T;!1===x.visible?(T=df.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,PR.item,t,T)):(T=df.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,PR.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?BR.selected:BR.unSelected);const C=df.group({x:0,y:0,pickable:!1});T.add(C);let B,E=0,R=0,O=0;if(v&&!1!==v.visible){const i=P(S,"style.size",10);R=_(i)?i[0]||0:i,O=P(v,"space",8);const s=df.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,PR.itemShape,t,T,S.state),s.addState(e?BR.selected:BR.unSelected),C.add(s)}let I=0;if(p){const e=P(g,"size",10);B=df.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,PR.focus,t,T),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=GM(Object.assign(Object.assign({x:R/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=k.style)||void 0===r?void 0:r.fontSize},k.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,PR.itemLabel,t,T,k.state),D.addState(e?BR.selected:BR.unSelected),C.add(D);const F=P(y,"space",8);if(u(l)){const s=P(b,"space",p?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=GM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:A.style.fontSize},A.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,PR.itemValue,t,T,A.state),r.addState(e?BR.selected:BR.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-R-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-R/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-R-O-I),E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);B&&(B.setAttribute("x",E),C.add(B));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=z.height(),V=u(this.attribute.item.width)?this.attribute.item.width:j+w[1]+w[3],N=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=V,T.attribute.height=N,B&&B.setAttribute("visible",!1),C.translateTo(-z.x1+w[3],-z.y1+w[0]),T}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new MR(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new MR(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new SM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new SM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",xt(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=wR,spaceRow:o=TR}=n,l=this._itemsContainer,{space:h=CR,defaultCurrent:c=1}=r,d=LR(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=df.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=wR,spaceRow:a=TR}=s,o=this._itemsContainer,{space:l=CR,defaultCurrent:h=1}=n,c=LR(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=df.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=df.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];ut(mt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),ut(mt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(BR.selected)?this._setLegendItemState(t,BR.selectedHover,e):this._setLegendItemState(t,BR.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===PR.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(ER.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(BR.unSelectedHover)||t.hasState(BR.selectedHover))&&(i=!0),t.removeState(BR.unSelectedHover),t.removeState(BR.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(BR.unSelectedHover)&&!t.hasState(BR.selectedHover)||(i=!0),t.removeState(BR.unSelectedHover),t.removeState(BR.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===PR.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(ER.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(ER.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==PR.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(ER.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==PR.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(ER.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(BR.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},DR,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(BR.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(c(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var zR;function jR(t){return _(t)?t:[t,t]}function HR(t){return t?"ew-resize":"ns-resize"}FR.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:wR,spaceRow:TR,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:CR,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"}(zR||(zR={})),OR();class VR extends hb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},VR.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=mt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=bM(),n="browser"===O_.env?O_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=mt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=bM(),n="browser"===O_.env?O_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?mt(t+p,h,c):mt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?mt(t+p,0,c-h):mt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(u(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=G(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:jR(p)[0],endValue:jR(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=df.group({x:0,y:0});f.name=zR.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=df.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=zR.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=df.group({x:g?v:0,y:g?0:v});f.add(_);const y=df.group({x:0,y:0});let b;if(y.name=zR.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=df.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=zR.endText,f.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=df.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=zR.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=jR(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":HR(p)},r));if(v.name=zR.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=zR.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":HR(p)},r));if(i.name=zR.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=zR.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=vt(h,i,s);c=t[0],u=t[1]}else c=i,u=mt(h,i,s);const g=this._isHorizontal;e||(c=i);const f=df.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=zR.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":HR(g);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(u,e?"end":"start"),b=df.rect(Object.assign({x:g?Math.min(_,y):0,y:g?0:Math.min(_,y),width:g?Math.abs(y-_):r,height:g?n:Math.abs(y-_),cursor:v},a));b.name=zR.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return df.symbol(t)}_renderHandlerText(t,e){return df.text(this._getHandlerTextAttributes(t,e))}_getHandlerPosition(t){return this.attribute.range&&t?"start":"end"}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return c(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":HR(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=df.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=df.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===O_.env?O_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=bM(),e="browser"===O_.env?O_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const n=t.name===zR.startHandler?this._startHandlerText:this._endHandlerText;if(n){const e=this._getHandlerPosition(t.name===zR.startHandler);n.setAttributes(this._getHandlerTextAttributes(i,e))}t.name===zR.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){const s=this._isHorizontal,n=this._getHandlerPosition(t.name===zR.startHandlerText);t.setAttributes(this._getHandlerTextAttributes(i,n));const r=t.name===zR.startHandlerText?this._startHandler:this._endHandler;r&&r.setAttributes({[s?"x":"y"]:e}),t.name===zR.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===O_.env?O_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}VR.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},IR(),OR();class NR extends RR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NR.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function WR(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}NR.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},IR(),OR(),QA();class UR extends RR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UR.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=df.group({x:0,y:0});this._innerView.add(x);const S=new VR({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:WR(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let k,A=0;"horizontal"===e?"top"===i?(k=`M0,0L${a},0L${b?0:a},12Z`,A=o):(k=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?k=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(k=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=df.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}UR.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}},XA(),dM(),rM();let GR=class t extends hb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y,b,x;const{textType:S,text:k,subtextType:A,textStyle:M={},subtext:w,subtextStyle:T={},width:C,height:B,minWidth:E,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=ni(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||u(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:k},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:k},_M),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(k)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(k)?k:[k],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==T.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=T,v=Math.max(Number.MIN_VALUE,O-H);if("rich"===A||u(T.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=T.character)&&void 0!==h?h:w},T);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===A){const o=Object.assign({html:Object.assign(Object.assign({dom:w},_M),T),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},T);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(w)?w:[w],whiteSpace:"normal"},T),{maxLineWidth:null!==(p=T.maxLineWidth)&&void 0!==p?p:C,heightLimit:null!==(g=T.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(V,W),G=H+(null!==(f=T.height)&&void 0!==f?f:N);if(u(C)&&(U=C),u(B)&&(G=B),u(E)&&UP&&(U=P),u(R)&&GO&&(G=O),z.attribute.width=U,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(m=M.width)&&void 0!==m?m:U;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(T.align)){const t=T.align?T.align:I,e=null!==(y=null!==(v=T.width)&&void 0!==v?v:M.width)&&void 0!==y?y:U;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=T.verticalAlign?T.verticalAlign:L,e=this._mainTitle?u(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=T.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};GR.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 YR={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};XA(),dM(),rM();let XR=class extends hb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},P(YR,n),e.style,{visible:e.visible});a.lineHeight=u(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=GM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const p=NM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",u(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",u(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class $R extends wg{constructor(t){super(t)}}var KR,qR;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(KR||(KR={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(qR||(qR={}));class ZR extends hb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZR.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"},ZR.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"},ZR.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},ZR.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},ZR.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{d(this._playController)&&(this._playController=new $R(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new $R(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new $R(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(KR.OnPlay)},this.pause=()=>{this._dispatchEvent(KR.OnPause)},this.forward=()=>{this._dispatchEvent(KR.OnForward)},this.backward=()=>{this._dispatchEvent(KR.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}ZR.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},ZR.defaultAttributes={[qR.Start]:{},[qR.Pause]:{},[qR.Backward]:{},[qR.Forward]:{}};const JR={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},QR=[200,10];var tO,eO;!function(t){t.Default="default",t.Reverse="reverse"}(tO||(tO={})),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"}(eO||(eO={}));const iO=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===tO.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===tO.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),sO=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===tO.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===tO.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),nO=t=>"top"===t||"bottom"===t;class rO extends hb{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},rO.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Ut(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(nO(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:QR[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:QR[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new VR(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=nO(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new ZR(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=nO(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:QR[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Ut(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(nO(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Ut(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:nO(this._orient)?t+s:(this._size.width-r)/2,y:nO(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:nO(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:nO(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Ut(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:nO(this._orient)?t+s:(this._size.width-r)/2,y:nO(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function aO(){OR(),XA(),hM()}rO.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({},JR),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},JR),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},JR),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},JR),{key:"backward",position:"start"})}},aO();class oO extends rO{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:tO.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(KR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(KR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(KR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(KR.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(eO.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(iO({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||sO({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===tO.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(eO.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=O_.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(eO.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(eO.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=O_.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(),O_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(eO.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(eO.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(eO.change),this.dispatchCustomEvent(eO.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var lO,hO=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};aO();class cO extends rO{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(KR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(KR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(KR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(KR.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(eO.change))},this.play=()=>hO(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(eO.play),this._rafId=O_.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=O_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(eO.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(eO.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(eO.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(eO.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}(lO||(lO={}));const dO={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},uO=5;const pO={debounce:bt,throttle:xt};XA(),eM();let gO=class t extends hb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=dO.updateTrigger,endTrigger:i=dO.endTrigger,brushMoved:s=!0}=this.attribute;G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:pO[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(lO.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=dO.trigger,resetTrigger:e=dO.resetTrigger}=this.attribute;G(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(lO.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(lO.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=uO}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(lO.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(lO.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent(lO.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=uO}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(lO.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(lO.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=dO.updateTrigger,endTrigger:e=dO.endTrigger}=this.attribute;G(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=df.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Ee(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};gO.defaultAttributes=dO;const fO=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},mO=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:G(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},vO={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:fM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:fM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:fM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new He).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},_O=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];XA(),sM(),hM(),dM(),rM();let yO=class t extends hb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ni(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:CM(p)&&CM(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:CM(p)&&CM(p.value)},mO(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:CM(p)&&CM(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:CM(p)&&CM(p.value)},mO(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},_M),p.value),visible:CM(p)&&CM(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=CM(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const _=CM(p)?p.height+p.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!CM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let p="right"===c?(o?d:0)+(CM(n.key)?r+n.key.spacing:0)+(CM(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(YM(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:CM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),YM(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(CM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=nd(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(CM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},mO(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},mO(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},_M),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(CM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},mO(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},mO(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>_O.includes(t)))?(this._mergeAttributes(e,s),d(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&CM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=CM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=VM(d),_=VM(u);let y=0;if(CM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(CM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&lu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return fO({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return fO({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};yO.defaultAttributes=vO;const bO=ut;function xO(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function SO(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function kO(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function AO(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function MO(t,e){const i=AO(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function wO(t,e){const i=TO(t),s=TO(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function TO(t,e={x:0,y:0}){return ne.distancePP(t,e)}function CO(t){return k(t.x)&&k(t.y)}function BO(t,e,i){let s=!1;if(e&&c(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function EO(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const PO=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function OO(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&OO(t[i],e)}}var IO,LO,DO;function FO(t){var e,i;const{type:s}=t;return s===LO.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(IO||(IO={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(LO||(LO={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(DO||(DO={}));const zO={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},jO={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function HO(t,e){var i;if(!t)return[];const s=XO(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?GO(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>UO(i)?NO(t,i,e):i)).filter(u)}))):i.map((i=>UO(i)?NO(t,i,e):i)).filter(u):[]}return[]}function VO(t,e){var i,s;return GO(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function NO(t,e,i){var s;const n=XO(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=zO[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=jO[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new ti(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ge(t,i,s),a=Ue(n,r,e.l),l=new ti(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const WO=(t,e)=>{if(e&&UO(t)){const i=NO(e,t);if(i)return i}return t};function UO(t){return t&&"palette"===t.type&&!!t.key}function GO(t){return!(!_(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function YO(t){return _(t)?{dataScheme:t}:t}function XO(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=FO(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class $O extends RB{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(!GO(this._range))return void super.range(this._range);const t=VO(this._range,this._domain);super.range(t)}}const KO={linear:iE,band:LB,point:class extends LB{constructor(t){super(!1),this.type=cB.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:RB,threshold:lE,colorOrdinal:$O};function qO(t){const e=KO[t];return e?new e:null}function ZO(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function JO(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function QO(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function tI(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function eI(t){return!!v(t)&&(!!t.endsWith("%")&&ab(t.substring(0,t.length-1)))}function iI(t){return!!p(t)&&("percent"in t||"offset"in t)}function sI(t,e,i,s=0){var n,r;return x(t)?t:eI(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function nI(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=sI(t[s],e.size,i)}))})),o}function rI(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function aI(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||eI(t)||c(t)||iI(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function oI(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const lI=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},hI=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function cI(t,e){return t&&e.key in t?t[e.key]:e.default}function dI(t){return t&&"token"===t.type&&!!t.key}const uI={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},pI={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:hI,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:uI,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},gI={name:"dark",colorScheme:{default:{dataScheme:hI,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},fI=(t,e)=>t===e||!c(t)&&!c(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>fI(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>fI(t[i],e[i])))),mI=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),mI(t[s],e.slice(1),i))},vI=t=>t instanceof Ba||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(t);function _I(t,e=["data"]){return I(t,vI,e)}function yI(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=YO(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}bI._charts={},bI._series={},bI._components={},bI._graphicComponents={},bI._marks={},bI._regions={},bI._animations={},bI._implements={},bI._chartPlugin={},bI._vChartPlugin={},bI._componentPlugin={},bI.transforms={fields:Gr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},bI.dataParser={csv:(t,e={},i)=>(i.type=Ur.DSV,ia(t)),dsv:(t,e={},i)=>{i.type=Ur.DSV;const s=jr(na,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return ea(n).parse(t)},tsv:(t,e={},i)=>(i.type=Ur.DSV,sa(t))},bI._layout={},bI._grammarTransforms={},bI._stageEventPlugins={},bI.registerStageEventPlugin=(t,e)=>{bI._stageEventPlugins[t]=e},bI.getStageEventPlugin=t=>bI._stageEventPlugins[t],bI._interactionTriggers={},bI.registerInteractionTrigger=(t,e)=>{bI._interactionTriggers[t]=e},bI._composedEventMap={},bI.registerComposedEvent=(t,e)=>{bI._composedEventMap[t]=e},bI._tooltipProcessors={},bI.registerTooltipProcessor=(t,e)=>{bI._tooltipProcessors[t]=e},bI.createTooltipProcessor=(t,e)=>{const i=bI._tooltipProcessors[t];return i?new i(e):null};const kI=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},AI=kI(),MI={[pI.name]:pI},wI=pI.name,TI=new Map(Object.keys(MI).map((t=>[t,MI[t]]))),CI=new Map,BI=new Map(Object.keys(MI).map((t=>[t,t===wI]))),EI=(t,e)=>{if(!t)return;const i=II(e);TI.set(t,i),BI.set(t,!0)},PI=(t=wI)=>(BI.has(t)&&!BI.get(t)&&EI(t,TI.get(t)),TI.get(t)),RI=t=>TI.delete(t)&&CI.delete(t)&&BI.delete(t),OI=t=>!!v(t)&&TI.has(t),II=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:wI;return xI({},PI(i),t)};class LI{static registerInstance(t){LI.instances.set(t.id,t)}static unregisterInstance(t){LI.instances.delete(t.id)}static getInstance(t){return LI.instances.get(t)}static instanceExist(t){return LI.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return LI.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}LI.instances=new Map;class DI{static registerTheme(t,e){EI(t,e)}static getTheme(t,e=!1){return PI(t)}static removeTheme(t){return RI(t)}static themeExist(t){return OI(t)}static getDefaultTheme(){return DI.themes.get(wI)}static setCurrentTheme(t){DI.themeExist(t)&&(DI._currentThemeName=t,LI.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return DI.getTheme(DI._currentThemeName,t)}static getCurrentThemeName(){return DI._currentThemeName}}function FI(t){return v(t)?DI.themeExist(t)?DI.getTheme(t):{}:p(t)?t:{}}DI.themes=TI,DI._currentThemeName=wI;const zI=["animationThreshold","colorScheme","name","padding"];function jI(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];zI.includes(n)?s[n]=r:f(r)?UO(r)?s[n]=WO(r,e):dI(r)?s[n]=cI(i,r):s[n]=jI(r,e,i):s[n]=r})),s}function HI(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=HI(t[s],e)}return i}return _(t)?t.map((t=>HI(t,e))):t}function VI(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(v(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=VI(t[s],e)}return i}return _(t)?t.map((t=>VI(t,e))):t}function NI(t,...e){return c(t)?t(...e):t}const WI=(t,e,i,s)=>((t,e,i)=>VM(t,e,i,{fontFamily:uI.fontFamily,fontSize:uI.fontSize}))(e,i,s).measure(t),UI="__VCHART",GI=500,YI=500,XI=`${UI}_MEASURE_CANVAS_ID`,$I=`${UI}_DEFAULT_DATA_INDEX`,KI=`${UI}_DEFAULT_DATA_KEY`,qI=`${UI}_DEFAULT_DATA_SERIES_FIELD`,ZI=`${UI}_DEFAULT_SERIES_STYLE_NAME`,JI=`${UI}_STACK_KEY`,QI=`${UI}_STACK_START`,tL=`${UI}_STACK_END`,eL=`${UI}_STACK_START_PERCENT`,iL=`${UI}_STACK_END_PERCENT`,sL=`${UI}_STACK_START_OffsetSilhouette`,nL=`${UI}_STACK_END_OffsetSilhouette`,rL=`${UI}_STACK_TOTAL`,aL=`${UI}_STACK_TOTAL_PERCENT`,oL=`${UI}_STACK_TOTAL_TOP`,lL=`${UI}_STACK_TOTAL_BOTTOM`,hL=`${UI}_MOSAIC_VALUE_START_PERCENT`,cL=`${UI}_MOSAIC_VALUE_END_PERCENT`,dL=`${UI}_MOSAIC_CAT_START_PERCENT`,uL=`${UI}_MOSAIC_CAT_END_PERCENT`,pL=`${UI}_SEGMENT_START`,gL=`${UI}_SEGMENT_END`,fL=`${UI}_KEY`,mL=`${UI}_MAP_LOOK_UP_KEY`;function vL(t,e){for(let i=0;it.key===e))}function yL(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function bL(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},ML(t,a,n[o],l,e,r))})),s?xL(n):n}function xL(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):xL(t[e].nodes);return t}function SL(t,e){if("values"in t&&t.values.length){const i=kO(t.values,e),s=SO(t.values,iL);t.values.forEach((t=>{t[rL]=i,t[aL]=s}))}else for(const i in t.nodes)SL(t.nodes[i],e)}function kL(t){if(!t.values.length)return;const e=t.values[t.values.length-1][tL]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)AL(t.nodes[r],e,i,s,n)}function ML(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[tL]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),ML(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const wL=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=CL(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function BL(t={}){const e=Object.assign({},t);if(c(t.style)?e.style=(e,i,s,n)=>RL(t.style(e,i,s,n)):E(t.style)||(e.style=RL(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])?i[e]=(i,s,n,r)=>RL(t.state[e](i,s,n,r)):E(t.state[e])||(i[e]=RL(t.state[e]))})),e.state=i}return e}function EL(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>RL(t[i](e,s,n,r)):E(t[i])||(e[i]=RL(t[i]))})),e}function PL(t,e){if(E(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),RL(i)}function RL(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:re(t.angle)}):t}const OL=t=>"line"===t||"area"===t,IL=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return OL(i)?e:null==e?void 0:e[0]},LL=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let DL=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=bI.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(bI.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var FL;!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"}(FL||(FL={}));const zL=["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 jL,HL,VL;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleRawDomainUpdate="scaleRawDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(jL||(jL={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(HL||(HL={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(VL||(VL={}));const NL=[VL.mark,VL.model,VL.chart,VL.vchart];class WL{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(VL.vchart,[]),this._levelNodes.set(VL.chart,[]),this._levelNodes.set(VL.model,[]),this._levelNodes.set(VL.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const UL={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class GL{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=P(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>IL(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||HL.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||HL.chart);o.get(t)||o.set(t,new WL);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||HL.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||HL.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||HL.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||HL.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?NL.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[HL.chart,HL.window,HL.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&P(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return UL[a]&&(a=UL[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?VL.model:VL.vchart:VL.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=xt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=bt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=HL.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==VL.model&&s!==VL.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=VL.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case HL.chart:return this._viewBubbles;case HL.window:return this._windowBubbles;case HL.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case HL.chart:return this._viewListeners;case HL.window:return this._windowListeners;case HL.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return zL.includes(t)||Object.values(FL).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&bI.hasInteractionTrigger(e)}}function YL(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function XL(t,e,i){t.getParser(e)||t.registerParser(e,i)}const $L=new Map;let KL;function qL(){KL||(KL=new Ca,XL(KL,"geojson",Sa),XL(KL,"topojson",Aa),YL(KL,"simplify",Wr))}function ZL(t,e,i={type:"geojson",centroid:!0}){$L.has(t)&&qy(`map type of '${t}' already exists, will be overwritten.`),qL();const s=new Ba(KL),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):p(r)&&s.transform({type:"simplify",options:r}),$L.set(t,s)}function JL(t){$L.has(t)?$L.delete(t):qy(`map type of '${t}' does not exists.`)}function QL(t,e=!1){let i=e;return t.latestData instanceof Ba&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const tD=(t,e)=>0===t.length?[]:1===t.length?QL(t[0],null==e?void 0:e.deep):t.map((t=>QL(t,null==e?void 0:e.deep)));function eD(t,e,i){YL(e=e instanceof Ca?e:t.dataSet,"copyDataView",tD);const s=new Ba(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:nD.copyDataView}),s}function iD(t,e,i=[]){var s;if(t instanceof Ba)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Ba(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return qy(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return qy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),qy("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function sD(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var nD,rD,aD,oD;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(nD||(nD={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(rD||(rD={})),function(t){t.data="data",t.mark="mark"}(aD||(aD={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(oD||(oD={}));const lD=["line","area","trail"];function hD(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(fL,i?t.slice().sort(i):t.slice()),{keys:[fL],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const cD=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function dD(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{dD(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function pD(t,e,i,s){const n=hD(t,(t=>i(t))),r=hD(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const gD=`${UI}_BuiltIn_CallBack_Disappear`;var fD;!function(t){t.render="render",t.disappear="disappear"}(fD||(fD={}));class mD{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(t,e){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(jL.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(jL.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(jL.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var t,e,i,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:g,background:f}=this._option;O_.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(t=this._option.stage)&&void 0!==t?t:new X_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:g},ReactDOM:this._option.ReactDOM,autoRefresh:u(r)?r:!u(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Pp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(u(h)?h:ib(o))&&!1!==c&&bI.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,p(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=oD.before}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(O_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=O_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>dD(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>dD(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{dD(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Ky(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===oD.before&&(this._layoutState=oD.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=oD.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),Ky(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=uD(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=pD(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=pD(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=hD(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=hD(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:gD,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{dD(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===rD.appear))?rD.appear:e.every((t=>t===rD.disappear))?rD.disappear:rD.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===HL.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:IL(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===HL.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===HL.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===HL.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===HL.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===HL.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{dD(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=uD(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return eb(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return bu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{xo.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{dD(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=O_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){O_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function vD(t,i){var s;return e(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==i?void 0:i.onError)&&void 0!==s?s:Zy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function _D(t){t.crosshair=G(t.crosshair||{}).map((e=>yI({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function yD(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ri(l,i.width,i.height);a=t,o=e}else if(h&&eb(e.mode)){let t;t=v(h)?O_.getElementById(h):h;const{width:e,height:s}=ri(t,i.width,i.height);a=e,o=s}else if(sb(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function bD(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function xD(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}const SD=9,kD=0,AD=-1;var MD,wD,TD,CD,BD,ED;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(MD||(MD={})),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"}(wD||(wD={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(TD||(TD={}));class PD{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},PD.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=G(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}PD.defaultMarkInfo={};class RD{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class OD{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>yI({},i,s,t);return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class ID extends RD{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=OD,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new PD,this._lastLayoutRect=null,this.id=rb(),this.userId=t.id,this._spec=t,this.effect={},this.event=new DL(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${UI}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=bI.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!d(e))return P(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class LD{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=wD.Region,this._willLayoutTag=!0,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=nI(aI(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:sI(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:sI(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:sI(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:sI(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:sI(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:sI(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=sI(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=sI(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=sI(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(rI(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class DD extends ID{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new LD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&N(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class FD extends OD{_initTheme(t,e){return{spec:t,theme:this._theme}}}class zD extends DD{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=FD,this.modelType="region",this.specKey="region",this.type=zD.type,this._series=[],this.layoutType="region",this.layoutZIndex=MD.Region,this.seriesDataFilterOver=()=>{this.event.emit(jL.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",MD.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",TD.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:MD.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:MD.Mark+1}))}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",TD.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",TD.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",TD.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",TD.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",TD.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||G(t.userId).includes(e.userId))&&(!u(t.specIndex)||G(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function jD(t){const e=[],i=[],s=[];return t.forEach((t=>{d(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function HD(t,e,i){e?t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function VD(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function ND(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=YD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),VD(d,!0,p,l),s&&HD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function WD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=YD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=YD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),VD(d,!1,p,o),s&&HD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function GD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=YD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=YD(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jD(t);n.length&&ND(n,e,i,!1,"left",s),r.length&&ND(r,e,i,!0,"left",s),a.length&&WD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jD(t);n.length&&UD(n,e,i,!1,"top",s),r.length&&UD(r,e,i,!0,"top",s),a.length&&GD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jD(t);n.length&&ND(n,e,i,!1,"right",s),r.length&&ND(r,e,i,!0,"right",s),a.length&&WD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jD(t);n.length&&UD(n,e,i,!1,"bottom",s),r.length&&UD(r,e,i,!0,"bottom",s),a.length&&GD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=YD(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{N(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=YD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Zy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}XD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(CD||(CD={})),function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(BD||(BD={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(ED||(ED={}));const $D=["linear","radial","conical"],KD={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const qD={};Object.values(BD).forEach((t=>{qD[t]=!0})),BD.STATE_HOVER,BD.STATE_HOVER_REVERSE,BD.STATE_SELECTED,BD.STATE_SELECTED_REVERSE,BD.STATE_DIMENSION_HOVER,BD.STATE_DIMENSION_HOVER_REVERSE;class ZD extends RD{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class JD extends ZD{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];u(s.domain)&&(n.domain=s.domain),u(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,lD.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!qD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(UI)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(UI))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(uB(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class QD extends RD{constructor(){super(...arguments),this.id=rb(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=bI.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class tF extends QD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const eF=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,iF=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=eF(l.delay,n,a,o),d=eF(l.duration,n,a,o),u=eF(l.oneByOne,n,a,o),p=eF(l.splitPath,n,a,o),g=k(u)&&u>0?t=>x(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?QT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:tC)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);KT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?QT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:tC)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>GT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>XT(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:$o.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new $T({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:HT,null!==(l=i.easing)&&void 0!==l?l:VT))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:$o.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new qT({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:HT,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:VT))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):KT(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},sF=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},nF=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class rF extends QD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new tF(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Pp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:MD.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Nl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==CD.enter&&t.context.diffState!==CD.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=t,this.model=e.model,this.key=e.key,this.state=new JD(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,re)}isUserLevel(t){return[TD.User_Mark,TD.User_Series,TD.User_Chart,TD.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&yI(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(pB(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=qO(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):$D.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):pB(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",TD.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,TD.User_Mark)}else this.setStyle(i,t,TD.User_Mark)}))}_computeGradientAttr(e){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=e,d=t(e,["gradient","scale","field"]);let p=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(p=t),g||(g=e)}const f=VO(HO(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},KD[o]),d);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==p?void 0:p.scale(t[g]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=ti.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)$D.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=VO(HO(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return hD(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return bI.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[KI],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=hD(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===rD.appear))?rD.appear:t.every((t=>t===rD.disappear))?rD.disappear:t[0];return null!=e?e:rD.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{nF(t),s.push(...t.getGraphics())})),e.forEach((t=>{nF(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);iF([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=sF(e,n),r=sF(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===rD.exit?rD.exit:i===rD.update?rD.update:rD.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===CD.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===CD.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=CD.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=CD.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=CD.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=rD.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=rD.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return cD(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=cD(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),d(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=LL(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===BD.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=bI.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=bI.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===oD.before||(this._product||this._initProduct(),Ky(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===CD.exit&&!e.isExiting)if(e.context.animationState===CD.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:CD.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Pp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{t.clearStates()}))}}var aF;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(aF||(aF={}));class oF extends rF{constructor(){super(...arguments),this.type=oF.type,this._marks=[],this._diffState=CD.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(qy("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?(qy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return dD(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===CD.update){const t=this.hasAnimation(),e=LL(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=CD.update}render(){this._isCommited&&(Ky(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}oF.type="group";const lF={measureText:WI};class hF{static instance(){return hF.instance_||(hF.instance_=new hF),hF.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class cF{constructor(){this.id=rb(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?qy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class dF extends cF{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const uF={type:"fadeIn"};function pF(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return uF;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}class gF extends DT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}afterStageRender(t,e){var i,s;return null===(s=null===(i=this.params)||void 0===i?void 0:i.callBack)||void 0===s?void 0:s.call(i,t,e,this.currentAnimationRatio,this.animationTime)}}const fF={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},mF={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},vF={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},_F=()=>{bI.registerAnimation("scaleInOut",(()=>mF))},yF=()=>{bI.registerAnimation("fadeInOut",(()=>vF))},bF=(t,e)=>({appear:pF(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:nC,duration:fF.update.duration,easing:fF.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),xF=()=>{bI.registerAnimation("line",bF)},SF=()=>{kT.registerBuiltInAnimate("growPointsIn",SC),kT.registerBuiltInAnimate("growPointsOut",kC),kT.registerBuiltInAnimate("growPointsXIn",MC),kT.registerBuiltInAnimate("growPointsXOut",wC),kT.registerBuiltInAnimate("growPointsYIn",CC),kT.registerBuiltInAnimate("growPointsYOut",BC),kT.registerBuiltInAnimate("clipIn",oC),kT.registerBuiltInAnimate("clipOut",lC)},kF=()=>{OT(),kT.registerBuiltInAnimate("scaleIn",FC),kT.registerBuiltInAnimate("scaleOut",zC),kT.registerBuiltInAnimate("fadeIn",hC),kT.registerBuiltInAnimate("fadeOut",cC),kT.registerBuiltInAnimate("moveIn",NC),kT.registerBuiltInAnimate("moveOut",WC),kT.registerBuiltInAnimate("rotateIn",GC),kT.registerBuiltInAnimate("rotateOut",YC),kT.registerBuiltInAnimate("update",HC),kT.registerBuiltInAnimate("state",jC),kT.registerBuiltInAnimate("fromTo",XC),kT.registerBuiltInAnimate(gD,gF)},AF=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};BD.STATE_HIGHLIGHT,BD.STATE_BLUR;class MF{constructor(t){this._markSet=new PD,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const wF={highlightState:BD.STATE_HIGHLIGHT,blurState:BD.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class TF extends MF{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},wF,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}TF.type="element-highlight",TF.defaultOptions=wF;const CF=()=>{bI.registerInteractionTrigger(TF.type,TF)},BF={state:BD.STATE_SELECTED,trigger:"click"};class EF extends MF{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},BF,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}EF.type="element-select",EF.defaultOptions=BF;const PF=()=>{bI.registerInteractionTrigger(EF.type,EF)};class RF extends cF{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class OF{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>bI.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>bI.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>bI.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return bI.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>bI.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){bI.registerTransform(t,e)}static registerFunction(t,e){t&&e&&hF.instance().registerFunction(t,e)}static unregisterFunction(t){t&&hF.instance().unregisterFunction(t)}static getFunction(t){return t?hF.instance().getFunction(t):null}static getFunctionList(){return hF.instance().getFunctionNameList()}static registerMap(t,e,i){const s=bI.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=bI.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,$L.get(e);var e}static registerSVG(t,e,i){const s=bI.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=bI.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){LI.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return rt.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=rb(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=fD.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;N(n.theme,this._spec.theme)?N(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=bD(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?bI.getSeriesBuiltInTheme(e):bI.getComponentBuiltInTheme(e);i=i?yI({},s,i[e]):s}s===t.length-1&&u(i)&&(i=jI({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},OO(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:_,stage:y,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=eb(_);if(S?fx(yo):"node"===_&&QS(yo),S&&f&&(this._container=v(f)?O_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==_&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=DI.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const k=[];!1!==b&&k.push("poptipForText"),"sankey"===e.type&&k.push("scrollbar");const A=new rt(null!==(a=this._option.logLevel)&&void 0!==a?a:nt.Error);rt.setInstance(A),(null===(o=this._option)||void 0===o?void 0:o.onError)&&A.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new mD({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new GL(this,this._compiler),this._event=new DL(this._eventDispatcher,_),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),LI.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=yI({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=HI(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;OF.getFunctionList()&&OF.getFunctionList().length&&(t=VI(t,OF)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=bI.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=bI.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=bI.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(jL.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(jL.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=xt(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return yD(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:GI,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:YI})}_initDataSet(t){this._dataSet=t instanceof Ca?t:new Ca,XL(this._dataSet,"dataview",Ma),XL(this._dataSet,"array",i),YL(this._dataSet,"copyDataView",tD);for(const t in bI.transforms)YL(this._dataSet,t,bI.transforms[t]);for(const t in bI.dataParser)XL(this._dataSet,t,bI.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(!0),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))):t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(jL.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?rD.none:rD.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,LI.unregisterInstance(this)}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return e(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Ba?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=iD(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?yI({},t[n][e.index],i):i):t[n]=s?yI({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?yI({},t[n][r],i):i)}else t.id===e&&(t[n]=s?yI({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=yI({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(jL.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=xI({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=FI(this._currentThemeName),this._currentTheme=o(a,l);else{const t=xI({},FI(p(r)&&r.type?r.type:p(n)&&n.type?n.type:this._currentThemeName),FI(n),FI(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(tw.poptip,QM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!eb(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return FI(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!DI.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=u(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield vD(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!eb(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,e):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t,e,i;null===(t=this._chart)||void 0===t||t.resetLayoutItemTag(),null===(e=this._chart)||void 0===e||e.setLayoutTag(!0,null,!1),null===(i=this._compiler)||void 0===i||i.render()}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(u(this._container))return this._container;let e;return e=v(this._canvas)?O_.getElementById(this._canvas):this._canvas,u(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?oI(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return qy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?oI(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(qy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return hF.instance().getFunction(t)}registerFunction(t,e){t&&e&&hF.instance().registerFunction(t,e)}unregisterFunction(t){t&&hF.instance().unregisterFunction(t)}getFunctionList(){return hF.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=bI.getChartPlugins();t.length>0&&(this._chartPlugin=new dF(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=bI.getVChartPlugins();e.length>0&&(this._vChartPlugin=new RF(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=fD.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;this._renderState=fD.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent()}}OF.InstanceManager=LI,OF.ThemeManager=DI,OF.globalConfig={uniqueTooltip:!0},OF.Utils=lF,OF.vglobal=O_;bI.registerRegion("region",zD),bI.registerLayout("base",XD),oM(),XA(),bI.registerMark(oF.type,oF),bI.registerStageEventPlugin("gesture",zb),CF(),PF(),EI(gI.name,gI);const IF="monotone",LF="linear",DF="bevel";var FF;function zF(t,e){return e("component",t)}function jF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=bI.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(FF||(FF={}));const HF=(t,e,i,s)=>{if(d(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},VF=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(c(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(d(i))for(let i=0;i(l(t),t)))},NF="2.0.22",WF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},UF=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?P(e,t.field):t,s){const{formatFunc:i,args:r}=jF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},GF=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const YF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function XF(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=KF(UF(h,r,a,c),p,g),o.value=KF(UF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=UF(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function $F(t,e,i,s,n,r,a){if(c(e)){XF(t,e(n,a),i,s,r,a)}else e&&XF(t,e,i,s,r,a)}const KF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=gi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class qF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:u(n)?G(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(u(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of G(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(u(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{$F(a,t,e,i,s,n,r)})):c(t)?$F(a,t,e,i,s,n,r):t&&XF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=c(e)?e(s,n):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:UF(r.visible,t,n),value:KF(UF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:UF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=UF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&YF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const ZF={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},JF=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=vL([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return QF(a,n,o)},QF=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{ab(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{ab(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=ZF[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},tz=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{ab(t[e])||(t[e]=0)}))})),t},ez=`${UI}_HIERARCHY_DEPTH`,iz=`${UI}_HIERARCHY_ROOT`,sz=`${UI}_HIERARCHY_ROOT_INDEX`;function nz(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function rz(t,e,i){t&&(i.needDefaultSeriesField&&(t[qI]=i.defaultSeriesField),t[$I]=e,t[KI]=i.getKey(t,e,i))}function az(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function oz(t,e,i,s=0,n,r){void 0===r&&(r=e),rz(t,e,i),t[ez]=s,t[iz]=n||t[i.categoryField],t[sz]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>oz(e,s,i,t[ez]+1,t[iz],r)))}const lz={label:{name:"label",type:"text"}},hz=`${UI}_rect_x`,cz=`${UI}_rect_x1`,dz=`${UI}_rect_y`,uz=`${UI}_rect_y1`,pz={data:!0},gz={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},fz=[...Object.keys(fF),"normal"];function mz(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var s;let n=t;return xz(n)&&delete n.type,n.oneByOne&&(n=_z(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:yz,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=yI({},o[e],a);return xz(n)&&delete n.type,n.oneByOne&&(n=_z(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:yz,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function vz(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),Sz(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function _z(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=c(n)?n(t,i,a):k(n)?n:0,h=c(r)?r(t,i,a):k(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):k(n)?n:0,d=c(a)?a(t,r,o):k(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function yz(t,e){var i;return null!==(i=null==t?void 0:t[$I])&&void 0!==i?i:e.context.graphicIndex}function bz(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function xz(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function Sz(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),Sz(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),Sz(t[s],e,i))}function kz(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class Az extends OD{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=FO(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=bI.getSeriesMarkMap(o)?function(t,e,i){const s=bI.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=yI({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return yI({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=yI({},i,s,t),n=i.label;return n&&p(n)&&_(e.label)&&(e.label=e.label.map((t=>yI({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class Mz extends ID{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){u(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${UI}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Az,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=MD.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(jL.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=kz(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(jL.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return d(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),u(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YL(this._rawData.dataSet,"invalidTravel",tz),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=iD(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=eD(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=eD(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new tF(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=QF(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){YL(this._dataSet,"dimensionStatistics",JF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Ba(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&vL(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){YL(this._dataSet,"dimensionStatistics",JF);const s=new Ba(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=vL(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&vL(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Ba(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return d(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:v(t)?e=>e[t]:_(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YL(this._rawData.dataSet,"addVChartProperty",WF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:nz.bind(this),call:rz}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(jL.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(jL.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(jL.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(jL.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=mz({},vz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:ib(i)||sb(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=yI(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=yI(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=AF(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=AF(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:BD.STATE_HOVER_REVERSE,highlightState:BD.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:BD.STATE_SELECTED_REVERSE,state:BD.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=AF(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:qI;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:ZI,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,ZI,TD.User_SeriesStyle)}))}afterInitMark(){this.event.emit(jL.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",TD.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new qF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!N(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!N(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},pz),gz),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(G(t.label),G(e.label),s),!s.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>gz[i]&&!N(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!N(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ba||sD(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();kz(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:qI,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new $O).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return HO(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:qI}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),d(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),d(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,yI({},p,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:KI}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==tL&&t!==iL&&t!==QI&&t!==eL||(t=this.getStackValueField()),null!==(e=yL(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>ab(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:qI]}}function wz(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();uB(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function Tz(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}Mz.mark=lz,Mz.transformerConstructor=Az;class Cz extends Mz{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);uB(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${UI}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(tL),this.setFieldX2(QI)):(this.setFieldY(tL),this.setFieldY2(QI))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(iL),this.setFieldX2(eL)):(this.setFieldY(iL),this.setFieldY2(eL))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(nL),this.setFieldX2(sL)):(this.setFieldY(nL),this.setFieldY2(sL))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=G(this._spec.xField),this._specYField=G(this._spec.yField),u(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(G(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(G(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(jL.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(wz("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function Bz(t){return"bottom"===t||"top"===t}function Ez(t){return"left"===t||"right"===t}function Pz(t){return"z"===t}function Rz(t,e){return tI(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Oz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function Iz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Bz(t)?"linear":"band":Bz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const Lz=(t,e,i)=>{var s;const n=null!==(s="band"===e?zF("axisBand",i):["linear","log","symlog"].includes(e)?zF("axisLinear",i):{})&&void 0!==s?s:{},r=Bz(t)?zF("axisX",i):Ez(t)?zF("axisY",i):zF("axisZ",i);return yI({},zF("axis",i),n,r)};class Dz{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:Zy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:Zy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>gB(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return Bz(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class Fz extends Dz{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:HL.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const zz=(t,e)=>{var i,s;return t===e||!d(t)&&!d(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},jz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},Hz=(t,e,i,s)=>{var n;const r=e.getScale(),a=gB(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:Vz(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,Nz=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(G(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class Wz extends Dz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!zz(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:HL.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:HL.canvas}),callback:this.onMouseOut}),ib(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:HL.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),ib(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var Uz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Uz||(Uz={}));const Gz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class Yz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(Gz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",TD.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",TD.Series),this.event.on(jL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:DF,curveType:LF,closePath:!0},"normal",TD.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===IF?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",TD.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",TD.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(Gz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:bz(this._spec,Gz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Ba(this._option.dataSet,{name:`${UI}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Uz.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:TD.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:BD.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",TD.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",TD.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[Gz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Uz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,yI({},this._spec[Gz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:BD.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",TD.Series),this.event.on(jL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",TD.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",TD.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Xz=Object.assign(Object.assign({},lz),Gz),$z=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>$z(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},Kz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class qz extends rF{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return Kz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(pB(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?$z(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:CD.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[KI]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class Zz extends qz{constructor(){super(...arguments),this.type=Zz.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)===LO.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}Zz.type="line";const Jz=()=>{bI.registerMark(Zz.type,Zz),oM(),ZA(),tP(),KE(),SF(),bI.registerGraphicComponent("line",Eg)};class Qz extends rF{constructor(){super(...arguments),this.type=Qz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}Qz.type="symbol";const tj=()=>{bI.registerMark(Qz.type,Qz),oM(),hM(),KE(),bI.registerGraphicComponent("symbol",Tg)};class ej extends Az{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function ij(t){return t.length>=2&&k(t[0])&&k(Y(t))&&Y(t)>=t[0]}function sj(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function nj(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function rj(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function aj(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function oj(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const lj=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ie(t,e),a=Math.max(te(i),te(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return aB(v)};class hj{constructor(t){this.id=rb(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class cj extends hj{constructor(){super(cj.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!uB(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(jL.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&ij(c)&&ij(d)))return;const u=sj(t,c),p=sj(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===f){if(!rj(u,p))return}else if(0===y&&0===b){if(!rj(p,u))return}else if(_||k)if(_&&!k){if(!nj(u,p))return}else if(k&&!_){if(!nj(p,u))return}else{if(f===b)return;if(f>b){if(!aj(u,p))return}else if(!aj(p,u))return}else{if(0===f&&0===y){if(!oj(u,p))return}else if(0===b&&0===g&&!oj(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){YL(e.getOption().dataSet,"tickAlign",lj);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}cj.pluginType="component",cj.type="AxisSyncPlugin";const dj={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function uj(t){let e=0;return P(t,"tick.visible")&&(e+=P(t,"tick.tickSize")),P(t,"label.visible")&&(e+=P(t,"label.space")),e}function pj(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function gj(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const fj=t=>"band"===t||"ordinal"===t||"point"===t;function mj(t,e){return{id:t,label:t,value:e,rawValue:t}}function vj(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class _j extends cF{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const yj=`${UI}_ARC_TRANSFORM_VALUE`,bj=`${UI}_ARC_RATIO`,xj=`${UI}_ARC_START_ANGLE`,Sj=`${UI}_ARC_END_ANGLE`,kj=`${UI}_ARC_K`,Aj=`${UI}_ARC_MIDDLE_ANGLE`,Mj=`${UI}_ARC_QUADRANT`,wj=`${UI}_ARC_RADIAN`,Tj=-Math.PI/2,Cj=3*Math.PI/2,Bj=.6,Ej=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ue(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},Pj=(t,e,i)=>{var s;const n=null!==(s="band"===e?zF("axisBand",i):"linear"===e?zF("axisLinear",i):{})&&void 0!==s?s:{},r=zF("angle"===t?"axisAngle":"axisRadius",i);return yI({},zF("axis",i),n,r)};function Rj(t,e,i,s){switch(t){case n.cartesianBandAxis:return Lz(Rz(i,["z"]),"band",e);case n.cartesianLinearAxis:return Lz(Rz(i,["z"]),"linear",e);case n.cartesianLogAxis:return Lz(Rz(i,["z"]),"log",e);case n.cartesianSymlogAxis:return Lz(Rz(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return Lz(Rz(i),void 0,e);case n.polarBandAxis:return Pj(i.orient,"band",e);case n.polarLinearAxis:return Pj(i.orient,"linear",e);case n.polarAxis:return Pj(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=zF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>Bz(t.orient)));let g;g=u(p)?yI({},fj(p.type)?a:o,l):l;const f=r.find((t=>Ez(t.orient)));let m;return m=u(f)?yI({},gB(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=zF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?yI({},fj(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?yI({},gB(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return Oj(i,zF(t,e));default:return zF(t,e)}}const Oj=(t,e)=>{var i;const s=yI({},e,e[Oz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Ij extends OD{getTheme(t,e){return Rj(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},aI(e)),{[s]:0}))}}class Lj extends DD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Ij,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Fc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:HL.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new _j(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!N(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(t.release(!0),null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var Dj,Fj;Lj.transformerConstructor=Ij,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Dj||(Dj={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Fj||(Fj={}));class zj extends rF{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=bI.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(FL.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}zj.type="component";const jj=()=>{bI.registerMark(zj.type,zj)},Hj=t=>t;class Vj extends Lj{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?Dj.circleAxis:Dj.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Fj.circleAxisGrid:Fj.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:MD.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(this._syncComponentVisibility(),(null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=mz(null===(l=bI.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:P(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:P(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:P(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:P(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:P(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:P(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:P(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this._specVisible&&(this.getVisible()||this._spec.forceInitTick||this._hideWhenEmpty)}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new tF(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&BO(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=_(a)?uB(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!uB(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return BO(this._regions,(e=>{var i;_(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(s)&&(this._regionIndex=G(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(jL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=EO(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),BO(this._regions,(t=>{t.event.on(jL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(jL.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&N(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):BO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(BO(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=BL(s=e.domainLine)).startSymbol=BL(s.startSymbol),s.endSymbol=BL(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=j(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return RL(yI({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:RL(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>RL(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=RL(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return RL(yI({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:RL(e.tick.style)),e.tick.state&&(i.tick.state=EL(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return RL(yI({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:RL(e.subTick.style)),e.subTick.state&&(i.subTick.state=EL(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=dj[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?re(p):null,textStyle:yI({},u,RL(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:RL(h.style)}),h.state&&(i.title.state.shape=EL(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:RL(o.style)}),o.state&&(i.title.state.background=EL(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=EL(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=RL(e.background.style)),e.background.state&&(i.panel.state=EL(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:NI(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:c(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return RL(yI({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:RL(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:NI(t.subGrid.alternateColor),style:RL(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=jF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){XL(this._option.dataSet,"scale",Hj);const i=this.registerTicksTransform();return new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===ww.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}Vj.specKey="axes";const Nj=()=>{jj(),bI.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},Wj=[cj];class Uj extends Vj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=MD.Axis,this.layoutLevel=wD.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),BO(this._regions,(t=>{const e=this.getOrient();Bz(e)?vj(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Ez(e)?vj(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):Pz(e)&&vj(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=yI({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(yI({x:e.x,y:e.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Bz(this.getOrient()),n=t=>{var e;return(s?!Bz(t.getOrient()):Bz(t.getOrient()))&&uB(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&Y(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=Rz(e,["z"]),Pz(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!gj(e))return null;const{axisType:t,componentName:s}=Iz(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>Ez(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!gj(t))return;const{axisType:s,componentName:n}=Iz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=bI.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return Bz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):Pz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(Wj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){Bz(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!Bz(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!Pz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Ez(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=sI(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=sI(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Bz(this.getOrient())?t.fieldX:Pz(this.getOrient())?t.fieldZ:t.fieldY,uB(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:uB(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(FL.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(Bz(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Bz(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return BO(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:Bz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Pz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();BO(this._regions,(e=>{Bz(t)?vj(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Ez(t)?vj(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Pz(t)&&vj(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Bz(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&_(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=Bz(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=yI(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new je).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=Bz(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?mt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):mt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return mj(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:uB(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(jL.layoutEnd,this._updateAxisLayout),this.event.on(jL.layoutEnd,this._fixAxisOnZero),this.event.on(jL.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}Uj.type=n.cartesianAxis,Uj.specKey="axes";const Gj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Yj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,$j=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function Kj(t,e,i="count"){const s=$j(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const qj=Math.sqrt(50),Zj=Math.sqrt(10),Jj=Math.sqrt(2);class Qj{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=pj(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=Bz(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Xj),e.sort(Xj),{domain:Yj(t,e),scope:Kj(t,e,i)}}(r,Xy(t),this._spec.breaks[0].scopeType);e=Xy(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=pj(this._spec);if(u(e)||u(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=qj?10:n>=Zj?5:n>=Jj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(jL.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(jL.scaleDomainUpdate,{model:this}),this.event.emit(jL.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const t=this.collectData(0,!0),e=this.computeLinearDomain(t);this._rawDomain=e,this.event.emit(jL.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const tH={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},eH={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},iH={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},sH={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}};class nH extends Uj{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new iE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!Pz(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=Bz(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=eI(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=Xy(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YL(this._option.dataSet,t,dE),t}}nH.type=n.cartesianLinearAxis,nH.specKey="axes",nH.builtInTheme={axis:sH,axisLinear:tH,axisX:eH,axisY:iH},U(nH,Qj);const rH=()=>{bI.registerGraphicComponent(Dj.lineAxis,((t,e)=>new QC(t,e))),bI.registerGraphicComponent(Fj.lineAxisGrid,((t,e)=>new hP(t,e))),Nj(),bI.registerComponent(nH.type,nH)};class aH{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new tF(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(jL.scaleDomainUpdate,{model:this}),this.event.emit(jL.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=G(e).concat(i);if(n.push(r),o){const e=mj(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>mj(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}this.event.emit(jL.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const oH={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class lH extends Uj{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new LB}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return YL(this._option.dataSet,t,mE),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=wB(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),p=e=>{const i=t===n?a:0;if(d(r)||t{bI.registerGraphicComponent(Dj.lineAxis,((t,e)=>new QC(t,e))),bI.registerGraphicComponent(Fj.lineAxisGrid,((t,e)=>new hP(t,e))),Nj(),bI.registerComponent(lH.type,lH,!1)};class cH extends nH{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),BO(this._regions,(t=>{Bz(this.getOrient())?vj(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):vj(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=yI({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new tF(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=gi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>mj(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>mj(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return YL(this._option.dataSet,t,dE),t}transformScaleDomain(){}}cH.type=n.cartesianTimeAxis,cH.specKey="axes",cH.builtInTheme={axis:sH,axisX:eH,axisY:iH};const dH=()=>{bI.registerGraphicComponent(Dj.lineAxis,((t,e)=>new QC(t,e))),bI.registerGraphicComponent(Fj.lineAxisGrid,((t,e)=>new hP(t,e))),Nj(),bI.registerComponent(cH.type,cH)};class uH extends nH{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new aE}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return YL(this._option.dataSet,t,dE),t}transformScaleDomain(){}}uH.type=n.cartesianLogAxis,uH.specKey="axes",uH.builtInTheme={axis:sH,axisLinear:tH,axisX:eH,axisY:iH},U(uH,Qj);const pH=()=>{bI.registerGraphicComponent(Dj.lineAxis,((t,e)=>new QC(t,e))),bI.registerGraphicComponent(Fj.lineAxisGrid,((t,e)=>new hP(t,e))),Nj(),bI.registerComponent(uH.type,uH)};class gH extends nH{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new oE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return YL(this._option.dataSet,t,dE),t}transformScaleDomain(){}}gH.type=n.cartesianSymlogAxis,gH.specKey="axes",gH.builtInTheme={axis:sH,axisLinear:tH,axisX:eH,axisY:iH},U(gH,Qj);const fH=()=>{bI.registerGraphicComponent(Dj.lineAxis,((t,e)=>new QC(t,e))),bI.registerGraphicComponent(Fj.lineAxisGrid,((t,e)=>new hP(t,e))),Nj(),bI.registerComponent(gH.type,gH)},mH=`${UI}_hide_`;function vH(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const _H=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[mH]&&(vH(t,!0),t[mH]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[mH]=!0,vH(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},yH=()=>{bI.registerGrammarTransform("symbolOverlap",{transform:_H,runType:"afterEncode"})},bH={min:$,max:X,average:AO,sum:kO};function xH(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function SH(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function kH(t,e,i,s){return SH(t,e,i,"min",s)}function AH(t,e,i,s){return SH(t,e,i,"max",s)}function MH(t,e,i,s){return SH(t,e,i,"average",s)}function wH(t,e,i,s){return SH(t,e,i,"sum",s)}const TH=(t,e)=>{let i=c(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=xH;if("min"===n?l=kH:"max"===n?l=AH:"average"===n?l=MH:"sum"===n&&(l=wH),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},CH=()=>{bI.registerGrammarTransform("dataSampling",{transform:TH})};class BH extends Cz{constructor(){super(...arguments),this.type=LO.line,this.transformerConstructor=ej,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(mz(null===(i=bI.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),vz("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Tz(this);this._symbolMark.setAnimationConfig(mz(null===(s=bI.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),vz("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}BH.type=LO.line,BH.mark=Xz,BH.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},BH.transformerConstructor=ej,U(BH,Yz);class EH{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{sD(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Ba)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];qy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];qy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class PH{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{ob(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{vL(e,[{key:t,operations:uB(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&vL(e,[{key:i.field,operations:uB(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?qO("colorOrdinal"):qO(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(ob(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(N(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!N(r.specified,s.specified))return e.reMake=!0,e;s.range&&!N(s.range,n.range())&&(n.range(s.range),e.reRender=!0),ob(s.domain)?e.reRender=!0:N(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!ob(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=uB(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=uB(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;uB(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(uB(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=uB(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!E(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));uB(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class RH{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class OH extends RD{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=rb(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:GI,height:YI},this._viewRect={width:GI,height:YI},this._viewBox={x1:0,y1:0,x2:GI,y2:YI},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>G(t).some((t=>u(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=aI(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new DL(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new EH(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new RH;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=bI.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(mz({},vz("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=j(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=bI.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:MD.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=bI.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(jL.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(jL.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(jL.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof ID)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof rF))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof rF)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&sD(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=yD(this._spec,this._option,{width:GI,height:YI})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=HO(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new PH(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){bD(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=HO(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!N(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{bD(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0};this._components.forEach((s=>{var r,a;if(s.type===n.label||s.type===n.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(r=this._spec[o])&&void 0!==r?r:{};_(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,bD(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):bD(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(_(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];bD(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=nI(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(jL.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(BD.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(BD.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(BD.STATE_SELECTED)}clearHovered(){this.clearState(BD.STATE_HOVER)}_initEvent(){[jL.dataZoomChange,jL.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(FL.AFTER_MARK_RENDER_END,e)};this._event.on(FL.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:IL;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(OL(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===Uz.dimensionHover||s===Uz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>gB(t.axis.getScale().type)&&d(t.index))),o=a||r.every((t=>gB(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(n.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(n.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),r=[];s.forEach((e=>{const i=t(e);!1!==i&&r.push({axis:e,value:i})})),i.showCrosshair(r)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const IH=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)};class LH{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):mI(t,a,c.spec),mI(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=IH(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=IH(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(bI.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(bI.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=bI.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=bI.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=bI.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):HF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=HF(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class DH extends LH{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{d(i[t])&&(i[t]=n[t])})),P(i,"trimPadding")&&yI(i,xD(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class FH extends DH{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),_D(t)}}const zH=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=bL(t,!0);for(const e in o)for(const i in o[e].nodes)AL(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)kL(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&SL(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(jL.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class HH{_beforeInit(){this._dataSet&&YL(this._dataSet,"stackSplit",zH)}_initStack(){this._stack=new jH(this),this._stack.init()}}const VH={state:BD.STATE_DIMENSION_HOVER,reverseState:BD.STATE_DIMENSION_HOVER_REVERSE,trigger:Uz.dimensionHover};class NH extends MF{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},VH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=IL(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}NH.type="dimension-hover",NH.defaultOptions=VH;const WH=()=>{bI.registerInteractionTrigger(NH.type,NH)},UH=()=>{bI.registerComposedEvent(Uz.dimensionHover,Wz),bI.registerComposedEvent(Uz.dimensionClick,Fz)},GH=t=>t.fieldX[0],YH=t=>t.fieldY[0],XH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},$H=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},KH=(t,e)=>t?e?GH:XH:e?YH:$H,qH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=Nz(t,(t=>Bz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=Nz(t,(t=>Ez(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{gB(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=ZH(t,i,KH(e,gB(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=ZH(t,i,KH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},ZH=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:JH(t,s,i)},JH=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=Hz(e,t,"cartesian",null!=i?i:Bz(t.getOrient())?GH:YH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},QH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let k;S&&(S._isCache=x);let A=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(gB(m.type))k=m.bandwidth(),0===k&&m.step&&(A=m.step());else if(uB(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(k=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):k=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=uj(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};eV(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&tV(S.labels[t],t,f.label)}))}t[n].bandSize=null!=k?k:0,t[n].offsetSize=A,t[n].cacheInfo=S})),t),tV=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=jF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},eV=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},iV=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=sV(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},sV=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},nV=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return QH(c,r,e),c.xField.cacheInfo?iV(c.xField):c.yField.cacheInfo?iV(c.yField):void 0},rV=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],aV=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&rV.forEach((e=>{u(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(oV(s).every((t=>{var e;return!YF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},oV=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},lV={dom:`${UI}_TOOLTIP_HANDLER_DOM`,canvas:`${UI}_TOOLTIP_HANDLER_CANVAS`},hV={key:"其他",value:"..."};var cV;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(cV||(cV={}));class dV{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(jL.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=aV(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},hV),t):hV;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!d(e)&&YF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class uV extends dV{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!gB(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(u(s))break}return u(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const pV=()=>{bI.registerTooltipProcessor("dimension",uV)};class gV extends dV{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Xo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(IL(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const fV=()=>{bI.registerTooltipProcessor("mark",gV)};class mV extends dV{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const vV=()=>{bI.registerTooltipProcessor("group",mV)};class _V extends OH{constructor(){super(...arguments),this.transformerConstructor=FH,this.type="line",this.seriesType=LO.line}_setModelOption(){this._modelOption.getDimensionInfo=qH,this._modelOption.getDimensionInfoByValue=JH,this._modelOption.getRectByDimensionData=nV}}_V.type="line",_V.seriesType=LO.line,_V.transformerConstructor=FH,U(_V,HH);const yV=[...Kz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class bV extends qz{constructor(){super(...arguments),this.type=bV.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return yV}_getIgnoreAttributes(){return[]}}bV.type="area";const xV=()=>{bI.registerMark(bV.type,bV),oM(),VA(),tP(),KE(),SF(),bI.registerGraphicComponent("area",ef)};class SV extends qF{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),u(e))return e}return i}}}const kV=Object.assign(Object.assign(Object.assign({},lz),Gz),{area:{name:"area",type:"area"}}),AV=()=>{bI.registerAnimation("area",bF),xF(),_F()};class MV extends ej{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||p&&!d)&&(g=h,f=l),l.style=yI({},f.style,g.style),l.state=yI({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class wV extends Cz{constructor(){super(...arguments),this.type=LO.area,this.transformerConstructor=MV,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(wV.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===IF?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return ZO(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",TD.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return ZO(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",TD.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",TD.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",TD.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[tL]},"normal",TD.Series),this.setMarkStyle(o,{curveType:a},"normal",TD.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(mz(null===(e=bI.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),vz("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(mz(null===(i=bI.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),vz("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Tz(this);this._symbolMark.setAnimationConfig(mz(null===(s=bI.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),vz("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new SV(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}wV.type=LO.area,wV.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},wV.mark=kV,wV.transformerConstructor=MV,U(wV,Yz);class TV extends DH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),_D(t)}}class CV extends OH{constructor(){super(...arguments),this.transformerConstructor=TV,this.type="area",this.seriesType=LO.area}_setModelOption(){this._modelOption.getDimensionInfo=qH,this._modelOption.getDimensionInfoByValue=JH,this._modelOption.getRectByDimensionData=nV}}CV.type="area",CV.seriesType=LO.area,CV.transformerConstructor=TV,U(CV,HH);function BV(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const EV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:BV(t,e)}),PV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:BV(t,e)}),RV={type:"fadeIn"},OV={type:"growCenterIn"};function IV(t,e){if(!1===e)return{};switch(e){case"fadeIn":return RV;case"scaleIn":return OV;default:return EV(t)}}class LV extends rF{constructor(){super(...arguments),this.type=LV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}LV.type="rect";const DV=()=>{oM(),sM(),YE("rect",ZE),bI.registerMark(LV.type,LV),kT.registerBuiltInAnimate("growHeightIn",_C),kT.registerBuiltInAnimate("growHeightOut",yC),kT.registerBuiltInAnimate("growWidthIn",LC),kT.registerBuiltInAnimate("growWidthOut",DC),kT.registerBuiltInAnimate("growCenterIn",fC),kT.registerBuiltInAnimate("growCenterOut",mC),bI.registerGraphicComponent("rect",Ig)},FV=Object.assign(Object.assign({},lz),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function zV(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=lI(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[hz]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):ZO(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[cz]):ZO(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=ZO(this._dataToPosX(t),e,i),n=ZO(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[dz]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):ZO(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[uz]):ZO(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=ZO(this._dataToPosY(t),e,i),n=ZO(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},VV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:bz(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(VV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",TD.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===n.cartesianBandAxis));let r;if(YL(this._option.dataSet,"addVChartProperty",WF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};YL(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Ba(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:nz.bind(this),call:rz}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new tF(this._option,r)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=uz,s=dz,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=cz,s=hz,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=bL(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)zV(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=ZO(this[r](t),l,i),u=ZO(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!JO(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",TD.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",TD.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,d=!1,p=1/0,g=-1/0;i.values.forEach((e=>{const i=e[QI],n=e[tL],r=e[eL],c=e[iL];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?dz:hz],i=e[a?uz:cz];l=Math.min(l,t,i),h=Math.max(h,t,i)}u(r)&&u(c)&&(d=!0,p=Math.min(p,r,c),g=Math.max(g,r,c))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[QI]:s,[tL]:o}),d?{[eL]:p,[iL]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(Ig(Object.assign(Object.assign({},m),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>ZO(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",TD.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",TD.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>ZO(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",TD.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",TD.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=d(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",TD.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",TD.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Tz(this);this._barMark.setAnimationConfig(mz(null===(e=bI.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),vz(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=u(this._spec.barWidth)&&r===n,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=a;return o&&(c=lI(this._spec.barWidth,a)),l&&(c=Math.max(c,lI(this._spec.barMinWidth,a))),h&&(c=Math.min(c,lI(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,p;"horizontal"===t?(h=this.getYAxisHelper(),c="height",p="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",p="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&u(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=lI(null!==(l=i[r-1])&&void 0!==l?l:Y(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=uB(g.type||"band");return p(e,m)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}VV.type=LO.bar,VV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},VV.mark=FV,VV.transformerConstructor=HV;const NV=()=>{CH(),DV(),bI.registerAnimation("bar",((t,e)=>({appear:IV(t,e),enter:EV(t,!1),exit:PV(t,!1),disappear:{duration:fF.disappear.duration}}))),hH(),rH(),bI.registerSeries(VV.type,VV)};class WV extends DH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),_D(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=p(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class UV extends OH{constructor(){super(...arguments),this.transformerConstructor=WV,this.type="bar",this.seriesType=LO.bar}_setModelOption(){this._modelOption.getDimensionInfo=qH,this._modelOption.getDimensionInfoByValue=JH,this._modelOption.getRectByDimensionData=nV}}UV.type="bar",UV.seriesType=LO.bar,UV.transformerConstructor=WV,U(UV,HH);const GV=[10,20],YV=cB.Linear,XV="circle",$V=cB.Ordinal,KV=["circle","square","triangle","diamond","star"],qV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},ZV=Object.assign(Object.assign({},lz),{point:{name:"point",type:"symbol"}});class JV extends Az{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class QV extends Cz{constructor(){super(...arguments),this.type=LO.scatter,this.transformerConstructor=JV,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(c(e))return e;if(_(e)){if(d(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${UI}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${UI}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:YV,defaultRange:GV},"size")}getShapeAttribute(t,e){return d(e)?XV:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:$V,defaultRange:KV},"shape")}initMark(){this._symbolMark=this._createMark(QV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:bz(this._spec,QV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Tz(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(mz(null===(i=bI.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),vz("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:XV},BD.STATE_NORMAL,TD.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},BD.STATE_NORMAL,TD.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},BD.STATE_NORMAL,TD.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",TD.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",TD.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},BD.STATE_NORMAL,TD.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},BD.STATE_NORMAL,TD.Series))}handleZoom(t){var e,i,s,n;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.y)}))}));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==r?void 0:r.renderInner)&&r.renderInner();const a=null===(i=null==r?void 0:r.getComponent)||void 0===i?void 0:i.call(r);(null==a?void 0:a.evaluate)&&a.evaluate(null,null);const o=null===(s=null==r?void 0:r.getProduct)||void 0===s?void 0:s.call(r);o&&(null==t?void 0:t.scale)&&(null==t?void 0:t.scaleCenter)&&((null===(n=o.attribute)||void 0===n?void 0:n.postMatrix)||o.setAttributes({postMatrix:new Ne}),o.scale(t.scale,t.scale,t.scaleCenter))}handlePan(t){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}QV.type=LO.scatter,QV.mark=ZV,QV.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},QV.transformerConstructor=JV;const tN=()=>{tj(),bI.registerAnimation("scatter",((t,e)=>Object.assign({appear:qV(0,e)},mF))),hH(),rH(),bI.registerSeries(QV.type,QV)};class eN extends DH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class iN extends OH{constructor(){super(...arguments),this.transformerConstructor=eN,this.type="scatter",this.seriesType=LO.scatter}_setModelOption(){this._modelOption.getDimensionInfo=qH,this._modelOption.getDimensionInfoByValue=JH,this._modelOption.getRectByDimensionData=nV}}iN.type="scatter",iN.seriesType=LO.scatter,iN.transformerConstructor=eN,U(iN,HH);const sN=()=>{pV(),fV(),UH(),WH(),tN(),bI.registerChart(iN.type,iN)};class nN extends Mz{constructor(){super(...arguments),this.type=LO.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return d(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${UI}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const rN=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[$I]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[mL]=e.nameMap[n]:t[mL]=n})),t.features);class aN extends qF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class oN extends rF{constructor(){super(...arguments),this.type=oN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}oN.type="path";const lN=()=>{bI.registerMark(oN.type,oN),oM(),QA(),bI.registerGraphicComponent("path",Jg)},hN=Object.assign(Object.assign({},lz),{area:{name:"area",type:"path"}});class cN{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Oa(i,e):Pa[i]?(Ea[i]||(Ea[i]=Oa(i,Pa[i])),Ea[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class dN{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class uN{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function pN(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:dN}:ib(t)||sb(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:uN}:null}const gN={debounce:bt,throttle:xt};class fN{constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=ib(this._renderMode)||sb(this._renderMode),pN(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return pN(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!Se({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:VL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:VL.chart,consume:!1}];l.on(...c,gN[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,gN[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||pN(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||pN(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return d(r)&&d(a)?s:Se({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:VL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:VL.chart,consume:!1}];l.on(...c,gN[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,gN[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){pN(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||pN(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:VL.chart},(t=>{if(!t.event)return;const{event:n}=t;Se({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:VL.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||pN(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:VL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||pN(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:VL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:VL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:VL.chart,source:HL.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:VL.chart,source:HL.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=gN[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=gN[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:VL.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:VL.chart,source:HL.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:VL.chart,source:HL.chart},this._handleDragMouseUp)}))}}function mN(t,e){return`${UI}_${e}_${t}`}class vN extends Lj{constructor(){super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=MD.Mark,this._projectionSpec={name:mN(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=u(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(d(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:n.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=yI(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var t,e,i;this.event.on(jL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new cN(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===LO.map||e.type===LO.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),BO(this._regions,(t=>{var e;if(t.type===LO.map||t.type===LO.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ne})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==LO.map&&e.type!==LO.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[mL],s=t.getDatumCenter(e);i&&u(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!N(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}vN.type=n.geoCoordinate,U(vN,fN);const _N=()=>{bI.registerComponent(vN.type,vN)};class yN extends Az{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class bN extends nN{constructor(){super(...arguments),this.type=LO.map,this.transformerConstructor=yN,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),$L.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),YL(this._dataSet,"copyDataView",tD),YL(this._dataSet,"map",rN),YL(this._dataSet,"lookup",VF);const i=$L.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new Ba(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:nD.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:mL,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new tF(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(bN.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:bz(this._spec,bN.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:qI])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:qI]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",TD.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",TD.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(mz(null===(t=bI.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),vz("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new aN(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[$I]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[$I],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s,n;const{scale:r,scaleCenter:a}=t;if(1===r)return;const o=this.getRootMark().getProduct();o&&(o.attribute.postMatrix||o.setAttributes({postMatrix:new Ne}),o.scale(r,r,a));const l=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==l?void 0:l.renderInner)&&l.renderInner();const h=null===(i=null==l?void 0:l.getComponent)||void 0===i?void 0:i.call(l);(null==h?void 0:h.evaluate)&&h.evaluate(null,null);const c=null===(s=null==l?void 0:l.getProduct)||void 0===s?void 0:s.call(l);c&&r&&a&&((null===(n=c.attribute)||void 0===n?void 0:n.postMatrix)||c.setAttributes({postMatrix:new Ne}),c.scale(r,r,a))}handlePan(t){var e,i,s,n;const{delta:r}=t;if(0===r[0]&&0===r[1])return;const a=this.getRootMark().getProduct();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new Ne}),a.translate(r[0],r[1]));const o=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==o?void 0:o.renderInner)&&o.renderInner();const l=null===(i=null==o?void 0:o.getComponent)||void 0===i?void 0:i.call(o);(null==l?void 0:l.evaluate)&&l.evaluate(null,null);const h=null===(s=null==o?void 0:o.getProduct)||void 0===s?void 0:s.call(o);h&&r&&((null===(n=h.attribute)||void 0===n?void 0:n.postMatrix)||h.setAttributes({postMatrix:new Ne}),h.translate(r[0],r[1]))}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return $I}getActiveMarks(){return[this._pathMark]}}bN.type=LO.map,bN.mark=hN,bN.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},bN.transformerConstructor=yN;const xN=`${UI}_waterfall_default_seriesField`,SN=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[oL]=!0:delete t[oL]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=kN([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const f=g[0];let{start:m,end:v}=AN(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>ie(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ee(_,e)):(t[c]=+y,y=ee(y,e)),t[d]=ee(t[c],e),m=ee(m,e),b=ie(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=kN(r,t,n,a,c,h,i,e),a.push(n)})),a};function kN(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=AN(t,i,s,n,u);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=ee(i.positive,e)):(t[h]=+i.negative,i.negative=ee(i.negative,e)),t[c]=ee(t[h],e),i.end=ee(i.end,e)}i.isTotal=e,(d(p)||p===xN)&&(t[xN]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function AN(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!d(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?qy("total.collectCountField error"):n=e[a].start;o<0?qy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=ee(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const MN=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ee(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},wN={type:"fadeIn"},TN={type:"growCenterIn"};function CN(t,e){switch(e){case"fadeIn":return wN;case"scaleIn":return TN;default:return EV(t,!1)}}class BN extends rF{constructor(){super(...arguments),this.type=BN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Eg(t)}}BN.type="rule";const EN=()=>{bI.registerMark(BN.type,BN),oM(),ZA(),bI.registerGraphicComponent("line",Eg)},PN=Object.assign(Object.assign({},FV),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),RN=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:ON(t.map((t=>t.latestData)).flat(),e.fields,i)}};function ON(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>ON(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class IN{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new Ba(e instanceof Ca?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),YL(e,"dimensionTree",RN),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class LN extends HV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const DN={rect:NN,symbol:HN,arc:UN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=HN(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:GN,line:YN,area:YN,rect3d:NN,arc3d:UN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function FN(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=DN[t])&&void 0!==i?i:DN.point;return e.series.type===LO.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=jN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:XN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function zN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==LO.sankey){const{formatFunc:t,args:n}=jF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function jN(t){return c(t)?e=>t(e.data):t}function HN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=jN(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:VN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function VN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function NN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=jN(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:WN(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function WN(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function UN(t){var e;const{labelSpec:i}=t,s=null!==(e=jN(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function GN(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=zN(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Ag(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function YN(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[qI]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function XN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class $N extends VV{constructor(){super(...arguments),this.type=LO.waterfall,this.transformerConstructor=LN,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&SL(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new IN(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],d(this._seriesField)&&(this._seriesField=xN)}getSeriesKeys(){return this._seriesField===xN?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),YL(this._dataSet,"waterfallFillTotal",MN),YL(this._dataSet,"waterfall",SN),(d(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=eD(this.getViewData(),this._dataSet,{name:`${UI}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new tF(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:QI,endAs:tL,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Tz(this);this._barMark.setAnimationConfig(mz(null===(i=bI.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),vz("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(mz(null===(s=bI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vz("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark($N.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ie(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ie(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return GN(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?ZO(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):ZO(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const t="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:e=>e.lastIndex?this.totalPositionY(e,"lastIndex",t?0:1):0,y1:e=>this.totalPositionY(e,"index",t?1:0)},"normal",TD.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:e=>e.lastIndex?this.totalPositionX(e,"lastIndex",t?0:1):0,x1:e=>this.totalPositionX(e,"index",t?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",TD.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&JO([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}$N.type=LO.waterfall,$N.mark=PN,$N.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},$N.transformerConstructor=LN;const KN=()=>{EN(),DV(),bI.registerAnimation("waterfall",((t,e)=>({appear:CN(t,e),enter:EV(t,!1),exit:PV(t,!1),disappear:{duration:fF.disappear.duration}}))),yF(),hH(),rH(),bI.registerSeries($N.type,$N)},qN=`${UI}_BOX_PLOT_OUTLIER_VALUE`;var ZN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(ZN||(ZN={}));const JN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];_(e)||(e=[e]),i.push(...e.map((e=>{const i={[qN]:e};return n.forEach((e=>{i[e]=t[e]})),u(r)&&(i[r]=t[r]),i})))})),i};class QN extends qF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===ZN.OUTLIER)return this.series.getOutliersField();if(t===ZN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case ZN.MIN:return this.series.getMinField();case ZN.MAX:return this.series.getMaxField();case ZN.MEDIAN:return this.series.getMedianField();case ZN.Q1:return this.series.getQ1Field();case ZN.Q3:return this.series.getQ3Field();case ZN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===ZN.OUTLIER)return e[qN];if(t===ZN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case ZN.MIN:return e[this.series.getMinField()];case ZN.MAX:return e[this.series.getMaxField()];case ZN.MEDIAN:return e[this.series.getMedianField()];case ZN.Q1:return e[this.series.getQ1Field()];case ZN.Q3:return e[this.series.getQ3Field()];case ZN.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[qN])}getDefaultContentList(t){return[{key:this.getContentKey(ZN.OUTLIER),value:this.getContentValue(ZN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(ZN.MAX),value:this.getContentValue(ZN.MAX)},{key:this.getContentKey(ZN.Q3),value:this.getContentValue(ZN.Q3)},{key:this.getContentKey(ZN.MEDIAN),value:this.getContentValue(ZN.MEDIAN)},{key:this.getContentKey(ZN.Q1),value:this.getContentValue(ZN.Q1)},{key:this.getContentKey(ZN.MIN),value:this.getContentValue(ZN.MIN)},{key:this.getContentKey(ZN.SERIES_FIELD),value:this.getContentValue(ZN.SERIES_FIELD)}]}}class tW extends rF{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==CD.enter&&t.context.diffState!==CD.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Dg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=bI.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const eW=()=>{bI.registerGraphicComponent("glyph",Dg),oM(),GA()},iW=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],sW=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class nW extends tW{constructor(){super(...arguments),this.type=nW.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=iW,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=sW,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}nW.type="boxPlot";const rW=Object.assign(Object.assign({},lz),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),aW=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},oW=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},lW=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),hW=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let w,T,C,B,E;if("horizontal"===e){w=null===(r=null===(n=(null===(s=lW(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,T=null===(h=null===(l=null===(o=null===(a=lW(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=lW(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=lW(t,"box").attribute.width,i=lW(t,"box").attribute.x;B=i,E=i+e}else{w=null===(m=null===(f=(null===(g=lW(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,T=null===(b=null===(y=null===(_=null===(v=lW(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=lW(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=lW(t,"box").attribute.height,i=lW(t,"box").attribute.y;B=i,E=i+e}return k(w)?w:k(B)&&k(E)?(B+E)/2:k(T)&&k(C)?(T+C)/2:k(C)?C:k(T)?T:NaN},cW=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=lW(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=lW(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=lW(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=lW(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=lW(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=lW(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=lW(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=lW(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=lW(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=lW(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class dW extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return aW(hW)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class uW extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return oW(hW)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class pW extends dW{computeAttribute(){return aW(cW)(this.target,this.params,this.params.options)}}class gW extends uW{computeAttribute(){return oW(cW)(this.target,this.params,this.params.options)}}class fW extends Az{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class mW extends Cz{constructor(){super(...arguments),this.type=LO.boxPlot,this.transformerConstructor=fW,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(mW.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(mW.mark.outlier,{key:$I,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var t,e,i,s,n,r;const a=this._boxPlotMark;if(a){const i={lineWidth:this._lineWidth,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"!==this._shaftShape?"#000":this.getColorAttribute()};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const s="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return lI(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return lI(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return lI(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return lI(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return lI(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return lI(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return lI(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return lI(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(a,i,BD.STATE_NORMAL,TD.Series),this.setMarkStyle(a,s,BD.STATE_NORMAL,TD.Built_In)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this._boxFillColor)&&void 0!==n?n:this.getColorAttribute(),stroke:this.getColorAttribute(),size:x(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10},BD.STATE_NORMAL,TD.Series)}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>ZO(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>ZO(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>ZO(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>ZO(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>ZO(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},BD.STATE_NORMAL,TD.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:e=>ZO(t(this.getDatumPositionValues(e,qN),{bandPosition:this._bandPosition}),i)}:{x:t=>this._getPosition(this.direction,t),y:e=>ZO(t(this.getDatumPositionValues(e,qN),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,BD.STATE_NORMAL,TD.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;YL(this._dataSet,"foldOutlierData",JN),YL(this._dataSet,"addVChartProperty",WF);const t=new Ba(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${UI}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:nz.bind(this),call:rz}},!1),this._outlierData=new tF(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return u(this._spec.boxWidth)&&(r=lI(this._spec.boxWidth,n)),u(this._spec.boxMinWidth)&&(r=Math.max(r,lI(this._spec.boxMinWidth,n))),u(this._spec.boxMaxWidth)&&(r=Math.min(r,lI(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),p=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,p-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(p>1&&u(this._spec.boxGapInGroup)){const t=this._groups.fields,i=G(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=lI(null!==(a=i[o-1])&&void 0!==a?a:Y(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=uB(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Tz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=bI.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(vz("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(mz(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(mz(null===(a=bI.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new QN(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}mW.type=LO.boxPlot,mW.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},mW.mark=rW,mW.transformerConstructor=fW;const vW=()=>{eW(),ZA(),sM(),bI.registerGraphicComponent("line",(t=>Eg(t))),bI.registerGraphicComponent("rect",(t=>Ig(t))),bI.registerMark(nW.type,nW),tj(),_F(),hH(),rH(),kT.registerBuiltInAnimate("boxplotScaleIn",dW),kT.registerBuiltInAnimate("boxplotScaleOut",uW),kT.registerBuiltInAnimate("barBoxplotScaleIn",pW),kT.registerBuiltInAnimate("barBoxplotScaleOut",gW),bI.registerSeries(mW.type,mW)};class _W extends rF{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=_W.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Kg(t):Ag(t)}}_W.type="text";const yW=()=>{bI.registerMark(_W.type,_W),oM(),dM(),rM(),bI.registerGraphicComponent("text",Ag),bI.registerGraphicComponent("richtext",Kg)};class bW extends qF{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const xW=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),SW={type:"fadeIn"},kW=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function AW(t,e){return"fadeIn"===e?SW:xW(t)}const MW=Object.assign(Object.assign({},FV),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class wW extends HV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class TW extends VV{constructor(){super(...arguments),this.type=LO.rangeColumn,this._barMarkType="rect",this._barName=LO.bar,this.transformerConstructor=wW}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(TW.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:bz(this._spec,TW.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(TW.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(TW.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",TD.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Tz(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(mz(null===(i=bI.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),vz("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(mz(null===(s=bI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vz("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(mz(null===(n=bI.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),vz("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new bW(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}TW.type=LO.rangeColumn,TW.mark=MW,TW.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},TW.transformerConstructor=wW;const CW=()=>{DV(),yW(),bI.registerAnimation("rangeColumn",((t,e)=>({appear:AW(t,e),enter:xW(t),exit:kW(t),disappear:{duration:fF.disappear.duration}}))),yF(),hH(),rH(),bI.registerSeries(TW.type,TW)};var BW,EW;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(BW||(BW={})),function(t){t.middle="middle",t.start="start",t.end="end"}(EW||(EW={}));class PW extends qF{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const RW=Object.assign({},kV);class OW extends wV{constructor(){super(...arguments),this.type=LO.rangeArea}initMark(){this._areaMark=this._createMark(OW.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",TD.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",TD.Series),this.setMarkStyle(t,{stroke:!1},"normal",TD.Series))}initTooltip(){this._tooltipHelper=new PW(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}OW.type=LO.rangeArea,OW.mark=RW;class IW extends Mz{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Bj,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};uB(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:[]};uB(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(jL.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&wz(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function LW(t){return ab(t)?Number.parseFloat(t):0}const DW=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&FW(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=pe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let k=p,A=S,M=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[yj],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,m.forEach((e=>{const i=e[r]===f?f:e[yj]*t;v(e,k,i),k+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},FW=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===LW(t[e])))||!i&&0===t.reduce(((t,i)=>t+LW(i[e])),0)));function zW(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const jW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:zW(t,!0,rD.appear)}),HW={type:"fadeIn"},VW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:zW(t,!0,rD.enter)}),NW=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:zW(t,!0,rD.exit)});function WW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return HW;case"growRadius":return jW(Object.assign(Object.assign({},t),{growField:"radius"}));default:return jW(Object.assign(Object.assign({},t),{growField:"angle"}))}}class UW extends rF{constructor(t,e){super(t,e),this.type=GW.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>le({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Aj])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class GW extends UW{constructor(){super(...arguments),this.type=GW.type}}GW.type="arc";const YW=()=>{oM(),jA(),YE("arc",sP),kT.registerBuiltInAnimate("growRadiusIn",RC),kT.registerBuiltInAnimate("growRadiusOut",OC),kT.registerBuiltInAnimate("growAngleIn",pC),kT.registerBuiltInAnimate("growAngleOut",gC),bI.registerGraphicComponent("arc",rf),bI.registerMark(GW.type,GW)},XW=Object.assign(Object.assign({},lz),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class $W extends Az{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=yI({},this._theme,i,t);const n=(t,e)=>yI({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const KW=`${UI}_LABEL_VISIBLE`;class qW extends IW{constructor(){super(...arguments),this.transformerConstructor=$W,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:sI(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:sI(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Tj,this._endAngle=Cj,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Aj];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return le(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=u(t),r=u(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(u(this._spec.startAngle)?re(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?re(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?re(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;YL(this._dataSet,"pie",DW),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?re(this._spec.minAngle):0,asStartAngle:xj,asEndAngle:Sj,asRatio:bj,asMiddleAngle:Aj,asRadian:wj,asQuadrant:Mj,asK:kj,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Ba(this._dataSet,{name:`${UI}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new tF(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},qW.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:KI,groupKey:this._seriesField,isSeriesMark:!0},{morph:bz(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return RO(xj)(t)}endAngleScale(t){return RO(Sj)(t)}_computeLayoutRadius(){return Ej((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:QO(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:QO(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",TD.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",TD.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,TD.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",TD.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:RO(KW).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(jL.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[Aj];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return le(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===rD.appear)return this._startAngle;if(i===rD.disappear)return this._endAngle;const r=[rD.disappear,rD.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[$I];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[$I]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[$I])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[$I])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[Aj]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[Aj]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[Aj]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[Aj]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=mz(null===(i=bI.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}qW.transformerConstructor=$W,qW.mark=XW,qW.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class ZW extends qW{constructor(){super(...arguments),this.type=LO.pie}}ZW.type=LO.pie;const JW=()=>{YW(),bI.registerAnimation("pie",((t,e)=>({appear:WW(t,e),enter:VW(t),exit:NW(t),disappear:{duration:fF.disappear.duration}}))),bI.registerAnimation("emptyCircle",((t,e)=>({appear:WW(t,e)}))),bI.registerSeries(ZW.type,ZW)};function QW(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const tU=t=>({type:QW(t.growField),options:{overall:!0}}),eU={type:"fadeIn"},iU=t=>({type:QW(t.growField)}),sU=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function nU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return eU;case"growAngle":return tU(Object.assign(Object.assign({},t),{growField:"angle"}));default:return tU(Object.assign(Object.assign({},t),{growField:"radius"}))}}class rU extends IW{getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(tL),this.setInnerRadiusField(QI)}setValueFieldToPercent(){this.setRadiusField(iL),this.setInnerRadiusField(eL)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const aU=Object.assign(Object.assign({},lz),{rose:{name:"rose",type:"arc"}});class oU extends Az{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class lU extends Vj{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=bI.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=MD.Axis,this._tick=void 0,this._center=null,this._startAngle=Tj,this._endAngle=Cj,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),BO(this._regions,(t=>{"radius"===this.getOrient()?vj(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):vj(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:sI(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:sI(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=re(this._spec.startAngle),this._endAngle=re(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:uj(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){BO(this._regions,(t=>{"radius"===this.getOrient()?vj(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):vj(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return uB(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:uB(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return le(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return he(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>mj(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ne.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return Ej((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=Bj,e=0;const i=this.getChart().getSpec();return BO(this.getRegions(),(s=>{const n=s;if(r=n.type,[LO.rose,LO.radar,LO.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(yI({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(yI({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}lU.type=n.polarAxis,lU.specKey="axes";const hU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},cU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class dU extends lU{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new iE}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YL(this._option.dataSet,t,dE),t}}dU.type=n.polarLinearAxis,dU.specKey="axes",dU.builtInTheme={axis:sH,axisLinear:tH,axisAngle:cU,axisRadius:hU},U(dU,Qj);const uU=()=>{bI.registerGraphicComponent(Dj.lineAxis,((t,e)=>new QC(t,e))),bI.registerGraphicComponent(Fj.lineAxisGrid,((t,e)=>new hP(t,e))),bI.registerGraphicComponent(Dj.circleAxis,((t,e)=>new rB(t,e))),bI.registerGraphicComponent(Fj.circleAxisGrid,((t,e)=>new gP(t,e))),Nj(),bI.registerComponent(dU.type,dU)};class pU extends lU{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new LB}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}registerTicksTransform(){const t=`${this.type}-ticks`;return YL(this._option.dataSet,t,yE),t}transformScaleDomain(){}}pU.type=n.polarBandAxis,pU.specKey="axes",pU.builtInTheme={axis:sH,axisBand:oH,axisAngle:cU,axisRadius:hU},U(pU,aH);const gU=()=>{bI.registerGraphicComponent(Dj.lineAxis,((t,e)=>new QC(t,e))),bI.registerGraphicComponent(Fj.lineAxisGrid,((t,e)=>new hP(t,e))),bI.registerGraphicComponent(Dj.circleAxis,((t,e)=>new rB(t,e))),bI.registerGraphicComponent(Fj.circleAxisGrid,((t,e)=>new gP(t,e))),Nj(),bI.registerComponent(pU.type,pU)};class fU extends rU{constructor(){super(...arguments),this.type=LO.rose,this.transformerConstructor=oU,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(fU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:bz(this._spec,fU.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>ZO(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=ZO(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(mz(null===(i=bI.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),vz("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}fU.type=LO.rose,fU.mark=aU,fU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},fU.transformerConstructor=oU;const mU=()=>{bI.registerSeries(fU.type,fU),YW(),bI.registerAnimation("rose",((t,e)=>({appear:nU(t,e),enter:iU(t),exit:sU(t),disappear:{duration:fF.disappear.duration}}))),gU(),uU()};class vU extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:le(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=he(this.from,this._prevCenter),{angle:i,radius:s}=he(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,bO(this._fromAngle,this._toAngle)&&bO(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=le({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class _U extends nC{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!CO(t)&&!CO(e))return e;const s=he(t,this._prevCenter),n=he(e,this._center);let r=de(s.angle),a=de(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return le({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new se(s,n,r,a);return o.defined=e.defined,o}}const yU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function bU(t,e,i){return"fadeIn"===e?yU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function xU(t,e,i){return"fadeIn"===e?yU(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const SU=(t,e)=>({custom:iC,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),kU=Object.assign(Object.assign(Object.assign({},lz),Gz),{area:{name:"area",type:"area"}});class AU extends rU{constructor(){super(...arguments),this.type=LO.radar,this.transformerConstructor=ej,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(AU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:LF,closePath:!0},"normal",TD.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",TD.Series),this.event.on(jL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:u(this._spec.startAngle)?re(this._spec.startAngle):Tj},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(mz(null===(s=bI.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),vz("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=bI.getAnimationInKey(e);t.setAnimationConfig(mz(null==i?void 0:i(n,r),vz(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&_(a)?a[0]:a}}}AU.type=LO.radar,AU.mark=kU,AU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},AU.transformerConstructor=ej,U(AU,Yz);const MU=()=>{bI.registerSeries(AU.type,AU),xV(),Jz(),tj(),bI.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:bU(t,e,"in"),enter:bU(t,e,"in"),exit:bU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:fF.disappear.duration},update:[{channel:["points","center"],custom:_U,customParameters:t,duration:fF.update.duration,easing:fF.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),bI.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:xU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:fF.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:vU,customParameters:t,duration:fF.update.duration,easing:fF.update.easing}]}))),bI.registerAnimation("radarGroup",((t,e)=>({appear:SU(t,"in"),disappear:{duration:fF.disappear.duration}}))),jA(),gU(),uU()};class wU extends qF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>gi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const TU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(UI)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[$I]:r,[KI]:`${s}_${e}`})),r++}))})),n},CU={fill:"#bbb",fillOpacity:.2},BU=Object.assign(Object.assign({},lz),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}});class EU extends Cz{constructor(){super(...arguments),this.type=LO.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),YL(this._option.dataSet,"objFlat",TU),YL(this._option.dataSet,"copyDataView",tD),XL(this._option.dataSet,"dataview",Ma),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:nD.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(yI(CU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(EU.mark.group),this._containerMark=this._createMark(EU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(EU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(EU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(EU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(EU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(EU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(EU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-(null!==(t=this._spec.leftAppendPadding)&&void 0!==t?t:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",TD.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",TD.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",TD.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",TD.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",TD.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",TD.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",TD.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",TD.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",TD.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:qI}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new $O).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:qI}}initTooltip(){this._tooltipHelper=new wU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}EU.type=LO.dot,EU.mark=BU,EU.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class PU extends qF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>gi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const RU=Object.assign(Object.assign({},lz),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),OU=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class IU extends Cz{constructor(){super(...arguments),this.type=LO.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),YL(this._option.dataSet,"linkDotInfo",OU),null===(t=this.getViewData())||void 0===t||t.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:nD.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(IU.mark.group),this._containerMark=this._createMark(IU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(IU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(IU.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",TD.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",TD.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",TD.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",TD.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:qI}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new PU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}IU.type=LO.link,IU.mark=RU,IU.builtInTheme={link:{arrow:{style:{size:10}}}};const LU=Object.assign(Object.assign({},lz),{group:{name:"group",type:"group"}});class DU extends IW{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?QI:pL],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(i.offsetAngle);let o;if(u(s)){const t=ot(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return d(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?tL:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(i.offsetAngle),o=ot(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=u(n)?re(n):Tj;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?re(r):Cj,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||u(null==s?void 0:s.startAngle)||u(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=ZO(this.angleAxisHelper.dataToPosition([t[QI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=ZO(this.angleAxisHelper.dataToPosition([t[tL]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?ZO(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(DU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",TD.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+re(a),o=re(r)/2;return rf(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Ig({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const HU=()=>{bI.registerAnimation("circularProgress",((t,e)=>({appear:jU(t,e),enter:{type:"growAngleIn"},disappear:{duration:fF.disappear.duration}})))};class VU extends Az{constructor(){super(...arguments),this._supportStack=!0}}class NU extends DU{constructor(){super(...arguments),this.type=LO.circularProgress,this.transformerConstructor=VU,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(NU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:bz(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",TD.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(NU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?QI:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?tL:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",TD.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(mz(null===(i=bI.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),vz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(mz(null===(s=bI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vz("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}NU.type=LO.circularProgress,NU.mark=FU,NU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},NU.transformerConstructor=VU;const WU=()=>{bI.registerSeries(NU.type,NU),YW(),HU(),yF(),gU(),uU()};function UU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const GU={type:"fadeIn"};function YU(t,e="grow"){return!1===e?{}:"fadeIn"===e?GU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:UU(t)}))(t)}class XU extends qF{enableByType(t){return"dimension"!==t}}const $U=Object.assign(Object.assign({},lz),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class KU extends Cz{constructor(){super(...arguments),this.type=LO.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=u(e.width)?e.width:e.x1-e.x,o=u(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(KU.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return ZO(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return ZO(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?ZO(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",TD.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return ZO(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return ZO(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?ZO(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",TD.Series)}}_initTrackMark(){return this._trackMark=this._createMark(KU.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return ZO(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",TD.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return ZO(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",TD.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(mz(null===(i=bI.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),vz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(mz(null===(s=bI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vz("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new XU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}KU.type=LO.linearProgress,KU.mark=$U,KU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const qU=()=>{DV(),bI.registerAnimation("linearProgress",((t,e)=>({appear:YU(t,e),enter:YU(t),disappear:{duration:fF.disappear.duration}}))),yF(),bI.registerSeries(KU.type,KU)},ZU=[0],JU=[20,40],QU=[200,500],tG={shrink:!1,enlarge:!1,fontSizeLimitMin:0},eG=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class iG{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const sG=`${UI}_WORD_CLOUD_TEXT`,nG=Object.assign(Object.assign({},lz),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),rG={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class aG extends Mz{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=JU}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:QU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:ZU,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?sG:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:tG},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||eb(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:ZU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!eG.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new iG(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var t;this._wordMark=this._createMark(aG.mark.word,{key:KI,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(aG.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:MD.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",TD.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",TD.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",TD.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(mz(bI.getAnimationInKey("wordCloud")(n,s),vz("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new $O).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:qI])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new iE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new iE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[$I])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,jL.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:KI,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:O_.createCanvas.bind(O_),getTextBounds:gf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Ng,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}aG.mark=nG,aG.builtInTheme={wordCloud:rG};function oG(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||fF.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=lG(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,At(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=At(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},hG=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=hG(t.children,e,t,n))})),s},cG=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=cG(t.children,e,t,n)),n=e(t,s,i,n)})),n},dG=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):dG(t.children,e,i)))})),e};function uG(t,e){let i,s;if(fG(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function fG(t,e){for(let i=0;i1e-6?(T+Math.sqrt(T*T-4*w*C))/(2*w):C/T);return{x:s+S+k*B,y:n+A+M*B,radius:B}}function yG(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function bG(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function xG(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function SG(t){return{_:t,next:null,prev:null}}function kG(t,e){const i=(t=G(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];yG(n,s,r);let a,o,l,h,c,d,u,p=SG(s),g=SG(n),f=SG(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=lG(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:TG.defaultOpionts.nodeSort;hG([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)hG([o],AG(h)),cG([o],MG(this._getPadding,.5,a)),hG([o],wG(1,this._maxDepth));else{const t=Math.min(s.width,s.height);hG([o],AG(TG.defaultOpionts.setRadius)),cG([o],MG(Pt,1,a)),d&&cG([o],MG(this._getPadding,o.radius/t,a)),hG([o],wG(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}TG.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const CG=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=CG(t.children):t.value=0),e+=Math.abs(t.value)})),e};function BG(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){CG(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=d(t.value)?0:At(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=At(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function EG(t){return t.depth}function PG(t,e){return e-1-t.endDepth}const RG=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),OG=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},IG={left:EG,right:PG,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:EG,end:PG},LG=_t(0,1);class DG{constructor(t){this._ascendingSourceBreadth=(t,e)=>RG(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>RG(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},DG.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Bt(e):null;this._getNodeKey=i,this._logger=rt.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):IG[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return BG(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!d(r.source),l=!d(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&d(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[OG(s[t.source]),OG(s[t.target],!0)].filter((t=>!d(t)));e.length&&(t.value=$(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=At(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=At(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(v(e)){const t=mt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*LG(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}d(this.options.nodeSortBy)&&n.sort(RG),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(RG),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];FG(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),zG);const s=_(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},jG.defaultOpionts,t):Object.assign({},jG.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Bt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Et(this.options.center[0],t.width),s=t.y0+Et(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Et(t,n))):Et(r,n),h=_(a),c=this.options.gapRadius,u=h?a.map((t=>Et(t,n))):Et(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Et(r,n),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(_(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=lG(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=le({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function HG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:FG,slice:HG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?HG:FG)(t,e,i,s,n)}};class WG{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},WG.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Bt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?VG(this.options.aspectRatio):null!==(e=NG[this.options.splitType])&&void 0!==e?e:NG.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=lG(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function UG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+li?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return rt.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=UG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=wi(o.map(wi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Pi(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=GG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&rt.getInstance().error("Area "+r+" not represented on screen")}return i}function JG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Bi((function(i){return-1*QG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},eY=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=G(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!E(G(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:G(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||XG,s=e.lossFunction||YG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];hi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rne.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:tY(f),arcs:f})}))},iY={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:sY,triangle:sY,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 sY(){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 nY(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const rY=t=>iY[t]?iY[t]():iY.circle(),aY=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function oY(t){return c(t)?t:function(){return t}}class lY{constructor(t){var e,i;switch(this.options=z({},lY.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=rY(this.options.shape),this.getText=null!==(e=oY(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=oY(this.options.fontWeight),this.getTextFontSize=oY(this.options.fontSize),this.getTextFontStyle=oY(this.options.fontStyle),this.getTextFontFamily=oY(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>aY(10,50);break;case"random-light":this.getTextColor=()=>aY(50,90);break;default:this.getTextColor=oY(this.options.color)}if(d(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=c(this.options.rotate)?t=>{var e;return re(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():Mt(e);return re(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!d(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class cY extends lY{constructor(t){var e;super(z({},cY.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<=cY.defaultOptions.minFontSize&&(this.options.minFontSize=cY.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=hY[this.options.spiral])&&void 0!==e?e:hY.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=oY(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=nY(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(gY(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(pY(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}gY(p,this._size)&&(p=fY(p,this._size))}else if(gY(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||uY(p,i))&&(!i||!dY(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function dY(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function uY(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,gY=(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 fY(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},vY=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>le(t,e,i+r*n)))},_Y=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},yY=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=nY(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=rY("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return le(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)_Y(n,vY({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)_Y(n,vY({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)_Y(n,vY({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)_Y(n,vY({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)_Y(n,vY({x:l,y:h},o,0,3));else if("star"===t.shape){const t=vY({x:l,y:h},o,-Math.PI/2,5),e=vY({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);_Y(n,i)}else n.fillRect(0,0,i,s)}; +function t(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(n||(n={}));var a={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var y=t=>Array.isArray?Array.isArray(t):l(t,"Array");var _=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var A=t=>x(t)&&Number.isFinite(t);var k=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var C=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const M=Object.prototype;var T=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||M)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(_(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(T(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var P=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!u(n[a])||"object"!=typeof n[a]||s&&y(t[a])?F(t,a,n[a]):L(t,e,a,i,s)}}}}function L(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(_(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function j(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(j(t)!==j(e))return!1;if(c(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=N(t),n=N(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function et(t){return Number(t)}function it(t,e,i=et){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&x(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(t=rt.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):nt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=rt.Warn&&nt(this._method||"warn","WARN",t),this}info(...t){return this._level>=rt.Info&&nt(this._method||"log","INFO",t),this}debug(...t){return this._level>=rt.Debug&&nt(this._method||"log","DEBUG",t),this}}function ot(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(Q)),it(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e,i=ut,s=dt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function ft(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var vt=function(t,e,i){return ti?i:t};var yt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function _t(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function _(t){return o=void 0,u&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(A(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function St(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xt(t,e,{leading:s,trailing:n,maxWait:e})}function At(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Ct(t){if(A(t))return t;const e=+t;return A(e)?e:0}function wt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}bt=!1;const Mt=4294967296;const Tt=t=>e=>P(e,t),Bt=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||Tt)(i)},Et=(t,e={})=>{if(y(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Pt=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Ot=t=>0,Rt=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Lt(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!d(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:u,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)u+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!d(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!d(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:u,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=It(f.min,f);for(let r=0;r=1?Ht:t<=-1?-Ht:Math.asin(t)}function Zt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Jt(t,e){return t[0]*e[1]-t[1]*e[0]}function Qt(t,e){let i=0;for(let s=0;s0?i:0}function ie(t,e){return te(t+e,10**Math.max(ee(t),ee(e)))}function se(t,e){return te(t-e,10**Math.max(ee(t),ee(e)))}class ne{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ne(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class re{static distancePP(t,e){return Kt($t(t.x-e.x,2)+$t(t.y-e.y,2))}static distanceNN(t,e,i,s){return Kt($t(t-i,2)+$t(e-s,2))}static distancePN(t,e,i){return Kt($t(e-t.x,2)+$t(i-t.y,2))}static pointAtPP(t,e,i){return new ne((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ae(t){return t*(Math.PI/180)}function oe(t){return 180*t/Math.PI}const le=(t=0)=>{if(t<0)for(;t<-jt;)t+=jt;else if(t>0)for(;t>jt;)t-=jt;return t};function he(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function ce(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function de(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ue(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function pe(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ue(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function ge(t){return(t=ue(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function fe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function me(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ye(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var _e;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(_e||(_e={}));const be=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function xe(t,e,i){if(!t||!e)return _e.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Ce({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function we(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Me(t,e){const i=e?ae(t.angle):t.angle,s=we(t);return[Ce({x:t.x1,y:t.y1},i,s),Ce({x:t.x2,y:t.y1},i,s),Ce({x:t.x2,y:t.y2},i,s),Ce({x:t.x1,y:t.y2},i,s)]}function Te(t,e,i=!1){const s=Me(t,i),n=Me(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(we(t),we(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ae(t.angle):t.angle;let u=i?ae(90-t.angle):t.angle+Ht;const p=i?ae(e.angle):e.angle;let g=i?ae(90-e.angle):e.angle+Ht;u>Nt&&(u-=Nt),g>Nt&&(g-=Nt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Ee(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Le{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(v(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(d(t))return{width:0,height:0};if(d(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(d(this._numberCharSize)){const t=this._standardMethod(Le.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Le.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Le.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Le.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Le.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Le.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Le.NUMBERS_CHAR_SET="0123456789",Le.FULL_SIZE_CHAR="字";const Fe=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}},ze=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),He=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return je(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ne{}class We extends Ne{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Ce({x:this.x1,y:this.y1},this.angle,t),Ce({x:this.x2,y:this.y1},this.angle,t),Ce({x:this.x1,y:this.y2},this.angle,t),Ce({x:this.x2,y:this.y2},this.angle,t)]}}class Ue{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ue,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ue;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ue(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=oe(r.rotateDeg),r}}class Ge{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Ye(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Xe(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Ke=/^#([0-9a-f]{3,8})$/,$e={transparent:4294967040},qe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ze(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Je(t){return x(t)?new si(t>>16,t>>8&255,255&t,1):y(t)?new si(t[0],t[1],t[2]):new si(255,255,255)}function Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ei=(t,e)=>{const i=Ke.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new si((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Je(t):8===e?new si(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ii{static Brighter(t,e=1){return 1===e?t:new ii(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ii(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ii?t:new ii(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u($e[t]))return function(t){return x(t)?new si(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new si(t[0],t[1],t[2],t[3]):new si(255,255,255,1)}($e[t]);if(u(qe[t]))return Je(qe[t]);const e=`${t}`.trim().toLowerCase(),i=ei(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new si(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new si(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ii.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new si(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Xe(this.color.r,this.color.g,this.color.b),r=Ye(d(t)?n.h:vt(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new si(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ei(e,!0);return null!=i?i:this}setColorName(t){const e=qe[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ii(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class si{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Ze(this.r)+Ze(this.g)+Ze(this.b)+(1===this.opacity?"":Ze(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Xe(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ni(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new si(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Xe});function ai(t){if(A(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(p(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function oi(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const li=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function hi(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function ci(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const di=1e-10;function ui(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+di)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=mi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=re.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=pi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-di,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function pi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function gi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return pi(t,t-(i*i-e*e+t*t)/(2*i))+pi(e,s)}function fi(t,e){const i=re.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function mi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let _i;function bi(t,e){const i=yi(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class xi{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Si=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ai(t){let e;if(e=Si.exec(t))return new xi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const ki=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ci{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return Ci.instance||(Ci.instance=new Ci),Ci.instance}newFormat(t){const e=Ai(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):wi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=wi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:y,group:_,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?m:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?ki[8+_i/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?y+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=_(k,1/0));let C=S.length+k.length+A.length,w=C>1)+S+k+A+w.slice(C);break;default:k=w+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Ai(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=yi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=ki[8+n/3];return function(t){return s(r*t)+a}}}const wi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>bi(100*t,e),r:bi,s:function(t,e){const i=yi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(_i=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+yi(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function Mi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Pi(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Pi(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Qt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Ii(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ei(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},es=Math.sqrt,is=Math.tan;function ss(t){return t>1?0:t<-1?ji:Math.acos(t)}function ns(t){return t>1?Ni:t<-1?-Ni:Math.asin(t)}function rs(){}function as(t,e){t&&ls.hasOwnProperty(t.type)&&ls[t.type](t,e)}var os={Feature:function(t,e){as(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sji?t+Math.round(-t/Wi)*Wi:t,e]}function xs(t,e,i){return(t%=Wi)?e||i?_s(As(t),ks(e,i)):As(t):e||i?ks(e,i):bs}function Ss(t){return function(e,i){return[(e+=t)>ji?e-Wi:e<-ji?e+Wi:e,i]}}function As(t){var e=Ss(t);return e.invert=Ss(-t),e}function ks(t,e){var i=$i(t),s=Qi(t),n=$i(e),r=Qi(e);function a(t,e){var a=$i(e),o=$i(t)*a,l=Qi(t)*a,h=Qi(e),c=h*i+o*s;return[Ki(l*n-c*r,o*i-h*s),ns(c*n+l*r)]}return a.invert=function(t,e){var a=$i(e),o=$i(t)*a,l=Qi(t)*a,h=Qi(e),c=h*n-l*r;return[Ki(l*n+h*r,o*i+c*s),ns(c*i-o*s)]},a}function Cs(t,e){(e=ps(e))[0]-=t,ys(e);var i=ss(-e[1]);return((-e[2]<0?-i:i)+Wi-Hi)%Wi}function ws(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:rs,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ms(t,e){return Yi(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function Es(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Ls(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function Fs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ws(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Ls(a);var t=function(t,e){var i=Is(e),s=e[1],n=Qi(s),r=[Qi(i),-$i(i),0],a=0,o=0;Rs.reset(),1===n?s=Ni+Hi:-1===n&&(s=-Ni-Hi);for(var l=0,h=t.length;l=0?1:-1,C=k*A,w=C>ji,M=f*x;if(Rs.add(Ki(M*k*Qi(C),m*S+M*$i(C))),a+=w?A+k*Wi:A,w^p>=i^_>=i){var T=fs(ps(u),ps(y));ys(T);var B=fs(r,T);ys(B);var E=(w^A>=0?-1:1)*ns(B[2]);(s>E||s===E&&(T[0]||T[1]))&&(o+=w^A>=0?1:-1)}}return(a<-Hi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(zs))}return u}}function zs(t){return t.length>1}function Hs(t,e){return((t=t.x)[0]<0?t[1]-Ni-Hi:Ni-t[1])-((e=e.x)[0]<0?e[1]-Ni-Hi:Ni-e[1])}1===(Ps=Ds).length&&(Os=Ps,Ps=function(t,e){return Ds(Os(t),e)});var js=Fs((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?ji:-ji,l=Yi(r-i);Yi(l-ji)0?Ni:-Ni),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=ji&&(Yi(i-n)Hi?Xi((Qi(e)*(r=$i(s))*Qi(i)-Qi(s)*(n=$i(e))*Qi(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*Ni,s.point(-ji,n),s.point(0,n),s.point(ji,n),s.point(ji,0),s.point(ji,-n),s.point(0,-n),s.point(-ji,-n),s.point(-ji,0),s.point(-ji,n);else if(Yi(t[0]-e[0])>Hi){var r=t[0]0,n=Yi(e)>Hi;function r(t,i){return $i(t)*$i(i)>e}function a(t,i,s){var n=[1,0,0],r=fs(ps(t),ps(i)),a=gs(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=fs(n,r),u=vs(n,h);ms(u,vs(r,c));var p=d,g=gs(u,p),f=gs(p,p),m=g*g-f*(gs(u,u)-1);if(!(m<0)){var v=es(m),y=vs(p,(-g-v)/f);if(ms(y,u),y=us(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Yi(y[0]-b)ji^(b<=y[0]&&y[0]<=x)){var w=vs(p,(-g+v)/f);return ms(w,u),[y,us(w)]}}}function o(e,i){var n=s?t:ji-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Fs(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?ji:-ji),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ms(e,p)||Ms(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&Ms(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=$i(e),o=Qi(e),l=s*i;null==n?(n=e+s*Wi,r=e-l/2):(n=Cs(a,n),r=Cs(a,r),(s>0?nr)&&(n+=s*Wi));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Yi(s[0]-t)0?0:3:Yi(s[0]-i)0?2:1:Yi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,y,_=a,b=ws(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&_.lineEnd()},polygonStart:function(){_=b,l=[],h=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=y&&e,n=(l=Ls(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Bs(l,o,e,r,a),a.polygonEnd());_=a,l=h=c=null}};function S(t,e){n(t,e)&&_.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(_.lineStart(),_.point(r,a));else if(o&&m)_.point(r,a);else{var l=[g=Math.max(Ws,Math.min(Vs,g)),f=Math.max(Ws,Math.min(Vs,f))],b=[r=Math.max(Ws,Math.min(Vs,r)),a=Math.max(Ws,Math.min(Vs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(_.lineStart(),_.point(r,a),y=!1):(m||(_.lineStart(),_.point(l[0],l[1])),_.point(b[0],b[1]),o||_.lineEnd(),y=!1)}g=r,f=a,m=o}return x}}function Gs(t){return t}var Ys,Xs,Ks,$s,qs=Di(),Zs=Di(),Js={point:rs,lineStart:rs,lineEnd:rs,polygonStart:function(){Js.lineStart=Qs,Js.lineEnd=sn},polygonEnd:function(){Js.lineStart=Js.lineEnd=Js.point=rs,qs.add(Yi(Zs)),Zs.reset()},result:function(){var t=qs/2;return qs.reset(),t}};function Qs(){Js.point=tn}function tn(t,e){Js.point=en,Ys=Ks=t,Xs=$s=e}function en(t,e){Zs.add($s*t-Ks*e),Ks=t,$s=e}function sn(){en(Ys,Xs)}var nn=Js,rn=1/0,an=rn,on=-rn,ln=on;var hn,cn,dn,un,pn={point:function(t,e){ton&&(on=t);eln&&(ln=e)},lineStart:rs,lineEnd:rs,polygonStart:rs,polygonEnd:rs,result:function(){var t=[[rn,an],[on,ln]];return on=ln=-(an=rn=1/0),t}},gn=0,fn=0,mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An={point:kn,lineStart:Cn,lineEnd:Tn,polygonStart:function(){An.lineStart=Bn,An.lineEnd=En},polygonEnd:function(){An.point=kn,An.lineStart=Cn,An.lineEnd=Tn},result:function(){var t=Sn?[bn/Sn,xn/Sn]:_n?[vn/_n,yn/_n]:mn?[gn/mn,fn/mn]:[NaN,NaN];return gn=fn=mn=vn=yn=_n=bn=xn=Sn=0,t}};function kn(t,e){gn+=t,fn+=e,++mn}function Cn(){An.point=wn}function wn(t,e){An.point=Mn,kn(dn=t,un=e)}function Mn(t,e){var i=t-dn,s=e-un,n=es(i*i+s*s);vn+=n*(dn+t)/2,yn+=n*(un+e)/2,_n+=n,kn(dn=t,un=e)}function Tn(){An.point=kn}function Bn(){An.point=Pn}function En(){On(hn,cn)}function Pn(t,e){An.point=On,kn(hn=dn=t,cn=un=e)}function On(t,e){var i=t-dn,s=e-un,n=es(i*i+s*s);vn+=n*(dn+t)/2,yn+=n*(un+e)/2,_n+=n,bn+=(n=un*t-dn*e)*(dn+t),xn+=n*(un+e),Sn+=3*n,kn(dn=t,un=e)}var Rn=An;function In(t){this._context=t}In.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,Wi)}},result:rs};var Dn,Ln,Fn,zn,Hn,jn=Di(),Nn={point:rs,lineStart:function(){Nn.point=Vn},lineEnd:function(){Dn&&Wn(Ln,Fn),Nn.point=rs},polygonStart:function(){Dn=!0},polygonEnd:function(){Dn=null},result:function(){var t=+jn;return jn.reset(),t}};function Vn(t,e){Nn.point=Wn,Ln=zn=t,Fn=Hn=e}function Wn(t,e){zn-=t,Hn-=e,jn.add(es(zn*zn+Hn*Hn)),zn=t,Hn=e}var Un=Nn;function Gn(){this._string=[]}function Yn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Xn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ds(t,i(s))),s.result()}return r.area=function(t){return ds(t,i(nn)),nn.result()},r.measure=function(t){return ds(t,i(Un)),Un.result()},r.bounds=function(t){return ds(t,i(pn)),pn.result()},r.centroid=function(t){return ds(t,i(Rn)),Rn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Gs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Gn):new In(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Kn(t){return function(e){var i=new $n;for(var s in t)i[s]=t[s];return i.stream=e,i}}function $n(){}function qn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ds(i,t.stream(pn)),e(pn.result()),null!=s&&t.clipExtent(s),t}function Zn(t,e,i){return qn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Jn(t,e,i){return Zn(t,[[0,0],e],i)}function Qn(t,e,i){return qn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function tr(t,e,i){return qn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Gn.prototype={_radius:4.5,_circle:Yn(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=Yn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},$n.prototype={constructor:$n,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var er=16,ir=$i(30*Gi);function sr(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,y=c-n,_=v*v+y*y;if(_>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=es(b*b+x*x+S*S),k=ns(S/=A),C=Yi(Yi(S)-1)e||Yi((v*B+y*E)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Gi:0,B()):[m*Ui,v*Ui,y*Ui]},M.angle=function(t){return arguments.length?(_=t%360*Gi,B()):_*Ui},M.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},M.precision=function(t){return arguments.length?(a=sr(o,w=t*t),E()):es(w)},M.fitExtent=function(t,e){return Zn(M,t,e)},M.fitSize=function(t,e){return Jn(M,t,e)},M.fitWidth=function(t,e){return Qn(M,t,e)},M.fitHeight=function(t,e){return tr(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&T,B()}}function hr(t){var e=0,i=ji/3,s=lr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Gi,i=t[1]*Gi):[e*Ui,i*Ui]},n}function cr(t,e){var i=Qi(t),s=(i+Qi(e))/2;if(Yi(s)2?t[2]*Gi:0),e.invert=function(e){return(e=t.invert(e[0]*Gi,e[1]*Gi))[0]*=Ui,e[1]*=Ui,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===vr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function _r(t){return is((Ni+t)/2)}function br(t,e){var i=$i(t),s=t===e?Qi(t):Zi(i/$i(e))/Zi(_r(e)/_r(t)),n=i*Ji(_r(t),s)/s;if(!s)return vr;function r(t,e){n>0?e<-Ni+Hi&&(e=-Ni+Hi):e>Ni-Hi&&(e=Ni-Hi);var i=n/Ji(_r(e),s);return[i*Qi(s*t),n-i*$i(s*t)]}return r.invert=function(t,e){var i=n-e,r=ts(s)*es(t*t+i*i),a=Ki(t,Yi(i))*ts(i);return i*s<0&&(a-=ji*ts(t)*ts(i)),[a/s,2*Xi(Ji(n/r,1/s))-Ni]},r}function xr(t,e){return[t,e]}function Sr(t,e){var i=$i(t),s=t===e?Qi(t):(i-$i(e))/(e-t),n=i/s+t;if(Yi(s)Hi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Pr.invert=gr(ns),Or.invert=gr((function(t){return 2*Xi(t)})),Rr.invert=function(t,e){return[-e,2*Xi(qi(t))-Ni]};var Lr={exports:{}},Fr=function(t,e){this.p1=t,this.p2=e};Fr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Fr.prototype.run=function(){return this.p2[0]-this.p1[0]},Fr.prototype.slope=function(){return this.rise()/this.run()},Fr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Fr.prototype.isVertical=function(){return!isFinite(this.slope())},Fr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Fr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Fr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Fr.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)},Fr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var zr=Fr,Hr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new zr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Hr(t.slice(0,s),e),o=Hr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},jr=Hr;!function(t){var e=jr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Vr(Gr,e),{tolerance:s}=i;return Nr(t,s)};var Xr;!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"}(Xr||(Xr={}));const Kr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(A(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let C=0;const w=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/C:0,w.push(_[t])}return w},qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(u=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==u?u:"percentage",w=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],T=M.length?M:void 0,B=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:T});if(!w.length)return $r(t,B);const E={};return t.forEach((t=>{const e=w.map((e=>null==t?void 0:t[e])).join("-&&-");E[e]?E[e].push(t):E[e]=[t]})),Object.values(E).map((t=>{const e=[...M,...w];return $r(t,Object.assign(Object.assign({},B),{groupField:e.length?e:void 0,n:t.length}))})).flat()},Zr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",w=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",T=null!==(l=k.q1)&&void 0!==l?l:"q1",B=null!==(h=k.median)&&void 0!==h?h:"median",E=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(u=k.iqr)&&void 0!==u?u:"iqr",O=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",D=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",L=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),y(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}y(S)&&(S=[vt(Math.min.apply(null,S),0,1),vt(Math.max.apply(null,S),0,1)]);const V=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[w]=s,f[M]=o,f[T]=l,f[B]=h,f[E]=c,f[P]=d,f[O]=n,f[R]=r,f[I]=u,f[D]=p,f[L]=g,A&&(f[F]=H.get(t)||[]),V.push(f)}return V};var Jr={},Qr={};function ta(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ea(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ia(t,e){var i=t+"",s=i.length;return s9999?"+"+ia(e,6):ia(e,4))+"-"+ia(t.getUTCMonth()+1,2)+"-"+ia(t.getUTCDate(),2)+(r?"T"+ia(i,2)+":"+ia(s,2)+":"+ia(n,2)+"."+ia(r,3)+"Z":n?"T"+ia(i,2)+":"+ia(s,2)+":"+ia(n,2)+"Z":s||i?"T"+ia(i,2)+":"+ia(s,2)+"Z":"")}function na(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Qr;if(h)return h=!1,Jr;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a0}function fa(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=la(t));var r=[];switch(t.type){case"GeometryCollection":return ma(t,(function(t){ya(t,s)})),t;case"FeatureCollection":return fa(t,(function(t){fa(ya(t,s),(function(t){r.push(t)}))})),ci(r)}return ya(t,s)}function ya(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ma(t,(function(t){ya(t,e)})),t;case"LineString":return _a(pa(t),e),t;case"Polygon":return ba(pa(t),e),t;case"MultiLineString":return pa(t).forEach((function(t){_a(t,e)})),t;case"MultiPolygon":return pa(t).forEach((function(t){ba(t,e)})),t;case"Point":case"MultiPoint":return t}}function _a(t,e){ga(t)===e&&t.reverse()}function ba(t,e){ga(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=xa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Ca=(t,e={},i)=>{i.type=Xr.GEO;const s=Vr(Aa,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ka(t))})):e.push(ka(t))})),e})(t);let l=t.features;return o&&(l=va(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=Sa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=Sa.bounds(t);t.bbox=e}})),t.features=l,t},wa={},Ma=(t,e,i)=>{i.type=Xr.GEO;const s=Vr(Aa,wa,e),{object:n}=s;if(!v(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Dr(a,t)}))}:Dr(a,o));var a,o;return Ca(r,s,i)},Ta=(t,e,i)=>{const s=!h(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Ba=0;function Ea(t="dataset"){return Ba>1e8&&(Ba=0),t+"_"+Ba++}class Pa{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:Ea("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Oa{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ea("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Oa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Kr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Xn();const Ra={},Ia={albers:ur,albersusa:function(){var t,e,i,s,n,r,a=ur(),o=dr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=dr().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}},Da=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function La(t,e){return function i(){const s=e();return s.type=t,s.path=Xn().projection(s),s.copy=s.copy||function(){const t=i();return Da.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Fa{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class za extends Fa{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}class Ha{static GenAutoIncrementId(){return Ha.auto_increment_id++}}Ha.auto_increment_id=0;class ja{}const Na=new ja;let Va=0;class Wa{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Na.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Va,t),this.tryRunAnimationFrameNextFrame(),Va}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class Ua{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Ga=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ya extends Ua{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Ha.GenAutoIncrementId(),this.hooks={onSetEnv:new za(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Wa);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Wa),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Ga(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}var Xa=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ka extends o{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=Ha.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Xa(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Za))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(eo(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof Za))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=eo(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof Za))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=eo(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Za))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=eo(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Za))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=to.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(eo(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(eo(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,eo(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Za))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):eo(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof Ja))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=to.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new io(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Za,this.rootWheelEvent=new Ja,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&v(t)&&!R(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const ao=jt-1e-8;class oo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>ao)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=jt)<0&&(s+=jt),(n%=jt)<0&&(n+=jt),nn;++o,a-=Ht)g(a);else for(a=s-s%Ht+Ht,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ho=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,co={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},uo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let po,go,fo,mo,vo,yo;function _o(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tyo){let t,e=fo;for(let s=1,r=i.length;s1&&(g=Math.sqrt(g),i*=g,s*=g);const f=d/i,m=c/i,v=-c/s,y=d/s,_=f*o+m*l,b=v*o+y*l,x=f*t+m*e,S=v*t+y*e;let A=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const C=.5*(_+x)-k*(S-b),w=.5*(b+S)+k*(x-_),M=Math.atan2(b-w,_-C);let T=Math.atan2(S-w,x-C)-M;T<0&&1===r?T+=jt:T>0&&0===r&&(T-=jt);const B=Math.ceil(Math.abs(T/(Ht+.001))),E=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Po(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=jo(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Vo(t,e){const{p0:i,p1:s}=t,n=re.pointAtPP(i,s,e);return[new Wo(i,n),new Wo(n,s)]}class Wo extends Oo{constructor(t,e){super(),this.type=ko.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return re.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?re.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Ao.ROW?Vt(this.p0.x-this.p1.x):t===Ao.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class Uo{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new No(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new Wo(new ne(this._lastX,this._lastY),new ne(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Ao.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===Ao.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Go extends Uo{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Yo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Xo(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?Ao.ROW:Ao.COLUMN;return"monotoneY"===t?new Go(t,s):new Uo(t,s)}class Ko{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 $o(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Xo("linear",i,t);return qo(new Ko(n,s),t),n}function qo(t,e){return Yo(t,e,1)}function Zo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Jo{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&&Zo(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:Zo(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 Qo(t,e){return Yo(t,e,2)}function tl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return $o(t,e);const n=Xo("basis",i,t);return Qo(new Jo(n,s),t),n}function el(t){return t<0?-1:1}function il(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(el(r)+el(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function sl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function nl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class rl{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:nl(this,this._t0,sl(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,nl(this,sl(this,e=il(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:nl(this,this._t0,e=il(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class al extends rl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ol(t,e){return Yo(t,e,2)}function ll(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return $o(t,e);const n=Xo("monotoneX",i,t);return ol(new rl(n,s),t),n}function hl(t,e){return Yo(t,e,2)}function cl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return $o(t,e);const n=Xo("monotoneY",i,t);return hl(new al(n,s),t),n}let dl=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class ul extends dl{lineEnd(){this.context.closePath()}}function pl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Uo("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ao.ROW:Ao.COLUMN);return gl(new dl(r,e,n),t),r}function gl(t,e){return Yo(t,e,1)}function fl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Uo("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ao.ROW:Ao.COLUMN);return gl(new ul(r,e,n),t),r}class ml extends Ko{lineEnd(){this.context.closePath()}}function vl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Xo("linear",i,t);return yl(new ml(n,s),t),n}function yl(t,e){return Yo(t,e,1)}function _l(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ft){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ft){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function bl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return $o(i,n);const o=Xo(t,r,i);return Yo(new e(o,s,a),i,2),o}}const xl=bl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:_l(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Sl=bl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:_l(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Al extends Oo{constructor(t,e,i){super(),this.type=ko.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return zo(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Ho(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===Ao.ROW?Vt(this.p0.x-this.p2.x):t===Ao.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=zo(i,s,n,e),a=re.pointAtPP(i,s,e),o=re.pointAtPP(s,n,e);return[new Al(i,a,r),new Al(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class kl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Wo(new ne(this._lastX,this._lastY),new ne(t,e))}quadraticCurveTo(t,e,i,s){const n=new Al(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new No(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Cl(t,e,i){var s,n;switch(e){case"linear":default:return $o(t,i);case"basis":return tl(t,i);case"monotoneX":return ll(t,i);case"monotoneY":return cl(t,i);case"step":return pl(t,.5,i);case"stepClosed":return fl(t,.5,i);case"stepBefore":return pl(t,0,i);case"stepAfter":return pl(t,1,i);case"catmullRom":return xl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Sl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return vl(t,i)}}class wl extends lo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new oo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([uo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([uo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([uo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([uo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([uo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([uo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([uo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([uo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([uo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new kl(this);Po(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[uo.M]=t=>`M${t[1]} ${t[2]}`,t[uo.L]=t=>`L${t[1]} ${t[2]}`,t[uo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[uo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[uo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];Bo(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[uo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=_o(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=Cl(e,i);"x"===s?this.direction=Ao.ROW:"y"===s?this.direction=Ao.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[uo.M]=this.moveToTransform,t[uo.L]=this.lineToTransform,t[uo.Q]=this.quadraticCurveToTransform,t[uo.C]=this.bezierCurveToTransform,t[uo.AT]=this.arcToTransform,t[uo.E]=this.ellipseTransform,t[uo.R]=this.rectTransform,t[uo.A]=this.arcTransform,t[uo.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Po(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Ao.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===Ao.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{at.getInstance().warn("空函数")}}),Jl=Object.assign(Object.assign({},Ul),{points:[],cornerRadius:0,closePath:!0}),Ql=Object.assign(Object.assign({},Ul),{width:100,height:100,spikes:5,thickness:.5}),th=Object.assign(Object.assign({},Ul),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),eh=Object.assign(Object.assign({},Ul),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),ih=Object.assign(Object.assign({},Ul),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),sh=Object.assign(Object.assign(Object.assign({},Ul),Hl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),nh=Object.assign(Object.assign(Object.assign({},Ul),Hl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),rh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Ul),{fill:!0,cornerRadius:0,cornerType:"round"}),ah=Object.assign(Object.assign({},rh),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});class oh{static GetImage(t,e){var i;const s=oh.cache.get(t);s?"fail"===s.loadState?Na.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):oh.loadImage(t,e)}static GetSvg(t,e){var i;let s=oh.cache.get(t);s?"fail"===s.loadState?Na.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},oh.cache.set(t,s),s.dataPromise=Na.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=oh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},oh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Na.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Na.global.loadBlob(t):"json"===e&&(i.dataPromise=Na.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!oh.isLoading&&oh.toLoadAueue.length){oh.isLoading=!0;const t=oh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(oh.cache.set(i,n),n.dataPromise=Na.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{oh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),oh.loading()})).catch((t=>{console.error(t),oh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),oh.loading()}))}}),0)}static loadImage(t,e){const i=lh(t,oh.toLoadAueue);if(-1!==i)return oh.toLoadAueue[i].marks.push(e),void oh.loading();oh.toLoadAueue.push({url:t,marks:[e]}),oh.loading()}static improveImageLoading(t){const e=lh(t,oh.toLoadAueue);if(-1!==e){const t=oh.toLoadAueue.splice(e,1);oh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function lh(t,e){for(let i=0;i{var e;let i=!0;if(h(t,!0)){for(let s=0;s<4;s++)ch[s]=t,i&&(i=!(null!==(e=ch[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)ch[e]=!!t[e],i&&(i=!!ch[e]);else ch[0]=!1,ch[1]=!1,ch[2]=!1,ch[3]=!1;return{isFullStroke:i,stroke:ch}},uh=[0,0,0,0],ph=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(uh[0]=t[0],uh[2]=t[0],uh[1]=t[1],uh[3]=t[1],uh):t:t:0,gh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],fh=[1,2,3,0,1,2,3,0];function mh(t,e,i,s){for(;t>=Nt;)t-=Nt;for(;t<0;)t+=Nt;for(;t>e;)e+=Nt;gh[0].x=i,gh[1].y=i,gh[2].x=-i,gh[3].y=-i;const n=Math.ceil(t/Ht)%4,r=Math.ceil(e/Ht)%4;if(s.add(Ut(t)*i,Xt(t)*i),s.add(Ut(e)*i,Xt(e)*i),n!==r||e-t>zt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}xh.TimeOut=1e3/60;const Sh=new xh,Ah=(t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,kh=(t,e)=>{const i=Ah(t,e);return isNaN(i)?i:Math.max(e,i)};class Ch{bounds(t,e){if(x(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}}function wh(t,e,i,s,n){return n?t.arc(i,s,e,0,jt,!1,n):t.arc(i,s,e,0,jt),!1}var Mh=new class extends Ch{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return wh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return wh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Th=new class extends Ch{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Eh=new class extends Ch{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Ph(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Ch{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Ph(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ph(t,this.parseSize(e)/2+n,i,s)}};function Rh(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Ih extends Ch{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Ih;var Lh=new class extends Ih{constructor(){super(...arguments),this.type="triangle"}};const Fh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),zh=Math.sin(jt/10)*Fh,Hh=-Math.cos(jt/10)*Fh;function jh(t,e,i,s){const n=zh*e,r=Hh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=jt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Nh=new class extends Ch{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return jh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return jh(t,this.parseSize(e)/2+n,i,s)}};const Vh=Kt(3);function Wh(t,e,i,s){const n=e,r=n/Vh,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Uh=new class extends Ch{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Gh(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Yh=new class extends Ch{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Gh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Gh(t,this.parseSize(e)/2+n,i,s)}};function Xh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Kh=new class extends Ch{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Xh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Xh(t,this.parseSize(e)/2+n,i,s)}};const $h=-.5,qh=Kt(3)/2,Zh=1/Kt(12);function Jh(t,e,i,s){const n=e/2,r=e*Zh,a=n,o=e*Zh+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo($h*n-qh*r+i,qh*n+$h*r+s),t.lineTo($h*a-qh*o+i,qh*a+$h*o+s),t.lineTo($h*l-qh*h+i,qh*l+$h*h+s),t.lineTo($h*n+qh*r+i,$h*r-qh*n+s),t.lineTo($h*a+qh*o+i,$h*o-qh*a+s),t.lineTo($h*l+qh*h+i,$h*h-qh*l+s),t.closePath(),!1}var Qh=new class extends Ch{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Jh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Jh(t,this.parseSize(e)/2+n,i,s)}};function tc(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ec=new class extends Ch{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return tc(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return tc(t,this.parseSize(e)/2,i,s,n)}};function ic(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var sc=new class extends Ch{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return ic(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ic(t,this.parseSize(e)/2,i,s,n)}};function nc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var rc=new class extends Ch{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return nc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return nc(t,this.parseSize(e)/2,i,s,n)}};const ac=Kt(3);function oc(t,e,i,s){const n=e*ac;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var lc=new class extends Ch{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return oc(t,this.parseSize(e)/2/ac,i,s)}drawOffset(t,e,i,s,n){return oc(t,this.parseSize(e)/2/ac+n,i,s)}};function hc(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var cc=new class extends Ch{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return hc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return hc(t,this.parseSize(e)/4+n,i,s)}};function dc(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var uc=new class extends Ch{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return dc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return dc(t,this.parseSize(e)/4+n,i,s)}};function pc(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var gc=new class extends Ch{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return pc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return pc(t,this.parseSize(e)/4+n,i,s)}};function fc(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var mc=new class extends Ch{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return fc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return fc(t,this.parseSize(e)/4+n,i,s)}};function vc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var yc=new class extends Ch{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return vc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return vc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function _c(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var bc=new class extends Ch{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return _c(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return _c(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function xc(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var Sc=new class extends Ch{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return xc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return xc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function Ac(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function kc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Cc=new class extends Ch{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return x(e)?kc(t,e,i,s):Ac(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?kc(t,e+2*n,i,s):Ac(t,[e[0]+2*n,e[1]+2*n],i,s)}};const wc=new Ve;class Mc{constructor(t,e,i=!1){this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Po(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Po(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{wc.x1=i.bounds.x1*t,wc.y1=i.bounds.y1*t,wc.x2=i.bounds.x2*t,wc.y2=i.bounds.y2*t,e.union(wc)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const Tc=[Mh,Th,Eh,Oh,lc,Lh,Nh,Uh,Yh,Kh,Qh,ec,sc,Dh,rc,cc,uc,gc,mc,Cc,yc,bc,Sc],Bc={};Tc.forEach((t=>{Bc[t.type]=t}));const Ec={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Pc{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Rc(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Rc(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Rc(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Pc(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Pc(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function Lc(t,e){return Fc(t)}function Fc(t,e){const i={};for(let e=0;e{Na.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)}))}function Gc(t,e,i,s=0){return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let Yc=0;function Xc(){return Yc++}var Kc;function $c(t){const e=[];let i=0,s="";for(let n=0;nqc.set(t,!0)));const Zc=new Map;function Jc(t){if(qc.has(t))return!0;if(Zc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Qc(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Zc.set(t,!0)));const td=Xc(),ed=Xc(),id=Xc(),sd=Xc(),nd=Xc(),rd=Xc(),ad=Xc(),od=Xc(),ld=Xc(),hd=Xc(),cd=Xc(),dd=Xc(),ud=Xc(),pd=Xc(),gd=Xc(),fd=Xc(),md=Xc(),vd=Symbol.for("GraphicService"),yd=Symbol.for("GraphicCreator"),_d={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},bd=Object.keys(_d),xd={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Sd=Object.keys(xd),Ad={duration:200,easing:"cubicOut"},kd=Symbol.for("CanvasFactory"),Cd=Symbol.for("Context2dFactory");function wd(t){return function(){var t,e;const i=null===(t=Na.global)||void 0===t?void 0:t.env,s=i?null===(e=Na.canvasFactory)||void 0===e?void 0:e.call(Na,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const Md=1e-4,Td=Math.sqrt(3),Bd=1/3;function Ed(t){return t>-Ud&&tUd||t<-Ud}function Od(t){return"number"==typeof t&&Number.isFinite(t)}const Rd=[0,0],Id=[0,0],Dd=[0,0];function Ld(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Fd(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function zd(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function Hd(t){return(t%=Nt)<0&&(t+=Nt),t}function jd(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Nt);let d=Math.atan2(l,o);return d<0&&(d+=Nt),d>=s&&d<=n||d+Nt>=s&&d+Nt<=n}function Wd(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(Ed(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Yd=[-1,-1,-1],Xd=[-1,-1];function Kd(){const t=Xd[0];Xd[0]=Xd[1],Xd[1]=t}function $d(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Ed(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Bd):Math.pow(i,Bd),s=s<0?-Math.pow(-s,Bd):Math.pow(s,Bd);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+Td*Math.sin(e)))/(3*a),h=(-o+i*(s-Td*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Yd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Kd(),p=zd(e,s,r,o,Xd[0]),u>1&&(g=zd(e,s,r,o,Xd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Ed(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Yd);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=Fd(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Yd[0]=-l,Yd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Nt-1e-4){s=0,n=Nt;const e=r?1:-1;return a>=Yd[0]+t&&a<=Yd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Nt,n+=Nt);let c=0;for(let e=0;e<2;e++){const i=Yd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Nt+t),(t>=s&&t<=n||t+Nt>=s&&t+Nt<=n)&&(t>zt/2&&t<1.5*zt&&(e=-e),c+=e)}}return c}function Jd(t){return Math.round(t/zt*1e8)/1e8%2*zt}function Qd(t,e){let i=Jd(t[0]);i<0&&(i+=Nt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Nt?n=i+Nt:e&&i-n>=Nt?n=i-Nt:!e&&i>n?n=i+(Nt-Jd(i-n)):e&&i1&&(i||(h+=Oe(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,A=b;tu[0]=S,tu[1]=A,Qd(tu,Boolean(a[6])),S=tu[0],A=tu[1];const k=S,C=A-S,w=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case uo.M:u=m,p=v,c=u,d=p;break;case uo.L:if(i){if(Wd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case uo.C:if(i){if(Nd(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=$d(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case uo.Q:if(i){if(jd(c,d,m,v,y,_,e,s,n))return!0}else h+=qd(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case uo.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Vd(m,v,y,k,k+C,w,e,M,n))return!0}else h+=Zd(m,v,y,k,k+C,w,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case uo.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Wd(u,p,o,p,e,s,n)||Wd(o,p,o,l,e,s,n)||Wd(o,l,u,l,e,s,n)||Wd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case uo.Z:if(i){if(Wd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class su{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(su.IsGradientStr(t))try{const e=iu(t)[0];if(e){if("linear"===e.type)return su.ParseLinear(e);if("radial"===e.type)return su.ParseRadial(e);if("conic"===e.type)return su.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2,n=parseFloat(e.value)/180*zt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Nt,stops:su.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:su.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2;let n="angular"===e.type?parseFloat(e.value)/180*zt:0;for(;n<0;)n+=Nt;for(;n>=Nt;)n-=Nt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function au(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ou(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s,t}function lu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n,t}function hu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s,t}function cu(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function du(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function uu(t,e,i){const s=i[0],n=i[1],r=i[2];return t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function pu(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function gu(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],v=s[0],y=s[1],_=s[2],b=i[0],x=i[1],S=i[2];return Math.abs(g-b)0&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Cu),function(t,e,i){return eu(t,0,!1,e,i)}(this.path.commandList,Cu.x,Cu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Cu);const i=nu(this,this.lineWidth,this.dpr);return function(t,e,i,s){return eu(t,e,!0,i,s)}(this.path.commandList,i,Cu.x,Cu.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(ku,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}const Mu={WIDTH:500,HEIGHT:500,DPR:1};class Tu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=Mu.WIDTH,height:n=Mu.HEIGHT,dpr:r=Mu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Bu;Tu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Bu||(Bu={}));class Eu{static Get(t,e=Bu.Color1,i=[0,0,0,1]){if(e===Bu.Color1){const e=Eu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ii.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Eu.store1[t]=e,Eu.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Eu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ii.parseColorString(t);return n&&(Eu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Eu.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Bu.Color1){if(Eu.store1[t])return;Eu.store1[t]=i,Eu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Eu.store255[t])return;Eu.store255[t]=i,Eu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Pu(t,e=!1){return Array.isArray(t)&&x(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Ou(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Ru(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Ru(t,e,i,s,n)}function Ru(t,e,i,s,n){if(!t||!e)return t&&Pu(t)||e&&Pu(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Eu.Get(t,Bu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Eu.Get(e,Bu.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:Pu(a)})))});return o?Ou(r,l,i,s,n):Ou(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return Iu(s,n,i);if("radial"===s.gradient)return Du(s,n,i);if("conical"===s.gradient)return Lu(s,n,i)}return!1}return n&&n(r,a),Pu(Fu(r,a,i),s)}function Iu(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Lu(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Fu(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]}function zu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Eu.store255={},Eu.store1={};const Hu=[0,0,0,0],ju=[0,0,0,0];function Nu(t,e,i){return Eu.Get(t,Bu.Color255,Hu),Eu.Get(e,Bu.Color255,ju),`rgba(${Math.round(Hu[0]+(ju[0]-Hu[0])*i)},${Math.round(Hu[1]+(ju[1]-Hu[1])*i)},${Math.round(Hu[2]+(ju[2]-Hu[2])*i)},${Hu[3]+(ju[3]-Hu[3])*i})`}class Vu{static GetCanvas(){try{return Vu.canvas||(Vu.canvas=Na.global.createCanvas({})),Vu.canvas}catch(t){return null}}static GetCtx(){if(!Vu.ctx){const t=Vu.GetCanvas();Vu.ctx=t.getContext("2d")}return Vu.ctx}}class Wu extends Ge{static getInstance(){return Wu._instance||(Wu._instance=new Wu),Wu._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Vu.GetCanvas(),s=Vu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Wu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Uu{static GetSize(t){for(let e=0;e=t)return Uu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Uu.GenKey(t,e,i,s,n),l=Uu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=Uu.GenKey(t,e,i,s,n);Uu.cache[l]?Uu.cache[l].push({width:a,height:o,pattern:r}):Uu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Gu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Nt;for(;i>Nt;)i-=Nt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),Ou(o.color,l.color,h,!1)}function Yu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Vu.GetCanvas(),d=Vu.GetCtx();if(!d)return null;const u=Uu.GetSize(o),p=Uu.GetSize(l);let g=Uu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Wu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);t++){const e=y.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Uu.Set(e,i,s,r,a,g,u,p),g}Uu.cache={},Uu.ImageSize=[20,40,80,160,320,640,1280,2560];const Xu=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Ku(t){return null==t?void 0:t}class $u{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Ku(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Xu.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:Ku(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function qu(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Zu(t){if(!qu(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Zu(t[i])})),e}function Ju(t,e){var i;const s=null!==(i=Zu(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];qu(n)&&qu(i)?s[t]=Ju(n,i):s[t]=Zu(i)})),s}class Qu{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Zu(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];qu(r)&&qu(n)?t[i]=Ju(r,n):!qu(r)&&qu(a)&&qu(n)?t[i]=Ju(a,n):t[i]=Zu(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?tp.PAINT|tp.BOUNDS|tp.PICK:tp.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?tp.PAINT|tp.BOUNDS:tp.PAINT}};class sp{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:Ad;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:So.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:So.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:So.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const np=new $u;function rp(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,ap(t),!0)}function ap(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=np.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function op(t){if(t)return t.parentScope&&op(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&ap(t),t}function lp(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function hp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function cp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,hp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),lp(null!=e?e:t.ownerStage))}const dp=new Ve,up=new Ue,pp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],gp=["x","y"],fp=["scaleX","scaleY"],mp=["angle"],vp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),yp=new ne,_p=[],bp=tp.PAINT|tp.SHAPE|tp.BOUNDS|tp.TRANSFORM|tp.LAYOUT;function xp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Sp(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Sp(s):s})),i}function Ap(t,e){return t===e||!!(xp(t)||xp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function kp(t,e){var i;const s=null!==(i=Sp(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];xp(n)&&xp(i)?s[t]=kp(n,i):s[t]=Sp(i)})),s}const Cp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class wp extends Ka{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,hp(this.stage,this),lp(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&op(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:So.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(op(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new $u).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Sp(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&xp(n)&&xp(s)?e[t]=kp(n,s):e[t]=Sp(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:Sp(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e){const i=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((s=>{const n=Object.prototype.hasOwnProperty.call(e,s),r=t[s];if(!n)return void(Object.prototype.hasOwnProperty.call(t,s)&&(i.set(s,{prev:r,next:void 0}),delete t[s]));const a=e[s];Ap(r,a)||(i.set(s,{prev:r,next:a}),t[s]=Sp(a))})),i}_syncAttribute(){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const t=this.buildStaticAttributeSnapshot(),e=this.syncObjectToSnapshot(this.attribute,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,e}_syncFinalAttributeFromStaticTruth(){const t=this.finalAttribute;if(!t)return;const e=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(t,e)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=ip[t];return n?n(e,i):null!==(s=ep[t])&&void 0!==s?s:tp.PAINT}(e,i,s):null!==(n=ep[e])&&void 0!==n?n:tp.PAINT;return r&tp.PICK&&(r|=tp.BOUNDS),r===tp.PAINT&&this.needUpdateTag(e)&&(r=tp.SHAPE|tp.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&bp)!==bp?(t&tp.SHAPE?this.addUpdateShapeAndBoundsTag():t&tp.BOUNDS&&this.addUpdateBoundTag(),t&tp.PAINT&&this.addUpdatePaintTag(),t&tp.TRANSFORM&&this.addUpdatePositionTag(),t&tp.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=tp.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&bo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=wp.userSymbolMap[t],e)return e;if(!0===jc(t=Ec[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=y(i.path)?i.path:[i.path];dp.clear();const n=[];s.forEach((t=>{const e=(new wl).fromString(t.d),i={};Sd.forEach((e=>{t[e]&&(i[xd[e]]=t[e])})),n.push({path:e,attribute:i}),dp.union(e.bounds)}));const r=dp.width(),a=dp.height(),o=1/Gt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new Mc(t,n,!0);return wp.userSymbolMap[t]=l,l}const i=(new wl).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Gt(s,n);i.transform(0,0,r,r);const a=new Mc(t,i);return wp.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=ph(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new oo(t);return Po(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&bo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&bo.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&bo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=bo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===xo.GLOBAL){const i=new ne(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===So.STATE||null!=i&&i>=So.ANIMATE_BIND&&i<=So.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===So.STATE||null!=o&&o>=So.ANIMATE_BIND&&o<=So.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!Ap(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:_p,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:So.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:So.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Ad}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:_p,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Sp(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:So.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:So.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:_p,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:_p,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:So.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:So.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:So.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Dl.x,y:e=Dl.y,scaleX:i=Dl.scaleX,scaleY:s=Dl.scaleY,angle:n=Dl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Ut(a),f=Xt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const y=m-i,_=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*y-S*_,t.f=p+h*m+d*v-x*y-A*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),Na.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Dl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=up.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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:Na.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:So.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:So.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=Na.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return v(t,!0)?this.pathProxy=(new wl).fromString(t):this.pathProxy=new wl,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:Na.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new Qa(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):Ka.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:So.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:So.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Na.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new wu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}function Mp(t){return!!t&&("string"==typeof t?!vp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Op=Ep();class Rp{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Bp.forEach((t=>{this._defaultTheme[t]=Object.create(Op[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Bp.forEach((s=>{const n=Object.create(Op[s]);t&&t[s]&&Pp(n,t[s]),i[s]&&Pp(n,i[s]),e[s]&&Pp(n,e[s]),this.combinedTheme[s]=n})),e.common&&Bp.forEach((t=>{Pp(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Ip=new Rp;function Dp(t,e){return t.glyphHost?Dp(t.glyphHost):e?(t.isContainer,e):Lp(t)||t.attachedThemeGraphic&&Dp(t.attachedThemeGraphic)||Ip.getTheme()}function Lp(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)):Ip.getTheme()}return null}const Fp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},zp=["radius","startAngle","endAngle",...pp];class Hp extends wp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=sd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Dp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Na.graphicService.updateTempAABBBounds(i);return Fp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Na.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Nt-Ft?i.set(-r,-r,r,r):mh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,zp)}needUpdateTag(t){return super.needUpdateTag(t,zp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new wl,s.arc(0,0,r,a,o),s}clone(){return new Hp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Hp.NOWORK_ANIMATE_ATTR}}function jp(t){return new Hp(t)}function Np(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Vp(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Wp(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[li(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=li(s);d(t[s])||(e[n]=i(t[s]))})),u(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&v(t.fill)&&(e.color=t.fill),e}Hp.NOWORK_ANIMATE_ATTR=Cp;class Up{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Bl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=md}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Dp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Yp({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Ce(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Na.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Gc(n,o/Math.abs(r+a),!0,l),i.union(n)}return Na.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Na.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,je(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=Na.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Up(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=Na.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),w={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new Up(a,w,C),T=y(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=T.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const t=Np(y,a),e=this.cache.verticalList.length*v,i=Vp(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>$c(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Kc.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const S=Np(y,a),A=x.verticalList.length*v,k=Vp(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=kh(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Gp){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Gp){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Yp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Yp.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Yp.baselineMapAlign}getAlignMapBaseline(){return Yp.alignMapBaseline}}function Xp(t){return new Yp(t)}Yp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Cp),Yp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Yp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Kp=["heightLimit","lineClamp"];class $p extends Yp{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=kh(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=Na.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new Up(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),w=[],M=[0,0];let T=1/0;if(y>0&&(T=Math.max(Math.floor(y/x),1)),b&&(T=Math.min(T,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Gc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Na.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Zp)}needUpdateTag(t){return super.needUpdateTag(t,Zp)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new wl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new wl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Qp(t){return new Jp(t)}Jp.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Cp);const tg=["segments","points","curveType","curveTension",...pp];let eg=class t extends wp{constructor(t={}){super(t),this.type="line",this.numberType=od}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=_h(i,s,e))}getGraphicTheme(){return Dp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Na.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Na.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,tg)}needUpdateTag(t){return super.needUpdateTag(t,tg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new wl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function ig(t){return new eg(t)}eg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const sg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},ng=["width","x1","y1","height","cornerRadius",...pp];class rg extends wp{constructor(t){super(t),this.type="rect",this.numberType=dd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Dp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Na.graphicService.updateTempAABBBounds(i);return Fp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Na.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,ng)}needUpdateTag(t){return super.needUpdateTag(t,ng)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=sg(e);return t=new wl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new rg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rg.NOWORK_ANIMATE_ATTR}}function ag(t){return new rg(t)}rg.NOWORK_ANIMATE_ATTR=Cp;const og=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class lg extends rg{constructor(t){super(t),this.type="rect3d",this.numberType=ud}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Yt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;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,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Dp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new cg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return cg.NOWORK_ANIMATE_ATTR}}function dg(t){return new cg(t)}cg.NOWORK_ANIMATE_ATTR=Cp;const ug=Symbol.for("EnvContribution"),pg=Symbol.for("VGlobal"),gg="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",fg={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"}},mg=!0,vg=!1,yg=/\w|\(|\)|-/,_g=/[.?!,;:/,。?!、;:]/,bg=/\S/,xg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Sg(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Na.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Ag(t,a)),a}function Ag(t,e,i=!1){let s=e;for(;yg.test(t[s-1])&&yg.test(t[s])||_g.test(t[s]);)if(s--,s<=0)return i?kg(t,e):e;return s}function kg(t,e){let i=e;for(;yg.test(t[i+1])&&yg.test(t[i])||_g.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Cg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Na.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class wg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=fg[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Mg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Tg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=kh(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Cg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Cg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Sg(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Cg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Mg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Sg(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Cg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Mg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Mg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Mg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Mg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Sg(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Cg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Bg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...pp];class Eg extends wp{constructor(t){super(t),this.type="image",this.numberType=ad,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Dp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Na.graphicService.updateTempAABBBounds(i);return Fp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Na.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return rh[t]}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}clone(){return new Eg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Eg.NOWORK_ANIMATE_ATTR}}function Pg(t){return new Eg(t)}Eg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Cp);class Og extends Eg{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=ph(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=ph(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=rh.width,height:e=rh.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Rg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Og?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=fg[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Tg){const e=bg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Og)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Cg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||vg;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,xg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||mg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?ru(t,s,{AABBBounds:i}):s,xg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Og)break;const{width:n}=Cg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Og?t.width:t.getWidthWithEllips(this.direction)})),i}}class Ig{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=fg[this.direction]}store(t){if(t instanceof Og){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 Rg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Og?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Sg(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Tg(i,t.newLine,t.character,t.ascentDescentMode),new Tg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Dg=!1;try{Dg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Dg=!1}const Lg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...pp];class Fg extends wp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=pd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:nh.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:nh.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:nh.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:nh.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:nh.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:nh.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:nh.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:nh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Dp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&Fg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&Fg.splitText(t.text).length>1)))}static splitText(t){if(Dg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Fg.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Na.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Na.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Na.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Lg)}needUpdateTag(t){return super.needUpdateTag(t,Lg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!Fg.AllSingleCharacter(y)&&(y=Fg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),w=new wg(0,0,(k?n:S?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&S,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Ig(w);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&w.lines[w.lines.length-1].paragraphs.push(s)):M.deal(s,!0),w.lines.length!==t&&(t=w.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,w.lines[w.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===w.layoutDirection?k:C)){const t=w.getActualSizeWidthEllipsis();let e="horizontal"===w.layoutDirection?t.width:t.height;("horizontal"===w.layoutDirection?S:A)&&(e=Math.min(e,"horizontal"===w.layoutDirection?i:s)),w.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&w.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new Fg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Fg.NOWORK_ANIMATE_ATTR}}function zg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Cp);const Hg=["path","customPath",...pp];class jg extends wp{constructor(t){super(t),this.type="path",this.numberType=ld}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof wl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof wl?this.cache:t.path)}getGraphicTheme(){return Dp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Na.graphicService.updateTempAABBBounds(i);Fp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Na.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new wl).fromString(t.path):t.customPath&&(this.cache=new wl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}toCustomPath(){return(new wl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new jg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return jg.NOWORK_ANIMATE_ATTR}}function Ng(t){return new jg(t)}jg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Cp);const Vg=["segments","points","curveType","curveTension",...pp];class Wg extends wp{constructor(t){super(t),this.type="area",this.numberType=id}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Dp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Na.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Na.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=_h(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new wl;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Wg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wg.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const Gg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...pp];class Yg extends wp{constructor(t){super(t),this.type="arc",this.numberType=td}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(x(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=le(e),i=e+a,s&&Vt(a)>Ft&&Vt(a)Ft&&o>Ft)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=Kt(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Ft&&l>Ft){const i=e>t?1:-1;let s=qt(Number(l)/o*Xt(g)),n=qt(Number(l)/a*Xt(g));return(f-=2*s)>Ft?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Ft?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Dp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Na.graphicService.updateTempAABBBounds(i);Fp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Na.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Ft?i.set(0,0,0,0):Math.abs(o-l)>Nt-Ft?i.set(-s,-s,s,s):(mh(l,o,s,i),mh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Gg)}needUpdateTag(t){return super.needUpdateTag(t,Gg)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Nt-Ft)n.moveTo(0+h*Ut(a),0+h*Xt(a)),n.arc(0,0,h,a,o,!d),l>Ft&&(n.moveTo(0+l*Ut(o),0+l*Xt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Ut(a),e=h*Xt(a),i=l*Ut(o),s=l*Xt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Yg.NOWORK_ANIMATE_ATTR}}function Xg(t){return new Yg(t)}Yg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);const Kg=["width","height","spikes","thickness",...pp];class $g extends wp{constructor(t){super(t),this.type="star",this._cachedPoints=[],this.numberType=gd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e,spikes:i}=this.attribute;return(null==t||t>0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return Dp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=Na.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Na.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new wl,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new $g(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return $g.NOWORK_ANIMATE_ATTR}}function qg(t){return new $g(t)}$g.NOWORK_ANIMATE_ATTR=Cp;class Zg extends Yg{constructor(t){super(t),this.type="arc3d",this.numberType=ed}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),Na.graphicService.updateTempAABBBounds(i),Na.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}var Qg;Zg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Qg||(Qg={}));let tf=class t extends wp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=rd,this._childUpdateTag=bo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(rp(this.sharedStateScope,t),cp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Rp),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Rp)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===xo.GLOBAL){const i=new ne(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&bo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Dl.x,y:e=Dl.y,dx:i=Dl.dx,dy:s=Dl.dy,scaleX:n=Dl.scaleX,scaleY:r=Dl.scaleY,angle:a=Dl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Dp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Na.graphicService.updateTempAABBBounds(i),Na.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=bo.CLEAR_BOUNDS,this._childUpdateTag&=bo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&bo.UPDATE_BOUNDS||(this._childUpdateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:Na.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&bo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Na.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&rp(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return ap({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function ef(t){return new tf(t)}tf.NOWORK_ANIMATE_ATTR=Cp;const sf=["points","cornerRadius",...pp];class nf extends wp{constructor(t){super(t),this.type="polygon",this.numberType=hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Dp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Na.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Na.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=_h(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,sf)}needUpdateTag(t){return super.needUpdateTag(t,sf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new wl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new nf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nf.NOWORK_ANIMATE_ATTR}}function rf(t){return new nf(t)}nf.NOWORK_ANIMATE_ATTR=Cp;class af extends nf{constructor(t){super(t),this.type="pyramid3d",this.numberType=cd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),Na.graphicService.updateTempAABBBounds(i),Na.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,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}getNoWorkAnimateAttr(){return af.NOWORK_ANIMATE_ATTR}}function of(t){return new af(t)}af.NOWORK_ANIMATE_ATTR=Cp;class lf extends tf{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function hf(t){return new lf(t)}class cf{constructor(){this.registry=new Map}create(t,e){const i=this.registry.get(t);if(!i)throw new Error(`GraphicFactory has no creator registered for type "${t}"`);return new i(e)}register(t,e){if(!t)throw new Error("GraphicFactory requires a non-empty graphic type");this.registry.set(t,e)}}const df=new cf;const uf=new class{constructor(){this.store=new Map}registerStore(t,e){this.store.set(t,e),this[t]=e}RegisterGraphicCreator(t,e){pf(t,e)}CreateGraphic(t,e){return this.store.has(t)?gf(t,e):null}};function pf(t,e){if(!t)throw new Error("Graphic registration requires a non-empty graphic type");uf.registerStore(t,e),df.register(t,function(t){return class{constructor(e){try{return new t(e)}catch(i){return t(e)}}}}(e))}function gf(t,e){return df.create(t,e)}function ff(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=m[1];y[2]=null!==(s=m[2])&&void 0!==s?s:0}if(au(t),cu(t,t,[n+o,r+l,a+h]),cu(t,t,[y[0],y[1],y[2]]),ou(t,t,g),lu(t,t,p),cu(t,t,[-y[0],-y[1],y[2]]),uu(t,t,[c,d,u]),f){const i=Au.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}cu(i,i,[s[0],s[1],0]),hu(i,i,f),cu(i,i,[-s[0],-s[1],0]),pu(t,t,i)}}function mf(t){const{alpha:e,beta:i}=t.attribute;return e||i}class vf{constructor(t=uf){this.creator=t,this.hooks={onAttributeUpdate:new za(["graphic"]),onSetStage:new za(["graphic","stage"]),onRemove:new za(["graphic"]),onRelease:new za(["graphic"]),onAddIncremental:new za(["graphic","group","stage"]),onClearIncremental:new za(["graphic","group","stage"]),beforeUpdateAABBBounds:new za(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new za(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new za(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Vp(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Np(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Gc(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Gc(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&je(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}let yf,_f;function bf(t){return yf||(yf=gf("text",{})),yf.initAttributes(t),yf.AABBBounds}function xf(t){return _f||(_f=gf("richtext",{})),_f.setAttributes(t),_f.AABBBounds}const Sf=Symbol.for("TransformUtil"),Af=Symbol.for("GraphicUtil"),kf=Symbol.for("LayerService"),Cf=Symbol.for("StaticLayerHandlerContribution"),wf=Symbol.for("DynamicLayerHandlerContribution"),Mf=Symbol.for("VirtualLayerHandlerContribution"),Tf=Symbol.for("RenderService"),Bf=Symbol.for("BeforeRenderConstribution"),Ef=Symbol.for("AutoEnablePlugins"),Pf=Symbol.for("PluginService"),Of=Symbol.for("GraphicPicker"),Rf=Symbol.for("PickerService"),If=Symbol.for("BoundsPicker"),Df=Symbol.for("GlobalPickerService"),Lf=Symbol.for("PickItemInterceptor"),Ff=Symbol.for("PickServiceInterceptor"),zf=Symbol.for("IncrementalDrawContribution"),Hf=Symbol.for("ArcRender"),jf=Symbol.for("Arc3dRender"),Nf=Symbol.for("AreaRender"),Vf=Symbol.for("CircleRender"),Wf=Symbol.for("GraphicRender"),Uf=Symbol.for("GroupRender"),Gf=Symbol.for("LineRender"),Yf=Symbol.for("PathRender"),Xf=Symbol.for("PolygonRender"),Kf=Symbol.for("RectRender"),$f=Symbol.for("Rect3DRender"),qf=Symbol.for("SymbolRender"),Zf=Symbol.for("TextRender"),Jf=Symbol.for("RichTextRender"),Qf=Symbol.for("Pyramid3dRender"),tm=Symbol.for("GlyphRender"),em=Symbol.for("ImageRender"),im=Symbol.for("RenderSelector"),sm=Symbol.for("DrawContribution"),nm=Symbol.for("StarRender"),rm=Symbol.for("VWindow"),am=Symbol.for("WindowHandlerContribution");function om(t){const e=Na.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class lm extends Ua{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=Na.global,e=om){super(),this.handlerFactory=e,this.hooks={onChange:new za(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=Ha.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&pt(this.width,t.width())&&pt(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class hm{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=wd(Object.assign({nativeCanvas:Na.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=wd(Object.assign({nativeCanvas:Na.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const cm=new hm;class dm{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Na.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=cm.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Hl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Le(Object.assign({defaultFontParams:{fontFamily:Hl.fontFamily,fontSize:Hl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=Na.windowFactory)||void 0===s?void 0:s.call(Na))&&void 0!==n?n:new lm(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var um;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(um||(um={}));const pm=new Ue;class gm{constructor(){this.matrix=new Ue}init(t){return this.mode=um.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=um.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(pm.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(pm.a,pm.b,pm.c,pm.d,pm.e,pm.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(pm.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(pm.a,pm.b,pm.c,pm.d,pm.e,pm.f),this}scale(t,e,i){return this.mode===um.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===um.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return pm.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(pm.a,pm.b,pm.c,pm.d,pm.e,pm.f),this}translate(t,e){return this.mode===um.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===um.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}class fm{constructor(){this.global=Na.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ue(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new ne(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var mm=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function vm(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function ym(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=vm(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=vm(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const xm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Sm{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(Cm(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Dp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){Rm(t,e,i,s)}}const Am=new Sm,km=new Set(["top","center","bottom"]);function Cm(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function wm({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Mm={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Tm({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Mm[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:wm({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Bm(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Em(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:km.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Bm(s,e,"left","center","right"),y:Bm(n,i,"top","center","bottom")}}function Pm(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Om(t){if(!t)return null;const e=Pm(t.naturalWidth,t.videoWidth,t.width),i=Pm(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Rm(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Om(e),{backgroundRepeatMode:m,backgroundSizing:v}=Tm({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Em(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=cm.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),cm.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class Im{constructor(t){this.subRenderContribitions=t,this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}}class Dm{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const Lm=new Dm;class Fm{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const zm=new Fm,Hm={getContributions:()=>[]};class jm{constructor(t=[],e=Hm,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):ym(e,Ul.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ne,this.backupDirtyBounds=new Ne,this.global=null!==(s=i.global)&&void 0!==s?s:Na.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:Na.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:Hm,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Ul.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Ul.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Su.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=bm(e,i,Ul.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Se(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=xm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Su.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),xm.free(n),Su.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||function(){const t=Na.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class Vm{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class Wm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Um{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Gm{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const Ym={getContributions:()=>[]};class Xm{constructor(t=Ym,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new Um}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class Km{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class $m{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Na.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Na.global.getRequestAnimationFrame();this.rafId=t((()=>{Na.global.devicePixelRatio!==this.dpr&&(this.dpr=Na.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Na.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class qm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Na.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Zm=new Ve;class Jm{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&bo.UPDATE_PAINT)||s._updateTag&bo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(Zm.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(Zm,t.parent&&t.parent.globalTransMatrix)))})),t.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let Qm;function tv(){if(null==Qm)try{const t=document.createElement("canvas"),e=t.getContext("2d");Qm=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),Qm&&(Qm=!!document.createElement)}catch(t){Qm=!1}}function ev(){tv();const t=Na.global&&Na.global.env;return t?"browser"===t:Qm}const iv="white";class sv extends tf{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:iv}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,y,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Rp,this.hooks={beforeRender:new za(["stage"]),afterRender:new za(["stage"]),afterClearScreen:new za(["stage"]),afterClearRect:new za(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:Na.global,!this.global.env&&ev()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:Na.windowFactory)&&void 0!==n?n:()=>new lm(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=Na.pickerServiceFactory)&&void 0!==a?a:()=>new fm,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=Na.renderServiceFactory)||void 0===h?void 0:h.call(Na))&&void 0!==c?c:Na.renderService)&&void 0!==d?d:new Nm,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=Na.pluginServiceFactory)||void 0===p?void 0:p.call(Na))&&void 0!==g?g:Na.pluginService)&&void 0!==f?f:new Xm,this.layerService=null!==(y=null!==(m=e.layerService)&&void 0!==m?m:Na.layerService)&&void 0!==y?y:new hv(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:Na.graphicService)&&void 0!==b?b:new vf,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:iv,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,ap(s)),cp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&v(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new ro(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[y,_,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,A=Math.cos(d)*Math.cos(u)*1);const k=ov.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=ov.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=ov.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new Km))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new $m))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new qm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ne;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Jm,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=ov.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=ov.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=ov.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return ap({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new ne(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class nv{constructor(t=sv,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class rv extends tf{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Rp,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Na.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Na.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}class av{constructor(t=rv){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let ov=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function lv(t){const e=Na.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}ov._pluginClasses={};class hv{static GenerateLayerId(){return`${hv.idprefix}_${hv.prefix_count++}`}constructor(t=Na.global,e=new av,i=lv){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:hv.GenerateLayerId(),layerHandler:n})}),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}}hv.idprefix="visactor_layer",hv.prefix_count=0;const cv=Symbol("ContributionProvider");class dv{constructor(t,e){this.serviceIdentifier=t,this.container=e,fv.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function uv(t,e){return new dv(t,e)}function pv(t,e){t(cv).toDynamicValue((({container:t})=>uv(e,t))).inSingletonScope().whenTargetNamed(e)}function gv(t,e){t(cv).toDynamicValue((({container:t})=>uv(e,t))).whenTargetNamed(e)}class fv{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}fv.store=new Map;class mv{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=sh.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Ag(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){at.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Ag(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}}const vv=Symbol.for("TextMeasureContribution");class yv extends mv{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function _v({bind:t}){t(pg).toDynamicValue((({container:t})=>new Ya(uv(ug,t)))).inSingletonScope(),t(rm).to(lm),t(Af).toDynamicValue((({container:t})=>new dm(uv(vv,t)))).inSingletonScope(),t(Sf).to(gm).inSingletonScope(),t(kf).to(hv).inSingletonScope()}function bv({bind:t}){t(Tf).to(Nm)}const xv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===ed,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Nt;for(;o<0;)o+=Nt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};class Sv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class Av{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Dp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Su.allocateByObj(a),u=new ne(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class kv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ne(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class Cv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=xv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function wv({bind:t,isBound:e}){e(Rf)||(t(Df).toSelf(),t(Rf).toService(Df)),t(Cv).toSelf().inSingletonScope(),t(Lf).toService(Cv),t(Av).toSelf().inSingletonScope(),t(Lf).toService(Av),t(kv).toSelf().inSingletonScope(),t(Lf).toService(kv),pv(t,Lf),t(Sv).toSelf().inSingletonScope(),t(Ff).toService(Sv),pv(t,Ff)}function Mv({bind:t}){t(vd).to(vf),t(yd).toConstantValue(uf)}class Tv{constructor(){this.type="static",this.offscreen=!1,this.global=Na.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=wd({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}}function Bv(t){(function({bind:t}){pv(t,ug)})({bind:t.bind}),function({bind:t}){t(vv).to(yv).inSingletonScope(),pv(t,vv)}({bind:t.bind}),function({bind:t}){t(Tv).toSelf(),t(Cf).toService(Tv)}({bind:t.bind})}const Ev=zt/2;function Pv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!$(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Ev,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!$(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Ev,!1)}if(o&&o[2]?o[2](_[0],_[1],S[0],S[1]):t.lineTo(S[0],S[1]),!$(S,A)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Ev,zt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!$(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],zt,zt+Ev,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function Ov(t,e){return!(!t&&!e)}function Rv(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Iv(t,e,i){return i&&t*e>0}function Dv(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Lv(t,e){return t*e>0}function Fv(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function zv(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uE*E+P*P&&(k=w,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function jv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Ut(c),k=n*Xt(c),C=s*Ut(u),w=s*Xt(u);let M,T,B,E;if((b>Ft||_>Ft)&&(M=n*Ut(d),T=n*Xt(d),B=s*Ut(p),E=s*Xt(p),r1?0:P<-1?zt:Math.acos(P))/2),l=Kt(t[0]*t[0]+t[1]*t[1]);S=Yt(b,(s-l)/(o-1)),x=Yt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:B,yirs:E,xore:M,yore:T,xire:C,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Nv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Nt-Ft)e.moveTo(i+n*Ut(o),s+n*Xt(o)),e.arc(i,s,n,o,l,!c),r>Ft&&(e.moveTo(i+r*Ut(l),s+r*Xt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:w,innerDeltaAngle:M,innerEndAngle:T,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:P,maxInnerCornerRadius:O}=jv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Ft){const t=Yt(v,m),r=Yt(y,m),o=Hv(g,f,u,p,n,t,Number(c)),l=Hv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Ut(Wt(l.y01,l.x01)),s+o.cy+m*Xt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ut(Wt(l.y01,l.x01)),s+l.cy+r*Xt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Xt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Ut(C),s+n*Xt(C));if(!(r>Ft)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(w>Ft){const t=Yt(E,w),n=Yt(P,w),o=Hv(S,A,b,x,r,-n,Number(c)),l=Hv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ut(Wt(l.y01,l.x01)),s+l.cy+t*Xt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,T,B,c):e.moveTo(i+r*Ut(B),s+r*Xt(B))}return a?a[3]&&e.lineTo(i+n*Ut(o),s+n*Xt(o)):e.closePath(),d}const Vv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Wv{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=cm.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),cm.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Nt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=cm.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=Qp({}));const C=h.columns?v/h.columns:b,w=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,w-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:Vv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=cm.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),cm.free(l),c}cm.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const Uv=new Wv;class Gv{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{innerPadding:m=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,w-=m;const T=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:nu(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:w-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Nv(t,e,i,s,M+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&T(u,"outerBorder"),f&&T(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:w,startAngle:y,endAngle:_})}}const Yv=new Gv,Xv=Uv,Kv=Am;class $v{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const qv=new $v,Zv=Uv,Jv=Am;class Qv extends Sm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Cm(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const ty=new Qv;class ey{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:M,height:T}=t.attribute;M=(null!=M?M:k-i)||0,T=(null!=T?T:C-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:nu(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,T-o*g)):(e.beginPath(),Pv(e,u,p,M-o*g,T-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}class iy{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}}class sy{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return Pv(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ny=new ey,ry=Uv,ay=Am;class oy extends ey{constructor(){super(...arguments),this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}}const ly=new oy,hy=Am;class cy{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class dy{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const uy=new cy,py=new dy,gy=Uv,fy=Am,my=Uv,vy=Am;class yy extends Wv{constructor(){super(...arguments),this.time=Co.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:bh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:bh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:bh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:bh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class _y{constructor(t){this.groupRenderContribitions=t,this.numberType=rd}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ty)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Dp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:w=l.y}=t.attribute,M=Dv(p,m,g,f,c),T=Fv(p,v,g,f),B=Ov(c,u),E=Rv(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(M||T||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Pv(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ty));const P={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Co.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,M,T,l,n,a,o,P)})),h&&e.clip();const O=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,w-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):T&&(e.setStrokeStyle(t,t.attribute,C-i,w-s,l),e.stroke()))};A?(R(),O()):(O(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Co.afterFillStroke&&r.drawShape(t,e,i,s,B,E,M,T,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Na.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Dp(t,null==s?void 0:s.theme).group,i=Au.allocate(),n=Au.allocate();ff(n,t,e),pu(i,p||i,n),a.modelMatrix=i,Au.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Au.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var by,xy=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(by||(by={}));class Sy extends jm{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=by.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new za([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return xy(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Ul.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Ul.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return xy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return xy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>xy(this,void 0,void 0,(function*(){if(2!==t.count)yield _m(t,Ul.zIndex,((i,s)=>{if(this.status===by.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return xy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return xy(this,void 0,void 0,(function*(){this.rendering&&(this.status=by.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=by.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 xy(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:()=>xy(this,void 0,void 0,(function*(){yield _m(t,Ul.zIndex,(t=>xy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const Ay=Symbol.for("DrawItemInterceptor"),ky=new Ve,Cy=new Ve;class wy{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){ky.copy(s.dirtyBounds),Cy.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Su.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(ky),s.backupDirtyBounds.copy(Cy)),!0}}class My{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}class Ty{constructor(){this.order=1,this.interceptors=[new wy,new Ey,new By,new My]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Au.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const Py=Symbol.for("ArcRenderContribution"),Oy=Symbol.for("AreaRenderContribution"),Ry=Symbol.for("CircleRenderContribution"),Iy=Symbol.for("GroupRenderContribution"),Dy=Symbol.for("ImageRenderContribution"),Ly=Symbol.for("PathRenderContribution"),Fy=Symbol.for("PolygonRenderContribution"),zy=Symbol.for("RectRenderContribution"),Hy=Symbol.for("SymbolRenderContribution"),jy=Symbol.for("TextRenderContribution"),Ny=Symbol.for("StarRenderContribution"),Vy=Symbol.for("CommonRenderContribution"),Wy=Symbol.for("InteractiveSubRenderContribution");function Uy(t){!function({bind:t}){t(Sm).toSelf().inSingletonScope(),t(Wv).toSelf().inSingletonScope(),t(sm).to(jm),t(zf).to(Sy),t(Uf).toDynamicValue((({container:t})=>new _y(uv(Iy,t)))).inSingletonScope(),t(Wf).toService(Uf),pv(t,Iy),pv(t,Wy),t(Im).toDynamicValue((({container:t})=>new Im(uv(Wy,t)))).inSingletonScope(),pv(t,Wf),t(Ty).toSelf().inSingletonScope(),t(Ay).toService(Ty),pv(t,Ay)}({bind:t.bind})}class Gy{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class Yy{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new Gy(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function Xy(){return new Yy}const Ky=Xy();function $y(){$y.__loaded||($y.__loaded=!0,_v({bind:Ky.bind}),Mv({bind:Ky.bind}),bv({bind:Ky.bind}),wv({bind:Ky.bind,isBound:Ky.isBound}),function({bind:t}){t(Pf).to(Xm),gv(t,Ef)}({bind:Ky.bind}),Bv(Ky),Uy(Ky))}function qy(){return Ky}function Zy(t){$y();const[e]=Ky.getAll(t);return e}function Jy(t,e){return $y(),Ky.getNamed(t,e)}function Qy(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}$y.__loaded=!1;const t_=Qy((()=>Zy(pg)));Na.global=t_;const e_=qy(),i_=Qy((()=>Zy(Af))),s_=Qy((()=>Zy(Sf))),n_=Qy((()=>Zy(vd))),r_=Qy((()=>Zy(kf)));function a_(){Na.global=t_,Na.graphicUtil=i_,Na.transformUtil=s_,Na.graphicService=n_,Na.layerService=r_,Na.canvasFactory=t=>Jy(kd,t),Na.context2dFactory=t=>Jy(Cd,t),Na.windowFactory=()=>new lm(Na.global),Na.windowHandlerFactory=t=>function(t){const e=Jy(am,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),Na.renderServiceFactory=()=>Zy(Tf),Na.renderService=Qy((()=>Zy(Tf))),Na.pluginServiceFactory=()=>Zy(Pf),Na.pluginService=Qy((()=>Zy(Pf))),Na.pickerServiceFactory=()=>Zy(Rf),Na.layerHandlerFactory=t=>Zy("static"===t?Cf:"dynamic"===t?wf:Mf),Na.incrementalDrawContributionFactory=()=>Zy(zf)}a_();const o_={x:0,y:0,z:0,lastModelMatrix:null};class l_{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(Lm),e(zm),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Dp(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,y=Iv(d,u,h),_=Lv(d,g),b=Ov(h),x=Rv(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Po(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Iv(o,l,n),p=Lv(o,c),g=Ov(n,r),f=Rv(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;o_.x=n,o_.y=r,o_.z=a,o_.lastModelMatrix=d;const p=u&&(s||mf(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Au.allocate(),n=Au.allocate();ff(n,t,e),pu(s,d||s,n),o_.x=0,o_.y=0,o_.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Au.free(n)}if(g&&!d){const s=t.getOffsetXY(e);o_.x+=s.x,o_.y+=s.y,o_.z=a,i.setTransformForCurrent()}else if(p)o_.x=0,o_.y=0,o_.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);o_.x+=s.x,o_.y+=s.y,this.transformWithoutTranslate(i,o_.x,o_.y,o_.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),o_.x=0,o_.y=0,o_.z=0;return o_}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,f,m,v,y,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Au.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class h_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=td,this.builtinContributions=[Yv,Kv,Xv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nFt){const t=Yt(b,_),r=Yt(x,_),a=Hv(v,y,f,m,n,t,Number(u)),o=Hv(A,k,C,w,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Ft)||T<.001)e.lineTo(i+C,s+w),p=!0;else if(M>Ft){const t=Yt(E,M),n=Yt(P,M),a=Hv(C,w,A,k,r,-n,Number(u)),o=Hv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Ut(B),s+r*Xt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Dp(t,null==r?void 0:r.theme).arc;const{fill:c=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let w=0;const M=(h(S)&&S||S[0])&&"conical"===c.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Nt-Ft){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),T||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Gu(0,0,h,n);a||Iv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}class c_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=sd,this.builtinContributions=[qv,Jv,Zv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}function d_(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=jo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function u_(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function p_(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=u_(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),d_(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Ao.ROW:"y"===s?u=Ao.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function f_(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}class m_ extends l_{constructor(){super(...arguments),this.numberType=od}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();p_(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Cl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Yt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}function v_(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Ao.ROW:Ao.COLUMN,Number.isFinite(c)||(o=Ao.COLUMN),Number.isFinite(d)||(o=Ao.ROW);const u=i*(o===Ao.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),d_(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),d_(t,l,1,s),o=!1):o=!0}t.closePath()}const __=new yy,b_=Am;class x_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=id,this.builtinContributions=[__,b_],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Dp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:w,points:M,segments:T}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===C&&!T&&!M.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,_,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Cl(E(t.points,x),B,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=T[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Cl(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Cl(e,B,{curveTension:b}),n=Cl(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Yt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Ao.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Vt(_.x-b.x),A=Vt(_.y-b.y);x=null==_.x1?Ao.ROW:null==_.y1?Ao.COLUMN:Number.isFinite(S+A)?S>A?Ao.ROW:Ao.COLUMN:Ao.ROW,v_(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),p_(t,i[0]?e.top:e.bottom,l,x===Ao.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const S_=Uv,A_=Am;class k_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ld,this.builtinContributions=[A_,S_],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Dp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)Po(t.pathShape.commandList,e,i,s,1,1,f);else{Po((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}class C_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=dd,this.builtinContributions=[ny,ay,ry],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Dp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:M}=t.attribute;w=(null!=w?w:b-S)||0,M=(null!=M?M:x-A)||0;const T=Dv(g,f,w,M,h),B=Fv(g,v,w,M,C),E=Ov(h,c),P=Rv(d,m);if(!t.valid||!_)return;if(!E&&!P)return;if(!(T||B||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,M)):(e.beginPath(),Pv(e,i,s,w,M,u,"bevel"!==p));const O={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,P,T,B,l,n,a,o,O),k?(this._runStroke(t,e,i,s,l,O,B,S,A,o),this._runFill(t,e,i,s,l,O,T,S,A,a)):(this._runFill(t,e,i,s,l,O,T,S,A,a),this._runStroke(t,e,i,s,l,O,B,S,A,o)),this.afterRenderStep(t,e,i,s,E,P,T,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}class w_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[uy,fy,gy,py],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Dp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,M=s,T=C;const B=e.camera;if(k&&B&&e.project){const t=e.project(i,s,C);e.camera=null,y(c)&&(c[0],c[1]),w=t.x,M=t.y,T=void 0}!1===A.draw(e,c,w,M,T,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const M_=new class extends Sm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:w=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:T=l.backgroundScale,backgroundOffsetX:B=l.backgroundOffsetX,backgroundOffsetY:E=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:O=l.backgroundClip,backgroundCornerRadius:R=l.backgroundCornerRadius}=t.attribute;let I,{background:D}=t.attribute;if(!D)return;const L=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=p(D)&&D.background?D:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(g=z.dx)&&void 0!==g?g:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=xm.allocate(i,s,i+n,s+r),D=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=bf(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const i=t.resources.get(D);if(!i||"success"!==i.state||!i.data)return void L();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,O&&(e.beginPath(),R?Pv(e,F.x1,F.y1,F.width(),F.height(),R,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:w,backgroundKeepAspectRatio:M,backgroundScale:T,backgroundOffsetX:B,backgroundOffsetY:E,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=D,R?(Pv(e,F.x1,F.y1,F.width(),F.height(),R,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&xm.free(F),L()}};class T_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=md,this.builtinContributions=[M_],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Dp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=kh(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:w}=S,M=!f,T=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,w,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,T,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Su.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Su.free(t)}w&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,T))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,T))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,T),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,T)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,T),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,T,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,T,e),this.afterRenderStep(t,e,i,s,C,w,A,k,d,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!d(c),_=y?c.width:i.clipedWidth,b=y?0:Np(u,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}function B_(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?B_(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void B_(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,y=v/m;const _=E_(d,u),b=E_(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=P_(h,y,_,d,u),A=P_(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,w=E_(k,C),M=P_(h,E_(y,v),w,k,C);let T=Math.atan2(S.y-M.y,S.x-M.x);const B=Math.atan2(A.y-M.y,A.x-M.x);let E=B-T;E<0&&(T=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const D_=["","repeat-x","repeat-y","repeat"];function L_(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?D_[i]:"no-repeat"}function F_({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=L_(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const z_={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function H_(t){return{backgroundMode:z_[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function j_({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=F_({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function N_(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=F_({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?H_(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Rm(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class V_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ad,this.builtinContributions=[ly,hy],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:_=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:w,doStroke:M}=A;if(!S||!t.resources)return;const T=t.resources.get(S);if("success"!==T.state)return;const B=t.width,E=t.height;e.beginPath();let P=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,B,E):(Pv(e,i,s,B,E,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const O=()=>{w&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),N_(e,T.data,i,s,B,E,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x})))},R=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=j_({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x}),D=P||I;g?(R(),D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,k,!1,l,n,a),O(),D&&e.restore()):(D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,k,!1,l,n,a),O(),D&&e.restore(),R()),this.afterRenderStep(t,e,i,s,w,!1,k,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&v(s))return void oh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Dp(t).image;this._draw(t,a,!1,i)}}var W_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class U_{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return W_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class G_{constructor(){this._uid=Ha.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class Y_{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Eu.Get(e,Bu.Color1),this.ambient=i;const s=Kt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Yt(Gt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=v(e)?Eu.Get(e,Bu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const X_=()=>{ov.registerPlugin("DirectionalLight",Y_)};class K_{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=Au.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Au.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return gu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return fu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return mu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;mu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const $_=()=>{ov.registerPlugin("OrthoCamera",K_)},q_={getContributions:()=>[]},Z_={getContributions:()=>[]};class J_{constructor(t=q_,e=Z_,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:Na.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:q_,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:Z_,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ue(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ne(e.x,e.y),a=Dp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new ne(e.x,e.y);l.transformPoint(a,a);const o=Dp(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&Au.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Su.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class Q_{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new Vm,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new Wm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new Gm,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new Um},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new nv(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new av,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new cf}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new Nm(new jm([],(t=this.registry.contribution,e=Ay,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class tb{constructor(t={}){this.context=new Q_(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function eb(t={}){return new tb(t)}class ib extends tb{}class sb extends tb{}class nb extends x_{constructor(){super(...arguments),this.numberType=id}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Dp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Iv(u,d,c),f=Ov(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=Dp(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=Iv(u,p,c),y=Lv(u,g),_=Ov(c),b=Rv(d,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||a||o))return;const{context:x}=n;for(let n=e;n{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function gb(t,e){let i=hb.get(t);i||(i=new Map,hb.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function fb(t,e,i){const s=gb(t,e);i&&s.forEach((t=>i(t))),s.clear()}function mb(){return db(),ab}function vb(){fv.refreshAllContributions()}function yb(){return db(),null!=ob||(ob=new Ya(uv(ug,ab))),ob}function _b(t){const e=mb(),i=yb();Na.global=i,Na.canvasFactory=t=>e.getNamed(kd,t),Na.context2dFactory=t=>e.getNamed(Cd,t),Na.windowHandlerFactory=t=>ub(am,t),Na.windowFactory=()=>new lm(i,(t=>ub(am,t))),Na.pluginServiceFactory=()=>new Xm(uv(Ef,e),{pluginRegistry:t.context.registry.plugin}),Na.incrementalDrawContributionFactory=()=>new Sy([],new rb,new nb(uv(Oy,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,Ay))}function bb(t){var e;const i=mb();vb();const s=i.getAll(Wf),n=gb(t.registry.renderer,"vrender:runtime-renderer");fb(t.registry.renderer,"vrender:runtime-renderer",null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),pb(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,"vrender:runtime-renderer")}function xb(t){var e;const i=mb();vb();const s=i.getAll(Ay),n=null!==(e=cb.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,Ay,e)})),n.clear(),cb.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(Ay));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(Ay,e),r.add(e)),n.add(e)}))}function Sb(t,e){var i;const s=mb();vb();const n=s.getAll(e),r=gb(t.registry.picker,"vrender:runtime-picker");fb(t.registry.picker,"vrender:runtime-picker",null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),pb(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,"vrender:runtime-picker")}function Ab(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function kb(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function Cb(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function wb(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function Ib(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=sg(t.attribute),n=Lb(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=Lb(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=Lb(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{const i=t.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;n{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return Yb(l,e,h),h},Vb=(t,e)=>{const i=t.attribute,s=i.points;if(s)return jb(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return jb(t,e)}return[]};const Wb=t=>t.map((t=>({x:t.x,y:t.y}))),Ub=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},Gb=t=>{const e=new Ne;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return Ub(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return Ub(t,{x:e.x1,y:n},{x:e.x2,y:n})},Yb=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=Gb(t);Yb(n[0],s,i),Yb(n[1],e-s,i)}},Xb=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:Wb(i)}];const s=[];return Yb(i,e,s),s},Kb=(t,e)=>{const i=Rb(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;rObject.assign({},t))):[]}function qb(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:$b(t.touches),configurable:!0},changedTouches:{value:$b(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function Zb(t,e){try{return t[e]}catch(t){return}}function Jb(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=qb(t),l=Zb(t,"target"),h=Zb(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var Qb=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function ix(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class sx{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:ex(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},tx(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},tx(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=Qb(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=ex(i,this.selectionStartCursorIdx),a=ex(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=tx(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=ix(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),Na.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),Na.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class nx{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=ex(i,Math.ceil(t)),n=ex(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=ex(i.attribute.textConfig,a),h=ex(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(rx,[this.formatTextCommandCb]),this.commandCbs.set(ax,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):p(t)&&e.forEach((e=>z(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new sx,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),Na.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(Na.global.isMacOS()&&t.metaKey&&"c"===t.key||!Na.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return Na.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(Na.global.isMacOS()&&t.metaKey&&"a"===t.key||!Na.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},tx(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=zg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:xf(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||ag({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},tx(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),Na.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=ef({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,ox.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=ig({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=ef({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=xf(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=xf(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(ag({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(ag({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(ag({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=xf(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=xf(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:xf(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Mx=new Cx;function Tx(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Bx=new WeakSet;function Ex({bind:t}){Tx(Bx,t)||(t(h_).toDynamicValue((({container:t})=>new h_(uv(Py,t)))).inSingletonScope(),t(Hf).toService(h_),t(Wf).toService(Hf),t(Py).toService(Im),pv(t,Py))}const Px=Ex,Ox=new WeakSet;function Rx({bind:t}){Tx(Ox,t)||(t(C_).toDynamicValue((({container:t})=>new C_(uv(zy,t)))).inSingletonScope(),t(Kf).toService(C_),t(Wf).toService(Kf),t(sy).toSelf(),t(iy).toSelf(),t(zy).toService(sy),t(zy).toService(iy),t(zy).toService(Im),pv(t,zy))}const Ix=Rx,Dx=new WeakSet;function Lx({bind:t}){Tx(Dx,t)||(t(m_).toDynamicValue((()=>new m_)).inSingletonScope(),t(Gf).toService(m_),t(Wf).toService(Gf))}const Fx=Lx,zx=new WeakSet;function Hx({bind:t}){Tx(zx,t)||(t(x_).toDynamicValue((({container:t})=>new x_(uv(Oy,t)))).inSingletonScope(),t(Nf).toService(x_),t(Wf).toService(Nf),t(Oy).toService(Im),pv(t,Oy))}const jx=Hx,Nx=new WeakSet;function Vx({bind:t}){Tx(Nx,t)||(t(w_).toDynamicValue((({container:t})=>new w_(uv(Hy,t)))).inSingletonScope(),t(qf).toService(w_),t(Wf).toService(qf),t(Hy).toService(Im),pv(t,Hy))}const Wx=Vx,Ux=new WeakSet;function Gx({bind:t}){Tx(Ux,t)||(t(c_).toDynamicValue((({container:t})=>new c_(uv(Ry,t)))).inSingletonScope(),t(Vf).toService(c_),t(Wf).toService(Vf),t(Ry).toService(Im),pv(t,Ry))}const Yx=Gx,Xx=new WeakSet;function Kx({bind:t}){Tx(Xx,t)||(t(Zf).toDynamicValue((({container:t})=>new T_(uv(jy,t)))).inSingletonScope(),t(Wf).toService(Zf),t(jy).toService(Im),pv(t,jy))}const $x=Kx,qx=new WeakSet;function Zx({bind:t}){Tx(qx,t)||(t(k_).toDynamicValue((({container:t})=>new k_(uv(Ly,t)))).inSingletonScope(),t(Yf).toService(k_),t(Wf).toService(Yf),t(Ly).toService(Im),pv(t,Ly))}const Jx=Zx,Qx=new WeakSet;function tS({bind:t}){Tx(Qx,t)||(t(Xf).toDynamicValue((({container:t})=>new I_(uv(Fy,t)))).inSingletonScope(),t(Wf).toService(Xf),t(Fy).toService(Im),pv(t,Fy))}const eS=tS;class iS extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=gd,this.builtinContributions=[vy,my],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const sS=new WeakSet;function nS({bind:t}){Tx(sS,t)||(t(iS).toDynamicValue((({container:t})=>new iS(uv(Ny,t)))).inSingletonScope(),t(nm).toService(iS),t(Wf).toService(nm),pv(t,Ny))}const rS=nS;class aS{constructor(){this.numberType=nd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Dp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const oS=new WeakSet;function lS({bind:t}){Tx(oS,t)||(t(aS).toDynamicValue((()=>new aS)).inSingletonScope(),t(tm).toService(aS),t(Wf).toService(tm))}const hS=lS;class cS extends l_{constructor(){super(),this.numberType=pd,this.builtinContributions=[M_],this.init()}drawShape(t,e,i,s,n){const r=Dp(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Iv(o,l,!0),d=Iv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Dp(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,y)):(e.beginPath(),Pv(e,i-t,s-n,v,y,f,!0)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,s,o,l))}draw(t,e,i){const s=Dp(t).richtext;this._draw(t,s,!1,i)}}const dS=new WeakSet;function uS({bind:t}){Tx(dS,t)||(t(cS).toDynamicValue((()=>new cS)).inSingletonScope(),t(Jf).toService(cS),t(Wf).toService(Jf))}const pS=uS,gS=new WeakSet;function fS({bind:t}){Tx(gS,t)||(t(em).toDynamicValue((({container:t})=>new V_(uv(Dy,t)))).inSingletonScope(),t(Wf).toService(em),t(Dy).toService(Im),pv(t,Dy))}const mS=fS;class vS extends l_{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Eu.Get(r,Bu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[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+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class yS extends vS{constructor(){super(...arguments),this.type="rect3d",this.numberType=ud}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=Dp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,w=Dv(v,y,A,k,d),M=Fv(v,b,A,k,S),T=Ov(d),B=Rv(u,_);if(!t.valid||!x)return;if(!T&&!B)return;if(!(w||M||a||o))return;const{light:E}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,E,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=Dp(t).rect;this._draw(t,s,!1,i)}}const _S=new WeakSet;function bS({bind:t}){Tx(_S,t)||(t(yS).toDynamicValue((()=>new yS)).inSingletonScope(),t($f).toService(yS),t(Wf).toService($f))}const xS=bS;class SS extends l_{constructor(){super(...arguments),this.numberType=ed}drawShape(t,e,i,s,n,r,a,o){var l;const h=Dp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Eu.Get(c,Bu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},w={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Nt-Ft)e.moveTo(i+r*Ut(o),s+r*Xt(o),n),e.arc(i,s,r,o,l,!c,n),a>Ft&&(e.moveTo(i+a*Ut(l),s+a*Xt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Ut(p),y=r*Xt(p),_=a*Ut(f),b=a*Xt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>Ft)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(w[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Nt,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=Ft)e.moveTo(i,s,n);else if(c>=Nt-Ft)e.moveTo(i+a*Ut(l),s+a*Xt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Ut(h),s+a*Xt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Ut(c),f=a*Xt(c),m=a*Ut(p),v=a*Xt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(w[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const AS=new WeakSet;function kS({bind:t}){Tx(AS,t)||(t(SS).toDynamicValue((()=>new SS)).inSingletonScope(),t(jf).toService(SS),t(Wf).toService(jf))}const CS=kS;class wS extends vS{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=cd}drawShape(t,e,i,s,n,r,a,o){var l;const h=Dp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=Dp(t).polygon;this._draw(t,s,!1,i)}}const MS=new WeakSet;function TS({bind:t}){Tx(MS,t)||(t(wS).toDynamicValue((()=>new wS)).inSingletonScope(),t(Qf).toService(wS),t(Wf).toService(Qf))}const BS=TS;function ES(){pf("arc",Xg)}function PS(){pf("arc3d",Jg)}function OS(){pf("area",Ug)}function RS(){pf("circle",jp)}function IS(){pf("glyph",dg)}function DS(){pf("group",ef)}function LS(){pf("image",Pg)}function FS(){pf("line",ig)}function zS(){pf("path",Ng)}function HS(){pf("polygon",rf)}function jS(){pf("star",qg)}function NS(){pf("pyramid3d",of)}function VS(){pf("rect",ag)}function WS(){pf("rect3d",hg)}function US(){pf("richtext",zg)}function GS(){pf("symbol",Qp)}function YS(){pf("text",Xp)}function XS(){pf("shadowRoot",hf)}function KS(){pf("wrapText",qp)}class $S{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?Na.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Na.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Wp("text"===t.type&&t.attribute?t.attribute:Dp(t).text)}getTransformOfText(t){const e=Dp(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const u=t.globalAABBBounds;let g=n.anchorType;if(d(g)&&(g="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===g&&(g="top-left"),"position"===g||u.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=Fe(u,g);l=t.x,h=t.y}const f=Na.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),y=e.viewBox,_=l+m.left-f.left+y.x1,b=h+m.top-f.top+y.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===g&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),c(n.style)){const e=n.style({top:b,left:_,width:u.width(),height:u.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else p(n.style)?o=Object.assign(Object.assign({},o),n.style):v(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));Na.global.updateDom(i,{width:n.width,height:n.height,style:o})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===Na.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Ul.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Ul.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&Na.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=d(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===Na.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const qS=()=>{ov.registerPlugin("HtmlAttributePlugin",$S)};class ZS extends $S{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?Na.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&Na.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=d(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const JS=()=>{ov.registerPlugin("ReactAttributePlugin",ZS)};class QS{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/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,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}const tA=()=>{ov.registerPlugin("ViewTransform3dPlugin",QS)},eA=new Ve;class iA{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Ha.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Dp(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},f=g.main,m=g.cross;"column"!==r&&"column-reverse"!==r||(f.len=d,m.len=c,f.field="y",m.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,y=0;const _=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===f.field?e.width():e.height(),s="x"===m.field?e.width():e.height();_.push({mainLen:i,crossLen:s}),v+=i,y=Math.max(y,s)}));const b=[];if(v>f.len&&"wrap"===a){let t=0,e=0;_.forEach((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),b.push({idx:_.length-1,mainLen:t,crossLen:e})}else b.push({idx:_.length-1,mainLen:v,crossLen:y});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,f,_,x,t),x=t.idx+1})),y=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":m.len,center:m.len/2};this.layoutCross(p,o,m,t,_,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(m.len-y)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",m,s,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(m.len-y)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(m.len-y)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&eA.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(eA.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const sA=()=>{ov.registerPlugin("FlexLayoutPlugin",iA)};var nA=Object.freeze({__proto__:null,ARC3D_NUMBER_TYPE:ed,ARC_NUMBER_TYPE:td,AREA_NUMBER_TYPE:id,AbstractGraphicRender:class{},get AnimateMode(){return El},get AnimateStatus(){return Rl},get AnimateStepType(){return Ol},AppContext:Q_,Application:ja,Arc:Yg,Arc3d:Zg,Arc3dRender:jf,ArcRender:Hf,ArcRenderContribution:Py,Area:Wg,AreaRender:Nf,AreaRenderContribution:Oy,get AttributeUpdateType(){return So},AutoEnablePlugins:Ef,BaseCanvas:Tu,BaseEnvContribution:U_,BaseRender:l_,get BaseRenderContributionTime(){return Co},BaseWindowHandlerContribution:G_,Basis:Jo,BeforeRenderConstribution:Bf,BoundsContext:oo,BoundsPicker:If,BrowserEntry:tb,CIRCLE_NUMBER_TYPE:sd,Canvas3DDrawItemInterceptor:Ey,Canvas3DPickItemInterceptor:Cv,CanvasFactory:kd,CanvasTextLayout:Up,Circle:Hp,CircleRender:Vf,CircleRenderContribution:Ry,ColorInterpolate:Wu,ColorStore:Eu,get ColorType(){return Bu},CommonDrawItemInterceptorContribution:Ty,CommonRenderContribution:Vy,Context2dFactory:Cd,ContributionProvider:cv,ContributionRegistry:Gm,ContributionStore:fv,CubicBezierCurve:No,CurveContext:kl,get CurveTypeEnum(){return ko},CustomEvent:Qa,CustomPath2D:wl,CustomSymbolClass:Mc,DEFAULT_TEXT_FONT_FAMILY:gg,DebugDrawItemInterceptorContribution:My,DefaultArcAllocate:dx,DefaultArcAttribute:Gl,DefaultArcRenderContribution:Gv,DefaultAreaAllocate:px,DefaultAreaAttribute:Yl,DefaultAreaTextureRenderContribution:yy,DefaultAttribute:Ul,DefaultBaseBackgroundRenderContribution:Sm,DefaultBaseClipRenderAfterContribution:Fm,DefaultBaseClipRenderBeforeContribution:Dm,DefaultBaseInteractiveRenderContribution:Im,DefaultBaseTextureRenderContribution:Wv,DefaultCanvasAllocate:hm,DefaultCanvasArcRender:h_,DefaultCanvasAreaRender:x_,DefaultCanvasCircleRender:c_,DefaultCanvasGroupRender:_y,DefaultCanvasImageRender:V_,DefaultCanvasLineRender:m_,DefaultCanvasPathRender:k_,DefaultCanvasPolygonRender:I_,DefaultCanvasRectRender:C_,DefaultCanvasSymbolRender:w_,DefaultCanvasTextRender:T_,DefaultCircleAllocate:fx,DefaultCircleAttribute:Xl,DefaultCircleRenderContribution:$v,DefaultConnectAttribute:Vl,DefaultDebugAttribute:Wl,DefaultFillStyle:Ll,DefaultGlobal:Ya,DefaultGlobalPickerService:fm,DefaultGlyphAttribute:$l,DefaultGraphicAllocate:lx,DefaultGraphicMemoryManager:Cx,DefaultGraphicService:vf,DefaultGraphicUtil:dm,DefaultGroupAttribute:Kl,DefaultGroupBackgroundRenderContribution:Qv,DefaultImageAttribute:rh,DefaultImageRenderContribution:oy,DefaultLayerService:hv,DefaultLayout:Il,DefaultLineAllocate:vx,DefaultLineAttribute:ql,DefaultMat4Allocate:xu,DefaultMatrixAllocate:bu,DefaultPathAllocate:_x,DefaultPathAttribute:Zl,DefaultPickService:J_,DefaultPickStyle:jl,DefaultPolygonAttribute:Jl,DefaultRect3dAttribute:eh,DefaultRectAllocate:hx,DefaultRectAttribute:th,DefaultRectRenderContribution:ey,DefaultRenderService:Nm,DefaultRichTextAttribute:nh,DefaultRichTextIconAttribute:ah,DefaultStarAttribute:Ql,DefaultStrokeStyle:zl,DefaultStyle:Nl,DefaultSymbolAllocate:xx,DefaultSymbolAttribute:ih,DefaultSymbolClipRangeStrokeRenderContribution:dy,DefaultSymbolRenderContribution:cy,DefaultTextAllocate:Ax,DefaultTextAttribute:sh,DefaultTextMeasureContribution:yv,DefaultTextStyle:Hl,DefaultTransform:Dl,DefaultTransformUtil:gm,DefaultWindow:lm,get Direction(){return Ao},DirectionalLight:Y_,DrawContribution:sm,DrawItemInterceptor:Ay,DynamicLayerHandlerContribution:wf,get Edge(){return hh},EditModule:sx,EmptyContext2d:wu,EnvContribution:ug,EventManager:io,EventSystem:ro,EventTarget:so,FORMAT_ALL_TEXT_COMMAND:ax,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:rx,Factory:ov,FederatedEvent:$a,FederatedMouseEvent:qa,FederatedPointerEvent:Za,FederatedWheelEvent:Ja,FlexLayoutPlugin:iA,GLYPH_NUMBER_TYPE:nd,GRAPHIC_UPDATE_TAG_KEY:pp,GROUP_NUMBER_TYPE:rd,Generator:Ha,GlobalPickerService:Df,Glyph:cg,GlyphRender:tm,GradientParser:su,Graphic:wp,GraphicCreator:yd,GraphicFactory:cf,GraphicPicker:Of,GraphicRender:Wf,GraphicService:vd,GraphicUtil:Af,Group:tf,GroupRender:Uf,GroupRenderContribution:Iy,get GroupUpdateAABBBoundsMode(){return Qg},HtmlAttributePlugin:$S,get IContainPointMode(){return xo},IMAGE_NUMBER_TYPE:ad,Image:Eg,ImageRender:em,ImageRenderContribution:Dy,IncrementalDrawContribution:zf,InteractiveDrawItemInterceptorContribution:By,InteractivePickItemInterceptorContribution:kv,InteractiveSubRenderContribution:Wy,LINE_NUMBER_TYPE:od,Layer:rv,LayerFactory:av,LayerService:kf,Line:eg,LineRender:Gf,Linear:Ko,LinearClosed:ml,Mat4Allocate:yu,MatrixAllocate:vu,get MeasureModeEnum(){return Bl},MiniappEntry:sb,MonotoneX:rl,MonotoneY:al,NOWORK_ANIMATE_ATTR:Cp,Node:Ka,NodeEntry:ib,OrthoCamera:K_,PATH_NUMBER_TYPE:ld,POLYGON_NUMBER_TYPE:hd,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:cd,Path:jg,PathRender:Yf,PathRenderContribution:Ly,PerformanceRAF:Wa,PickItemInterceptor:Lf,PickServiceInterceptor:Ff,PickerRegistry:Wm,PickerService:Rf,PluginRegistry:Um,PluginService:Pf,Polygon:nf,PolygonRender:Xf,PolygonRenderContribution:Fy,Pyramid3d:af,Pyramid3dRender:Qf,RECT3D_NUMBER_TYPE:ud,RECT_NUMBER_TYPE:dd,RICHTEXT_NUMBER_TYPE:pd,RafBasedSTO:xh,ReactAttributePlugin:ZS,Rect:rg,Rect3DRender:$f,Rect3d:lg,RectRender:Kf,RectRenderContribution:zy,ReflectSegContext:Go,RenderSelector:im,RenderService:Tf,RendererRegistry:Vm,ResourceLoader:oh,RichText:Fg,RichTextEditPlugin:ox,RichTextRender:Jf,STAR_NUMBER_TYPE:gd,get STATUS(){return Pl},SVG_ATTRIBUTE_MAP:_d,SVG_ATTRIBUTE_MAP_KEYS:bd,SVG_PARSE_ATTRIBUTE_MAP:xd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Sd,SYMBOL_NUMBER_TYPE:fd,SegContext:Uo,ShadowPickServiceInterceptorContribution:Sv,ShadowRoot:lf,ShadowRootDrawItemInterceptorContribution:wy,ShadowRootPickItemInterceptorContribution:Av,SplitRectAfterRenderContribution:sy,SplitRectBeforeRenderContribution:iy,Stage:sv,StageFactory:nv,Star:$g,StarRender:nm,StarRenderContribution:Ny,StateDefinitionCompiler:$u,StateEngine:Qu,StaticLayerHandlerContribution:Cf,Step:dl,StepClosed:ul,Symbol:Jp,SymbolRender:qf,SymbolRenderContribution:Hy,TEXT_NUMBER_TYPE:md,Text:Yp,get TextDirection(){return Kc},TextMeasureContribution:vv,TextRender:Zf,TextRenderContribution:jy,Theme:Rp,TransformUtil:Sf,get UpdateTag(){return bo},VGlobal:pg,VWindow:rm,ViewTransform3dPlugin:QS,VirtualLayerHandlerContribution:Mf,WILDCARD:"*",WindowHandlerContribution:am,WrapText:$p,XMLParser:Vc,_calculateLineHeight:Ah,_interpolateColor:Ru,addArcToBezierPath:Bo,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:Ob,alignSubpath:wb,application:Na,applyTransformOnBezierCurves:Ib,arc3dModule:CS,arcModule:Px,areaModule:jx,bezier:Mo,bezierCurversToPath:Db,binarySplitPolygon:Gb,bindArc3dRenderModule:kS,bindArcRenderModule:Ex,bindAreaRenderModule:Hx,bindCircleRenderModule:Gx,bindContributionProvider:pv,bindContributionProviderNoSingletonScope:gv,bindGlyphRenderModule:lS,bindImageRenderModule:fS,bindLineRenderModule:Lx,bindPathRenderModule:Zx,bindPolygonRenderModule:tS,bindPyramid3dRenderModule:TS,bindRect3dRenderModule:bS,bindRectRenderModule:Rx,bindRichtextRenderModule:uS,bindStarRenderModule:nS,bindSymbolRenderModule:Vx,bindTextRenderModule:Kx,boundStroke:Gc,builtInSymbolStrMap:Ec,builtinSymbols:Tc,builtinSymbolsMap:Bc,calcLineCache:Cl,calculateArcCornerRadius:jv,calculateLineHeight:kh,canvasAllocate:cm,centroidOfSubpath:Bb,circleBounds:mh,circleModule:Yx,clock:to,colorEqual:function(t,e){const i=ii.parseColorString(t),s=ii.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:Nu,configureRuntimeApplicationForApp:_b,container:e_,cornerTangents:Hv,createApp:eb,createArc:Xg,createArc3d:Jg,createArea:Ug,createBrowserApp:eb,createCanvasEventTransformer:function(t,e,i,s){return Jb(t.parentElement,e,i,s)},createCircle:jp,createColor:ru,createConicalGradient:Yu,createContributionProvider:uv,createEventTransformer:Jb,createGlyph:dg,createGraphic:gf,createGroup:ef,createImage:Pg,createLine:ig,createMat4:_u,createMiniappApp:function(t={}){return new sb(t)},createNodeApp:function(t={}){return new ib(t)},createPath:Ng,createPolygon:rf,createPyramid3d:of,createRect:ag,createRect3d:hg,createRectPath:Pv,createRichText:zg,createShadowRoot:hf,createStage:function(t){return a_(),(new nv).create(t)},createStar:qg,createSymbol:Qp,createText:Xp,createWrapText:qp,cubicCalc:Do,cubicLength:Io,cubicPointAt:Lo,cubicSubdivide:Cb,defaultArcAllocate:ux,defaultArcBackgroundRenderContribution:Kv,defaultArcRenderContribution:Yv,defaultArcTextureRenderContribution:Xv,defaultAreaAllocate:gx,defaultBaseBackgroundRenderContribution:Am,defaultBaseClipRenderAfterContribution:zm,defaultBaseClipRenderBeforeContribution:Lm,defaultBaseTextureRenderContribution:Uv,defaultCircleAllocate:mx,defaultCircleBackgroundRenderContribution:Jv,defaultCircleRenderContribution:qv,defaultCircleTextureRenderContribution:Zv,defaultGraphicMemoryManager:Mx,defaultGroupBackgroundRenderContribution:ty,defaultImageBackgroundRenderContribution:hy,defaultImageRenderContribution:ly,defaultLineAllocate:yx,defaultPathAllocate:bx,defaultRectAllocate:cx,defaultRectBackgroundRenderContribution:ay,defaultRectRenderContribution:ny,defaultRectTextureRenderContribution:ry,defaultStarBackgroundRenderContribution:vy,defaultStarTextureRenderContribution:my,defaultSymbolAllocate:Sx,defaultSymbolBackgroundRenderContribution:fy,defaultSymbolClipRangeStrokeRenderContribution:py,defaultSymbolRenderContribution:uy,defaultSymbolTextureRenderContribution:gy,defaultTextAllocate:kx,diff:kb,divideCubic:jo,drawArc:To,drawArcPath:Nv,drawAreaSegments:v_,drawBackgroundImage:Rm,drawImageWithLayout:N_,drawIncrementalAreaSegments:f_,drawIncrementalSegments:g_,drawSegments:p_,enumCommandMap:uo,fillVisible:Iv,findBestMorphingRotation:Pb,findConfigIndexByCursorIdx:ex,findCursorIdxByConfigIndex:ix,findNextGraphic:bm,flatten_simplify:Ab,foreach:ym,foreachAsync:_m,genBasisSegments:tl,genBasisTypeSegments:Qo,genLinearClosedSegments:vl,genLinearClosedTypeSegments:yl,genLinearSegments:$o,genLinearTypeSegments:qo,genMonotoneXSegments:ll,genMonotoneXTypeSegments:ol,genMonotoneYSegments:cl,genMonotoneYTypeSegments:hl,genNumberType:Xc,genStepClosedSegments:fl,genStepSegments:pl,genStepTypeSegments:gl,getAttributeFromDefaultAttrList:bh,getBackgroundImage:Cm,getConicGradientAt:Gu,getCurrentEnv:function(){return ev()?"browser":"node"},getDefaultCharacterConfig:tx,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Np(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Au.allocate();return cu(o,o,[a[0],a[1],0]),n&&ou(o,o,n),s&&lu(o,o,s),cu(o,o,[-a[0],-a[1],0]),o},getLegacyBindingContext:qy,getModelMatrix:ff,getRichTextBounds:xf,getRuntimeInstallerBindingContext:mb,getRuntimeInstallerGlobal:yb,getScaledStroke:nu,getTextBounds:bf,getTheme:Dp,getThemeFromGroup:Lp,globalTheme:Ip,glyphModule:hS,graphicCreator:uf,graphicService:n_,graphicUtil:i_,identityMat4:au,imageModule:mS,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeDrawContributionsToApp:xb,installRuntimeGraphicRenderersToApp:bb,installRuntimePickersToApp:Sb,interpolateColor:Ou,interpolateGradientConicalColor:Lu,interpolateGradientLinearColor:Iu,interpolateGradientRadialColor:Du,interpolatePureColorArray:Fu,interpolatePureColorArrayToStr:zu,intersect:zv,isBrowserEnv:ev,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){tv();const t=Na.global&&Na.global.env;return t?"node"===t:!Qm},isSvg:jc,isXML:Nc,layerService:r_,lineModule:Fx,lookAt:gu,mapToCanvasPointForCanvas:function(t){var e;if(Od(t._canvasX)&&Od(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:du,mat4Allocate:Au,matrixAllocate:Su,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i.c,b=i.d,x=0,S=0,t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=0,b=0,x=1,S=0,t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i.e,b=i.f,x=0,S=1,t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t},multiplyMat4Mat4:pu,newThemeObj:Ep,ortho:fu,parsePadding:ph,parseStroke:dh,parseSvgPath:_o,pathModule:Jx,pathToBezierCurves:Rb,point:Zo,pointEqual:vh,pointInterpolation:yh,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Zt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Zt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>vh(t,e[i]))):!Number.isNaN(t.x+t.y)&&vh(t,e))},pointsInterpolation:_h,polygonModule:eS,preLoadAllModule:$y,pyramid3dModule:BS,quadCalc:Fo,quadLength:Ho,quadPointAt:zo,rafBasedSto:Sh,rect3dModule:xS,rectFillVisible:Dv,rectModule:Ix,rectStrokeVisible:Fv,recursiveCallBinarySplit:Yb,refreshRuntimeInstallerContributions:vb,registerArc3dGraphic:PS,registerArcGraphic:ES,registerAreaGraphic:OS,registerCircleGraphic:RS,registerDirectionalLight:X_,registerFlexLayoutPlugin:sA,registerGlobalEventTransformer:function(t,e,i,s,n){const r=Jb(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:IS,registerGraphic:pf,registerGroupGraphic:DS,registerHtmlAttributePlugin:qS,registerImageGraphic:LS,registerLineGraphic:FS,registerOrthoCamera:$_,registerPathGraphic:zS,registerPolygonGraphic:HS,registerPyramid3dGraphic:NS,registerReactAttributePlugin:JS,registerRect3dGraphic:WS,registerRectGraphic:VS,registerRichtextGraphic:US,registerShadowRootGraphic:XS,registerStarGraphic:jS,registerSymbolGraphic:GS,registerTextGraphic:YS,registerViewTransform3dPlugin:tA,registerWindowEventTransformer:function(t,e,i,s,n){const r=Jb(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:KS,renderCommandList:Po,resolveBackgroundDrawMode:Tm,resolveBackgroundParamsByImageSizing:H_,resolveBackgroundPosition:Em,resolveBackgroundSizing:wm,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:F_,resolveImageRepeatMode:L_,resolveRenderableImageSize:Om,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:pS,rotateX:ou,rotateY:lu,rotateZ:hu,runFill:Ov,runStroke:Rv,scaleMat4:uu,segments:wo,shouldClipImageByLayout:j_,shouldUseMat4:mf,snapLength:Ro,splitArc:zb,splitArea:Nb,splitCircle:Hb,splitLine:Vb,splitPath:Kb,splitPolygon:Xb,splitRect:Fb,splitToGrids:Lb,starModule:rS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Lv,symbolModule:Wx,textAttributesToStyle:Wp,textDrawOffsetX:Np,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Vp,textModule:$x,transformMat4:mu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:s_,translate:cu,verticalLayout:$c,vglobal:t_,waitForAllSubLayers:Uc,wrapCanvas:wd,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=Na.global)||void 0===t?void 0:t.env,s=i?null===(e=Na.context2dFactory)||void 0===e?void 0:e.call(Na,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=y(t)?t[0]:t,i=[];if(!e)return i;if(!0===Nc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Qc(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Qc(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});function rA(t){const e=[];for(let i=0;i=0&&n>=0&&sat.getInstance().info(`[VChart log]: ${t}`,...e),lA=(t,e)=>(c(cA.warnHandler)&&cA.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),hA=(t,e,i)=>{if(!c(cA.errorHandler))throw new Error(t);cA.errorHandler.call(null,t,e)},cA={silent:!1,warnHandler:!1,errorHandler:!1},dA=ev(),uA=dA&&globalThis?globalThis.document:void 0;function pA(t){return("desktop-browser"===t||"mobile-browser"===t)&&dA}function gA(t){return fA(t)||"mobile-browser"===t}function fA(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let mA=0;function vA(){return mA>=9999999&&(mA=0),mA++}function yA(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function _A(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&y(t[0].fields))}function bA(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&bA(t,e)}))}const xA=t=>!d(t)&&!1!==t.visible;function SA(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function AA(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const CA=["#ffffff","#000000"];function wA(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ii(t).toHex(),o=new ii(e).toHex();return MA(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...CA);for(const n of a)if(t!==n&&MA(n,e,i,s,r))return n}(a,o,i,s,n,r)}function MA(t,e,i,s,n){if("lightness"===n){const i=ii.getColorBrightness(new ii(e));return ii.getColorBrightness(new ii(t))<.5?i>=.5:i<.5}return s?TA(t,e)>s:"largeText"===i?TA(t,e)>3:TA(t,e)>4.5}function TA(t,e){const i=BA(t),s=BA(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function BA(t){const e=ni(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function EA(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function PA(t,e){return[t[0]*e,t[1]*e]}function OA(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function RA(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Jt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const IA=gf,DA={arc:t=>IA("arc",t),circle:t=>IA("circle",t),group:t=>IA("group",t),image:t=>IA("image",t),line:t=>IA("line",t),path:t=>IA("path",t),polygon:t=>IA("polygon",t),rect:t=>IA("rect",t),richtext:t=>IA("richtext",t),symbol:t=>IA("symbol",t),text:t=>IA("text",t)},LA=-.5*Math.PI,FA=1.5*Math.PI,zA="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var HA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(HA||(HA={}));const jA={[HA.selectedReverse]:{},[HA.selected]:{},[HA.hover]:{},[HA.hoverReverse]:{}},NA={container:"",width:30,height:30,style:{}},VA="scrollDrag",WA=(t,e,i,s)=>new Le(Object.assign({defaultFontParams:Object.assign({fontFamily:zA,fontSize:14},s),getTextBounds:i?void 0:bf,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function UA(t,e,i={}){if(!t)return{width:0,height:0};const s=bf({text:t,fontFamily:e.fontFamily||i.fontFamily||zA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function GA(t,e="type"){var i,s;return p(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function YA(t){var e,i;return u(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function XA(t,e="type"){const i=GA(t,e);return"rich"===i?DA.richtext(YA(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),DA.text(t))}function KA(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const $A=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function qA(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function ZA(t,e){const{dx:i,dy:s}=qA(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const JA={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},QA={size:8,stroke:"#000",lineWidth:1,zIndex:1};const tk=Math.sin(Math.PI/10);function ek(t,e=tk){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function ik(t,e=tk){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function sk(t){const e={};return bA(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function nk(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function rk(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return PA(r,(s?-1:1)*(n?-1:1)*t/OA(r))}function ak(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function lk(t,e,i){var s;if(ik(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>ze(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>ze(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>He(n,r)}function hk(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:K(i)}function uk(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}function pk(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function gk(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)}));return i/s}function fk(t,e){const i=gk(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function mk(t,e){const i=vk(t),s=vk(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function vk(t,e={x:0,y:0}){return re.distancePP(t,e)}function yk(t){return A(t.x)&&A(t.y)}function _k(t,e,i){let s=!1;if(e&&c(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function bk(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const xk=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function Ak(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&Ak(t[i],e)}}var kk;!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"}(kk||(kk={}));const Ck={};function wk(t){switch(t){case kk.Linear:case kk.Log:case kk.Pow:case kk.Sqrt:case kk.Symlog:case kk.Time:return!0;default:return!1}}function Mk(t){return!!Ck[t]}function Tk(t){switch(t){case kk.Ordinal:case kk.Point:case kk.Band:return!0;default:return!1}}function Bk(t){return t}Object.values(kk).forEach((t=>{Ck[t]=!0}));const Ek=t=>-Math.log(-t),Pk=t=>-Math.exp(-t),Ok=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Rk=t=>10===t?Ok:t===Math.E?Math.exp:e=>Math.pow(t,e),Ik=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Dk=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Lk=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Fk(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 zk(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function Hk(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function jk(t,e,i,s){return 1===i&&(i=0),Hk(t,i,s)*(e/(1-i))}function Nk(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Vk(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class Uk{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=Nk(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Gk=Symbol("implicit");class Yk extends Uk{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=kk.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Gk}clone(){const t=(new Yk).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==Gk)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return Xk(t,e,r,n)}class $k extends Yk{constructor(t){super(),this.type=kk.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=jk(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[et(t[0]),et(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[et(t[0]),et(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:Kk(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return Kk(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=_t(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&x(this._userBandwidth)}clone(){var t,e,i;return new $k(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:qk}=ri;function Zk(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=ii.parseColorString(e)){const e=qk(ii.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof si?qk(t,e):e instanceof ii?qk(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):At(Number(t),Number(e))}class Jk extends Uk{constructor(t=Bk,e=Bk){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Bk,this._piecewise=zk,this._interpolate=Zk}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),At)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,et);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=_t(i[0],i[r-1])),this._piecewise=r>2?Vk:zk,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Bk),this.rescale(i)):this._clamp!==Bk}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const Qk=Math.sqrt(50),tC=Math.sqrt(10),eC=Math.sqrt(2),iC=[1,2,5,10],sC=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=oC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),J(0,e).map((t=>n+t*s))):t>0?rC(0,-(e-1)/s,s):rC((e-1)/s,0,s)},nC=mt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return sC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return sC(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=rC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=rC(t,e,l);return n&&r.reverse(),r})),oC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=iC[0];return i>=Qk?s=iC[3]:i>=tC?s=iC[2]:i>=eC&&(s=iC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function lC(t,e,i){const s=(e-t)/Math.max(0,i);return oC(s)}function hC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=lC(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function dC(t,e){const i=x(e.forceMin),s=x(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const uC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),pC=mt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),gC=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=aC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?uC(t,e,n):uC(t,e,Wk(n)),h=uC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),fC=mt(((t,e,i,s,n)=>hC(s(t),s(e),i).map((t=>Wk(n(t))))));class mC extends Jk{constructor(){super(...arguments),this.type=kk.Linear}clone(){var t;const e=new mC;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return nC(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=aC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return hC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function yC(t){return e=>-t(-e)}function _C(t=Number.EPSILON){return e=>Math.max(e,t)}class bC extends Jk{constructor(){super(Ik(10),Rk(10)),this.type=kk.Log,this._limit=_C(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new bC).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=Ik(this._base),s=Rk(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=yC(i),this._pows=yC(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Ek,this.untransformer=Pk):(this._logs=i,this._pows=s,this._limit=_C(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Bk}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return pC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return gC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return fC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return fC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(bC,vC);class xC extends mC{constructor(){super(Dk(1),Lk(1)),this.type=kk.Symlog,this._const=1}clone(){return(new xC).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=Dk(t),this.untransformer=Lk(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return pC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return gC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return fC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return fC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(xC,vC);class SC{constructor(){this.type=kk.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!d(t)&&A(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new SC).domain(this._domain).range(this._range).unknown(this._unknown)}}var AC,kC,CC;function wC(t){var e,i;const{type:s}=t;return s===kC.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(AC||(AC={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(kC||(kC={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(CC||(CC={}));const MC={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},TC={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function BC(t,e){var i;if(!t)return[];const s=LC(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?IC(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>RC(i)?PC(t,i,e):i)).filter(u)}))):i.map((i=>RC(i)?PC(t,i,e):i)).filter(u):[]}return[]}function EC(t,e){var i,s;return IC(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function PC(t,e,i){var s;const n=LC(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=MC[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=TC[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new ii(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Xe(t,i,s),a=Ye(n,r,e.l),l=new ii(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const OC=(t,e)=>{if(e&&RC(t)){const i=PC(e,t);if(i)return i}return t};function RC(t){return t&&"palette"===t.type&&!!t.key}function IC(t){return!(!y(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function DC(t){return y(t)?{dataScheme:t}:t}function LC(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=wC(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class FC extends Yk{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!IC(this._range))return void super.range(this._range);const t=EC(this._range,this._domain);super.range(t)}}const zC={linear:mC,band:$k,point:class extends $k{constructor(t){super(!1),this.type=kk.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:Yk,threshold:SC,colorOrdinal:FC};function HC(t){const e=zC[t];return e?new e:null}function jC(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function NC(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function VC(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function WC(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function UC(t){return!!v(t)&&(!!t.endsWith("%")&&yA(t.substring(0,t.length-1)))}function GC(t){return!!p(t)&&("percent"in t||"offset"in t)}function YC(t,e,i,s=0){var n,r;return x(t)?t:UC(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function XC(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=YC(t[s],e.size,i)}))})),o}function KC(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function $C(t){let e={};return y(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||UC(t)||c(t)||GC(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function qC(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ZC=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},JC=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function QC(t,e){return t&&e.key in t?t[e.key]:e.default}function tw(t){return t&&"token"===t.type&&!!t.key}const ew={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},iw={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:JC,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:ew,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},sw={name:"dark",colorScheme:{default:{dataScheme:JC,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},nw=(t,e)=>t===e||!c(t)&&!c(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>nw(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>nw(t[i],e[i])))),rw=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),rw(t[s],e.slice(1),i))},aw=t=>t instanceof Oa||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(t);function ow(t,e=["data"]){return I(t,aw,e)}function lw(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=DC(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}hw._charts={},hw._series={},hw._components={},hw._graphicComponents={},hw._marks={},hw._regions={},hw._animations={},hw._implements={},hw._chartPlugin={},hw._vChartPlugin={},hw._componentPlugin={},hw.transforms={fields:Kr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},hw.dataParser={csv:(t,e={},i)=>(i.type=Xr.DSV,ra(t)),dsv:(t,e={},i)=>{i.type=Xr.DSV;const s=Vr(oa,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return na(n).parse(t)},tsv:(t,e={},i)=>(i.type=Xr.DSV,aa(t))},hw._layout={},hw._grammarTransforms={},hw._stageEventPlugins={},hw.registerStageEventPlugin=(t,e)=>{hw._stageEventPlugins[t]=e},hw.getStageEventPlugin=t=>hw._stageEventPlugins[t],hw._interactionTriggers={},hw.registerInteractionTrigger=(t,e)=>{hw._interactionTriggers[t]=e},hw._composedEventMap={},hw.registerComposedEvent=(t,e)=>{hw._composedEventMap[t]=e},hw._tooltipProcessors={},hw.registerTooltipProcessor=(t,e)=>{hw._tooltipProcessors[t]=e},hw.createTooltipProcessor=(t,e)=>{const i=hw._tooltipProcessors[t];return i?new i(e):null};const uw=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},pw=uw(),gw={[iw.name]:iw},fw=iw.name,mw=new Map(Object.keys(gw).map((t=>[t,gw[t]]))),vw=new Map,yw=new Map(Object.keys(gw).map((t=>[t,t===fw]))),_w=(t,e)=>{if(!t)return;const i=Aw(e);mw.set(t,i),yw.set(t,!0)},bw=(t=fw)=>(yw.has(t)&&!yw.get(t)&&_w(t,mw.get(t)),mw.get(t)),xw=t=>mw.delete(t)&&vw.delete(t)&&yw.delete(t),Sw=t=>!!v(t)&&mw.has(t),Aw=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:fw;return cw({},bw(i),t)};class kw{static registerInstance(t){kw.instances.set(t.id,t)}static unregisterInstance(t){kw.instances.delete(t.id)}static getInstance(t){return kw.instances.get(t)}static instanceExist(t){return kw.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return kw.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}kw.instances=new Map;class Cw{static registerTheme(t,e){_w(t,e)}static getTheme(t,e=!1){return bw(t)}static removeTheme(t){return xw(t)}static themeExist(t){return Sw(t)}static getDefaultTheme(){return Cw.themes.get(fw)}static setCurrentTheme(t){Cw.themeExist(t)&&(Cw._currentThemeName=t,kw.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return Cw.getTheme(Cw._currentThemeName,t)}static getCurrentThemeName(){return Cw._currentThemeName}}function ww(t){return v(t)?Cw.themeExist(t)?Cw.getTheme(t):{}:p(t)?t:{}}Cw.themes=mw,Cw._currentThemeName=fw;const Mw=["animationThreshold","colorScheme","name","padding"];function Tw(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];Mw.includes(n)?s[n]=r:f(r)?RC(r)?s[n]=OC(r,e):tw(r)?s[n]=QC(i,r):s[n]=Tw(r,e,i):s[n]=r})),s}function Bw(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=Bw(t[s],e)}return i}return y(t)?t.map((t=>Bw(t,e))):t}function Ew(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(v(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=Ew(t[s],e)}return i}return y(t)?t.map((t=>Ew(t,e))):t}function Pw(t,...e){return c(t)?t(...e):t}const Ow=(t,e,i,s)=>((t,e,i)=>WA(t,e,i,{fontFamily:ew.fontFamily,fontSize:ew.fontSize}))(e,i,s).measure(t),Rw="__VCHART",Iw=500,Dw=500,Lw=`${Rw}_MEASURE_CANVAS_ID`,Fw=`${Rw}_DEFAULT_DATA_INDEX`,zw=`${Rw}_DEFAULT_DATA_KEY`,Hw=`${Rw}_DEFAULT_DATA_SERIES_FIELD`,jw=`${Rw}_DEFAULT_SERIES_STYLE_NAME`,Nw=`${Rw}_STACK_KEY`,Vw=`${Rw}_STACK_START`,Ww=`${Rw}_STACK_END`,Uw=`${Rw}_STACK_START_PERCENT`,Gw=`${Rw}_STACK_END_PERCENT`,Yw=`${Rw}_STACK_START_OffsetSilhouette`,Xw=`${Rw}_STACK_END_OffsetSilhouette`,Kw=`${Rw}_STACK_TOTAL`,$w=`${Rw}_STACK_TOTAL_PERCENT`,qw=`${Rw}_STACK_TOTAL_TOP`,Zw=`${Rw}_STACK_TOTAL_BOTTOM`,Jw=`${Rw}_MOSAIC_VALUE_START_PERCENT`,Qw=`${Rw}_MOSAIC_VALUE_END_PERCENT`,tM=`${Rw}_MOSAIC_CAT_START_PERCENT`,eM=`${Rw}_MOSAIC_CAT_END_PERCENT`,iM=`${Rw}_SEGMENT_START`,sM=`${Rw}_SEGMENT_END`,nM=`${Rw}_KEY`,rM=`${Rw}_MAP_LOOK_UP_KEY`;function aM(t,e){for(let i=0;it.key===e))}function lM(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function hM(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},gM(t,a,n[o],l,e,r))})),s?cM(n):n}function cM(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):cM(t[e].nodes);return t}function dM(t,e){if("values"in t&&t.values.length){const i=pk(t.values,e),s=uk(t.values,Gw);t.values.forEach((t=>{t[Kw]=i,t[$w]=s}))}else for(const i in t.nodes)dM(t.nodes[i],e)}function uM(t){if(!t.values.length)return;const e=t.values[t.values.length-1][Ww]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)pM(t.nodes[r],e,i,s,n)}function gM(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[Ww]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),gM(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const fM=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=vM(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function yM(t){return!c(t)&&!E(t)&&Object.keys(t).some((e=>c(t[e])))}function _M(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(c(t))return AM(t(r,i,s,n));if(yM(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{c(e[t])&&(e[t]=e[t](r,i,s,n))})),AM(e)}return AM(t)}function bM(t={}){const e=Object.assign({},t);if(c(t.style)||yM(t.style)?e.style=(e,i,s,n)=>_M(t.style,e,i,s,n):E(t.style)||(e.style=AM(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])||yM(t.state[e])?i[e]=(i,s,n,r)=>_M(t.state[e],i,s,n,r):E(t.state[e])||(i[e]=AM(t.state[e]))})),e.state=i}return e}function xM(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>AM(t[i](e,s,n,r)):E(t[i])||(e[i]=AM(t[i]))})),e}function SM(t,e){if(E(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),AM(i)}function AM(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ae(t.angle)}):t}const kM=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},CM=t=>"line"===t||"area"===t,wM=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return CM(i)?e:null==e?void 0:e[0]},MM=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let TM=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=hw.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(hw.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var BM;!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"}(BM||(BM={}));const EM=["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 PM,OM,RM;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleRawDomainUpdate="scaleRawDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(PM||(PM={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(OM||(OM={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(RM||(RM={}));const IM=[RM.mark,RM.model,RM.chart,RM.vchart];class DM{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(RM.vchart,[]),this._levelNodes.set(RM.chart,[]),this._levelNodes.set(RM.model,[]),this._levelNodes.set(RM.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const LM={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class FM{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=P(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>wM(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||OM.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||OM.chart);o.get(t)||o.set(t,new DM);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||OM.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||OM.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||OM.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||OM.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?IM.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[OM.chart,OM.window,OM.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&P(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return LM[a]&&(a=LM[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?RM.model:RM.vchart:RM.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=St(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=xt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=OM.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==RM.model&&s!==RM.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=RM.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case OM.chart:return this._viewBubbles;case OM.window:return this._windowBubbles;case OM.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case OM.chart:return this._viewListeners;case OM.window:return this._windowListeners;case OM.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return EM.includes(t)||Object.values(BM).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&hw.hasInteractionTrigger(e)}}function zM(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function HM(t,e,i){t.getParser(e)||t.registerParser(e,i)}const jM=new Map;let NM;function VM(){NM||(NM=new Pa,HM(NM,"geojson",Ca),HM(NM,"topojson",Ma),zM(NM,"simplify",Yr))}function WM(t,e,i={type:"geojson",centroid:!0}){jM.has(t)&&lA(`map type of '${t}' already exists, will be overwritten.`),VM();const s=new Oa(NM),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):p(r)&&s.transform({type:"simplify",options:r}),jM.set(t,s)}function UM(t){jM.has(t)?jM.delete(t):lA(`map type of '${t}' does not exists.`)}function GM(t,e=!1){let i=e;return t.latestData instanceof Oa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const YM=(t,e)=>0===t.length?[]:1===t.length?GM(t[0],null==e?void 0:e.deep):t.map((t=>GM(t,null==e?void 0:e.deep)));function XM(t,e,i){zM(e=e instanceof Pa?e:t.dataSet,"copyDataView",YM);const s=new Oa(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:qM.copyDataView}),s}function KM(t,e,i=[]){var s;if(t instanceof Oa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Oa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return lA(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return lA(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),lA("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function $M(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var qM,ZM,JM,QM;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(qM||(qM={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(ZM||(ZM={})),function(t){t.data="data",t.mark="mark"}(JM||(JM={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(QM||(QM={}));const tT=["line","area","trail"];function eT(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(nM,i?t.slice().sort(i):t.slice()),{keys:[nM],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const iT=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function sT(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{sT(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function rT(t,e,i,s){const n=eT(t,(t=>i(t))),r=eT(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const aT=`${Rw}_BuiltIn_CallBack_Disappear`;var oT;!function(t){t.render="render",t.disappear="disappear"}(oT||(oT={}));const lT=[0,0,0];class hT{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Ll),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},zl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Hl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this._clearMatrix=new Ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Su.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&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Nt;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=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Hl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Hl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(mu(lT,[e,i,s],this.modelMatrix),e=lT[0],i=lT[1],s=lT[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=ru(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:nu(this,a,this.dpr),r.strokeStyle=ru(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}hT.env="browser";class cT extends Tu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Na.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new hT(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}}function dT(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,kd,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Cd,e.env));r||i.bind(kd).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(Cd).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}cT.env="browser";const uT=dT(cT,hT);class pT extends hT{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}pT.env="feishu";class gT extends Tu{constructor(t){super(t)}init(){this._context=new pT(this,this._dpr)}release(...t){}}gT.env="feishu";const fT=dT(gT,pT);class mT extends hT{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=Na.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Na.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}mT.env="harmony";class vT extends Tu{constructor(t){super(t)}init(){this._context=new mT(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}vT.env="harmony";const yT=dT(vT,mT);class _T extends hT{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=Na.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Na.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}_T.env="lynx";class bT extends Tu{constructor(t){super(t)}init(){this._context=new _T(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}bT.env="lynx";const xT=dT(bT,_T);class ST extends hT{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}ST.env="node";class AT extends Tu{constructor(t){super(t)}init(){this._context=new ST(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}}AT.env="node";const kT=dT(AT,ST);class CT extends hT{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,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(ru(this,l,t,i,s)))}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:nu(this,l,this.dpr)),r.setStrokeStyle(ru(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}CT.env="taro";class wT extends Tu{constructor(t){super(t)}init(){this._context=new CT(this,this._dpr)}release(...t){}}wT.env="taro";const MT=dT(wT,CT);class TT extends pT{}TT.env="tt";class BT extends Tu{constructor(t){super(t)}init(){this._context=new TT(this,this._dpr)}release(...t){}}BT.env="tt";const ET=dT(BT,TT);class PT extends hT{draw(){}createPattern(t,e){return null}}PT.env="wx";class OT extends Tu{constructor(t){super(t)}init(){this._context=new PT(this,this._dpr)}release(...t){}}OT.env="wx";const RT=dT(OT,PT);function IT(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function DT(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}class LT extends J_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=cm.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:nu(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class _B extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let bB=!1;function xB(t){bB||(bB=!0,t.bind(qT).toDynamicValue((()=>new _B(IT(t,Hf)))).inSingletonScope(),t.bind(fB).toService(qT))}class SB extends l_{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class AB extends SB{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=ed,this.themeType="arc"}}let kB=!1;function CB(t){var e;kB||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,jf))&&(kB=!0,t.bind(ZT).toDynamicValue((()=>new AB(IT(t,jf)))).inSingletonScope(),t.bind(fB).toService(ZT))}class wB extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let MB=!1;function TB(t){MB||(MB=!0,t.bind(JT).toDynamicValue((()=>new wB(IT(t,Nf)))).inSingletonScope(),t.bind(fB).toService(JT))}class BB extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=sd}}let EB=!1;function PB(t){EB||(EB=!0,t.bind(QT).toDynamicValue((()=>new BB(IT(t,Vf)))).inSingletonScope(),t.bind(fB).toService(QT))}class OB{constructor(){this.type="glyph",this.numberType=nd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}class RB extends OB{constructor(t){super(),this.canvasRenderer=t}}let IB=!1;function DB(t){IB||(IB=!0,t.bind(uB).toDynamicValue((()=>new RB(IT(t,tm)))).inSingletonScope(),t.bind(fB).toService(uB))}class LB extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=ad}}let FB=!1;function zB(t){FB||(FB=!0,t.bind(tB).toDynamicValue((()=>new LB(IT(t,em)))).inSingletonScope(),t.bind(fB).toService(tB))}class HB extends l_{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class jB extends HB{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let NB=!1;function VB(t){NB||(NB=!0,t.bind(iB).toDynamicValue((()=>new jB(IT(t,Gf)))).inSingletonScope(),t.bind(fB).toService(iB))}const WB=new Ve;class UB{constructor(){this.type="rect",this.numberType=dd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||x(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:nu(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;WB.setValue(i.x1,i.y1,i.x2,i.y2),WB.expand(-r/2),h=!WB.containsPoint(e)}}return s.highPerformanceRestore(),h}}class GB extends UB{constructor(t){super(),this.canvasRenderer=t}}let YB=!1;class XB extends HB{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let KB=!1;function $B(t){KB||(KB=!0,t.bind(nB).toDynamicValue((()=>new XB(IT(t,Yf)))).inSingletonScope(),t.bind(fB).toService(nB))}class qB extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let ZB=!1;function JB(t){ZB||(ZB=!0,t.bind(hB).toDynamicValue((()=>new qB(IT(t,Xf)))).inSingletonScope(),t.bind(fB).toService(hB))}class QB extends SB{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=cd,this.themeType="polygon"}}let tE=!1;function eE(t){var e;tE||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Qf))&&(tE=!0,t.bind(cB).toDynamicValue((()=>new QB(IT(t,Qf)))).inSingletonScope(),t.bind(fB).toService(cB))}class iE extends UB{constructor(t){super(),this.canvasRenderer=t}}let sE=!1;function nE(t){sE||(sE=!0,t.bind(rB).toDynamicValue((()=>new iE(IT(t,Kf)))).inSingletonScope(),t.bind(fB).toService(rB))}class rE extends SB{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=ud,this.themeType="rect"}}let aE=!1;function oE(t){var e;aE||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,$f))&&(aE=!0,t.bind(aB).toDynamicValue((()=>new rE(IT(t,$f)))).inSingletonScope(),t.bind(fB).toService(aB))}class lE{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let hE=!1;function cE(t){hE||(hE=!0,t.bind(dB).toDynamicValue((()=>new lE(IT(t,Jf)))).inSingletonScope(),t.bind(fB).toService(dB))}class dE extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=gd}}let uE=!1;function pE(t){var e;uE||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,nm))&&(uE=!0,t.bind(gB).toDynamicValue((()=>new dE(IT(t,nm)))).inSingletonScope(),t.bind(fB).toService(gB))}class gE extends SB{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Au.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let fE=!1;function mE(t){fE||(fE=!0,t.bind(oB).toDynamicValue((()=>new gE(IT(t,qf)))).inSingletonScope(),t.bind(fB).toService(oB))}class vE extends SB{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=md}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Vp(a,u,n),v=Np(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&Au.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let yE=!1;function _E(t){yE||(yE=!0,t.bind(lB).toDynamicValue((()=>new vE(IT(t,Zf)))).inSingletonScope(),t.bind(fB).toService(lB))}const bE=Xc();Xc();class xE{constructor(){this.type="gif-image",this.numberType=bE}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let SE=!1;function AE(t){SE||(SE=!0,t.bind(eB).toDynamicValue((()=>new xE)).inSingletonScope(),t.bind(fB).toService(eB))}function kE(t){t.isBound(LT)||t.bind(LT).toDynamicValue((()=>new LT(DT(fB,t),IT(t,sm),DT(Lf,t),DT(Ff,t)))).inSingletonScope(),t.isBound(Rf)?t.rebind(Rf).toService(LT):t.bind(Rf).toService(LT)}function CE(t){(function(t){vB||(vB=!0,t.bind(pB).toDynamicValue((()=>new mB)).inSingletonScope(),t.bind(fB).toService(pB),pv(t.bind.bind(t),fB))})(t),xB(t),CB(t),TB(t),PB(t),DB(t),zB(t),VB(t),function(t){YB||(YB=!0,t.bind(sB).toDynamicValue((()=>new GB(IT(t,Kf)))).inSingletonScope(),t.bind(fB).toService(sB))}(t),$B(t),JB(t),eE(t),nE(t),oE(t),cE(t),pE(t),mE(t),_E(t),AE(t),kE(t)}class wE extends G_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${wE.idprefix}_${wE.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Na.global,this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:wE.GenerateCanvasId(),canvasControled:!0};this.canvas=new cT(s)}createWindowByCanvas(t){var e,i;let s;if("string"==typeof t.canvas){if(s=this.global.getElementById(t.canvas),s||"undefined"==typeof document||(s=document.getElementById(t.canvas)),!s)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else s=t.canvas;if(!s)throw new Error("发生错误,传入的canvas不正确");let n=t.width,r=t.height;if(null==n||null==r||!t.canvasControled){const t=s.getBoundingClientRect();n=t.width,r=t.height}let a=t.dpr;null==a&&(a=null!==(e=s.getContext("2d").pixelRatio)&&void 0!==e?e:s.width/n),this.canvas=new cT({width:n,height:r,dpr:a,nativeCanvas:s,canvasControled:null!==(i=t.canvasControled)&&void 0!==i&&i})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}}function ME(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,wE))||t.bind(wE).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,wE.env))||t.bind(am).toService(wE).whenTargetNamed(wE.env)}wE.env="browser",wE.idprefix="visactor_window",wE.prefix_count=0;var TE=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class BE{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function EE(t,e=!1){const i=document.createElement("img");if(Na.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class PE extends U_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new BE(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return EE(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return EE(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:Ha.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return TE(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function OE(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,PE))||(t.bind(PE).toSelf().inSingletonScope(),t.bind(ug).toService(PE))}function RE(t=qy(),e=!0){RE.__loaded||(RE.__loaded=!0,OE(t),uT(t),ME(t),e&&CE(t))}RE.__loaded=!1;class IE extends G_{get container(){return null}constructor(t=Na.global){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:Ha.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new gT(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new gT({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function DE(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,IE))||t.bind(IE).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,IE.env))||t.bind(am).toService(IE).whenTargetNamed(IE.env)}IE.env="feishu";class LE extends J_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new wu(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}}let FE=!1;class zE extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let HE=!1;function jE(t){HE||(HE=!0,t.bind(zT).toDynamicValue((()=>new zE(IT(t,Hf)))).inSingletonScope(),t.bind(FT).toService(zT))}class NE extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let VE=!1;function WE(t){VE||(VE=!0,t.bind(HT).toDynamicValue((()=>new NE(IT(t,Nf)))).inSingletonScope(),t.bind(FT).toService(HT))}class UE extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=sd}}let GE=!1;function YE(t){GE||(GE=!0,t.bind(jT).toDynamicValue((()=>new UE(IT(t,Vf)))).inSingletonScope(),t.bind(FT).toService(jT))}class XE extends OB{constructor(t){super(),this.canvasRenderer=t}}let KE=!1;function $E(t){KE||(KE=!0,t.bind(KT).toDynamicValue((()=>new XE(IT(t,tm)))).inSingletonScope(),t.bind(FT).toService(KT))}class qE{constructor(){this.type="image",this.numberType=ad}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let ZE=!1;function JE(t){ZE||(ZE=!0,t.bind(NT).toDynamicValue((()=>new qE)).inSingletonScope(),t.bind(FT).toService(NT))}class QE extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let tP=!1;function eP(t){tP||(tP=!0,t.bind(VT).toDynamicValue((()=>new QE(IT(t,Gf)))).inSingletonScope(),t.bind(FT).toService(VT))}class iP extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let sP=!1;function nP(t){sP||(sP=!0,t.bind(XT).toDynamicValue((()=>new iP(IT(t,Xf)))).inSingletonScope(),t.bind(FT).toService(XT))}class rP extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let aP=!1;function oP(t){aP||(aP=!0,t.bind(WT).toDynamicValue((()=>new rP(IT(t,Yf)))).inSingletonScope(),t.bind(FT).toService(WT))}class lP extends UB{constructor(t){super(),this.canvasRenderer=t}}let hP=!1;function cP(t){hP||(hP=!0,t.bind(UT).toDynamicValue((()=>new lP(IT(t,Kf)))).inSingletonScope(),t.bind(FT).toService(UT))}class dP{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let uP=!1;function pP(t){uP||(uP=!0,t.bind($T).toDynamicValue((()=>new dP(IT(t,Jf)))).inSingletonScope(),t.bind(FT).toService($T))}class gP extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}}let fP=!1;function mP(t){fP||(fP=!0,t.bind(GT).toDynamicValue((()=>new gP(IT(t,qf)))).inSingletonScope(),t.bind(FT).toService(GT))}class vP{constructor(){this.type="text",this.numberType=md}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let yP=!1;function _P(t){yP||(yP=!0,t.bind(YT).toDynamicValue((()=>new vP)).inSingletonScope(),t.bind(FT).toService(YT))}function bP(t){(function(t){FE||(FE=!0,pv(t.bind.bind(t),FT))})(t),function(t){t.isBound(LE)||t.bind(LE).toDynamicValue((()=>new LE(DT(FT,t),DT(Lf,t),DT(Ff,t)))).inSingletonScope(),t.isBound(Rf)?t.rebind(Rf).toService(LE):t.bind(Rf).toService(LE)}(t),jE(t),WE(t),YE(t),$E(t),JE(t),eP(t),nP(t),oP(t),cP(t),pP(t),mP(t),_P(t)}class xP{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class SP{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function AP(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function kP(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new xP(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function CP(t,e,i,s){const n=AP(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new SP(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function wP(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function MP(t,e=wP(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class TP extends U_{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},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 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=wP(i),n=null!==(e=t.dpr)&&void 0!==e?e:MP(i,s),r=CP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=kP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return MP(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function BP(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,TP))||(t.bind(TP).toSelf().inSingletonScope(),t.bind(ug).toService(TP))}function EP(t=qy(),e=!0){EP.__loaded||(EP.__loaded=!0,BP(t),fT(t),DE(t),e&&bP(t))}EP.__loaded=!1;function PP(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function OP(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Ha.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new vT(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new vT({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return PP(t,"target",s),PP(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=OP(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=OP(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&RP(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),RP(t,"x",_),RP(t,"y",b),RP(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),RP(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),RP(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),RP(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),RP(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),RP(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function DP(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,IP))||t.bind(IP).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,IP.env))||t.bind(am).toService(IP).whenTargetNamed(IP.env)}IP.env="harmony";const LP="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function FP(t){return"number"==typeof t&&Number.isFinite(t)}function zP(...t){for(let e=0;e({width:i,height:s})),new SP(t,l,n,i,s,e)}function WP(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=NP(e*s,i*s);if(t)return t}throw new Error(LP)}class UP extends U_{constructor(){super(),this.type="harmony",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,this.rafSTO=new xh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=HP(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=HP(s),r=null!==(i=t.dpr)&&void 0!==i?i:jP(s),a=function(t,e){if(!FP(t)||!FP(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=VP(WP(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=VP(WP(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return jP(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=zP(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=zP(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function GP(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,UP))||(t.bind(UP).toSelf().inSingletonScope(),t.bind(ug).toService(UP))}function YP(t=qy(),e=!0){YP.__loaded||(YP.__loaded=!0,GP(t),yT(t),DP(t),e&&bP(t))}YP.__loaded=!1;function XP(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function KP(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Ha.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new bT(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new bT({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return XP(t,"target",s),XP(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=KP(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=KP(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&$P(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),$P(t,"x",_),$P(t,"y",b),$P(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),$P(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),$P(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),$P(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),$P(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),$P(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function ZP(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,qP))||t.bind(qP).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,qP.env))||t.bind(am).toService(qP).whenTargetNamed(qP.env)}qP.env="lynx";function JP(t){return"number"==typeof t&&Number.isFinite(t)}function QP(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=eO(r),o=null!==(i=t.dpr)&&void 0!==i?i:iO(r,a),l=nO(t.width,t.height),h=rO(aO(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=eO(a),l=null!==(n=t.dpr)&&void 0!==n?n:iO(a,o),h=nO(t.width,t.height),c=Math.random().toString(),d=rO(aO(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return iO(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=QP(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=QP(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function lO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,oO))||(t.bind(oO).toSelf().inSingletonScope(),t.bind(ug).toService(oO))}function hO(t=qy(),e=!0){hO.__loaded||(hO.__loaded=!0,lO(t),xT(t),ZP(t),e&&bP(t))}hO.__loaded=!1;class cO extends G_{get container(){return null}constructor(t=Na.global){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:Ha.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new AT(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new AT({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function dO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,cO))||t.bind(cO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,cO.env))||t.bind(am).toService(cO).whenTargetNamed(cO.env)}cO.env="node";class uO extends U_{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function pO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,uO))||(t.bind(uO).toSelf().inSingletonScope(),t.bind(ug).toService(uO))}function gO(t=qy(),e=!0){gO.__loaded||(gO.__loaded=!0,pO(t),kT(t),dO(t))}gO.__loaded=!1;class fO extends G_{get container(){return null}constructor(t=Na.global){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:Ha.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new wT(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new wT({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.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){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function mO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,fO))||t.bind(fO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,fO.env))||t.bind(am).toService(fO).whenTargetNamed(fO.env)}fO.env="taro";class vO extends U_{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},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 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=CP(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=AP(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=kP(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}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(...t){}}function yO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,vO))||(t.bind(vO).toSelf().inSingletonScope(),t.bind(ug).toService(vO))}function _O(t=qy(),e=!0){_O.__loaded||(_O.__loaded=!0,yO(t),MT(t),mO(t),e&&bP(t))}_O.__loaded=!1;class bO extends G_{get container(){return null}constructor(t=Na.global){super(),this.global=t,this.type="tt",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:Ha.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new BT(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new BT({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function xO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,bO))||t.bind(bO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,bO.env))||t.bind(am).toService(bO).whenTargetNamed(bO.env)}bO.env="tt";function SO(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function AO(t,e=SO(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class kO extends U_{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=SO(i),n=null!==(e=t.dpr)&&void 0!==e?e:AO(i,s),r=CP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=kP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return AO(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function CO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,kO))||(t.bind(kO).toSelf().inSingletonScope(),t.bind(ug).toService(kO))}function wO(t=qy(),e=!0){wO.__loaded||(wO.__loaded=!0,CO(t),ET(t),xO(t),e&&bP(t))}wO.__loaded=!1;class MO{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={}}}function TO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class BO extends G_{get container(){return null}constructor(t=Na.global){super(),this.global=t,this.type="wx",this.eventManager=new MO}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:Ha.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new OT(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new OT({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,s,n,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return TO(t,"target",o),TO(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s: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!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function EO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,BO))||t.bind(BO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,BO.env))||t.bind(am).toService(BO).whenTargetNamed(BO.env)}BO.env="wx";function PO(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function OO(t,e=PO(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class RO extends U_{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=PO(i),n=null!==(e=t.dpr)&&void 0!==e?e:OO(i,s),r=CP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=kP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return OO(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function IO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,RO))||(t.bind(RO).toSelf().inSingletonScope(),t.bind(ug).toService(RO))}function DO(t=qy(),e=!0){DO.__loaded||(DO.__loaded=!0,IO(t),RT(t),EO(t),e&&bP(t))}DO.__loaded=!1;var LO={},FO={},zO={};Object.defineProperty(zO,"__esModule",{value:!0}),zO.loop=zO.conditional=zO.parse=void 0;zO.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};zO.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};zO.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var HO={};Object.defineProperty(HO,"__esModule",{value:!0}),HO.readBits=HO.readArray=HO.readUnsigned=HO.readString=HO.peekBytes=HO.readBytes=HO.peekByte=HO.readByte=HO.buildStream=void 0;HO.buildStream=function(t){return{data:t,pos:0}};var jO=function(){return function(t){return t.data[t.pos++]}};HO.readByte=jO;HO.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var NO=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};HO.readBytes=NO;HO.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};HO.readString=function(t){return function(e){return Array.from(NO(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};HO.readUnsigned=function(t){return function(e){var i=NO(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};HO.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=NO(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=ZO(t),i=GO(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=ZO(this.attribute.gifImage),e=GO(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=Na.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=Na.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function tR(t){return new QO(t)}class eR extends V_{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=bE,this._renderContribitions=void 0,this.builtinContributions=[iR],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=Dp(t).image;this._draw(t,n,!1,i)}}const iR=new class extends ey{constructor(){super(...arguments),this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let sR=!1;function nR(t){sR||(sR=!0,t.bind(eR).toDynamicValue((()=>new eR(DT(Dy,t)))).inSingletonScope(),t.bind(Wf).toService(eR))}function rR(){uf.RegisterGraphicCreator("gif",tR)}function aR(){if(aR.__loaded)return;aR.__loaded=!0;const t=qy();rR(),nR(t),AE(t)}aR.__loaded=!1;const oR=aR,lR=[{register:ES,bindModule:Px},{register:PS,bindModule:CS},{register:OS,bindModule:jx},{register:RS,bindModule:Yx},{register:IS,bindModule:hS},{register:DS},{register:LS,bindModule:mS},{register:FS,bindModule:Fx},{register:zS,bindModule:Jx},{register:HS,bindModule:eS},{register:NS,bindModule:BS},{register:VS,bindModule:Ix},{register:WS,bindModule:xS},{register:US,bindModule:pS},{register:XS},{register:jS,bindModule:rS},{register:GS,bindModule:Wx},{register:YS,bindModule:$x},{register:KS},{register:rR}];let hR=!1;const cR=[xB,CB,TB,PB,DB,zB,VB,$B,JB,eE,nE,oE,cE,pE,mE,_E,AE];function dR(t){return{getContributions:t}}function uR(t,{envParams:e,force:i=!1}={}){yb().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function pR(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){_b(t);const a=mb();i(a),s(a),n(a),vb(),uR(e,{envParams:r,force:!0})}function gR(t,e){pR(t,"browser",{bindEnv:OE,bindCanvasModules:uT,bindWindowContribution:ME},e)}function fR(t,e){pR(t,"node",{bindEnv:pO,bindCanvasModules:kT,bindWindowContribution:dO},e)}function mR(t){_b(t),function(){if(hR)return;const t=mb();hR=!0,lR.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),nR(t),vb()}(),xb(t),bb(t)}function vR(t){_b(t);const e=mb();cR.forEach((t=>t(e))),kE(e),Sb(t,fB),function(t){const e=mb(),i=dR((()=>t.registry.picker.getAll())),s=dR((()=>e.isBound(Lf)?e.getAll(Lf):[])),n=dR((()=>e.isBound(Ff)?e.getAll(Ff):[])),r=yb();Na.pickerServiceFactory=()=>new LT(i,{},s,n),Na.global=r}(t)}function yR(t){_b(t);bP(mb()),Sb(t,FT),function(t){const e=mb(),i=dR((()=>t.registry.picker.getAll())),s=dR((()=>e.isBound(Lf)?e.getAll(Lf):[])),n=dR((()=>e.isBound(Ff)?e.getAll(Ff):[]));Na.pickerServiceFactory=()=>new LE(i,s,n)}(t)}const _R=ev();function bR(){if(bR.__loaded)return;bR.__loaded=!0;const t=qy();ES(),Px({bind:t.bind}),_R?xB(t):jE(t)}bR.__loaded=!1;const xR=bR;function SR(){if(SR.__loaded)return;SR.__loaded=!0;const t=qy();PS(),X_(),$_(),CS({bind:t.bind}),CB(t)}SR.__loaded=!1;const AR=SR;function kR(){if(kR.__loaded)return;kR.__loaded=!0;const t=qy();OS(),jx({bind:t.bind}),_R?TB(t):WE(t)}kR.__loaded=!1;const CR=kR;function wR(){if(wR.__loaded)return;wR.__loaded=!0;const t=qy();RS(),Yx({bind:t.bind}),_R?PB(t):YE(t)}wR.__loaded=!1;const MR=wR;function TR(){if(TR.__loaded)return;TR.__loaded=!0;const t=qy();IS(),hS({bind:t.bind}),_R?DB(t):$E(t)}TR.__loaded=!1;const BR=TR;function ER(){ER.__loaded||(ER.__loaded=!0,DS())}ER.__loaded=!1;const PR=ER;function OR(){if(OR.__loaded)return;OR.__loaded=!0;const t=qy();LS(),mS({bind:t.bind}),_R?zB(t):JE(t)}OR.__loaded=!1;const RR=OR;function IR(){if(IR.__loaded)return;IR.__loaded=!0;const t=qy();FS(),Fx({bind:t.bind}),_R?VB(t):eP(t)}IR.__loaded=!1;const DR=IR;function LR(){if(LR.__loaded)return;LR.__loaded=!0;const t=qy();zS(),Jx({bind:t.bind}),_R?$B(t):oP(t)}LR.__loaded=!1;const FR=LR;function zR(){if(zR.__loaded)return;zR.__loaded=!0;const t=qy();HS(),eS({bind:t.bind}),_R?JB(t):nP(t)}zR.__loaded=!1;const HR=zR;function jR(){if(jR.__loaded)return;jR.__loaded=!0;const t=qy();NS(),X_(),$_(),BS({bind:t.bind}),eE(t)}jR.__loaded=!1;const NR=jR;function VR(){if(VR.__loaded)return;VR.__loaded=!0;const t=qy();VS(),Ix({bind:t.bind}),_R?nE(t):cP(t)}VR.__loaded=!1;const WR=VR;function UR(){if(UR.__loaded)return;UR.__loaded=!0;const t=qy();WS(),xS({bind:t.bind}),oE(t)}UR.__loaded=!1;const GR=UR;function YR(){if(YR.__loaded)return;YR.__loaded=!0;const t=qy();US(),pS({bind:t.bind}),_R?cE(t):pP(t)}YR.__loaded=!1;const XR=YR;function KR(){KR.__loaded||(KR.__loaded=!0,XS())}KR.__loaded=!1;const $R=KR;function qR(){if(qR.__loaded)return;qR.__loaded=!0;const t=qy();jS(),rS({bind:t.bind}),pE(t)}qR.__loaded=!1;const ZR=qR;function JR(){if(JR.__loaded)return;JR.__loaded=!0;const t=qy();GS(),Wx({bind:t.bind}),_R?mE(t):mP(t)}JR.__loaded=!1;const QR=JR;function tI(){if(tI.__loaded)return;tI.__loaded=!0;const t=qy();YS(),$x({bind:t.bind}),_R?_E(t):_P(t)}tI.__loaded=!1;const eI=tI;function iI(){iI.__loaded||(iI.__loaded=!0,KS())}iI.__loaded=!1;const sI=iI;function nI(t){if(!t||!c(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}class rI{static registerBuiltInAnimate(t,e){rI.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._activeConfigList=null,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:rI.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=nI(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:rI.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=nI(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=A(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:w,customType:M,controlOptions:T}=t,B=e.animate();B.priority=k;const E=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],O=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&O&&(i=null!==(h=P[O])&&void 0!==h?h:i),B.startAt(b);const R=i*x+E;R>0&&B.wait(R);let I=null,D=t.to,L=t.from;const F=this.shouldCommitAttrOutChannel(p);D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.props),L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,w,M,L,D,_,m,f,T,C,p,e);let z=0;x&&(z=x*(s-i-1));const H=c(y)?y(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&B.wait(z),S&&S>0&&B.loop(S),A&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,y,_,b;if(e&&i){i=nI(e);let d=this.resolveValue(o,u);"function"==typeof d&&(d=d(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),d=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},d);const x=c(h)?h.call(null,null!==(y=d&&(null===(v=d.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,d):h;d.options=x,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:rI.builtInAnimateMap[r],m=t.custom?t.customType:nI(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Rl.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}rI.builtInAnimateMap={};class aI{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-aI.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*aI.bounceIn(2*t):.5*aI.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Nt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Nt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Nt/e)*.5+1}}static registerFunc(t,e){aI[t]=e}}function oI(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}aI.quadIn=aI.getPowIn(2),aI.quadOut=aI.getPowOut(2),aI.quadInOut=aI.getPowInOut(2),aI.cubicIn=aI.getPowIn(3),aI.cubicOut=aI.getPowOut(3),aI.cubicInOut=aI.getPowInOut(3),aI.quartIn=aI.getPowIn(4),aI.quartOut=aI.getPowOut(4),aI.quartInOut=aI.getPowInOut(4),aI.quintIn=aI.getPowIn(5),aI.quintOut=aI.getPowOut(5),aI.quintInOut=aI.getPowInOut(5),aI.backIn=aI.getBackIn(1.7),aI.backOut=aI.getBackOut(1.7),aI.backInOut=aI.getBackInOut(1.7),aI.elasticIn=aI.getElasticIn(1,.3),aI.elasticOut=aI.getElasticOut(1,.3),aI.elasticInOut=aI.getElasticInOut(1,.3*1.5),aI.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),aI.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},aI.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)aI[`flicker${t}`]=e=>oI(e,t);for(let t=2;t<10;t++)aI[`aIn${t}`]=e=>t*e*e+(1-t)*e;function lI(t,e,i){return t+(e-t)*i}const hI=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=lI(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=lI(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=lI(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=lI(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=lI(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=lI(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=lI(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=lI(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=lI(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Ou(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?zu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Ou(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?zu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=lI(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=lI(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=lI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=lI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=lI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=lI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=lI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=lI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=lI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=lI(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=lI(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=lI(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=lI(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=lI(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=lI(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=lI(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=_h(e,i,s),r.addUpdateBoundTag()}}};function cI(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:So.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=aI[s])&&void 0!==n?n:aI.linear:aI.linear,"wait"===t&&(this.onUpdate=bI),this.id=Ha.GenAutoIncrementId(),this.syncAttributeUpdate=bI}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=Eu.Get(i,Bu.Color255),r=Eu.Get(s,Bu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(hI["fill"===e?"fillPure":"strokePure"])}else hI[e]?t.push(hI[e]):t.push(cI)}else hI[e]?t.push(hI[e]):t.push(cI)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class AI extends SI{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();yI(this.target,t,So.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class kI extends SI{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class CI extends kI{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class wI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Rl.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class MI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&_I(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class TI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,yI(this.target,i,So.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class BI extends MI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class EI extends TI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class PI extends MI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class OI extends TI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}class RI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){yI(this.target,this.from,So.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const II=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class DI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){mI(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){mI(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class LI extends DI{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=II(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&_I(this.target,r),this.determineUpdateFunction()}}class FI extends DI{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class zI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&_I(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class HI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const jI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class NI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=jI(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&_I(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){vI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class VI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){vI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const WI=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class UI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(mI(this.target,{points:r.map(((t,i)=>yh(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class GI extends UI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:WI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&_I(this.target,e)}else this.valid=!1}}class YI extends UI{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:WI(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const XI=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class KI extends UI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:XI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&_I(this.target,e)}else this.valid=!1}}class $I extends UI{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:XI(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const qI=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class ZI extends UI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:qI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&_I(this.target,e)}else this.valid=!1}}class JI extends UI{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:qI(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const QI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class tD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class eD extends tD{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=QI(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&_I(this.target,r)}}class iD extends tD{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const sD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class nD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=sD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&_I(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){vI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){vI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class oD extends aD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&A(m.x)?m.x:g,b=u.includes("y")?y:m&&A(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&_I(this.target,e)}}class lD extends aD{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,y=v&&A(v.x)?v.x:f,_=v&&A(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class hD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,yI(this.target,{text:n})}}class cD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class dD extends cD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=pt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&_I(this.target,e)}}class uD extends cD{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=pt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class pD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),w=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,T=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,B=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,E=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(T){case"x":A={scaleX:null!==(g=null!=B?B:w.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=E?E:w.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=B?B:w.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=E?E:w.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&_I(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),mI(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class gD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class fD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function mD(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;tvD[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&mD(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(mI(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class bD{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new rI(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function xD(t){return new bD(t)}class SD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;yI(this.target,{text:o})}}class AD extends CI{onBind(){super.onBind();const t=xD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(_I(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),_I(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),_I(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),_I(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;_I(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:SD});const i=s._titleBottom.attribute.text;_I(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:SD})}else _I(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),_I(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;_I(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());_I(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class kD extends CI{onBind(){super.onBind();const t=xD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class CD extends CI{onBind(){super.onBind();const t=xD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if(_I(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:SD}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:SD}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class wD extends CI{onBind(){super.onBind();const t=xD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class MD extends wI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=t_.createCanvas({width:t.width,height:t.height,dpr:t_.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=t_.createCanvas({width:t.width,height:t.height,dpr:t_.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==MD.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class TD extends MD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class BD extends MD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==BD.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==BD.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class ED{static createTempCanvas(t,e,i){return t_.createCanvas({width:t,height:e,dpr:i||t_.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=ED.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(ED.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(ED.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(ED.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(ED.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(ED.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(ED.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(ED.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class RD extends BD{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class FD extends BD{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=ED.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class zD extends MD{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=t_.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=t_.createCanvas({width:i,height:s,dpr:t_.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class HD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?Fg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Fg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}yI(this.target,{textConfig:o})}}class jD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Fg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Fg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),yI(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),yI(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class ND extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Fg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Fg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),yI(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?Fg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Fg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),yI(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function GD(t,e){mI(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class YD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,_I(this.target,m)}onUpdate(t,e,i){GD(this.target,UD(this.propKeys,this.from,this.to,e))}}class XD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,_I(this.target,d)}onUpdate(t,e,i){GD(this.target,UD(this.propKeys,this.from,this.to,e))}}class KD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,_I(this.target,p)}onUpdate(t,e,i){GD(this.target,UD(this.propKeys,this.from,this.to,e))}}class $D extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,_I(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),yI(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class qD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,_I(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),yI(this.target,n)}}class ZD extends kI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new rI(this.target);a.execute({type:"custom",custom:YD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:XD,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class JD extends kI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new rI(this.target);a.execute({type:"custom",custom:YD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:KD,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class QD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){GD(this.target,UD(this.propKeys,this.from,this.to,e))}}class tL extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){GD(this.target,UD(this.propKeys,this.from,this.to,e))}}class eL extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){GD(this.target,UD(this.propKeys,this.from,this.to,e))}}class iL extends kI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new rI(this.target);n.execute({type:"custom",custom:tL,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:QD,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class sL extends kI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new rI(this.target);n.execute({type:"custom",custom:eL,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:QD,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class nL extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),mI(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Ou(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Ou(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class rL extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Na.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new wl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Na.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:So.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:So.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=jo(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=jo(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}aL.getInstance();const oL="appear",lL="disappear",hL="update",cL="highlight",dL="unhighlight";class uL{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class pL{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new rI(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new rI(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([oL],[{name:oL,animation:t}],e)}applyDisappearState(t,e){this.applyState([lL],[{name:lL,animation:t}],e)}applyUpdateState(t,e){this.applyState([hL],[{name:hL,animation:t}],e)}applyHighlightState(t,e){this.applyState([cL],[{name:cL,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([dL],[{name:dL,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class gL{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new pL(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new uL(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class fL extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Ha.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Rl.END?this.removeAnimate(t,!0):t.status!==Rl.RUNNING&&t.status!==Rl.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const mL=new fL;function vL(t,e){for(let i=0;i{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new SI(Ol.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new AI(Ol.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new RI(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Rl.RUNNING&&(this.status=Rl.PAUSED)}resume(){this.status===Rl.PAUSED&&(this.status=Rl.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Rl.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Rl.END,this.target.restoreStaticAttribute(),void(this.__skipRestoreStaticAttributeOnRemove=!0);this.status=Rl.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&yI(this.target,this._startProps,So.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const bL=new Wa;class xL{constructor(){this.released=!1}tick(t,e){bL.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class SL extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Pl.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Pl.INITIAL,Na.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Na.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new xL;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Pl.INITIAL&&(this.status=Pl.PAUSE,!0)}resume(){return this.status!==Pl.INITIAL&&(this.status=Pl.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Pl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Pl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Pl.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Pl.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Pl.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Pl.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Na.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function kL(){U(wp,gL),U(wp,AL)}const CL=Symbol.for("vrender.bootstrap.state"),wL=new WeakMap;function ML(t,e){var i;const s=null!==(i=t[CL])&&void 0!==i?i:new Set;return t[CL]=s,!s.has(e)&&(s.add(e),!0)}function TL(t,e){var i,s,n,r;const a=null!==(i=null==t?void 0:t.type)&&void 0!==i?i:"unknown",o=null!==(s=null==t?void 0:t.numberType)&&void 0!==s?s:"unknown",l=null!==(r=null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)&&void 0!==r?r:"anonymous";return`${e}:${String(o)}:${String(a)}:${l}`}function BL(t,e){let i=wL.get(t);i||(i=new Map,wL.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function EL(t,e,i){const s=BL(t,e);i&&s.forEach((t=>i(t))),s.clear()}function PL(t){var e,i;const s=null!==(e=qy().getAll(Wf))&&void 0!==e?e:[],n=BL(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;EL(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=TL(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function OL(t,e){var i,s;const n=null!==(i=qy().getAll(e))&&void 0!==i?i:[],r=BL(t.registry.picker,"vrender:legacy-picker"),a=new Set;EL(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=TL(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const RL=gR,IL=fR,DL={taro:{installEnv:function(t,e){pR(t,"taro",{bindEnv:yO,bindCanvasModules:MT,bindWindowContribution:mO},e)},loadEnv:_O},feishu:{installEnv:function(t,e){pR(t,"feishu",{bindEnv:BP,bindCanvasModules:fT,bindWindowContribution:DE},e)},loadEnv:EP},tt:{installEnv:function(t,e){pR(t,"tt",{bindEnv:CO,bindCanvasModules:ET,bindWindowContribution:xO},e)},loadEnv:wO},wx:{installEnv:function(t,e){pR(t,"wx",{bindEnv:IO,bindCanvasModules:RT,bindWindowContribution:EO},e)},loadEnv:DO},lynx:{installEnv:function(t,e){pR(t,"lynx",{bindEnv:lO,bindCanvasModules:xT,bindWindowContribution:ZP},e)},loadEnv:hO},harmony:{installEnv:function(t,e){pR(t,"harmony",{bindEnv:GP,bindCanvasModules:yT,bindWindowContribution:DP},e)},loadEnv:YP}},LL=[sA,tA,qS,JS,X_,$_],FL=[()=>{rI.registerBuiltInAnimate("increaseCount",hD),rI.registerBuiltInAnimate("fromTo",RI),rI.registerBuiltInAnimate("scaleIn",pD),rI.registerBuiltInAnimate("scaleOut",gD),rI.registerBuiltInAnimate("growHeightIn",NI),rI.registerBuiltInAnimate("growHeightOut",VI),rI.registerBuiltInAnimate("growWidthIn",nD),rI.registerBuiltInAnimate("growWidthOut",rD),rI.registerBuiltInAnimate("growCenterIn",zI),rI.registerBuiltInAnimate("growCenterOut",HI),rI.registerBuiltInAnimate("clipIn",BI),rI.registerBuiltInAnimate("clipOut",EI),rI.registerBuiltInAnimate("fadeIn",PI),rI.registerBuiltInAnimate("fadeOut",OI),rI.registerBuiltInAnimate("growPointsIn",GI),rI.registerBuiltInAnimate("growPointsOut",YI),rI.registerBuiltInAnimate("growPointsXIn",KI),rI.registerBuiltInAnimate("growPointsXOut",$I),rI.registerBuiltInAnimate("growPointsYIn",ZI),rI.registerBuiltInAnimate("growPointsYOut",JI),rI.registerBuiltInAnimate("growAngleIn",LI),rI.registerBuiltInAnimate("growAngleOut",FI),rI.registerBuiltInAnimate("growRadiusIn",eD),rI.registerBuiltInAnimate("growRadiusOut",iD),rI.registerBuiltInAnimate("moveIn",oD),rI.registerBuiltInAnimate("moveOut",lD),rI.registerBuiltInAnimate("rotateIn",dD),rI.registerBuiltInAnimate("rotateOut",uD),rI.registerBuiltInAnimate("update",_D),rI.registerBuiltInAnimate("state",fD),rI.registerBuiltInAnimate("labelItemAppear",AD),rI.registerBuiltInAnimate("labelItemDisappear",kD),rI.registerBuiltInAnimate("poptipAppear",CD),rI.registerBuiltInAnimate("poptipDisappear",wD),rI.registerBuiltInAnimate("inputText",SD),rI.registerBuiltInAnimate("inputRichText",HD),rI.registerBuiltInAnimate("outputRichText",jD),rI.registerBuiltInAnimate("slideRichText",VD),rI.registerBuiltInAnimate("slideOutRichText",ND),rI.registerBuiltInAnimate("slideIn",YD),rI.registerBuiltInAnimate("growIn",XD),rI.registerBuiltInAnimate("spinIn",KD),rI.registerBuiltInAnimate("moveScaleIn",ZD),rI.registerBuiltInAnimate("moveRotateIn",JD),rI.registerBuiltInAnimate("strokeIn",$D),rI.registerBuiltInAnimate("slideOut",QD),rI.registerBuiltInAnimate("growOut",tL),rI.registerBuiltInAnimate("spinOut",eL),rI.registerBuiltInAnimate("moveScaleOut",iL),rI.registerBuiltInAnimate("moveRotateOut",sL),rI.registerBuiltInAnimate("strokeOut",qD),rI.registerBuiltInAnimate("pulse",nL),rI.registerBuiltInAnimate("MotionPath",WD),rI.registerBuiltInAnimate("streamLight",rL),rI.registerBuiltInAnimate("dissolve",OD),rI.registerBuiltInAnimate("grayscale",LD),rI.registerBuiltInAnimate("distortion",RD),rI.registerBuiltInAnimate("particle",FD),rI.registerBuiltInAnimate("glitch",DD),rI.registerBuiltInAnimate("gaussianBlur",ID),rI.registerBuiltInAnimate("pixelation",zD)},kL],zL=[xR,AR,CR,MR,BR,oR,PR,RR,DR,FR,HR,NR,WR,GR,XR,$R,QR,eI,sI,ZR];function HL(){LL.forEach((t=>t())),FL.forEach((t=>t()))}function jL(t,e){if(!ML(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==t_?void 0:t_.env)?t_.envParams:void 0}(e);return void 0===i?fR(t):IL(t,i),mR(t),yR(t),gO(),zL.forEach((t=>t())),PL(t),OL(t,FT),HL(),t}function NL(t,e,i){if(!ML(t,e))return t;const s=DL[e];return s.installEnv(t,i),mR(t),function(t){yR(t)}(t),s.loadEnv(),zL.forEach((t=>t())),PL(t),OL(t,FT),HL(),t}var VL=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt())),PL(t),OL(t,fB),HL(),t):t}(eb(VL(t,["envParams"])),e)}var UL=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nJL(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=ZL(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&JL(t,i,s))}}}(t,s,r,o)}function tF(t){const{env:e}=t,i=Object.assign({},t);return delete i.env,delete i.key,"browser"===e?WL(i):"node"===e?function(t={}){const{envParams:e}=t,i=XL(t,["envParams"]);return jL(KL(i),e)}(i):"taro"===e?function(t={}){return YL("taro",t)}(i):"feishu"===e?function(t={}){return YL("feishu",t)}(i):"tt"===e?function(t={}){return YL("tt",t)}(i):"wx"===e?function(t={}){return YL("wx",t)}(i):"lynx"===e?function(t={}){return YL("lynx",t)}(i):function(t={}){return YL("harmony",t)}(i)}const eF=t=>{switch(t){case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony";case s.lynx:return"lynx";default:return"browser"}},iF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},sF=(t,e)=>{const i=eF(t),s=iF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},nF=(t,e)=>{const i=QL((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,tF,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}};class rF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(t,e){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(PM.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(PM.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(PM.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var t,e,i,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:g,background:f}=this._option,m=sF(o,l);t_.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(o),null!=m?m:{});const v=this._option.stage;if(this._isExternalStage=!!v,this._releaseVRenderAppRef=void 0,this._stage=v,!this._stage){const s=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=eF(i.mode),n=sF(i.mode,i.modeParams);return nF(s,n)})({app:this._option.app,mode:o,modeParams:l});this._releaseVRenderAppRef=s.releaseAppRef;try{this._stage=(y=s.app,_=Object.assign({background:f,width:this._width,height:this._height,container:null!==(t=this._container.dom)&&void 0!==t?t:null,canvas:null!==(e=this._container.canvas)&&void 0!==e?e:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:g},ReactDOM:this._option.ReactDOM,autoRefresh:u(r)?r:!u(a)},null!==(i=this._option.renderHooks)&&void 0!==i?i:{}),y.createStage(_))}catch(t){throw null===(n=this._releaseVRenderAppRef)||void 0===n||n.call(this),this._releaseVRenderAppRef=void 0,t}}var y,_;this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const b=ef({x:0,y:0,width:this._width,height:this._height});b.name="root",this._stage.defaultLayer.appendChild(b),this._rootGroup=b;const x=(u(h)?h:gA(o))&&!1!==c&&hw.getStageEventPlugin("gesture");x&&(this._gestureController=new x(this._stage,p(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=QM.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!y(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!pA(this._option.mode))return!1;return!1===(u(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:t_.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(t_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=t_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>sT(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>sT(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{sT(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===QM.before;(e||i)&&(oA(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=QM.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=QM.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),oA(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=nT(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=rT(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=rT(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=eT(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=eT(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:aT,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{sT(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===ZM.appear))?ZM.appear:e.every((t=>t===ZM.disappear))?ZM.disappear:ZM.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===OM.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=kM(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=kM(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:wM(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===OM.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===OM.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===OM.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===OM.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===OM.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{sT(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=nT(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return pA(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&Uc(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{sT(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=t_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){t_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function aF(t,i){var s;return e(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==i?void 0:i.onError)&&void 0!==s?s:hA)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const oF={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}},lF={poptip:z({},oF)};function hF(t){t.crosshair=G(t.crosshair||{}).map((e=>lw({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function cF(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=oi(l,i.width,i.height);a=t,o=e}else if(h&&pA(e.mode)){let t;t=v(h)?t_.getElementById(h):h;const{width:e,height:s}=oi(t,i.width,i.height);a=e,o=s}else if(fA(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}const dF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function uF(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function pF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function gF(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;dF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function fF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}const mF=9,vF=0,yF=-1;var _F,bF,xF,SF,AF,kF;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(_F||(_F={})),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"}(bF||(bF={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(xF||(xF={}));class CF{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},CF.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=G(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}CF.defaultMarkInfo={};class wF{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class MF{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>lw({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class TF extends wF{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=MF,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new CF,this._lastLayoutRect=null,this.id=vA(),this.userId=t.id,this._spec=t,this.effect={},this.event=new TM(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${Rw}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=hw.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!d(e))return P(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class BF{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=bF.Region,this._willLayoutTag=!0,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=XC($C(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:YC(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:YC(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:YC(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:YC(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:YC(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:YC(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=YC(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=YC(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=YC(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(KC(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class EF extends TF{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new BF(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class PF extends MF{_initTheme(t,e){return{spec:t,theme:this._theme}}}class OF extends EF{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=PF,this.modelType="region",this.specKey="region",this.type=OF.type,this._series=[],this.layoutType="region",this.layoutZIndex=_F.Region,this.seriesDataFilterOver=()=>{this.event.emit(PM.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",_F.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",xF.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:_F.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:_F.Mark+1}))}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",xF.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",xF.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",xF.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",xF.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",xF.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||G(t.userId).includes(e.userId))&&(!u(t.specIndex)||G(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function RF(t){const e=[],i=[],s=[];return t.forEach((t=>{d(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function IF(t,e,i){e?t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function DF(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function LF(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=jF(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),DF(d,!0,p,l),s&&IF(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function FF(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=jF(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=jF(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),DF(d,!1,p,o),s&&IF(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function HF(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=jF(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=jF(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=RF(t);n.length&&LF(n,e,i,!1,"left",s),r.length&&LF(r,e,i,!0,"left",s),a.length&&FF(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=RF(t);n.length&&zF(n,e,i,!1,"top",s),r.length&&zF(r,e,i,!0,"top",s),a.length&&HF(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=RF(t);n.length&&LF(n,e,i,!1,"right",s),r.length&&LF(r,e,i,!0,"right",s),a.length&&FF(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=RF(t);n.length&&zF(n,e,i,!1,"bottom",s),r.length&&zF(r,e,i,!0,"bottom",s),a.length&&HF(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=jF(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=jF(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:hA)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}NF.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(SF||(SF={})),function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(AF||(AF={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(kF||(kF={}));const VF=["linear","radial","conical"],WF={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const UF={};Object.values(AF).forEach((t=>{UF[t]=!0})),AF.STATE_HOVER,AF.STATE_HOVER_REVERSE,AF.STATE_SELECTED,AF.STATE_SELECTED_REVERSE,AF.STATE_DIMENSION_HOVER,AF.STATE_DIMENSION_HOVER_REVERSE;class GF extends wF{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class YF extends GF{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];u(s.domain)&&(n.domain=s.domain),u(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,tT.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!UF[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Rw)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(Rw))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(wk(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class XF extends wF{constructor(){super(...arguments),this.id=vA(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=hw.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class KF extends XF{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const $F=1e3,qF="quadInOut",ZF=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],JF=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=Ou(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},QF=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Rb(t):[],n=Rb(e);i&&s&&(i.fromTransform&&Ib(s,i.fromTransform.clone().getInverse()),Ib(s,i.toTransfrom));const[r,a]=Ob(s,n);return t?Pb(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},ez=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],iz=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!ez.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Eu.Get(t,Bu.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class sz extends kI{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;QF(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&JF(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):yI(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const nz=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=tz(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=iz(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new sz({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:$F,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:qF);return c.play(d),c};class rz extends kI{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;QF(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&JF(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const az=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>ZF.includes(t))(i)||(e[i]=t[i])})),e},oz=(t,e,i)=>{const s=az(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=Na.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},lz=(t,e,i)=>{const s=[],n=i?null:az(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:az(t.attribute);if("rect"===t.type)Fb(t,e).forEach((t=>{s.push(Na.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)zb(t,e).forEach((t=>{s.push(Na.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)Hb(t,e).forEach((t=>{s.push(Na.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=Vb(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Na.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?Xb(t,e).forEach((t=>{s.push(Na.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?Nb(t,e).forEach((t=>{s.push(Na.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&Kb(t,e).forEach((t=>{"path"in t?s.push(Na.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Na.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&oz(t,s,e),s},cz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,dz=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=cz(l.delay,n,a,o),d=cz(l.duration,n,a,o),u=cz(l.oneByOne,n,a,o),p=cz(l.splitPath,n,a,o),g=A(u)&&u>0?t=>x(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?lz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:hz)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);nz(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?lz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:hz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>tz(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>iz(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:So.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new sz({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:$F,null!==(l=i.easing)&&void 0!==l?l:qF))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:So.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new rz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:$F,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:qF))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):nz(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},uz=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},pz=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},gz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},fz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];gz(t,a,s)},mz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));gz(t,r,i)},vz=Symbol("statesClearedBeforeReInit");class yz extends XF{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new KF(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=ef("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:_F.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new wl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===SF.enter||t.context.diffState===SF.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&gz(t,r,e)},this.name=t,this.model=e.model,this.key=e.key,this.state=new YF(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ae)}isUserLevel(t){return[xF.User_Mark,xF.User_Series,xF.User_Chart,xF.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&lw(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Mk(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=HC(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):VF.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Mk(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",xF.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,xF.User_Mark)}else this.setStyle(i,t,xF.User_Mark)}))}_computeGradientAttr(e){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=e,d=t(e,["gradient","scale","field"]);let p=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(p=t),g||(g=e)}const f=EC(BC(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},WF[o]),d);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==p?void 0:p.scale(t[g]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=ii.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)VF.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=EC(BC(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return eT(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return hw.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[zw],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=eT(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===ZM.appear))?ZM.appear:t.every((t=>t===ZM.disappear))?ZM.disappear:t[0];return null!=e?e:ZM.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{pz(t),s.push(...t.getGraphics())})),e.forEach((t=>{pz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);dz([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=uz(e,n),r=uz(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===ZM.exit?ZM.exit:i===ZM.update?ZM.update:ZM.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===SF.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===SF.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=SF.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=SF.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=SF.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=ZM.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=ZM.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return iT(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=iT(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||c(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!c(r)&&(!VF.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!Mk(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);d(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,MM(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===AF.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=hw.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=hw.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===QM.before||(this._product||this._initProduct(),oA(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[vz],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?fz(i,t,!0,a):mz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[vz]=e:delete s[vz]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===SF.exit&&!e.isExiting)if(e.context.animationState===SF.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===SF.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:SF.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=ef({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[vz]=t.currentStates.slice())}))}}var _z;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(_z||(_z={}));class bz extends yz{constructor(){super(...arguments),this.type=bz.type,this._marks=[],this._diffState=SF.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(lA("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?(lA("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return sT(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===SF.update){const t=this.hasAnimation(),e=MM(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=SF.update}render(){this._isCommited&&(oA(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}bz.type="group";const xz={measureText:Ow};class Sz{static instance(){return Sz.instance_||(Sz.instance_=new Sz),Sz.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class Az{constructor(){this.id=vA(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?lA("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class kz extends Az{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const Cz=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},wz=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class Mz extends o{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=to.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=to.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||Cz(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=wz(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=to.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=wz(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Cz(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=to.now()-i>this.config.press.time&&wz(s[0],t){Na.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Bz extends Tz{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},y=null!==(o=v.width)&&void 0!==o?o:0,_=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const C=Na.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:y/2,y:null!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:_/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(y+_)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let w,M;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},M={startAngle:x}):(w={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?w:M,"in"===b?M:w,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class Ez extends Tz{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",y=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",_=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Na.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===y?0:f,height:"in"===v&&"y"===y?0:m,fill:!0});let x={},S={};"y"===y?"negative"===_?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===_?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Pz extends kI{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),A(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ne(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;A(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&mD(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(mI(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=yh(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));yI(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const Oz={type:"fadeIn"};function Rz(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return Oz;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}class Iz extends wI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}afterStageRender(t,e){var i,s;return null===(s=null===(i=this.params)||void 0===i?void 0:i.callBack)||void 0===s?void 0:s.call(i,t,e,this.currentAnimationRatio,this.animationTime)}}const Dz={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},Lz={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},Fz={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},zz=()=>{hw.registerAnimation("scaleInOut",(()=>Lz))},Hz=()=>{hw.registerAnimation("fadeInOut",(()=>Fz))},jz=(t,e)=>({appear:Rz(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Pz,duration:Dz.update.duration,easing:Dz.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),Nz=()=>{hw.registerAnimation("line",jz)},Vz=()=>{rI.registerBuiltInAnimate("growPointsIn",GI),rI.registerBuiltInAnimate("growPointsOut",YI),rI.registerBuiltInAnimate("growPointsXIn",KI),rI.registerBuiltInAnimate("growPointsXOut",$I),rI.registerBuiltInAnimate("growPointsYIn",ZI),rI.registerBuiltInAnimate("growPointsYOut",JI),rI.registerBuiltInAnimate("clipIn",BI),rI.registerBuiltInAnimate("clipOut",EI)},Wz=()=>{kL(),rI.registerBuiltInAnimate("scaleIn",pD),rI.registerBuiltInAnimate("scaleOut",gD),rI.registerBuiltInAnimate("fadeIn",PI),rI.registerBuiltInAnimate("fadeOut",OI),rI.registerBuiltInAnimate("moveIn",oD),rI.registerBuiltInAnimate("moveOut",lD),rI.registerBuiltInAnimate("rotateIn",dD),rI.registerBuiltInAnimate("rotateOut",uD),rI.registerBuiltInAnimate("update",_D),rI.registerBuiltInAnimate("state",fD),rI.registerBuiltInAnimate("fromTo",RI),rI.registerBuiltInAnimate(aT,Iz)},Uz=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};AF.STATE_HIGHLIGHT,AF.STATE_BLUR;class Gz{constructor(t){this._markSet=new CF,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const Yz={highlightState:AF.STATE_HIGHLIGHT,blurState:AF.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class Xz extends Gz{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},Yz,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&mz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}Xz.type="element-highlight",Xz.defaultOptions=Yz;const Kz=()=>{hw.registerInteractionTrigger(Xz.type,Xz)},$z={state:AF.STATE_SELECTED,trigger:"click"};class qz extends Gz{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},$z,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),fz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&mz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}qz.type="element-select",qz.defaultOptions=$z;const Zz=()=>{hw.registerInteractionTrigger(qz.type,qz)};class Jz extends Az{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const Qz=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},tH=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...tH(t))})),s},eH=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(Qz(t,r),!1)};class iH{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>hw.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>hw.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>hw.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return hw.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>hw.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){hw.registerTransform(t,e)}static registerFunction(t,e){t&&e&&Sz.instance().registerFunction(t,e)}static unregisterFunction(t){t&&Sz.instance().unregisterFunction(t)}static getFunction(t){return t?Sz.instance().getFunction(t):null}static getFunctionList(){return Sz.instance().getFunctionNameList()}static registerMap(t,e,i){const s=hw.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=hw.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,jM.get(e);var e}static registerSVG(t,e,i){const s=hw.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=hw.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){kw.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=vA(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=oT.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=gF(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?hw.getSeriesBuiltInTheme(e):hw.getComponentBuiltInTheme(e);i=i?lw({},s,i[e]):s}s===t.length-1&&u(i)&&(i=Tw({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},Ak(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:y,stage:_,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=pA(y);if(S?RE(e_):"node"===y&&gO(e_),S&&f&&(this._container=v(f)?t_.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==y&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=Cw.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===e.type&&A.push("scrollbar");const k=new at(null!==(a=this._option.logLevel)&&void 0!==a?a:rt.Error);at.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new rF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new FM(this,this._compiler),this._event=new TM(this._eventDispatcher,y),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),kw.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=lw({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Bw(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;iH.getFunctionList()&&iH.getFunctionList().length&&(t=Ew(t,iH)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=hw.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=hw.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=hw.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(PM.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(PM.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=St(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return cF(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:Iw,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:Dw})}_initDataSet(t){this._dataSet=t instanceof Pa?t:new Pa,HM(this._dataSet,"dataview",Ta),HM(this._dataSet,"array",i),zM(this._dataSet,"copyDataView",YM);for(const t in hw.transforms)zM(this._dataSet,t,hw.transforms[t]);for(const t in hw.dataParser)HM(this._dataSet,t,hw.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),uF(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(PM.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?ZM.none:ZM.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,kw.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{Qz(t)})),this._exitingVRenderComponents.clear())}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return e(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Oa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=KM(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?lw({},t[n][e.index],i):i):t[n]=s?lw({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?lw({},t[n][r],i):i)}else t.id===e&&(t[n]=s?lw({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=lw({},t.getSpec(),e));const r=t.updateSpec(e),a=uF(r),o=pF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(PM.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=cw({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=ww(this._currentThemeName),this._currentTheme=o(a,l);else{const t=cw({},ww(p(r)&&r.type?r.type:p(n)&&n.type?n.type:this._currentThemeName),ww(n),ww(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(lF.poptip,oF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!pA(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return ww(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!Cw.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=u(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield aF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!pA(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,e):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(u(this._container))return this._container;let e;return e=v(this._canvas)?t_.getElementById(this._canvas):this._canvas,u(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?qC(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return lA("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?qC(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(lA("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return Sz.instance().getFunction(t)}registerFunction(t,e){t&&e&&Sz.instance().registerFunction(t,e)}unregisterFunction(t){t&&Sz.instance().unregisterFunction(t)}getFunctionList(){return Sz.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=hw.getChartPlugins();t.length>0&&(this._chartPlugin=new kz(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=hw.getVChartPlugins();e.length>0&&(this._vChartPlugin=new Jz(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=oT.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;this._renderState=oT.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent()}}iH.InstanceManager=kw,iH.ThemeManager=Cw,iH.globalConfig={uniqueTooltip:!0},iH.Utils=xz,iH.vglobal=t_;hw.registerRegion("region",OF),hw.registerLayout("base",NF),$R(),PR(),hw.registerMark(bz.type,bz),hw.registerStageEventPlugin("gesture",Mz),Kz(),Zz(),_w(sw.name,sw);const sH="monotone",nH="linear",rH="bevel";var aH;!function(t){t.vertical="vertical",t.horizontal="horizontal"}(aH||(aH={}));class oH{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}class lH extends SL{constructor(t){super(t),this.lastFrameTime=0,this.status=Pl.RUNNING}setupTickHandler(){const t=new oH;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Pl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Pl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Pl.RUNNING,!0}}function hH(t,e){return e("component",t)}function cH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=hw.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const dH=(t,e,i,s)=>{if(d(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},uH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,c(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],p=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(c(e.set))g=function(t){const i=p.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=p.get(`${e[a]}`);if(d(i))for(let i=0;i(g(t),t)))},pH="2.1.0",gH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},fH=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?P(e,t.field):t,s){const{formatFunc:i,args:r}=cH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},mH=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const vH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function yH(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=bH(fH(h,r,a,c),p,g),o.value=bH(fH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=fH(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function _H(t,e,i,s,n,r,a){if(c(e)){yH(t,e(n,a),i,s,r,a)}else e&&yH(t,e,i,s,r,a)}const bH=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=vi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class xH{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:u(n)?G(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(u(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of G(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(u(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{_H(a,t,e,i,s,n,r)})):c(t)?_H(a,t,e,i,s,n,r):t&&yH(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=c(e)?e(s,n):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:fH(r.visible,t,n),value:bH(fH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:fH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=fH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&vH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const SH={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},AH=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=aM([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return kH(a,n,o)},kH=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{yA(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{yA(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=SH[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},CH=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{yA(t[e])||(t[e]=0)}))})),t},wH=`${Rw}_HIERARCHY_DEPTH`,MH=`${Rw}_HIERARCHY_ROOT`,TH=`${Rw}_HIERARCHY_ROOT_INDEX`;function BH(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function EH(t,e,i){t&&(i.needDefaultSeriesField&&(t[Hw]=i.defaultSeriesField),t[Fw]=e,t[zw]=i.getKey(t,e,i))}function PH(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function OH(t,e,i,s=0,n,r){void 0===r&&(r=e),EH(t,e,i),t[wH]=s,t[MH]=n||t[i.categoryField],t[TH]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>OH(e,s,i,t[wH]+1,t[MH],r)))}const RH={label:{name:"label",type:"text"}},IH=`${Rw}_rect_x`,DH=`${Rw}_rect_x1`,LH=`${Rw}_rect_y`,FH=`${Rw}_rect_y1`,zH={data:!0},HH={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},jH=[...Object.keys(Dz),"normal"];function NH(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return YH(n)&&delete n.type,n.oneByOne&&(n=WH(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:UH,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=lw({},o[e],a);return YH(n)&&delete n.type,n.oneByOne&&(n=WH(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:UH,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function VH(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),XH(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function WH(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=c(n)?n(t,i,a):A(n)?n:0,h=c(r)?r(t,i,a):A(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):A(n)?n:0,d=c(a)?a(t,r,o):A(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function UH(t,e){var i;return null!==(i=null==t?void 0:t[Fw])&&void 0!==i?i:e.context.graphicIndex}function GH(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function YH(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function XH(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),XH(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),XH(t[s],e,i))}function KH(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class $H extends MF{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=wC(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=hw.getSeriesMarkMap(o)?function(t,e,i){const s=hw.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=lw({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return lw({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=lw({},i,s,t),n=i.label;return n&&p(n)&&y(e.label)&&(e.label=e.label.map((t=>lw({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const qH=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(HH[e]||(t[e]=!0),t)),{}),ZH={compileOnlyKeys:HH,dataRelatedKeys:qH,seriesOnlyKeys:{tooltip:!0}},JH={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},QH=t=>(t=>p(t)&&!y(t)&&!c(t))(t)?t:d(t)?{}:null,tj=(t,e,i)=>{const s=QH(t),n=QH(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function ej(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class ij extends TF{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){u(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${Rw}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=$H,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=_F.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(PM.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=KH(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(PM.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return d(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),u(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(zM(this._rawData.dataSet,"invalidTravel",CH),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=KM(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=XM(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=XM(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new KF(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=kH(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){zM(this._dataSet,"dimensionStatistics",AH);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Oa(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&aM(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){zM(this._dataSet,"dimensionStatistics",AH);const s=new Oa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=aM(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&aM(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Oa(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return d(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:v(t)?e=>e[t]:y(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(zM(this._rawData.dataSet,"addVChartProperty",gH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:BH.bind(this),call:EH}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(PM.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(PM.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(PM.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(PM.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=NH({},VH(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:gA(i)||fA(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=lw(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=lw(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=Uz(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=Uz(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:AF.STATE_HOVER_REVERSE,highlightState:AF.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:AF.STATE_SELECTED_REVERSE,state:AF.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=Uz(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:Hw;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:jw,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,jw,xF.User_SeriesStyle)}))}afterInitMark(){this.event.emit(PM.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",xF.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(hw.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new xH(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,ej(i))}_getSpecUpdatePolicy(){return ZH}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},zH),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(G(t.label),G(e.label),l),!l.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>tj(t[i],e[i],JH)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&tj(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?ej(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&ej(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Oa||$M(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();KH(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:Hw,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new FC).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return BC(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:Hw}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),d(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),d(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,u=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${u}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,lw({},p,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:zw}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${d(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==Ww&&t!==Gw&&t!==Vw&&t!==Uw||(t=this.getStackValueField()),null!==(e=lM(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>yA(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:Hw]}}function sj(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();wk(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function nj(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}ij.mark=RH,ij.transformerConstructor=$H;class rj extends ij{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);wk(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${Rw}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(Ww),this.setFieldX2(Vw)):(this.setFieldY(Ww),this.setFieldY2(Vw))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(Gw),this.setFieldX2(Uw)):(this.setFieldY(Gw),this.setFieldY2(Uw))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(Xw),this.setFieldX2(Yw)):(this.setFieldY(Xw),this.setFieldY2(Yw))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=G(this._spec.xField),this._specYField=G(this._spec.yField),u(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(G(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(G(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(PM.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(sj("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function aj(t){return"bottom"===t||"top"===t}function oj(t){return"left"===t||"right"===t}function lj(t){return"z"===t}function hj(t,e){return WC(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function cj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function dj(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?aj(t)?"linear":"band":aj(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const uj=(t,e,i)=>{var s;const n=null!==(s="band"===e?hH("axisBand",i):["linear","log","symlog"].includes(e)?hH("axisLinear",i):{})&&void 0!==s?s:{},r=aj(t)?hH("axisX",i):oj(t)?hH("axisY",i):hH("axisZ",i);return lw({},hH("axis",i),n,r)};class pj{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:hA)("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:hA)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>Tk(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return aj(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class gj extends pj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:OM.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const fj=(t,e)=>{var i,s;return t===e||!d(t)&&!d(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},mj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return A(s)?[-s,s]:s},vj=(t,e,i,s)=>{var n;const r=e.getScale(),a=Tk(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:yj(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,_j=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(G(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class bj extends pj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!fj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:OM.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:OM.canvas}),callback:this.onMouseOut}),gA(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:OM.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),gA(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var xj;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(xj||(xj={}));const Sj={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},Aj={sampling:!0,samplingFactor:!0};class kj{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(Sj.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",xF.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",xF.Series),this.event.on(PM.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:rH,curveType:nH,closePath:!0},"normal",xF.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===sH?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",xF.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",xF.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(Sj.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:GH(this._spec,Sj.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Oa(this._option.dataSet,{name:`${Rw}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(xj.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:xF.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:AF.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",xF.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",xF.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[Sj.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(xj.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,lw({},this._spec[Sj.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:AF.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",xF.Series),this.event.on(PM.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",xF.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",xF.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Cj=Object.assign(Object.assign({},RH),Sj),wj=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>wj(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},Mj=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class Tj extends yz{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return Mj}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(Mk(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?wj(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:SF.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[zw]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const Bj=new Uint32Array(33),Ej=new Uint32Array(33);Ej[0]=0,Bj[0]=~Ej[0];for(let t=1;t<=32;++t)Ej[t]=Ej[t-1]<<1|1,Bj[t]=~Ej[t];function Pj(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&Bj[31&o]&Ej[1+(31&l)])return!0}else{if(i[h]&Bj[31&o])return!0;if(i[c]&Ej[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,Bj[31&o]&Ej[1+(31&l)]);else for(s(h,Bj[31&o]),s(c,Ej[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,Ej[31&a]|Bj[1+(31&o)]);else for(n(l,Ej[31&a]),n(h,Bj[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function Oj(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=vt(i,-o,t.width+l),d=vt(s,-o,t.width+l),u=vt(n,-a,t.height+h),p=vt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function Rj(t,e,i=!1){return i?Oj(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function Ij(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=Rj(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=Oj(t,r)),e.getRange(r)))}function Dj(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>u(t))),p=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return Dj(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return Dj(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return Dj(t,e,n,s,h,d)}return!1}const Fj=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],zj=["top","inside-top","inside"];function Hj(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const jj={mode:"same-time",duration:300,easing:"linear"};function Nj(t){return 3===t||4===t}function Vj(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const Wj=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function Uj(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}class Gj extends CI{onBind(){const t=xD(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class Yj extends CI{onBind(){const t=xD(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const Xj=(t,e)=>Math.ceil(t)>Math.floor(e),Kj=([t,e],[i,s])=>s>t&&e>i;function $j(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const qj=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Zj extends tf{constructor(t,e){super(t),this._skipRenderAttributes=qj,(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){d(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{tN(t,e,i)})),e}function eN(t,e){e&&(null==t||t.onComplete.push(e))}function iN(t){t.forEach((t=>{t()}))}function sN(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var nN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(HA.hover,!0),bA(this,(t=>{t===e||E(t.states)||t.addState(HA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(bA(this,(t=>{E(t.states)||(t.removeState(HA.hoverReverse),t.removeState(HA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void bA(this,(t=>{E(t.states)||(t.removeState(HA.selectedReverse),t.removeState(HA.selected))}));E(e.states)||(e.addState(HA.selected,!0),bA(this,(t=>{t===e||E(t.states)||t.addState(HA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===So.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===So.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Se(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[Uj(g,f,c,d,a,o),Uj(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=DA.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new wl)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),iN(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,eN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(jj),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=tN(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=tN(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},sN(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(c(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}let a=this._initText(r);a=c(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(a);const o=[],l=a;if(!h(t)&&c(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}c(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return XA(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=c(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&Xj(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&Xj(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(pt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if($j([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!Kj([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(Rj(i,e,!0))}))),h.length>0&&h.forEach((t=>{v(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(Rj(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(Rj(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;Qj(i,null==n?void 0:n.attribute),Qj(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{aN[t]=e};var lN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};hN.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const cN=()=>{oN("line",hN),oN("area",hN)};var dN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}uN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const pN=()=>{oN("symbol",uN),oN("line-data",uN)};class gN extends Tj{constructor(){super(...arguments),this.type=gN.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)===kC.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}gN.type="line";const fN=()=>{hw.registerMark(gN.type,gN),$R(),DR(),cN(),pN(),Vz(),hw.registerGraphicComponent("line",ig)};class mN extends yz{constructor(){super(...arguments),this.type=mN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}mN.type="symbol";const vN=()=>{hw.registerMark(mN.type,mN),$R(),QR(),pN(),hw.registerGraphicComponent("symbol",Qp)};class yN extends $H{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function _N(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function bN(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function xN(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function SN(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function AN(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function kN(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const CN=t=>t.map(((t,e)=>({index:e,value:t}))),wN=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},MN=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ae(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=WA(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=se(t,e),a=Math.max(ee(i),ee(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return CN(v)};class EN{constructor(t){this.id=vA(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class PN extends EN{constructor(){super(PN.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!wk(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(PM.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&_N(c)&&_N(d)))return;const u=bN(t,c),p=bN(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=u,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!SN(u,p))return}else if(0===_&&0===b){if(!SN(p,u))return}else if(y||A)if(y&&!A){if(!xN(u,p))return}else if(A&&!y){if(!xN(p,u))return}else{if(f===b)return;if(f>b){if(!AN(u,p))return}else if(!AN(p,u))return}else{if(0===f&&0===_){if(!kN(u,p))return}else if(0===b&&0===g&&!kN(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){zM(e.getOption().dataSet,"tickAlign",BN);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}PN.pluginType="component",PN.type="AxisSyncPlugin";const ON={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function RN(t){let e=0;return P(t,"tick.visible")&&(e+=P(t,"tick.tickSize")),P(t,"label.visible")&&(e+=P(t,"label.space")),e}function IN(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function DN(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const LN=t=>"band"===t||"ordinal"===t||"point"===t;function FN(t,e){return{id:t,label:t,value:e,rawValue:t}}function zN(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class HN extends Az{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const jN=`${Rw}_ARC_TRANSFORM_VALUE`,NN=`${Rw}_ARC_RATIO`,VN=`${Rw}_ARC_START_ANGLE`,WN=`${Rw}_ARC_END_ANGLE`,UN=`${Rw}_ARC_K`,GN=`${Rw}_ARC_MIDDLE_ANGLE`,YN=`${Rw}_ARC_QUADRANT`,XN=`${Rw}_ARC_RADIAN`,KN=-Math.PI/2,$N=3*Math.PI/2,qN=.6,ZN=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return pe(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},JN=(t,e,i)=>{var s;const n=null!==(s="band"===e?hH("axisBand",i):"linear"===e?hH("axisLinear",i):{})&&void 0!==s?s:{},r=hH("angle"===t?"axisAngle":"axisRadius",i);return lw({},hH("axis",i),n,r)};function QN(t,e,i,s){switch(t){case n.cartesianBandAxis:return uj(hj(i,["z"]),"band",e);case n.cartesianLinearAxis:return uj(hj(i,["z"]),"linear",e);case n.cartesianLogAxis:return uj(hj(i,["z"]),"log",e);case n.cartesianSymlogAxis:return uj(hj(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return uj(hj(i),void 0,e);case n.polarBandAxis:return JN(i.orient,"band",e);case n.polarLinearAxis:return JN(i.orient,"linear",e);case n.polarAxis:return JN(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=hH(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>aj(t.orient)));let g;g=u(p)?lw({},LN(p.type)?a:o,l):l;const f=r.find((t=>oj(t.orient)));let m;return m=u(f)?lw({},Tk(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=hH(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?lw({},LN(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?lw({},Tk(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return tV(i,hH(t,e));default:return hH(t,e)}}const tV=(t,e)=>{var i;const s=lw({},e,e[cj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class eV extends MF{getTheme(t,e){return QN(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},$C(e)),{[s]:0}))}}class iV extends EF{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=eV,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Qa||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:OM.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new HN(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;Qz(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=tH(t),s=eH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}Qz(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var sV,nV;iV.transformerConstructor=eV,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(sV||(sV={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(nV||(nV={}));class rV extends yz{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=eH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?Qz(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(Qz(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=hw.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(BM.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}rV.type="component";const aV=()=>{hw.registerMark(rV.type,rV)};var oV,lV;!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.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(oV||(oV={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(lV||(lV={}));const hV={[lV.selectedReverse]:{},[lV.selected]:{},[lV.hover]:{},[lV.hoverReverse]:{}},cV=t=>t,dV={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class uV extends iV{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?sV.circleAxis:sV.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?nV.circleAxisGrid:nV.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:_F.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(this._syncComponentVisibility(),(null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=NH(null===(l=hw.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:P(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:P(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:P(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:P(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:P(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:P(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==_?_:P(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new KF(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&_k(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=y(a)?wk(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!wk(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return _k(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(s)&&(this._regionIndex=G(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(PM.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=bk(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),_k(this._regions,(t=>{t.event.on(PM.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(PM.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):_k(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(_k(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;tV(null==e?void 0:e[i],null==t?void 0:t[i])||dV[i]))}_getAxisAttributes(){const e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=bM(s=e.domainLine)).startSymbol=bM(s.startSymbol),s.endSymbol=bM(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=H(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return AM(lw({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:AM(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>AM(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=AM(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return AM(lw({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:AM(e.tick.style)),e.tick.state&&(i.tick.state=xM(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return AM(lw({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:AM(e.subTick.style)),e.subTick.state&&(i.subTick.state=xM(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=ON[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ae(p):null,textStyle:lw({},u,AM(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:AM(h.style)}),h.state&&(i.title.state.shape=xM(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:AM(o.style)}),o.state&&(i.title.state.background=xM(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=xM(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=AM(e.background.style)),e.background.state&&(i.panel.state=xM(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:Pw(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:c(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return AM(lw({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:AM(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:Pw(t.subGrid.alternateColor),style:AM(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=cH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){HM(this._option.dataSet,"scale",cV);const i=this.registerTicksTransform();return new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===oV.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}uV.specKey="axes";const pV=()=>{aV(),hw.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},gV=[PN];class fV extends uV{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=_F.Axis,this.layoutLevel=bF.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),_k(this._regions,(t=>{const e=this.getOrient();aj(e)?zN(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):oj(e)?zN(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):lj(e)&&zN(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=lw({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(lw({x:e.x,y:e.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=aj(this.getOrient()),n=t=>{var e;return(s?!aj(t.getOrient()):aj(t.getOrient()))&&wk(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&Y(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=hj(e,["z"]),lj(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!DN(e))return null;const{axisType:t,componentName:s}=dj(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>oj(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!DN(t))return;const{axisType:s,componentName:n}=dj(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=hw.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return aj(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):lj(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(gV.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){aj(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!aj(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!lj(this.getOrient())&&this._spec.innerOffset){const t=this._spec;oj(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=YC(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=YC(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=aj(this.getOrient())?t.fieldX:lj(this.getOrient())?t.fieldZ:t.fieldY,wk(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:wk(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(BM.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(aj(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=aj(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return _k(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:aj(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:lj(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();_k(this._regions,(e=>{aj(t)?zN(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):oj(t)?zN(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):lj(t)&&zN(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=aj(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=aj(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=lw(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ne).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=aj(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?vt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):vt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return FN(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:wk(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(PM.layoutEnd,this._updateAxisLayout),this.event.on(PM.layoutEnd,this._fixAxisOnZero),this.event.on(PM.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}fV.type=n.cartesianAxis,fV.specKey="axes";class mV{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new KF(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(PM.scaleDomainUpdate,{model:this}),this.event.emit(PM.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=G(e).concat(i);if(n.push(r),o){const e=FN(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>FN(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}this.event.emit(PM.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const vV=(t,e,i,s)=>{const n=TN(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},yV=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,_V=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?CN([s[s.length-1]]):CN([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(g),a=X(g);if(s.length<=f/n){const i=vV(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=xV(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=vV(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!yV(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?_V(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function AV(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=ok(t,!!n),o=ok(r,!!n);const h=re.distancePP(s,l),c=re.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=SV(e,t,!1,!!n),o=SV(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=ok(t,!!n),o=ok(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class kV extends Zj{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&sk(this._innerView),this.removeAllChild(!0),this._innerView=DA.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return nk(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${oV.grid}-sub`:`${oV.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=ok(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=SV(t,o,!1,!!a)}const u=DA.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:kV.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=ok(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=DA.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*zt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:kV.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!pt(a.value,0)&&!pt(l.value,0),d=!pt(a.value,1)&&!pt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}kV.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class CV{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=OA(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return PA([n[1],-1*n[0]],t*(e?1:-1)*s)}}class wV extends CI{onBind(){var t;const e=xD(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;Qj(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class MV extends CI{onBind(){const t=xD(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;Qj(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function TV(){PR(),DR(),XR(),eI(),rI.registerBuiltInAnimate("axisEnter",wV),rI.registerBuiltInAnimate("axisUpdate",MV)}PR(),FR();class BV extends kV{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},kV.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=LA,endAngle:r=FA}=this.attribute;i=ak(t,s,re.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function EV(){PR(),DR(),HR(),QR()}function PV(){PR(),DR(),xR(),QR()}U(BV,CV),EV();class OV extends Zj{getStartAngle(){return ue(this._startAngle)}getEndAngle(){return ue(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OV.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(Z(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=DA.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),E(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=DA.line;G(i)[0].cornerRadius&&(t=DA.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=DA.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:Z(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}OV.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}}},PV();class RV extends OV{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OV.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=DA.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),E(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function IV(){PR(),WR(),QR(),XR(),eI()}var DV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nc&&(w=c,R.setAttribute("maxLineWidth",c-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=w,A&&A.setAttribute("x",(A.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):j>0&&S.setAttribute("x",b[3]):(k-=w/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const N="right"===_||"end"===_,V="left"===_||"start"===_,W=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:G(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=w-b[1]-b[3],e=I+B,i=1===j?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),A){const t=i-I/2-B+F/2;A.setAttributes({x:t})}}if(V&&1!==j){const t=w-b[1]-b[3],e=0===j?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=w-b[1]-b[3],e=0===j?t/2+B/2:t;if(W(e,"right"),A){const t=e-I-B+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-D/2),S.setAttribute("y",-b[2])):"top"===H&&(S.setAttribute("y",b[0]),A&&A.setAttribute("y",D/2)),E(null==m?void 0:m.text)||(R.states=m.text);const{visible:U}=a,Y=DV(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:M,x:k,y:C}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new wl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},LV.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}LV.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const FV=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!E(s.states)?(s.addState(HA.hover,!0),bA(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(HA.hoverReverse,!0)})),s):i},zV=(t,e,i)=>i?(bA(e,(t=>{t.name&&!E(t.states)&&(t.removeState(HA.hoverReverse),t.removeState(HA.hover))})),null):i,HV=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(HA.selected)?(bA(e,(t=>{t.name&&!E(t.states)&&(t.removeState(HA.selectedReverse),t.removeState(HA.selected))})),null):s.name&&!E(s.states)?(s.addState(HA.selected,!0),bA(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(HA.selectedReverse,!0)})),s):i},jV={type:"default",duration:300,easing:"linear"};class NV extends Jj{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=FV(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=zV(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=HV(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=DA.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),iN(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,eN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(bA(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=tN(this),{delay:a=0,duration:o=jV.duration,easing:l=jV.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};Qj(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=tN(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},sN(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&sk(this._innerView),this.removeAllChild(!0),this._innerView=DA.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(jV)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=DA.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=oV.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=DA.group({x:0,y:0,pickable:!1});t.name=oV.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=DA.group({x:0,y:0,pickable:!1});i.name=oV.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=DA.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=oV.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=jA;else{const t=this.data[s],e=z({},jA,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=DA.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=oV.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=jA;else{const i=z({},jA,s.state);Object.keys(i).forEach((s=>{c(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=DA.group({x:0,y:0,pickable:!1});return r.name=`${oV.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=XA(this._getLabelAttribute(t,e,n,i));if(a.name=oV.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=jA;else{const s=z({},jA,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new LV(Object.assign({},e));i.name=oV.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return nk(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&c(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=zt/2*(l.x>e.x?1:-1):h=zt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+P(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+P(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=c(y)?z({},JA.label.style,y(t,e,i,s)):y;y=z(this.getLabelAlign(m,o,y.angle),y),c(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return c(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=d?d:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},bA(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=I(r.attribute),a=I(e.attribute),o=kb(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},Qj(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const VV={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&lk(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function WV(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function UV(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=c(n)?n:VV[n]||VV.parity;if(s.length>=3&&hk(s,r)){do{s=a(s,r)}while(s.length>=3&&hk(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);lk(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),UV(l,s,n,(t=>lk(t,l,r))),UV(h,s,o,(t=>lk(t,h,r)||!(!n||t===l)&&lk(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function YV(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},$V(t,e.attribute.angle)),{angle:KV(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({},qV(t,e.attribute.angle)),{angle:KV(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Ce({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function KV(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function $V(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=KV(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function qV(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=KV(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function ZV(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(E(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=ik(h),m=ek(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function JV(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var QV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=DA.group({zIndex:999});e.name=oV.axisBreak,e.id=this._getNodeId(`${oV.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},QA,s),a=null!==(e=r.size)&&void 0!==e?e:QA.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=DA.symbol(Object.assign({x:s.x,y:s.y},o));l.name=oV.axisBreakSymbol;const h=DA.symbol(Object.assign({x:n.x,y:n.y},o));h.name=oV.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=DA.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=oV.background,n.id=this._getNodeId("background"),n.states=z({},hV,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new LV(Object.assign({},t));e.name=oV.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=QV(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:z({},hV,l),symbol:z({},hV,l)});const d=new OV(c);d.name=oV.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=s,p=QV(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+P(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),k=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let w,M,{angle:T}=p;if(w="start"===n?"start":"end"===n?"end":"center",d(T)&&o){T=RA(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else w=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let B=u;if(d(B)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(T!==Math.PI/2){const t=Math.abs(Math.cos(null!=T?T:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=s-S;else if(T&&0!==T){const t=Math.abs(Math.sin(T));B=t<1e-6?1/0:this.attribute.end.y/t}else B=s-S}const E=Object.assign(Object.assign(Object.assign({},k),p),{maxWidth:B,textStyle:Object.assign({textAlign:w,textBaseline:M},a),state:{text:z({},hV,c.text),shape:z({},hV,c.shape),panel:z({},hV,c.background)}});return E.angle=T,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=s,p=QV(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(d(b)&&a){b=RA(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=u,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return $V(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return qV(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=Y(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(E(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=ae(e)})),XV(i,t),!YV(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!A(i))return;const a=t[0].attribute.angle,o=ik(a),l=ek(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=JV(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Yt(c,i))}}else{if(l){const i=JV(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Yt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);ZV(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&GV(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=DA.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=oV.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=UA(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ai(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}tW.defaultAttributes=JA,U(tW,CV);const eW={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},iW={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},sW={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},nW={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}};class rW extends fV{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new $k}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return zM(this._option.dataSet,t,bV),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=jk(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),p=e=>{const i=t===n?a:0;if(d(r)||t{hw.registerGraphicComponent(sV.lineAxis,((t,e)=>new tW(t,e))),hw.registerGraphicComponent(nV.lineAxisGrid,((t,e)=>new BV(t,e))),pV(),hw.registerComponent(rW.type,rW,!1)},oW=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function lW(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,cW=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function dW(t,e,i="count"){const s=cW(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const uW=Math.sqrt(50),pW=Math.sqrt(10),gW=Math.sqrt(2);class fW{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=IN(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=aj(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!c(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(Y(e)-e[0]);i<=1||A(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(hW),e.sort(hW),{domain:lW(t,e),scope:dW(t,e,i)}}(r,rA(t),this._spec.breaks[0].scopeType);e=rA(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=IN(this._spec);if(u(e)||u(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=uW?10:n>=pW?5:n>=gW?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(PM.scaleDomainUpdate,{model:this}),this.event.emit(PM.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const t=this.collectData(0,!0),e=this.computeLinearDomain(t);this._rawDomain=e,this.event.emit(PM.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function mW(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function vW(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!wk(t.type))return CN(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return CN([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(u(h))m=mW(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=mW(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=mW(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=TN(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=TN(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?_W.greedy:_W.parity;for(;l.length>=3&&hk(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;lk(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),vW(t,l,a,(e=>lk(e,t,i))),vW(n,l,o,(e=>lk(e,n,i)||!(!a||e===t)&&lk(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return CN(m)},_W={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&lk(i,t,e)||(i=t,0))))}},bW={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class xW extends fV{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new mC}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!lj(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=aj(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=UC(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=rA(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return zM(this._option.dataSet,t,yW),t}}xW.type=n.cartesianLinearAxis,xW.specKey="axes",xW.builtInTheme={axis:iW,axisLinear:bW,axisX:sW,axisY:nW},U(xW,fW);const SW=()=>{hw.registerGraphicComponent(sV.lineAxis,((t,e)=>new tW(t,e))),hw.registerGraphicComponent(nV.lineAxisGrid,((t,e)=>new BV(t,e))),pV(),hw.registerComponent(xW.type,xW)},AW=`${Rw}_hide_`;function kW(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const CW=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[AW]&&(kW(t,!0),t[AW]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[AW]=!0,kW(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},wW=()=>{hw.registerGrammarTransform("symbolOverlap",{transform:CW,runType:"afterEncode"})},MW={min:K,max:X,average:gk,sum:pk};function TW(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function BW(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function EW(t,e,i,s){return BW(t,e,i,"min",s)}function PW(t,e,i,s){return BW(t,e,i,"max",s)}function OW(t,e,i,s){return BW(t,e,i,"average",s)}function RW(t,e,i,s){return BW(t,e,i,"sum",s)}const IW=(t,e)=>{let i=c(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=TW;if("min"===n?l=EW:"max"===n?l=PW:"average"===n?l=OW:"sum"===n&&(l=RW),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},DW=()=>{hw.registerGrammarTransform("dataSampling",{transform:IW})};class LW extends rj{constructor(){super(...arguments),this.type=kC.line,this.transformerConstructor=yN,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Aj)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(NH(null===(i=hw.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),VH("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=nj(this);this._symbolMark.setAnimationConfig(NH(null===(s=hw.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),VH("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}LW.type=kC.line,LW.mark=Cj,LW.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},LW.transformerConstructor=yN,U(LW,kj);class FW{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{$M(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Oa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];lA(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];lA(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class zW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{_A(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{aM(e,[{key:t,operations:wk(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&aM(e,[{key:i.field,operations:wk(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?HC("colorOrdinal"):HC(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(_A(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),_A(s.domain)?e.reRender=!0:V(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!_A(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=wk(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=wk(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;wk(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(wk(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=wk(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!E(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));wk(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class HW{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");fz(t,s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");mz(t,s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");mz(t,s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");fz(t,s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&fz(t,i,!0,l):a&&fz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&fz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{mz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&mz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const jW={[n.markPoint]:!0,[n.markLine]:!0,[n.markArea]:!0},NW={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class VW extends wF{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=vA(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:Iw,height:Dw},this._viewRect={width:Iw,height:Dw},this._viewBox={x1:0,y1:0,x2:Iw,y2:Dw},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>G(t).some((t=>u(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(NW).some((t=>!d(e[t])))},this._paddingSpec=$C(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new TM(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new FW(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new HW;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=hw.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(NH({},VH("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=hw.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:_F.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=hw.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(PM.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(PM.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(PM.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof TF)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof yz))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof yz)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&$M(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=cF(this._spec,this._option,{width:Iw,height:Dw})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=BC(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new zW(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){gF(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=BC(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=$C(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{gF(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},r={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===n.label||l.type===n.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));r[l.type]&&(r[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(y(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);pF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),gF(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);pF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),gF(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(r).forEach((e=>{if(r[e]){const i=this._spec[e];(y(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(jW[t]&&y(e)&&y(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return jW[t]&&y(e)&&e.length>0&&y(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!jW[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;jW[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];gF(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=XC(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(PM.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(AF.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(AF.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(AF.STATE_SELECTED)}clearHovered(){this.clearState(AF.STATE_HOVER)}_initEvent(){[PM.dataZoomChange,PM.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(BM.AFTER_MARK_RENDER_END,e)};this._event.on(BM.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:wM;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(CM(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===xj.dimensionHover||s===xj.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>Tk(t.axis.getScale().type)&&d(t.index))),o=a||r.every((t=>Tk(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(n.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(n.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),r=[];s.forEach((e=>{const i=t(e);!1!==i&&r.push({axis:e,value:i})})),i.showCrosshair(r)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const WW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)},UW={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class GW{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},UW),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):rw(t,a,c.spec),rw(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=WW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=WW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(hw.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(hw.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=hw.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=hw.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=hw.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):dH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=dH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class YW extends GW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{d(i[t])&&(i[t]=n[t])})),P(i,"trimPadding")&&lw(i,fF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class XW extends YW{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),hF(t)}}const KW=(t,e)=>{const i={nodes:{}},{fields:s}=c(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=hM(t,!0);for(const e in o)for(const i in o[e].nodes)pM(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)uM(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&dM(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(PM.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class qW{_beforeInit(){this._dataSet&&zM(this._dataSet,"stackSplit",KW)}_initStack(){this._stack=new $W(this),this._stack.init()}}const ZW={state:AF.STATE_DIMENSION_HOVER,reverseState:AF.STATE_DIMENSION_HOVER_REVERSE,trigger:xj.dimensionHover};class JW extends Gz{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},ZW,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=wM(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}JW.type="dimension-hover",JW.defaultOptions=ZW;const QW=()=>{hw.registerInteractionTrigger(JW.type,JW)},tU=()=>{hw.registerComposedEvent(xj.dimensionHover,bj),hw.registerComposedEvent(xj.dimensionClick,gj)},eU=t=>t.fieldX[0],iU=t=>t.fieldY[0],sU=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},nU=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},rU=(t,e)=>t?e?eU:sU:e?iU:nU,aU=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=_j(t,(t=>aj(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=_j(t,(t=>oj(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Tk(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=oU(t,i,rU(e,Tk(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=oU(t,i,rU(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},oU=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:lU(t,s,i)},lU=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=vj(e,t,"cartesian",null!=i?i:aj(t.getOrient())?eU:iU);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},hU=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(Tk(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(wk(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=RN(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};dU(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&cU(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),cU=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=cH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},dU=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},uU=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=pU(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},pU=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},gU=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return hU(c,r,e),c.xField.cacheInfo?uU(c.xField):c.yField.cacheInfo?uU(c.yField):void 0},fU=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],mU=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&fU.forEach((e=>{u(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(vU(s).every((t=>{var e;return!vH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},vU=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},yU={dom:`${Rw}_TOOLTIP_HANDLER_DOM`,canvas:`${Rw}_TOOLTIP_HANDLER_CANVAS`},_U={key:"其他",value:"..."};var bU;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(bU||(bU={}));class xU{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(PM.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=mU(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},_U),t):_U;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!d(e)&&vH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class SU extends xU{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Tk(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(u(s))break}return u(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const AU=()=>{hw.registerTooltipProcessor("dimension",SU)};class kU extends xU{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,xo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(wM(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const CU=()=>{hw.registerTooltipProcessor("mark",kU)};class wU extends xU{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const MU=()=>{hw.registerTooltipProcessor("group",wU)};class TU extends VW{constructor(){super(...arguments),this.transformerConstructor=XW,this.type="line",this.seriesType=kC.line}_setModelOption(){this._modelOption.getDimensionInfo=aU,this._modelOption.getDimensionInfoByValue=lU,this._modelOption.getRectByDimensionData=gU}}TU.type="line",TU.seriesType=kC.line,TU.transformerConstructor=XW,U(TU,qW);const BU=[...Mj,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class EU extends Tj{constructor(){super(...arguments),this.type=EU.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return BU}_getIgnoreAttributes(){return[]}}EU.type="area";const PU=()=>{hw.registerMark(EU.type,EU),$R(),CR(),cN(),pN(),Vz(),hw.registerGraphicComponent("area",Ug)};class OU extends xH{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),u(e))return e}return i}}}const RU=Object.assign(Object.assign(Object.assign({},RH),Sj),{area:{name:"area",type:"area"}}),IU=()=>{hw.registerAnimation("area",jz),Nz(),zz()};class DU extends yN{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||p&&!d)&&(g=h,f=l),l.style=lw({},f.style,g.style),l.state=lw({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function LU(){PR(),WR()}function FU(){return"browser"===t_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const zU={debounce:xt,throttle:St};LU();let HU=class t extends Zj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=FU(),a="browser"===t_.env?t_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=vt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:zU[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:yt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=yt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(VA,{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",zU[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===t_.env?t_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(yt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ai(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ai(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=vt(t[0],0,1),c=vt(t[1],0,1),d=vt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=yt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?yt([a+i*n,a+s*n],a,n-l):yt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=FU(),e="browser"===t_.env?t_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===t_.env?t_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};HU.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class jU{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ne).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=jU.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(VA,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new HU(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),D.setAttribute("x",D.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),D.setAttribute("y",D.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:zt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:zt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:zt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}$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"},panel:{},maxWidthPercent:.8,space:8,padding:10};class qU{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,$U.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new $U(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,z(e,lF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class ZU{constructor(){this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class JU extends ZU{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class QU extends ZU{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function tG(t){t.isBound(qU)||(t.bind(qU).toSelf().inSingletonScope(),t.bind(Wy).toService(qU)),t.isBound(JU)||(t.bind(JU).toSelf(),t.bind(Ef).toService(JU)),t.isBound(QU)||(t.bind(QU).toSelf(),t.bind(Ef).toService(QU))}class eG extends Zj{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}PR(),DR();class iG extends eG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},iG.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}iG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},PR(),WR();class sG extends eG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},sG.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}sG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},PR(),xR();class nG extends eG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},nG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=re.distancePP(t,e);this.setAttribute("radius",i)}}nG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},PR(),xR();class rG extends eG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},rG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=LA,endAngle:s=FA}=this.attribute,n=s-i,r=oe(de(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}rG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},PR(),FR();class aG extends eG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},aG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=he(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=re.distancePP(t,e);this.setAttribute("radius",i)}}aG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class oG{isInValidValue(t){const{startAngle:e=LA,endAngle:i=FA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=LA,endAngle:i=FA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return he(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return rk(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function lG(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=lG(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var dG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),A(l)&&l>=3){const t=ak(n,l,c,e,i);h=DA.path(Object.assign(Object.assign({},a.style),{path:ok(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=DA.circle(t)}h.name=oV.line,h.id=this._getNodeId("line"),E(a.state)||(h.states=z({},hV,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:u={}}=a,p=dG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=P(this.attribute.label,"style.fontSize",12)+P(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;d(_)&&(_=0===r?"end":"middle"),"start"===_?(y="bottom",g={x:s.x,y:s.y-v}):"end"===_&&(y="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:y,textAlign:"center"},l),state:{text:z({},hV,u.text),shape:z({},hV,u.shape),panel:z({},hV,u.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(pt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=lG(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&hG(e,c,i)}else e.AABBBounds.width()>r&&hG(e,r,i)}else o>a.x&&h.x2>n.x2?(hG(e,n.x2-o,i),r&&cG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return pt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}uG.defaultAttributes=JA,U(uG,oG);const pG=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=WA(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=he({x:0,y:0},i,t),a=nk(r,rk(s,r,e,n));return o=a,l=rk(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(pt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return CN(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=pG(t,i,e),r=K(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=fG(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return CN(d)},fG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&wN(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var mG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=ge(h.endAngle-d/2),g=he(c,h.outerRadius,o),f=he(c,a+e.line.line1MinLength,o),m=new _G(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=he(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):Nj(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=he(t.circleCenter,v,t.middleAngle),t.labelLimit=f,gt(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=Nj(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=Nj(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(ft(t.pointB.x,this._line2MinLength+h)||gt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=Nj(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?d(h)||"auto"===h?"edge"===c?Nj(t.quadrant)?"left":"right":Nj(t.quadrant)?"right":"left":h:d(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(Nj(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(pt(l/2,u))g=0,f=1,m=-p;else if(pt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&ft(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&ft(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),iN(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,eN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}SG.defaultAttributes={pickable:!1};var AG,kG,CG,wG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(MG,oG),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(AG||(AG={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(kG||(kG={})),function(t){t.dataZoomChange="dataZoomChange"}(CG||(CG={}));const TG="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",BG={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:TG,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:TG,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},EG={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}},PG=0,OG=1,RG=2,IG=3,DG=4,LG=5,FG=5,zG=999,HG=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var jG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:RG},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:RG},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:PG},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,w;const{orient:M,middleHandlerStyle:T={},startHandlerStyle:B={},endHandlerStyle:E={},zoomLock:P}=this.attribute,{start:O,end:R}=this._getState(),{position:I,width:D,height:L}=this._getLayoutAttrFromConfig(),F=null!==(t=B.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=E.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(T.visible){const t=(null===(i=T.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+O*D,y:I.y-t,width:(R-O)*D,height:t,zIndex:LG},null===(s=T.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=T.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(O+R)/2*D,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=T.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:LG},T.icon),{pickable:!P&&(null===(h=T.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*D,y:I.y+L/2,size:L,symbolType:null!==(c=B.symbolType)&&void 0!==c?c:"square"},EG.horizontal),{zIndex:LG}),B),{pickable:!P&&(null===(d=B.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*D,y:I.y+L/2,size:L,symbolType:null!==(u=E.symbolType)&&void 0!==u?u:"square"},EG.horizontal),{zIndex:LG}),E),{pickable:!P&&(null===(p=E.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+O*D-t/2,y:I.y+L/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:zG},EG.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+R*D-g/2,y:I.y+L/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:zG},EG.horizontal),{pickable:!P}),"rect")}else{if(T.visible){const t=(null===(g=T.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+D,y:I.y+O*L,width:t,height:(R-O)*L,zIndex:LG},null===(f=T.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=T.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+D+t/2,y:I.y+(O+R)/2*L,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=T.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:LG},T.icon),{pickable:!P&&(null===(S=null===(x=T.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+D/2,y:I.y+O*L,size:D,symbolType:null!==(A=B.symbolType)&&void 0!==A?A:"square"},EG.vertical),{zIndex:LG}),B),{pickable:!P&&(null===(k=B.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+D/2,y:I.y+R*L,size:D,symbolType:null!==(C=E.symbolType)&&void 0!==C?C:"square",zIndex:LG},EG.vertical),E),{pickable:!P&&(null===(w=E.pickable)||void 0===w||w)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+D/2+t/2,y:I.y+O*L-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:zG},EG.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+D/2+i/2,y:I.y+R*L-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:zG},EG.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:IG},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:IG},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:OG},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:DG},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return Ab(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ne).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=jG(c,["formatMethod"]),{formatMethod:g}=d,f=jG(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,w,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},w={textAlign:HG(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:HG(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:HG(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:HG(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),z({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:FG}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),z({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:FG}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new LV(e),s.name=i,t.add(s)),s}}const VG={debounce:xt,throttle:St};class WG extends o{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=AG.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=AG.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=AG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=AG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=AG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===t_.env?t_:this.stage,s=FU();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===AG.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===AG.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===AG.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===AG.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(kG.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(kG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(kG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===AG.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(kG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(kG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:VG[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===t_.env?t_:this.stage,e=FU();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===t_.env?t_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===t_.env?t_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:vt(e+t,0,1),end:vt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=AG.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}IV(),WR(),QR(),CR(),DR();let UG=class t extends Zj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,y;h.visible?this._isHorizontal?(m=p,v=g-f,y={x:a.x,y:a.y+f}):(m=p-f,v=g,y={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,y=a);const _=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(_+b)/2,y={x:y.x+_/2,y:y.y}):(v-=(_+b)/2,y={x:y.x,y:y.y+_/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new NG(this._getRendererAttrs()),this._interaction=new WG(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(kG.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(kG.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(CG.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(kG.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;u(t)&&u(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(CG.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...G(a))}setPreviewPointsX(t){c(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._renderer.statePointToData=t)}};var GG,YG,XG,KG;function $G(){PR(),IV(),kL()}UG.defaultAttributes=BG,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(GG||(GG={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(YG||(YG={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(XG||(XG={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(KG||(KG={}));class qG extends Zj{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=FV(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=zV(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=HV(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=DA.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=DA.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=DA.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),iN(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,eN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=tN(this);this.markerAnimate("exit");const n=tN(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},sN(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function ZG(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function JG(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;Qj(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function QG(t,e,i,s){t&&(JG(t.startSymbol,e,i,s),ZG(t).forEach((t=>JG(t,e,i,s))),JG(t.endSymbol,e,i,s))}function tY(t,e,i,s){t&&(JG(t.getTextShape(),e,i,s),JG(t.getBgRect(),e,i,s))}function eY(t,e,i,s){var n,r,a,o;t&&(Qj(t,{fillOpacity:0,strokeOpacity:0},{fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function iY(t,e,i,s){t&&(eY(t.startSymbol,e,i,s),ZG(t).forEach((t=>eY(t,e,i,s))),eY(t.endSymbol,e,i,s))}function sY(t,e,i,s){t&&(eY(t.getTextShape(),e,i,s),eY(t.getBgRect(),e,i,s))}function nY(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;JG(t.startSymbol,s,r,n);const h=ZG(t);h.forEach((t=>Qj(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),JG(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;JG(t.getTextShape(),e,l,n),JG(t.getBgRect(),e,l,n)}))}function rY(t,e,i,s,n){QG(t,s,i,n),G(e).forEach((t=>{tY(t,s,i,n)}))}function aY(t,e,i,s,n){JG(t,s,i,n),G(e).forEach((t=>{tY(t,s,i,n)}))}function oY(t,e,i,s,n){JG(t,s,i,n),G(e).forEach((t=>{tY(t,s,i,n)}))}function lY(t,e,i,s,n,r){var a;QG(t,n,s,r),JG(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?tY(i,n,s,r):JG(i,n,s,r)}function hY(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;JG(t.startSymbol,n,o,r);const u=ZG(t);u.forEach((t=>Qj(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),JG(e,n+o+l,h,r),JG(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(JG(i.getTextShape(),n+o+l+h+c,d,r),JG(i.getBgRect(),n+o+l+c,d,r)):JG(i,n+o+l+c,d,r)}function cY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?nY(t,e,s,r,a):"fadeIn"===i&&rY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?nY(t,e,s,n,a):"fadeIn"===i&&rY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){iY(t,s,i,n),G(e).forEach((t=>{sY(t,s,i,n)}))}(t,e,i,s,n)}}function dY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&aY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&aY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){eY(t,s,i,n),G(e).forEach((t=>{sY(t,s,i,n)}))}(t,e,i,s,n)}}function uY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&oY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&oY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){eY(t,s,i,n),G(e).forEach((t=>{sY(t,s,i,n)}))}(t,e,i,s,n)}}function pY(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?lY(n,r,e,i,s,o):"callIn"===t&&hY(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?lY(n,r,e,i,s,a):"callIn"===t&&hY(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;iY(t,n,s,r),eY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?sY(i,n,s,r):eY(i,n,s,r)}(n,r,e,t,i,s)}}const gY={type:"clipIn",duration:500,easing:"linear",delay:0},fY={type:"fadeIn",duration:500,easing:"linear",delay:0},mY={type:"callIn",duration:500,easing:"linear",delay:0},vY={type:"fadeOut",duration:500,easing:"linear",delay:0};class yY{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new LV(Object.assign(Object.assign({},h),{state:{panel:z({},jA,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},jA,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},jA,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},jA,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class _Y extends qG{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=gY,this.defaultExitAnimation=vY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;ZA(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U(_Y,yY);const bY=.001,xY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:GG.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]}},SY={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},AY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:XG.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},kY={interactive:!0,label:{position:YG.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}},CY={interactive:!0,label:{autoRotate:!0,position:XG.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},wY={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},MY={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},TY={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function BY(){EY._animate=cY}$G(),EV(),kL();class EY extends _Y{markerAnimate(t){EY._animate&&this._animationConfig&&EY._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},EY.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(SA(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return AA(Math.abs(e),Math.PI/2,bY)||AA(Math.abs(e),3*Math.PI/2,bY)?kA(i,e,t):SA(e)?SY.postiveXAxis[t]:SY.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new OV({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},jA,null==a?void 0:a.line),startSymbol:z({},jA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},jA,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},jA,null==a?void 0:a.line),startSymbol:z({},jA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},jA,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)}));else if(!A(t.x)||!A(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",EY.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(EY.defaultAttributes.label)}}function PY(){OY._animate=dY}EY.defaultAttributes=xY,$G(),HR(),kL();class OY extends qG{markerAnimate(t){OY._animate&&this._animationConfig&&OY._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OY.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=fY,this.defaultExitAnimation=vY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},MY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;ZA(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=DA.polygon(Object.assign({points:e},i));n.states=z({},jA,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",OY.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},jA,null==i?void 0:i.area)),this._updateMarkLabels(OY.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)})),e}}OY.defaultAttributes=kY,U(OY,yY),$G(),PV(),kL();class RY extends _Y{markerAnimate(t){RY._animate&&this._animationConfig&&RY._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},RY.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case XG.arcInnerStart:l=n;case XG.arcOuterStart:l=n;break;case XG.arcInnerEnd:l=r;case XG.arcOuterEnd:l=r;break;case XG.center:case XG.arcInnerMiddle:case XG.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return wY[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new RV({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},jA,null==o?void 0:o.line),startSymbol:z({},jA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},jA,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},jA,null==o?void 0:o.line),startSymbol:z({},jA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},jA,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",RY.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(RY.defaultAttributes.label)}}RY.defaultAttributes=AY,$G(),xR(),kL();class IY extends qG{markerAnimate(t){IY._animate&&this._animationConfig&&IY._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},IY.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=fY,this.defaultExitAnimation=vY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case XG.center:h=(s+n)/2,c=(r+a)/2;break;case XG.arcInnerStart:h=s,c=r;break;case XG.arcOuterStart:h=n,c=r;break;case XG.arcInnerEnd:h=s,c=a;break;case XG.arcOuterEnd:h=n,c=a;break;case XG.arcInnerMiddle:h=s,c=(r+a)/2;break;case XG.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},wY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;ZA(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=DA.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},jA,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",IY.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},jA,null==o?void 0:o.area)),this._updateMarkLabels(IY.defaultAttributes.label)}isValidPoints(){return!0}}function DY(){LY._animate=pY}IY.defaultAttributes=CY,U(IY,yY),$G(),EV(),PV(),QR(),RR(),DR(),kL();class LY extends qG{markerAnimate(t){LY._animate&&this._animationConfig&&LY._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},LY.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=mY,this.defaultExitAnimation=vY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return AA(Math.abs(s),Math.PI/2,bY)||AA(Math.abs(s),3*Math.PI/2,bY)?kA(t,s,n):SA(s)?TY.postiveXAxis[n]:TY.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=KG.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},jA,null==p?void 0:p.textBackground),text:z({},jA,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},jA,null==p?void 0:p.itemContent));const v=SA(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=DA.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},jA,null==s?void 0:s.itemContent)):"text"===n?o=new LV(Object.assign(Object.assign({},i),{state:{panel:z({},jA,null==s?void 0:s.textBackground),text:z({},jA,null==s?void 0:s.itemContent)}})):"richText"===n?(o=DA.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},jA,null==s?void 0:s.itemContent)):"image"===n?(o=DA.image(Object.assign(Object.assign({},i),r)),o.states=z({},jA,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},jA,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=AA(c,0,bY)||AA(d,0,bY),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=$A(e-u,t-d),o=$A(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(GY.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(GY.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===GY.focus||"focus"===o){const s=a.hasState(WY.focus);a.toggleState(WY.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[WY.unSelected,WY.unSelectedHover,WY.focus],t),this._setLegendItemState(e,WY.selected,t)})):(this._setLegendItemState(a,WY.selected,t),this._removeLegendItemState(a,[WY.unSelected,WY.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[WY.selected,WY.selectedHover,WY.focus],t),this._setLegendItemState(e,WY.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(WY.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(WY.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(UY.legendItemClick,a,t);i?(this._removeLegendItemState(a,[WY.selected,WY.selectedHover],t),this._setLegendItemState(a,WY.unSelected,t)):(this._setLegendItemState(a,WY.selected,t),this._removeLegendItemState(a,[WY.unSelected,WY.unSelectedHover],t))}else this._setLegendItemState(a,WY.selected,t),this._removeLegendItemState(a,[WY.unSelected,WY.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[WY.selected,WY.selectedHover],t),this._setLegendItemState(e,WY.unSelected,t))}))}this._dispatchLegendEvent(UY.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,WY.selected),this._removeLegendItemState(e,[WY.unSelected,WY.unSelectedHover])):(this._removeLegendItemState(e,[WY.selected,WY.selectedHover]),this._setLegendItemState(e,WY.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=jY,spaceRow:l=NY,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,w=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=w+l,w=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,w=Math.max(w,m),M.push(i)):(u(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=DA.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=K(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";p(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";p(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:p,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),C=this._handleStyle(x,t,e,i,s),w=ai(c);let M;!1===x.visible?(M=DA.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,GY.item,t,M)):(M=DA.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,GY.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?WY.selected:WY.unSelected);const T=DA.group({x:0,y:0,pickable:!1});M.add(T);let B,E=0,O=0,R=0;if(v&&!1!==v.visible){const i=P(S,"style.size",10);O=y(i)?i[0]||0:i,R=P(v,"space",8);const s=DA.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,GY.itemShape,t,M,S.state),s.addState(e?WY.selected:WY.unSelected),T.add(s)}let I=0;if(p){const e=P(g,"size",10);B=DA.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,GY.focus,t,M),I=e}const D=_.formatMethod?_.formatMethod(o,t,i):o,L=XA(Object.assign(Object.assign({x:O/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:D,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(L,GY.itemLabel,t,M,A.state),L.addState(e?WY.selected:WY.unSelected),T.add(L);const F=P(_,"space",8);if(u(l)){const s=P(b,"space",p?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=XA(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,GY.itemValue,t,M,k.state),r.addState(e?WY.selected:WY.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-O-R-F-I-s;this._autoEllipsis(m,t,L,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-O/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2))}else r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),T.add(r)}else this._itemWidthByUser?(L.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-O-R-I),E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2)):E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2);B&&(B.setAttribute("x",E),T.add(B));const z=T.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;T.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const j=z.height(),N=u(this.attribute.item.width)?this.attribute.item.width:H+w[1]+w[3],V=this._itemHeightByUser||j+w[0]+w[2];return M.setAttributes({width:N,height:V}),B&&B.setAttribute("visible",!1),T.translateTo(-z.x1+w[3],-z.y1+w[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new HY(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new HY(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new HU(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new HU(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",St(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=jY,spaceRow:o=NY}=n,l=this._itemsContainer,{space:h=VY,defaultCurrent:c=1}=r,d=$Y(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=DA.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=jY,spaceRow:a=NY}=s,o=this._itemsContainer,{space:l=VY,defaultCurrent:h=1}=n,c=$Y(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=DA.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=DA.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];pt(vt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),pt(vt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(WY.selected)?this._setLegendItemState(t,WY.selectedHover,e):this._setLegendItemState(t,WY.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===GY.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(UY.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(WY.unSelectedHover)||t.hasState(WY.selectedHover))&&(i=!0),t.removeState(WY.unSelectedHover),t.removeState(WY.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(WY.unSelectedHover)&&!t.hasState(WY.selectedHover)||(i=!0),t.removeState(WY.unSelectedHover),t.removeState(WY.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===GY.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(UY.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(UY.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==GY.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(UY.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==GY.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(UY.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(WY.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},qY,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(WY.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(c(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var JY;function QY(t){return y(t)?t:[t,t]}function tX(t){return t?"ew-resize":"ns-resize"}ZY.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:jY,spaceRow:NY,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:VY,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"}(JY||(JY={})),XY();class eX extends Zj{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eX.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=FU(),n="browser"===t_.env?t_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=FU(),n="browser"===t_.env?t_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(u(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=G(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:QY(p)[0],endValue:QY(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=DA.group({x:0,y:0});f.name=JY.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=DA.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=JY.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=DA.group({x:g?v:0,y:g?0:v});f.add(y);const _=DA.group({x:0,y:0});let b;if(_.name=JY.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=DA.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=JY.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=DA.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=JY.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=QY(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":tX(p)},r));if(v.name=JY.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=JY.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":tX(p)},r));if(i.name=JY.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=JY.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=yt(h,i,s);c=t[0],u=t[1]}else c=i,u=vt(h,i,s);const g=this._isHorizontal;e||(c=i);const f=DA.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=JY.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":tX(g);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(u,e?"end":"start"),b=DA.rect(Object.assign({x:g?Math.min(y,_):0,y:g?0:Math.min(y,_),width:g?Math.abs(_-y):r,height:g?n:Math.abs(_-y),cursor:v},a));b.name=JY.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return DA.symbol(t)}_renderHandlerText(t,e){return DA.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return c(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":tX(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=DA.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=DA.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===t_.env?t_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=FU(),e="browser"===t_.env?t_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===JY.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===JY.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===JY.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===JY.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===t_.env?t_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}eX.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},KY(),XY();class iX extends YY{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},iX.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip:y,inverse:_,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function sX(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}iX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},KY(),XY(),FR();class nX extends YY{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},nX.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,sizeBackground:y,disableTriggerEvent:_,inverse:b}=this.attribute,x=DA.group({x:0,y:0});this._innerView.add(x);const S=new eX({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:sX(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:_,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const C=DA.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);const w=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}nX.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)"}},PR(),eI(),XR();let rX=class t extends Zj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:w,subtextStyle:M={},width:T,height:B,minWidth:E,maxWidth:P,minHeight:O,maxHeight:R,align:I,verticalAlign:D,padding:L=0}=this.attribute,F=ai(L),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||u(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:T)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},NA),C),x:h,y:c,width:null!==(s=null!=t?t:T)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:T,heightLimit:null!==(a=C.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,R-j);if("rich"===k||u(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:T)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:w},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:w},NA),M),x:n,y:r,width:null!==(c=null!=t?t:T)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(w)?w:[w],whiteSpace:"normal"},M),{maxLineWidth:null!==(p=M.maxLineWidth)&&void 0!==p?p:T,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const V=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(N,W),G=j+(null!==(f=M.height)&&void 0!==f?f:V);if(u(T)&&(U=T),u(B)&&(G=B),u(E)&&UP&&(U=P),u(O)&&GR&&(G=R),z.setAttributes({width:U,height:G,boundsPadding:F}),this._mainTitle){if(u(I)||u(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:U;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:D,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(_=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==_?_:U;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:D,e=this._mainTitle?u(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};rX.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 aX={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"}}};PR(),eI(),XR();let oX=class extends Zj{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},P(aX,n),e.style,{visible:e.visible});a.lineHeight=u(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=XA(a);return o.name=r,t.appendChild(o),e.autoFit&&A(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&A(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const p=UA(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",u(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;A(_)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",u(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class lX extends Jp{constructor(t){super(t)}}var hX,cX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(hX||(hX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(cX||(cX={}));class dX extends Zj{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},dX.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"},dX.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"},dX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},dX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},dX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{d(this._playController)&&(this._playController=new lX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new lX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new lX(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(hX.OnPlay)},this.pause=()=>{this._dispatchEvent(hX.OnPause)},this.forward=()=>{this._dispatchEvent(hX.OnForward)},this.backward=()=>{this._dispatchEvent(hX.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}dX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},dX.defaultAttributes={[cX.Start]:{},[cX.Pause]:{},[cX.Backward]:{},[cX.Forward]:{}};const uX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},pX=[200,10];var gX,fX;!function(t){t.Default="default",t.Reverse="reverse"}(gX||(gX={})),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"}(fX||(fX={}));const mX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===gX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===gX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),vX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===gX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===gX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),yX=t=>"top"===t||"bottom"===t;class _X extends Zj{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},_X.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;A(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Gt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:A(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(yX(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:pX[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:pX[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new eX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=yX(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new dX(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=yX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:pX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Gt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(yX(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:yX(this._orient)?t+s:(this._size.width-r)/2,y:yX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:yX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:yX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:yX(this._orient)?t+s:(this._size.width-r)/2,y:yX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function bX(){XY(),PR(),QR()}_X.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({},uX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},uX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},uX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},uX),{key:"backward",position:"start"})}},bX();class xX extends _X{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:gX.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(hX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(hX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(hX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(hX.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(fX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(mX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||vX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===gX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(fX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=t_.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(fX.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(fX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=t_.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(),t_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(fX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,t_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(fX.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(fX.change),this.dispatchCustomEvent(fX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var SX,AX=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};bX();class kX extends _X{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(hX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(hX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(hX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(hX.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(fX.change))},this.play=()=>AX(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(fX.play),this._rafId=t_.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=t_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,t_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(fX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,t_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(fX.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(fX.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(fX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}(SX||(SX={}));const CX={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},wX=5;const MX={debounce:xt,throttle:St};PR(),HR();let TX=class t extends Zj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=CX.updateTrigger,endTrigger:i=CX.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(G(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:MX[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(SX.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=CX.trigger,resetTrigger:i=CX.resetTrigger}=this.attribute;G(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),G(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(SX.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(SX.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=wX}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(SX.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(SX.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent(SX.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=wX}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(SX.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(SX.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),G(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=CX.updateTrigger,endTrigger:s=CX.endTrigger}=this.attribute;G(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),G(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=DA.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Pe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};TX.defaultAttributes=CX;const BX=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},EX=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:G(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},PX={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:zA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:zA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:zA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},OX=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];PR(),WR(),QR(),eI(),XR();let RX=class t extends Zj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ai(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:xA(p)&&xA(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:xA(p)&&xA(p.value)},EX(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:xA(p)&&xA(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:xA(p)&&xA(p.value)},EX(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},NA),p.value),visible:xA(p)&&xA(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=xA(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const y=xA(p)?p.height+p.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!xA(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let p="right"===c?(o?d:0)+(xA(n.key)?r+n.key.spacing:0)+(xA(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(KA(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:xA(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),KA(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(xA(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=kh(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(xA(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},EX(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},EX(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},NA),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(xA(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},EX(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},EX(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>OX.includes(t)))?(this._mergeAttributes(e,s),d(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&xA(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=xA(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=WA(d),y=WA(u);let _=0;if(xA(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(xA(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return BX({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return BX({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};RX.defaultAttributes=PX;class IX extends xW{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),_k(this._regions,(t=>{aj(this.getOrient())?zN(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):zN(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=lw({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new KF(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=vi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>FN(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>FN(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return zM(this._option.dataSet,t,yW),t}transformScaleDomain(){}}IX.type=n.cartesianTimeAxis,IX.specKey="axes",IX.builtInTheme={axis:iW,axisX:sW,axisY:nW};const DX=()=>{hw.registerGraphicComponent(sV.lineAxis,((t,e)=>new tW(t,e))),hw.registerGraphicComponent(nV.lineAxisGrid,((t,e)=>new BV(t,e))),pV(),hw.registerComponent(IX.type,IX)};class LX extends xW{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new bC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return zM(this._option.dataSet,t,yW),t}transformScaleDomain(){}}LX.type=n.cartesianLogAxis,LX.specKey="axes",LX.builtInTheme={axis:iW,axisLinear:bW,axisX:sW,axisY:nW},U(LX,fW);const FX=()=>{hw.registerGraphicComponent(sV.lineAxis,((t,e)=>new tW(t,e))),hw.registerGraphicComponent(nV.lineAxisGrid,((t,e)=>new BV(t,e))),pV(),hw.registerComponent(LX.type,LX)};class zX extends xW{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new xC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return zM(this._option.dataSet,t,yW),t}transformScaleDomain(){}}zX.type=n.cartesianSymlogAxis,zX.specKey="axes",zX.builtInTheme={axis:iW,axisLinear:bW,axisX:sW,axisY:nW},U(zX,fW);const HX=()=>{hw.registerGraphicComponent(sV.lineAxis,((t,e)=>new tW(t,e))),hw.registerGraphicComponent(nV.lineAxisGrid,((t,e)=>new BV(t,e))),pV(),hw.registerComponent(zX.type,zX)};class jX extends rj{constructor(){super(...arguments),this.type=kC.area,this.transformerConstructor=DU,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Aj)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(jX.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===sH?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return jC(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",xF.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return jC(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",xF.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",xF.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",xF.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[Ww]},"normal",xF.Series),this.setMarkStyle(o,{curveType:a},"normal",xF.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(NH(null===(e=hw.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),VH("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(NH(null===(i=hw.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),VH("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=nj(this);this._symbolMark.setAnimationConfig(NH(null===(s=hw.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),VH("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new OU(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}jX.type=kC.area,jX.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},jX.mark=RU,jX.transformerConstructor=DU,U(jX,kj);class NX extends YW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),hF(t)}}class VX extends VW{constructor(){super(...arguments),this.transformerConstructor=NX,this.type="area",this.seriesType=kC.area}_setModelOption(){this._modelOption.getDimensionInfo=aU,this._modelOption.getDimensionInfoByValue=lU,this._modelOption.getRectByDimensionData=gU}}VX.type="area",VX.seriesType=kC.area,VX.transformerConstructor=NX,U(VX,qW);function WX(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const UX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:WX(t,e)}),GX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:WX(t,e)}),YX={type:"fadeIn"},XX={type:"growCenterIn"};function KX(t,e){if(!1===e)return{};switch(e){case"fadeIn":return YX;case"scaleIn":return XX;default:return UX(t)}}class $X extends yz{constructor(){super(...arguments),this.type=$X.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}$X.type="rect";const qX=()=>{$R(),WR(),oN("rect",vG),hw.registerMark($X.type,$X),rI.registerBuiltInAnimate("growHeightIn",NI),rI.registerBuiltInAnimate("growHeightOut",VI),rI.registerBuiltInAnimate("growWidthIn",nD),rI.registerBuiltInAnimate("growWidthOut",rD),rI.registerBuiltInAnimate("growCenterIn",zI),rI.registerBuiltInAnimate("growCenterOut",HI),hw.registerGraphicComponent("rect",ag)},ZX=Object.assign(Object.assign({},RH),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function JX(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=ZC(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[IH]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):jC(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[DH]):jC(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=jC(this._dataToPosX(t),e,i),n=jC(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[LH]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):jC(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[FH]):jC(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=jC(this._dataToPosY(t),e,i),n=jC(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),eK)})}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},iK.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:GH(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(iK.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",xF.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===n.cartesianBandAxis));let r;if(zM(this._option.dataSet,"addVChartProperty",gH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};zM(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Oa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:BH.bind(this),call:EH}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new KF(this._option,r)}init(t){super.init(t),this.initRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=FH,s=LH,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=DH,s=IH,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=hM(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)JX(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=jC(this[r](t),l,i),u=jC(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!NC(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",xF.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",xF.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&d(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,d=!1,p=1/0,g=-1/0;i.values.forEach((e=>{const i=e[Vw],n=e[Ww],r=e[Uw],c=e[Gw];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?LH:IH],i=e[a?FH:DH];l=Math.min(l,t,i),h=Math.max(h,t,i)}u(r)&&u(c)&&(d=!0,p=Math.min(p,r,c),g=Math.max(g,r,c))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[Vw]:s,[Ww]:o}),d?{[Uw]:p,[Gw]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(ag(Object.assign(Object.assign({},m),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>jC(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",xF.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",xF.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>jC(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",xF.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",xF.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=d(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",xF.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",xF.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=nj(this);this._barMark.setAnimationConfig(NH(null===(e=hw.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),VH(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=u(this._spec.barWidth)&&r===n,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=a;return o&&(c=ZC(this._spec.barWidth,a)),l&&(c=Math.max(c,ZC(this._spec.barMinWidth,a))),h&&(c=Math.min(c,ZC(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,p;"horizontal"===t?(h=this.getYAxisHelper(),c="height",p="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",p="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&u(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=ZC(null!==(l=i[r-1])&&void 0!==l?l:Y(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*y+(u-1)*p,n+=g*(y+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const _=wk(g.type||"band");return p(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}iK.type=kC.bar,iK.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},iK.mark=ZX,iK.transformerConstructor=tK;const sK=()=>{DW(),qX(),hw.registerAnimation("bar",((t,e)=>({appear:KX(t,e),enter:UX(t,!1),exit:GX(t,!1),disappear:{duration:Dz.disappear.duration}}))),aW(),SW(),hw.registerSeries(iK.type,iK)};class nK extends YW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),hF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=p(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class rK extends VW{constructor(){super(...arguments),this.transformerConstructor=nK,this.type="bar",this.seriesType=kC.bar}_setModelOption(){this._modelOption.getDimensionInfo=aU,this._modelOption.getDimensionInfoByValue=lU,this._modelOption.getRectByDimensionData=gU}}rK.type="bar",rK.seriesType=kC.bar,rK.transformerConstructor=nK,U(rK,qW);const aK=[10,20],oK=kk.Linear,lK="circle",hK=kk.Ordinal,cK=["circle","square","triangle","diamond","star"],dK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},uK=Object.assign(Object.assign({},RH),{point:{name:"point",type:"symbol"}});class pK extends $H{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const gK={sizeField:!0};class fK extends rj{constructor(){super(...arguments),this.type=kC.scatter,this.transformerConstructor=pK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),gK)})}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(c(e))return e;if(y(e)){if(d(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${Rw}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${Rw}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:oK,defaultRange:aK},"size")}getShapeAttribute(t,e){return d(e)?lK:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:hK,defaultRange:cK},"shape")}initMark(){this._symbolMark=this._createMark(fK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:GH(this._spec,fK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=nj(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(NH(null===(i=hw.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),VH("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:lK},AF.STATE_NORMAL,xF.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},AF.STATE_NORMAL,xF.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},AF.STATE_NORMAL,xF.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",xF.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",xF.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},AF.STATE_NORMAL,xF.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},AF.STATE_NORMAL,xF.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ue});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}fK.type=kC.scatter,fK.mark=uK,fK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},fK.transformerConstructor=pK;const mK=()=>{vN(),hw.registerAnimation("scatter",((t,e)=>Object.assign({appear:dK(0,e)},Lz))),aW(),SW(),hw.registerSeries(fK.type,fK)};class vK extends YW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class yK extends VW{constructor(){super(...arguments),this.transformerConstructor=vK,this.type="scatter",this.seriesType=kC.scatter}_setModelOption(){this._modelOption.getDimensionInfo=aU,this._modelOption.getDimensionInfoByValue=lU,this._modelOption.getRectByDimensionData=gU}}yK.type="scatter",yK.seriesType=kC.scatter,yK.transformerConstructor=vK,U(yK,qW);const _K=()=>{AU(),CU(),tU(),QW(),mK(),hw.registerChart(yK.type,yK)};class bK extends ij{constructor(){super(...arguments),this.type=kC.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return d(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${Rw}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const xK=(t,e)=>{const i=c(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[Fw]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[rM]=a||r})),s};class SK extends xH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class AK extends yz{constructor(){super(...arguments),this.type=AK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}AK.type="path";const kK=()=>{hw.registerMark(AK.type,AK),$R(),FR(),hw.registerGraphicComponent("path",Ng)},CK=Object.assign(Object.assign({},RH),{area:{name:"area",type:"path"}});class wK{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?La(i,e):Ia[i]?(Ra[i]||(Ra[i]=La(i,Ia[i])),Ra[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class MK{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class TK{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function BK(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:MK}:gA(t)||fA(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:TK}:null}const EK={debounce:xt,throttle:St};class PK{constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=gA(this._renderMode)||fA(this._renderMode),BK(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return BK(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!Ae({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:RM.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:RM.chart,consume:!1}];l.on(...c,EK[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,EK[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||BK(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||BK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return d(r)&&d(a)?s:Ae({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:RM.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:RM.chart,consume:!1}];l.on(...c,EK[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,EK[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){BK(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||BK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:RM.chart},(t=>{if(!t.event)return;const{event:n}=t;Ae({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:RM.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||BK(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:RM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||BK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:RM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:RM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:RM.chart,source:OM.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:RM.chart,source:OM.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=EK[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=EK[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:RM.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:RM.chart,source:OM.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:RM.chart,source:OM.chart},this._handleDragMouseUp)}))}}class OK extends iV{constructor(){var t,e;super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=_F.Mark,this._projectionSpec={name:(t=this.type,e=this.id,`${Rw}_${e}_${t}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=u(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(d(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:n.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=lw(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var t,e,i;this.event.on(PM.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new wK(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===kC.map||e.type===kC.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),_k(this._regions,(t=>{var e;if(t.type===kC.map||t.type===kC.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==kC.map&&e.type!==kC.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[rM],s=t.getDatumCenter(e);i&&u(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}OK.type=n.geoCoordinate,U(OK,PK);const RK=()=>{hw.registerComponent(OK.type,OK)};class IK extends $H{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class DK extends bK{constructor(){super(...arguments),this.type=kC.map,this.transformerConstructor=IK,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),jM.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),zM(this._dataSet,"copyDataView",YM),zM(this._dataSet,"map",xK),zM(this._dataSet,"lookup",uH);const i=jM.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new Oa(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:qM.copyDataView}).transform({type:"map",options:()=>({nameMap:this._nameMap,nameProperty:this._nameProperty})}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:rM,fields:()=>this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new KF(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(DK.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:GH(this._spec,DK.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:Hw])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:Hw]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",xF.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",xF.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(NH(null===(t=hw.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),VH("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new SK(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[Fw]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[Fw],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ue}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ue}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:A(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return Fw}getActiveMarks(){return[this._pathMark]}}DK.type=kC.map,DK.mark=CK,DK.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},DK.transformerConstructor=IK;const LK=`${Rw}_waterfall_default_seriesField`,FK=(t,e)=>{if(!t||0===t.length)return t;const i=c(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let d=Array.from(l[s]);"decrease"===a&&(d=d.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return d.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[qw]=!0:delete t[qw]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===d.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=zK([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const f=g[0];let{start:m,end:v}=HK(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>se(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=ie(y,e)):(t[c]=+_,_=ie(_,e)),t[d]=ie(t[c],e),m=ie(m,e),b=se(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,d,e,i,a),void o.push(s)}u=zK(r,t,s,o,u,d,e,i),o.push(s)})),o};function zK(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=HK(t,i,s,n,u);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=ie(i.positive,e)):(t[h]=+i.negative,i.negative=ie(i.negative,e)),t[c]=ie(t[h],e),i.end=ie(i.end,e)}i.isTotal=e,(d(p)||p===LK)&&(t[LK]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function HK(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!d(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?lA("total.collectCountField error"):n=e[a].start;o<0?lA("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=ie(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const jK=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=c(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ie(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},NK={type:"fadeIn"},VK={type:"growCenterIn"};function WK(t,e){switch(e){case"fadeIn":return NK;case"scaleIn":return VK;default:return UX(t,!1)}}class UK extends yz{constructor(){super(...arguments),this.type=UK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return ig(t)}}UK.type="rule";const GK=()=>{hw.registerMark(UK.type,UK),$R(),DR(),hw.registerGraphicComponent("line",ig)},YK=Object.assign(Object.assign({},ZX),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),XK=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:KK(t.map((t=>t.latestData)).flat(),e.fields,i)}};function KK(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>KK(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class $K{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new Oa(e instanceof Pa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),zM(e,"dimensionTree",XK),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class qK extends tK{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const ZK={rect:s$,symbol:e$,arc:r$,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=e$(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:a$,line:o$,area:o$,rect3d:s$,arc3d:r$,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function JK(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=ZK[t])&&void 0!==i?i:ZK.point;return e.series.type===kC.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=t$(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:l$(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function QK(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==kC.sankey){const{formatFunc:t,args:n}=cH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function t$(t){return c(t)?e=>t(e.data):t}function e$(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=t$(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:i$(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function i$(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function s$(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=t$(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:n$(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function n$(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function r$(t){var e;const{labelSpec:i}=t,s=null!==(e=t$(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function a$(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=QK(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Xp(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function o$(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[Hw]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function l$(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const h$={calculationMode:!0};class c$ extends iK{constructor(){super(...arguments),this.type=kC.waterfall,this.transformerConstructor=qK,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&dM(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),h$)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new $K(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],d(this._seriesField)&&(this._seriesField=LK)}getSeriesKeys(){return this._seriesField===LK?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),zM(this._dataSet,"waterfallFillTotal",jK),zM(this._dataSet,"waterfall",FK),(d(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=XM(this.getViewData(),this._dataSet,{name:`${Rw}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new KF(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:Vw,endAs:Ww,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=nj(this);this._barMark.setAnimationConfig(NH(null===(i=hw.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),VH("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(NH(null===(s=hw.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),VH("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(c$.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:se(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:se(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return a$(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?jC(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):jC(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const t="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:e=>e.lastIndex?this.totalPositionY(e,"lastIndex",this._getLeaderLineCategoryPos(!0,t)):0,y1:e=>this.totalPositionY(e,"index",this._getLeaderLineCategoryPos(!1,t))},"normal",xF.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:e=>e.lastIndex?this.totalPositionX(e,"lastIndex",this._getLeaderLineCategoryPos(!0,t)):0,x1:e=>this.totalPositionX(e,"index",this._getLeaderLineCategoryPos(!1,t)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",xF.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&NC([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}c$.type=kC.waterfall,c$.mark=YK,c$.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},c$.transformerConstructor=qK;const d$=()=>{GK(),qX(),hw.registerAnimation("waterfall",((t,e)=>({appear:WK(t,e),enter:UX(t,!1),exit:GX(t,!1),disappear:{duration:Dz.disappear.duration}}))),Hz(),aW(),SW(),hw.registerSeries(c$.type,c$)},u$=`${Rw}_BOX_PLOT_OUTLIER_VALUE`;var p$;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(p$||(p$={}));const g$=(t,e)=>{const i=[],s=c(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=y(e)?e:[e];i.push(...s.map((e=>{const i={[u$]:e};return r.forEach((e=>{i[e]=t[e]})),u(a)&&(i[a]=t[a]),i})))})),i};class f$ extends xH{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===p$.OUTLIER)return this.series.getOutliersField();if(t===p$.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case p$.MIN:return this.series.getMinField();case p$.MAX:return this.series.getMaxField();case p$.MEDIAN:return this.series.getMedianField();case p$.Q1:return this.series.getQ1Field();case p$.Q3:return this.series.getQ3Field();case p$.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===p$.OUTLIER)return e[u$];if(t===p$.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case p$.MIN:return e[this.series.getMinField()];case p$.MAX:return e[this.series.getMaxField()];case p$.MEDIAN:return e[this.series.getMedianField()];case p$.Q1:return e[this.series.getQ1Field()];case p$.Q3:return e[this.series.getQ3Field()];case p$.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[u$])}getDefaultContentList(t){return[{key:this.getContentKey(p$.OUTLIER),value:this.getContentValue(p$.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(p$.MAX),value:this.getContentValue(p$.MAX)},{key:this.getContentKey(p$.Q3),value:this.getContentValue(p$.Q3)},{key:this.getContentKey(p$.MEDIAN),value:this.getContentValue(p$.MEDIAN)},{key:this.getContentKey(p$.Q1),value:this.getContentValue(p$.Q1)},{key:this.getContentKey(p$.MIN),value:this.getContentValue(p$.MIN)},{key:this.getContentKey(p$.SERIES_FIELD),value:this.getContentValue(p$.SERIES_FIELD)}]}}const m$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class v$ extends yz{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.context.diffState!==SF.enter&&t.context.diffState!==SF.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{m$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?z(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=dg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e),e.addEventListener("afterAttributeUpdate",(t=>{var i;2===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.type)&&this._syncInheritedStyleAttrs(e,e.attribute)}));const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=hw.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const y$=()=>{hw.registerGraphicComponent("glyph",dg),$R(),BR()},_$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],b$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class x$ extends v${constructor(){super(...arguments),this.type=x$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=_$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),A(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=b$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),A(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}x$.type="boxPlot";const S$=Object.assign(Object.assign({},RH),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),A$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!A(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return A(c)&&(f.from.min=o,f.to.min=c),A(d)&&(f.from.max=o,f.to.max=d),A(u)&&(f.from.q1=o,f.to.q1=u),A(p)&&(f.from.q3=o,f.to.q3=p),A(g)&&(f.from.median=o,f.to.median=g),f},k$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!A(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return A(c)&&(f.to.min=o,f.from.min=c),A(d)&&(f.to.max=o,f.from.max=d),A(u)&&(f.to.q1=o,f.from.q1=u),A(p)&&(f.to.q3=o,f.from.q3=p),A(g)&&(f.to.median=o,f.from.median=g),f},C$=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),w$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,k,C;if(i&&A(i.center))return i.center;let w,M,T,B,E;if("horizontal"===e){w=null===(r=null===(n=(null===(s=C$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=C$(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,T=null===(p=null===(u=null===(d=null===(c=C$(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=C$(t,"box").attribute.width,i=C$(t,"box").attribute.x;B=i,E=i+e}else{w=null===(m=null===(f=(null===(g=C$(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=C$(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,T=null===(C=null===(k=null===(S=null===(x=C$(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===k?void 0:k[0])||void 0===C?void 0:C.y;const e=C$(t,"box").attribute.height,i=C$(t,"box").attribute.y;B=i,E=i+e}return A(w)?w:A(B)&&A(E)?(B+E)/2:A(M)&&A(T)?(M+T)/2:A(T)?T:A(M)?M:NaN},M$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(A(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=C$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=C$(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=C$(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=C$(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=C$(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=C$(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=C$(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=C$(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=C$(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=C$(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return A(v)?v:A(b)&&A(x)?(b+x)/2:A(y)&&A(_)?(y+_)/2:A(_)?_:A(y)?y:NaN};class T$ extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return A$(w$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class B$ extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return k$(w$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class E$ extends T${computeAttribute(){return A$(M$)(this.target,this.params,this.params.options)}}class P$ extends B${computeAttribute(){return k$(M$)(this.target,this.params,this.params.options)}}class O$ extends $H{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const R$={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class I$ extends rj{constructor(){super(...arguments),this.type=kC.boxPlot,this.transformerConstructor=O$,this._bandPosition=0}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}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),R$)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(I$.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(I$.mark.outlier,{key:Fw,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var t,e,i,s,n,r;const a=this._boxPlotMark;if(a){const i={lineWidth:this._lineWidth,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"!==this._shaftShape?"#000":this.getColorAttribute()};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const s="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return ZC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return ZC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return ZC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return ZC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return ZC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return ZC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return ZC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return ZC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(a,i,AF.STATE_NORMAL,xF.Series),this.setMarkStyle(a,s,AF.STATE_NORMAL,xF.Built_In)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this._boxFillColor)&&void 0!==n?n:this.getColorAttribute(),stroke:this.getColorAttribute(),size:x(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10},AF.STATE_NORMAL,xF.Series),this.initBoxPlotMarkStyle()}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>jC(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>jC(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>jC(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>jC(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>jC(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},AF.STATE_NORMAL,xF.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:e=>jC(t(this.getDatumPositionValues(e,u$),{bandPosition:this._bandPosition}),i)}:{x:t=>this._getPosition(this.direction,t),y:e=>jC(t(this.getDatumPositionValues(e,u$),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,AF.STATE_NORMAL,xF.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;zM(this._dataSet,"foldOutlierData",g$),zM(this._dataSet,"addVChartProperty",gH);const t=new Oa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Rw}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:BH.bind(this),call:EH}},!1),this._outlierData=new KF(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return u(this._spec.boxWidth)&&(r=ZC(this._spec.boxWidth,n)),u(this._spec.boxMinWidth)&&(r=Math.max(r,ZC(this._spec.boxMinWidth,n))),u(this._spec.boxMaxWidth)&&(r=Math.min(r,ZC(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),p=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,p-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(p>1&&u(this._spec.boxGapInGroup)){const t=this._groups.fields,i=G(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=ZC(null!==(a=i[o-1])&&void 0!==a?a:Y(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=wk(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=nj(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=hw.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(VH("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(NH(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(NH(null===(a=hw.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new f$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}I$.type=kC.boxPlot,I$.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},I$.mark=S$,I$.transformerConstructor=O$;const D$=()=>{y$(),DR(),WR(),hw.registerGraphicComponent("line",(t=>ig(t))),hw.registerGraphicComponent("rect",(t=>ag(t))),hw.registerMark(x$.type,x$),vN(),zz(),aW(),SW(),rI.registerBuiltInAnimate("boxplotScaleIn",T$),rI.registerBuiltInAnimate("boxplotScaleOut",B$),rI.registerBuiltInAnimate("barBoxplotScaleIn",E$),rI.registerBuiltInAnimate("barBoxplotScaleOut",P$),hw.registerSeries(I$.type,I$)};class L$ extends yz{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=L$.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?zg(t):Xp(t)}}L$.type="text";const F$=()=>{hw.registerMark(L$.type,L$),$R(),eI(),XR(),hw.registerGraphicComponent("text",Xp),hw.registerGraphicComponent("richtext",zg)};class z$ extends xH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const H$=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),j$={type:"fadeIn"},N$=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function V$(t,e){return"fadeIn"===e?j$:H$(t)}const W$=Object.assign(Object.assign({},ZX),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class U$ extends tK{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class G$ extends iK{constructor(){super(...arguments),this.type=kC.rangeColumn,this._barMarkType="rect",this._barName=kC.bar,this.transformerConstructor=U$}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(G$.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:GH(this._spec,G$.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(G$.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(G$.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",xF.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=nj(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(NH(null===(i=hw.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),VH("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(NH(null===(s=hw.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),VH("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(NH(null===(n=hw.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),VH("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new z$(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}G$.type=kC.rangeColumn,G$.mark=W$,G$.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},G$.transformerConstructor=U$;const Y$=()=>{qX(),F$(),hw.registerAnimation("rangeColumn",((t,e)=>({appear:V$(t,e),enter:H$(t),exit:N$(t),disappear:{duration:Dz.disappear.duration}}))),Hz(),aW(),SW(),hw.registerSeries(G$.type,G$)};var X$,K$;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(X$||(X$={})),function(t){t.middle="middle",t.start="start",t.end="end"}(K$||(K$={}));class $$ extends xH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const q$=Object.assign({},RU);class Z$ extends jX{constructor(){super(...arguments),this.type=kC.rangeArea}initMark(){this._areaMark=this._createMark(Z$.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",xF.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",xF.Series),this.setMarkStyle(t,{stroke:!1},"normal",xF.Series))}initTooltip(){this._tooltipHelper=new $$(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}Z$.type=kC.rangeArea,Z$.mark=q$;class J$ extends ij{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=qN,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};wk(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:[]};wk(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(PM.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&sj(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function Q$(t){return yA(t)?Number.parseFloat(t):0}const tq=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&eq(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ge(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[jN],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[jN]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},eq=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===Q$(t[e])))||!i&&0===t.reduce(((t,i)=>t+Q$(i[e])),0)));function iq(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const sq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:iq(t,!0,ZM.appear)}),nq={type:"fadeIn"},rq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:iq(t,!0,ZM.enter)}),aq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:iq(t,!0,ZM.exit)});function oq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return nq;case"growRadius":return sq(Object.assign(Object.assign({},t),{growField:"radius"}));default:return sq(Object.assign(Object.assign({},t),{growField:"angle"}))}}class lq extends yz{constructor(t,e){super(t,e),this.type=hq.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>he({x:0,y:0},this.getAttribute("centerOffset",e,i),e[GN])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class hq extends lq{constructor(){super(...arguments),this.type=hq.type}}hq.type="arc";const cq=()=>{$R(),xR(),oN("arc",bG),rI.registerBuiltInAnimate("growRadiusIn",eD),rI.registerBuiltInAnimate("growRadiusOut",iD),rI.registerBuiltInAnimate("growAngleIn",LI),rI.registerBuiltInAnimate("growAngleOut",FI),hw.registerGraphicComponent("arc",Xg),hw.registerMark(hq.type,hq)},dq=Object.assign(Object.assign({},RH),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class uq extends $H{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=lw({},this._theme,i,t);const n=(t,e)=>lw({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const pq=`${Rw}_LABEL_VISIBLE`,gq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},fq={outerRadius:!0};class mq extends J${constructor(){super(...arguments),this.transformerConstructor=uq,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:YC(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:YC(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=KN,this._endAngle=$N,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[GN];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return he(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=u(t),r=u(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(u(this._spec.startAngle)?ae(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?ae(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?ae(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;zM(this._dataSet,"pie",tq),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?ae(this._spec.minAngle):0,asStartAngle:VN,asEndAngle:WN,asRatio:NN,asMiddleAngle:GN,asRadian:XN,asQuadrant:YN,asK:UN,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Oa(this._dataSet,{name:`${Rw}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new KF(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},mq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:zw,groupKey:this._seriesField,isSeriesMark:!0},{morph:GH(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Sk(VN)(t)}endAngleScale(t){return Sk(WN)(t)}_computeLayoutRadius(){return ZN((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:VC(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:VC(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",xF.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",xF.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,xF.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",xF.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Sk(pq).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(PM.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),fq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),gq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[GN];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return he(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===ZM.appear)return this._startAngle;if(i===ZM.disappear)return this._endAngle;const r=[ZM.disappear,ZM.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[Fw];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Fw]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Fw])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Fw])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[GN]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[GN]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[GN]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[GN]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=NH(null===(i=hw.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}mq.transformerConstructor=uq,mq.mark=dq,mq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class vq extends mq{constructor(){super(...arguments),this.type=kC.pie}}vq.type=kC.pie;const yq=()=>{cq(),hw.registerAnimation("pie",((t,e)=>({appear:oq(t,e),enter:rq(t),exit:aq(t),disappear:{duration:Dz.disappear.duration}}))),hw.registerAnimation("emptyCircle",((t,e)=>({appear:oq(t,e)}))),hw.registerSeries(vq.type,vq)};function _q(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const bq=t=>({type:_q(t.growField),options:{overall:!0}}),xq={type:"fadeIn"},Sq=t=>({type:_q(t.growField)}),Aq=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function kq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return xq;case"growAngle":return bq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return bq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const Cq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class wq extends J${_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Cq)})}getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(Ww),this.setInnerRadiusField(Vw)}setValueFieldToPercent(){this.setRadiusField(Gw),this.setInnerRadiusField(Uw)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const Mq=Object.assign(Object.assign({},RH),{rose:{name:"rose",type:"arc"}});class Tq extends $H{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class Bq extends uV{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=hw.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=_F.Axis,this._tick=void 0,this._center=null,this._startAngle=KN,this._endAngle=$N,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),_k(this._regions,(t=>{"radius"===this.getOrient()?zN(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):zN(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:YC(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:YC(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:RN(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){_k(this._regions,(t=>{"radius"===this.getOrient()?zN(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):zN(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return wk(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:wk(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return he(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return ce(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>FN(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=re.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return ZN((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=qN,e=0;const i=this.getChart().getSpec();return _k(this.getRegions(),(s=>{const n=s;if(r=n.type,[kC.rose,kC.radar,kC.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;A(s)&&(t=s),A(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(lw({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(lw({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}Bq.type=n.polarAxis,Bq.specKey="axes";const Eq={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},Pq={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class Oq extends Bq{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new mC}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return zM(this._option.dataSet,t,yW),t}}Oq.type=n.polarLinearAxis,Oq.specKey="axes",Oq.builtInTheme={axis:iW,axisLinear:bW,axisAngle:Pq,axisRadius:Eq},U(Oq,fW);const Rq=()=>{hw.registerGraphicComponent(sV.lineAxis,((t,e)=>new tW(t,e))),hw.registerGraphicComponent(nV.lineAxisGrid,((t,e)=>new BV(t,e))),hw.registerGraphicComponent(sV.circleAxis,((t,e)=>new uG(t,e))),hw.registerGraphicComponent(nV.circleAxisGrid,((t,e)=>new MG(t,e))),pV(),hw.registerComponent(Oq.type,Oq)};class Iq extends Bq{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new $k}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return zM(this._option.dataSet,t,gG),t}transformScaleDomain(){}}Iq.type=n.polarBandAxis,Iq.specKey="axes",Iq.builtInTheme={axis:iW,axisBand:eW,axisAngle:Pq,axisRadius:Eq},U(Iq,mV);const Dq=()=>{hw.registerGraphicComponent(sV.lineAxis,((t,e)=>new tW(t,e))),hw.registerGraphicComponent(nV.lineAxisGrid,((t,e)=>new BV(t,e))),hw.registerGraphicComponent(sV.circleAxis,((t,e)=>new uG(t,e))),hw.registerGraphicComponent(nV.circleAxisGrid,((t,e)=>new MG(t,e))),pV(),hw.registerComponent(Iq.type,Iq)};class Lq extends wq{constructor(){super(...arguments),this.type=kC.rose,this.transformerConstructor=Tq,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(Lq.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:GH(this._spec,Lq.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>jC(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=jC(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(NH(null===(i=hw.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),VH("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}Lq.type=kC.rose,Lq.mark=Mq,Lq.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},Lq.transformerConstructor=Tq;const Fq=()=>{hw.registerSeries(Lq.type,Lq),cq(),hw.registerAnimation("rose",((t,e)=>({appear:kq(t,e),enter:Sq(t),exit:Aq(t),disappear:{duration:Dz.disappear.duration}}))),Dq(),Rq()};class zq extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:he(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=ce(this.from,this._prevCenter),{angle:i,radius:s}=ce(this.to,this._center);A(i*s)||(this.valid=!1),this._fromAngle=A(t)?t:i,this._fromRadius=A(e)?e:s,this._toAngle=i,this._toRadius=s,ck(this._fromAngle,this._toAngle)&&ck(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Hq extends Pz{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!yk(t)&&!yk(e))return e;const s=ce(t,this._prevCenter),n=ce(e,this._center);let r=ue(s.angle),a=ue(n.angle);!A(r)&&A(a)&&(r=a),A(r)&&!A(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new ne(s,n,r,a);return o.defined=e.defined,o}}const jq=t=>({type:"in"===t?"fadeIn":"fadeOut"});function Nq(t,e,i){return"fadeIn"===e?jq(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function Vq(t,e,i){return"fadeIn"===e?jq(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const Wq=(t,e)=>({custom:Bz,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),Uq=Object.assign(Object.assign(Object.assign({},RH),Sj),{area:{name:"area",type:"area"}});class Gq extends wq{constructor(){super(...arguments),this.type=kC.radar,this.transformerConstructor=yN,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(Gq.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:nH,closePath:!0},"normal",xF.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",xF.Series),this.event.on(PM.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:u(this._spec.startAngle)?ae(this._spec.startAngle):KN},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(NH(null===(s=hw.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),VH("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=hw.getAnimationInKey(e);t.setAnimationConfig(NH(null==i?void 0:i(n,r),VH(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}Gq.type=kC.radar,Gq.mark=Uq,Gq.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Gq.transformerConstructor=yN,U(Gq,kj);const Yq=()=>{hw.registerSeries(Gq.type,Gq),PU(),fN(),vN(),hw.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:Nq(t,e,"in"),enter:Nq(t,e,"in"),exit:Nq(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:Dz.disappear.duration},update:[{channel:["points","center"],custom:Hq,customParameters:t,duration:Dz.update.duration,easing:Dz.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),hw.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:Vq(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:Dz.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:zq,customParameters:t,duration:Dz.update.duration,easing:Dz.update.easing}]}))),hw.registerAnimation("radarGroup",((t,e)=>({appear:Wq(t,"in"),disappear:{duration:Dz.disappear.duration}}))),xR(),Dq(),Rq()};class Xq extends xH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>vi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const Kq=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(Rw)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[Fw]:r,[zw]:`${s}_${e}`})),r++}))})),n},$q={fill:"#bbb",fillOpacity:.2},qq=Object.assign(Object.assign({},RH),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),Zq={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},Jq={grid:{background:!0}};class Qq extends rj{constructor(){super(...arguments),this.type=kC.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Zq),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),Jq)})}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),zM(this._option.dataSet,"objFlat",Kq),zM(this._option.dataSet,"copyDataView",YM),HM(this._option.dataSet,"dataview",Ta),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:qM.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(lw($q,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(Qq.mark.group),this._containerMark=this._createMark(Qq.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(Qq.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(Qq.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(Qq.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(Qq.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(Qq.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(Qq.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-(null!==(t=this._spec.leftAppendPadding)&&void 0!==t?t:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",xF.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",xF.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",xF.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",xF.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",xF.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",xF.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",xF.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",xF.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",xF.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:Hw}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new FC).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:Hw}}initTooltip(){this._tooltipHelper=new Xq(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}Qq.type=kC.dot,Qq.mark=qq,Qq.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class tZ extends xH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>vi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const eZ=Object.assign(Object.assign({},RH),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),iZ=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class sZ extends rj{constructor(){super(...arguments),this.type=kC.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),zM(this._option.dataSet,"linkDotInfo",iZ),null===(t=this.getViewData())||void 0===t||t.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:qM.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(sZ.mark.group),this._containerMark=this._createMark(sZ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(sZ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(sZ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",xF.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",xF.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",xF.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",xF.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:Hw}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new tZ(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}sZ.type=kC.link,sZ.mark=eZ,sZ.builtInTheme={link:{arrow:{style:{size:10}}}};const nZ=Object.assign(Object.assign({},RH),{group:{name:"group",type:"group"}}),rZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class aZ extends J${constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?Vw:iM],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(i.offsetAngle);let o;if(u(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return d(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?Ww:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),rZ)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=u(n)?ae(n):KN;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?ae(r):$N,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||u(null==s?void 0:s.startAngle)||u(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=jC(this.angleAxisHelper.dataToPosition([t[Vw]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=jC(this.angleAxisHelper.dataToPosition([t[Ww]]),this.angleAxisHelper.getScale(0));if(A(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?jC(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(aZ.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",xF.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ae(a),o=ae(r)/2;return Xg(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[ag({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const cZ=()=>{hw.registerAnimation("circularProgress",((t,e)=>({appear:hZ(t,e),enter:{type:"growAngleIn"},disappear:{duration:Dz.disappear.duration}})))};class dZ extends $H{constructor(){super(...arguments),this._supportStack=!0}}const uZ={cornerRadius:!0,roundCap:!0};class pZ extends aZ{constructor(){super(...arguments),this.type=kC.circularProgress,this.transformerConstructor=dZ,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(A(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(A(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),uZ)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(pZ.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:GH(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",xF.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(pZ.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?Vw:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?Ww:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",xF.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(NH(null===(i=hw.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),VH("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(NH(null===(s=hw.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),VH("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}pZ.type=kC.circularProgress,pZ.mark=oZ,pZ.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},pZ.transformerConstructor=dZ;const gZ=()=>{hw.registerSeries(pZ.type,pZ),cq(),cZ(),Hz(),Dq(),Rq()};function fZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const mZ={type:"fadeIn"};function vZ(t,e="grow"){return!1===e?{}:"fadeIn"===e?mZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:fZ(t)}))(t)}class yZ extends xH{enableByType(t){return"dimension"!==t}}const _Z=Object.assign(Object.assign({},RH),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),bZ={bandWidth:!0,cornerRadius:!0,clamp:!0},xZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class SZ extends rj{constructor(){super(...arguments),this.type=kC.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=u(e.width)?e.width:e.x1-e.x,o=u(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),bZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),xZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(SZ.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return jC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return jC(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?jC(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",xF.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return jC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return jC(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?jC(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",xF.Series)}}_initTrackMark(){return this._trackMark=this._createMark(SZ.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return jC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",xF.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return jC(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",xF.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(NH(null===(i=hw.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),VH("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(NH(null===(s=hw.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),VH("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new yZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}SZ.type=kC.linearProgress,SZ.mark=_Z,SZ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const AZ=()=>{qX(),hw.registerAnimation("linearProgress",((t,e)=>({appear:vZ(t,e),enter:vZ(t),disappear:{duration:Dz.disappear.duration}}))),Hz(),hw.registerSeries(SZ.type,SZ)},kZ=[0],CZ=[20,40],wZ=[200,500],MZ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},TZ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class BZ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const EZ=`${Rw}_WORD_CLOUD_TEXT`,PZ=Object.assign(Object.assign({},RH),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),OZ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class RZ extends ij{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=CZ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:wZ,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:kZ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?EZ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:MZ},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||pA(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:kZ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!TZ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new BZ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var t;this._wordMark=this._createMark(RZ.mark.word,{key:zw,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(RZ.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:_F.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",xF.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",xF.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",xF.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(NH(hw.getAnimationInKey("wordCloud")(n,s),VH("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new FC).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:Hw])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new mC).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new mC).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[Fw])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!A(t)||!A(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,PM.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:zw,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:t_.createCanvas.bind(t_),getTextBounds:bf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Pg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}RZ.mark=PZ,RZ.builtInTheme={wordCloud:OZ};function IZ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||Dz.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=DZ(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,Ct(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Ct(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},LZ=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=LZ(t.children,e,t,n))})),s},FZ=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=FZ(t.children,e,t,n)),n=e(t,s,i,n)})),n},zZ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):zZ(t.children,e,i)))})),e};function HZ(t,e){let i,s;if(VZ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function VZ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*w*T))/(2*w):T/M);return{x:s+S+A*B,y:n+k+C*B,radius:B}}function YZ(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function XZ(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function KZ(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function $Z(t){return{_:t,next:null,prev:null}}function qZ(t,e){const i=(t=G(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];YZ(n,s,r);let a,o,l,h,c,d,u,p=$Z(s),g=$Z(n),f=$Z(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=DZ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Mt)/Mt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:tJ.defaultOpionts.nodeSort;LZ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)LZ([o],ZZ(h)),FZ([o],JZ(this._getPadding,.5,a)),LZ([o],QZ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);LZ([o],ZZ(tJ.defaultOpionts.setRadius)),FZ([o],JZ(Ot,1,a)),d&&FZ([o],JZ(this._getPadding,o.radius/t,a)),LZ([o],QZ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}tJ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const eJ=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=eJ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function iJ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){eJ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=d(t.value)?0:Ct(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Ct(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function sJ(t){return t.depth}function nJ(t,e){return e-1-t.endDepth}const rJ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),aJ=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},oJ={left:sJ,right:nJ,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:sJ,end:nJ},lJ=_t(0,1);class hJ{constructor(t){this._ascendingSourceBreadth=(t,e)=>rJ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>rJ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},hJ.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Et(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):oJ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return iJ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!d(r.source),l=!d(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&d(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[aJ(s[t.source]),aJ(s[t.target],!0)].filter((t=>!d(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Ct(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Ct(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(v(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*lJ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}d(this.options.nodeSortBy)&&n.sort(rJ),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(rJ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];cJ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),dJ);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},uJ.defaultOpionts,t):Object.assign({},uJ.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Et(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Pt(this.options.center[0],t.width),s=t.y0+Pt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>Pt(t,n))):Pt(r,n),h=y(a),c=this.options.gapRadius,u=h?a.map((t=>Pt(t,n))):Pt(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Pt(r,n),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=DZ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=he({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function pJ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,y=Math.max(v/x,x/m),y>_){f-=h;break}_=y}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:cJ,slice:pJ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?pJ:cJ)(t,e,i,s,n)}};class mJ{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},mJ.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Et(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?gJ(this.options.aspectRatio):null!==(e=fJ[this.options.splitType])&&void 0!==e?e:fJ.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=DZ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function vJ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+di?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return at.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=vJ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rwt(e)));u=Ii(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=yJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&at.getInstance().error("Area "+r+" not represented on screen")}return i}function CJ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*wJ({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},TJ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=G(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!E(G(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:G(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||bJ,s=e.lossFunction||_J,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];ui(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rre.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:MJ(f),arcs:f})}))},BJ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:EJ,triangle:EJ,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 EJ(){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 PJ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const OJ=t=>BJ[t]?BJ[t]():BJ.circle(),RJ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function IJ(t){return c(t)?t:function(){return t}}class DJ{constructor(t){var e,i;switch(this.options=z({},DJ.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=OJ(this.options.shape),this.getText=null!==(e=IJ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=IJ(this.options.fontWeight),this.getTextFontSize=IJ(this.options.fontSize),this.getTextFontStyle=IJ(this.options.fontStyle),this.getTextFontFamily=IJ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>RJ(10,50);break;case"random-light":this.getTextColor=()=>RJ(50,90);break;default:this.getTextColor=IJ(this.options.color)}if(d(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=c(this.options.rotate)?t=>{var e;return ae(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():wt(e);return ae(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!d(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class FJ extends DJ{constructor(t){var e;super(z({},FJ.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<=FJ.defaultOptions.minFontSize&&(this.options.minFontSize=FJ.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=LJ[this.options.spiral])&&void 0!==e?e:LJ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=IJ(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=PJ(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,y=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;y[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(NJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(jJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}NJ(p,this._size)&&(p=VJ(p,this._size))}else if(NJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||HJ(p,i))&&(!i||!zJ(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function zJ(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function HJ(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,NJ=(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 VJ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},UJ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>he(t,e,i+r*n)))},GJ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},YJ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=PJ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=OJ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return he(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)GJ(n,UJ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)GJ(n,UJ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)GJ(n,UJ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)GJ(n,UJ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)GJ(n,UJ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=UJ({x:l,y:h},o,-Math.PI/2,5),e=UJ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);GJ(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ function t(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let bY=class t extends lY{constructor(e){super(z({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,k,A).data;if(this.exceedTime())return null;const w=[];let T,C=S;const B=[x/2,S/2,x/2,S/2],E=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),tB[1]&&(B[1]=t),eB[2]&&(B[2]=e))}};for(;C--;)for(T=x;T--;)E(C,T,w);return{datum:t,occupied:w,bounds:B,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),q(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(p(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?mY(t,o,l.width,l.height,h):"geometric"===t.type&&yY(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=nY(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};bY.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class xY extends lY{constructor(t){super(z({},xY.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}xY.defaultOptions={enlarge:!1};const kY={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},AY=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return rt.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?MY(t.fontFamily):"sans-serif",d=t.fontStyle?MY(t.fontStyle):"normal",u=t.fontWeight?MY(t.fontWeight):"normal",p=t.rotate?MY(t.rotate):0,g=MY(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?MY(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,S=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},kY),t.as):kY,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?MY(t.fontSize):14;const C=t.fontSizeRange;if(C&&!x(T)){const t=T,e=TY(CY(t,l),C);T=i=>e(t(i))}let B=cY;"fast"===t.layoutType?B=xY:"grid"===t.layoutType&&(B=bY);const E=new B(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:S,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:E}:E.output()},MY=t=>v(t)||x(t)||c(t)||_(t)?t:e=>e[t.field],wY=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),TY=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=wY(t[0]),n=wY(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(wY(t)-r)/(a-r)*(e[1]-e[0])+e[0]},CY=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function BY(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{bI.registerGrammarTransform("wordcloud",{transform:AY}),yW(),bI.registerAnimation("wordCloud",((t,e)=>({appear:oG(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:fF.disappear.duration}}))),bI.registerSeries(EY.type,EY)},RY=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:f=!1,isCone:m=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(y*v)&&0!==v?y/v:0,S=k(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},OY=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},IY=`${UI}_FUNNEL_TRANSFORM_RATIO`,LY=`${UI}_FUNNEL_REACH_RATIO`,DY=`${UI}_FUNNEL_HEIGHT_RATIO`,FY=`${UI}_FUNNEL_VALUE_RATIO`,zY=`${UI}_FUNNEL_LAST_VALUE_RATIO`,jY=`${UI}_FUNNEL_NEXT_VALUE_RATIO`,HY=`${UI}_FUNNEL_LAST_VALUE`,VY=`${UI}_FUNNEL_CURRENT_VALUE`,NY=`${UI}_FUNNEL_NEXT_VALUE`,WY=`${UI}_FUNNEL_TRANSFORM_LEVEL`;class UY extends qF{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[LY])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return u(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class GY extends rF{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class YY extends GY{constructor(){super(...arguments),this.type=YY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}YY.type="polygon";const XY=()=>{bI.registerMark(YY.type,YY),oM(),eM(),kT.registerBuiltInAnimate("growPointsOut",kC),bI.registerGraphicComponent("polygon",lf)},$Y=Object.assign(Object.assign({},lz),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class KY extends Az{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class qY extends Mz{constructor(){super(...arguments),this.type=LO.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=KY,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;YL(this._dataSet,"funnel",RY),YL(this._dataSet,"funnelTransform",OY);const t=new Ba(this._dataSet,{name:`${UI}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new tF(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:VY,asTransformRatio:IY,asReachRatio:LY,asHeightRatio:DY,asValueRatio:FY,asNextValueRatio:jY,asLastValueRatio:zY,asLastValue:HY,asNextValue:NY,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:WY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},qY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:bz(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},qY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(qY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(qY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new UY(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,s;const n=this._funnelMark;n&&this.setMarkStyle(n,{points:t=>this.getPoints(t),visible:t=>u(t[this._valueField]),fill:this.getColorAttribute()},"normal",TD.Series);const r=this._funnelTransformMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",TD.Series);const a=this._funnelOuterLabelMark.label;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",TD.Series),c(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(a,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",TD.User_Mark));const o=this._funnelOuterLabelMark.line;if(o&&a){this.setMarkStyle(o,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",TD.Series);const n=null!==(i=null===(e=null===(t=this._spec.outerLabel)||void 0===t?void 0:t.line)||void 0===e?void 0:e.visible)&&void 0!==i?i:null===(s=this._spec.outerLabel)||void 0===s?void 0:s.visible;u(n)&&o.setVisible(n)}}initLabelMarkStyle(t){var e;if(!t)return;const i=t.getTarget(),s=t.getComponent();if(i===this._funnelMark){this._labelMark=t,this.setMarkStyle(t,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",TD.Series);const i=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&$y(i,this._funnelOuterLabelMark.label,s),this._funnelOuterLabelMark.line&&$y(i,this._funnelOuterLabelMark.line,null!==(e=this._funnelOuterLabelMark.label)&&void 0!==e?e:s)}else this._funnelTransformMark&&i===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*RO(LY).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",TD.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(mz(null===(s=bI.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),vz("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(mz(bI.getAnimationInKey("fadeInOut")(),vz(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(mz(bI.getAnimationInKey("funnel")({},o),vz(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(mz(null===(a=bI.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),vz("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[zY])/2:this._getSecondaryAxisLength(t[FY])/2,n=this._getSecondaryAxisLength(t[FY])/2):(s=this._getSecondaryAxisLength(t[FY])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[jY])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[WY])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return u(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[KI]===t[KI]));if(!u(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(x(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{XY(),yW(),EN(),bI.registerSeries(qY.type,qY),bI.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},vF))),bI.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:sC,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),yF()},JY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},QY=t=>{const e=t.filter((t=>t.context.diffState===CD.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},tX=(t,e,i)=>{if(E(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},eX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QY(i.parent.children),a=tX(r,s,n);return JY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QY(i.parent.children),a=tX(r,s,n);return JY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),iX=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},sX=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QY(i.parent.children),a=iX(r);return JY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QY(i.parent.children),a=iX(r);return JY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),nX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},rX=(t,e={})=>{if(!t)return[];const i=[];return dG(t,i,e),i},aX=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new jG(i).layout(t,{width:s,height:n})};class oX extends qF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var lX;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(lX||(lX={}));const hX=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(d(n))return t;if(i.type===lX.DrillDown){return G(wL(t,n,s,"children"))}if(i.type===lX.DrillUp){const e=TL(t,n,s,"children");if(e)return G(e)}return t};class cX{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=pN(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(n.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;YL(t,"drillFilter",hX),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(d(t.datum)||d(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!_(t)||E(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:lX.DrillDown},e().reRunAllTransform(),i.emit(jL.drill,{value:{path:t,type:lX.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!_(n)||E(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:lX.DrillUp},i().reRunAllTransform(),s.emit(jL.drill,{value:{path:n,type:lX.DrillUp},model:this}),n}}const dX=Object.assign(Object.assign({},lz),{sunburst:{name:"sunburst",type:"arc"}}),uX=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:ez,operations:["max","min","values"]}),t.push({key:iz,operations:["values"]}),t),pX={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class gX extends IW{constructor(){super(...arguments),this.type=LO.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:iz),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:KI},getRawData:()=>this.getRawData()}),this._startAngle=re(this._spec.startAngle),this._endAngle=re(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),YL(this._dataSet,"sunburstLayout",aX),YL(this._dataSet,"flatten",rX),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[u(this._centerX)?this._centerX:this.getLayoutRect().width/2,u(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return uX(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(YL(t.dataSet,"addVChartProperty",WF),t.transform({type:"addVChartProperty",options:{beforeCall:az.bind(this),call:oz}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(gX.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){d(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(u(this._offsetX)?this._offsetX:0),y:t=>t.y+(u(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},BD.STATE_NORMAL,TD.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(gX.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return p(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(u(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(u(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},BD.STATE_NORMAL,TD.Series)}initTooltip(){this._tooltipHelper=new oX(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(G(this.__innerRadius))[0],outerRadius:this._computeRadius(G(this.__outerRadius))[0],startAngle:G(this._startAngle)[0],endAngle:G(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(mz(null===(e=bI.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),vz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(mz(null===(e=bI.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),vz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}gX.type=LO.sunburst,gX.mark=dX,gX.builtInTheme={sunburst:pX},U(gX,cX);const fX=()=>{bI.registerSeries(gX.type,gX),YW(),yW(),yF(),bI.registerAnimation("sunburst",((t,e)=>({appear:nX(0,e),enter:eX(t),exit:sX(t),disappear:{duration:fF.disappear.duration}})))},mX=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new TG(i).layout(t,{width:s,height:n})};class vX extends qF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const _X=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},yX=Object.assign(Object.assign({},lz),{circlePacking:{name:"circlePacking",type:"arc"}});class bX extends Cz{constructor(){super(...arguments),this.type=LO.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:iz),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:KI},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();d(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),YL(this._dataSet,"circlePackingLayout",mX),YL(this._dataSet,"flatten",rX),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(YL(t.dataSet,"addVChartProperty",WF),t.transform({type:"addVChartProperty",options:{beforeCall:az.bind(this),call:oz}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(bX.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){d(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},BD.STATE_NORMAL,TD.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(bX.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},BD.STATE_NORMAL,TD.Series)}getStatisticFields(){return uX(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new vX(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(mz(null===(i=bI.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),vz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(mz(null===(e=bI.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),vz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}bX.type=LO.circlePacking,bX.mark=yX,bX.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},U(bX,cX);const xX=()=>{bI.registerSeries(bX.type,bX),YW(),yW(),_F(),bI.registerAnimation("circlePacking",((t,e)=>({appear:_X(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:fF.disappear.duration}})))},SX=(t,e,i)=>{e.forEach((e=>{d(e[i])||t.add(e[i]),e.children&&e.children.length>0&&SX(t,e.children,i)}))},kX=t=>{var e;if(!t||!_(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},AX=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new DG(e),r=[];return r.push(n.layout(s,i)),r},MX=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},wX=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class TX extends qF{constructor(){super(...arguments),this._getDimensionData=t=>{if(!d(null==t?void 0:t.source)&&!d(null==t?void 0:t.target)){if(x(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const CX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),BX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:CX(t),EX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class PX extends IT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class RX extends IT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const OX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},IX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class LX extends tW{constructor(){super(...arguments),this.type=LX.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?IX:OX,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}LX.type="linkPath";const DX=Object.assign(Object.assign({},lz),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class FX extends Az{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const zX=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class jX extends Cz{constructor(){super(...arguments),this.type=LO.sankey,this.transformerConstructor=FX,this._nodeLayoutZIndex=MD.Node,this._labelLayoutZIndex=MD.Label,this._viewBox=new je,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(u(a))return a;if(u(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(u(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=x(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getGraphics();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getGraphics();s&&s.length&&(i.forEach((t=>{t.removeState(BD.STATE_SANKEY_EMPHASIS),t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE)})),s.forEach((t=>{t.removeState(BD.STATE_SANKEY_EMPHASIS),t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=t=>{const e=IL(t),i=[e.key];if(this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=IL(t);n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(BD.STATE_SANKEY_EMPHASIS,!0)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(BD.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(BD.STATE_SANKEY_EMPHASIS),t.addState(BD.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=IL(t),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),zX(e,BD.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(BD.STATE_SANKEY_EMPHASIS),e.addState(BD.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=IL(t),s=this._nodeMark.getGraphics();if(!s||!s.length)return;const n=this._linkMark.getGraphics();if(!n||!n.length)return;const r=(null===(e=IL(n[0]))||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=IL(n),d=(null==c?void 0:c.parents)?"parents":"source";if(G(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;const n=IL(t);e.includes(null!==(s=n.key)&&void 0!==s?s:n.index)?(t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(BD.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(BD.STATE_SANKEY_EMPHASIS),t.addState(BD.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(G(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const a=IL(s),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return s.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),void zX(s,BD.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),void zX(s,BD.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState(BD.STATE_SANKEY_EMPHASIS),s.addState(BD.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{const e=this._nodeMark.getGraphics();if(!e||!e.length)return;const i=this._linkMark.getGraphics();if(!i||!i.length)return;if("source"===(IL(t)?"parents":"source"))this._linkMark&&i.forEach((t=>{t.removeState(BD.STATE_SANKEY_EMPHASIS),t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&e.forEach((t=>{t.removeState(BD.STATE_SANKEY_EMPHASIS),t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const s=IL(t),n=[s.source,s.target],r=[];G(s.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),i.forEach((t=>{const e=IL(t),i=e.datum;if(e.source===s.source&&e.target===s.target)return t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),void zX(t,BD.STATE_SANKEY_EMPHASIS,{ratio:1});const a=i?i.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(s.source)&&e.includes(s.target)})):null;if(a&&a.length){n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target);const i=a.filter((t=>t.parents.some(((e,i)=>{var n;return e.key===s.source&&(null===(n=t.parents[i+1])||void 0===n?void 0:n.key)===s.target})))).reduce(((t,e)=>t+e.value),0),r=i/e.value;return t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),void zX(t,BD.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===e.source&&t.target===e.target));if(o)return n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target),t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),void zX(t,BD.STATE_SANKEY_EMPHASIS,{ratio:o.value/e.value});t.removeState(BD.STATE_SANKEY_EMPHASIS),t.addState(BD.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(e,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){YL(this._dataSet,"sankeyLayout",AX),YL(this._dataSet,"sankeyFormat",kX),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:nD.sankeyLayout});const{dataSet:a}=this._option;YL(a,"sankeyNodes",MX),YL(a,"flatten",rX);const o=new Ba(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:nz.bind(this),call:rz}},!1),this._nodesSeriesData=o,YL(a,"sankeyLinks",wX);const l=new Ba(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:nz.bind(this),call:rz}},!1),this._linksSeriesData=l}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(jX.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(jX.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=G(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=G(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},BD.STATE_NORMAL,TD.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",TD.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(i.setGlyphConfig({direction:this.direction}),this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},BD.STATE_NORMAL,TD.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",TD.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(d(t)||d(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=jF(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(mz(null===(i=bI.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),vz("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(mz(null===(s=bI.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),vz("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:VL.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([BD.STATE_SANKEY_EMPHASIS_REVERSE,BD.STATE_SANKEY_EMPHASIS]),e.includes(IL(t).key)?t.addState(BD.STATE_SANKEY_EMPHASIS,!0):t.addState(BD.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new TX(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!d(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new $O;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{u(t[i])&&e.add(t[i]),u(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return SX(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}jX.type=LO.sankey,jX.transformerConstructor=FX,jX.mark=DX,jX.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const HX=()=>{DV(),eW(),QA(),bI.registerGraphicComponent("path",(t=>Jg(t))),bI.registerMark(LX.type,LX),yW(),bI.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:BX(t,e)},vF))),bI.registerAnimation("sankeyLinkPath",((t,e)=>({appear:EX(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:fF.disappear.duration}}))),kT.registerBuiltInAnimate("linkPathGrowOut",RX),kT.registerBuiltInAnimate("linkPathGrowIn",PX),yF(),bI.registerSeries(jX.type,jX)},VX=(t,e)=>{let i={},s=e.fields;if(c(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=rX(n);return i=JF([{latestData:r}],e),i};class NX extends qF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const WX=Object.assign(Object.assign({},lz),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),UX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class GX extends Az{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const YX=(t,e)=>{if(e.getViewBox()){const i=new WG(e).layout(t,e.getViewBox()),s=[];return dG(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[iz,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class XX extends Cz{constructor(){super(...arguments),this.type=LO.treemap,this.transformerConstructor=GX,this._categoryField="name",this._valueField="value",this._viewBox=new je,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:iz),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ne),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:KI},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),YL(this._dataSet,"treemap",YX),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YL(this._rawData.dataSet,"addVChartProperty",WF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:az.bind(this),call:oz}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=VX([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){YL(this._dataSet,"hierarchyDimensionStatistics",VX),YL(this._dataSet,"flatten",rX);const i=new Ba(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 uX(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(XX.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(XX.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},BD.STATE_NORMAL,TD.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()},BD.STATE_NORMAL,TD.Series)}_initRichStyleOfLabelMark(t){"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},BD.STATE_NORMAL,TD.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},BD.STATE_NORMAL,TD.Series),this._initRichStyleOfLabelMark(t))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},BD.STATE_NORMAL,TD.Series),this._initRichStyleOfLabelMark(t))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(mz(null===(e=bI.getAnimationInKey("treemap"))||void 0===e?void 0:e(),vz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new NX(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(FL.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(FL.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}XX.type=LO.treemap,XX.mark=WX,XX.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},XX.transformerConstructor=GX,U(XX,cX),U(XX,fN);const $X=()=>{bI.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),bI.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),DV(),yW(),bI.registerAnimation("treemap",((t,e)=>({appear:UX(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:fF.disappear.duration}}))),yF(),bI.registerSeries(XX.type,XX)},KX=Object.assign(Object.assign({},LU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),qX=Object.assign(Object.assign({},lz),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),ZX={type:"fadeIn"};function JX(t,e){return"fadeIn"===e?ZX:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class QX extends Az{constructor(){super(...arguments),this._supportStack=!1}}class t$ extends qF{enableByType(t){return"dimension"!==t}}const e$="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",i$={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:e$,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:e$,fill:"#ddd"}}};class s$ extends DU{constructor(){super(...arguments),this.type=LO.gaugePointer,this.transformerConstructor=QX,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(s$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},s$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(s$.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new t$(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return u(this.radiusAxisHelper)&&u(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=$(e),n=mt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(mz(null===(i=bI.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),vz("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}s$.type=LO.gaugePointer,s$.mark=qX,s$.builtInTheme={gaugePointer:i$},s$.transformerConstructor=QX;const n$=()=>{bI.registerSeries(s$.type,s$),lN(),DV(),bI.registerAnimation("gaugePointer",((t,e)=>{const i=JX(t,e);return{appear:i,enter:i,disappear:{duration:fF.disappear.duration}}})),gU(),uU()};class r$ extends Az{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class a$ extends DU{constructor(){super(...arguments),this.type=LO.gauge,this.transformerConstructor=r$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=re(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();YL(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[gL]=t[this._angleField[0]],t[pL]=e>0?i[e-1][gL]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(a$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(a$.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t&&"segment"===t.name){const e=this.getSpec().segment;if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,TD.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?ZO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?ZO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return u(t[pL])?this.angleAxisHelper.dataToPosition([t[pL]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[gL]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(mz(null===(i=bI.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),vz("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}a$.type=LO.gauge,a$.mark=KX,a$.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},a$.transformerConstructor=r$;class o$ extends rF{constructor(){super(...arguments),this.type=o$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Tg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="rect":a.symbolType=o,a}}o$.type="cell";function l$(t){return!1===t?{}:{type:"fadeIn"}}class h$ extends qF{enableByType(t){return"dimension"!==t}}const c$=Object.assign(Object.assign({},lz),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class d$ extends Az{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class u$ extends Cz{constructor(){super(...arguments),this.type=LO.heatmap,this.transformerConstructor=d$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=G(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(u$.mark.cell,{isSeriesMark:!0},{morph:bz(this._spec,u$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(u$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",TD.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=ni(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",TD.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Tz(this);this._cellMark.setAnimationConfig(mz(null===(i=bI.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),vz("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new h$(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}u$.type=LO.heatmap,u$.mark=c$,u$.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},u$.transformerConstructor=d$;const p$=()=>{yW(),bI.registerMark(o$.type,o$),bI.registerGraphicComponent("symbol",Tg),oM(),hM(),KE(),bI.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},vF),{appear:l$(e)}))),hH(),rH(),bI.registerSeries(u$.type,u$)},g$=Object.assign(Object.assign({},lz),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),f$=`${UI}_CORRELATION_X`,m$=`${UI}_CORRELATION_Y`,v$=`${UI}_CORRELATION_SIZE`,_$=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const y=e.view();if(y.x1-y.x0==0||y.y1-y.y0==0||y.x1-y.x0==-1/0||y.x1-y.x0==1/0||y.y1-y.y0==-1/0||y.y1-y.y0==1/0)return t;const b=re(null!==(i=e.startAngle)&&void 0!==i?i:-90),S=re(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((y.x1-y.x0)/2,(y.y1-y.y0)/2),A=Et(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=Et(e.outerRadius,k),w=[x(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:y.x0+Et(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",y.x1-y.x0),x(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:y.y0+Et(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",y.y1-y.y0)],T=Bt(e.field),C=t.map(T),[B,E]=Rt(C),P=B===E?t=>(A+M)/2:t=>A+(M-A)*(t-B)/(E-B),R=d(e.radiusField)?T:Bt(e.radiusField),O=null!==(p=null===(u=null==e?void 0:e.radiusRange)||void 0===u?void 0:u[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Rt(t.map(R)):[B,E],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,S),D=Math.max(b,S),F=y$(L,D,t.length),z=[],j=(D-L)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=I(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),b$({x:n,y:r,size:s},z)||n-sy.x1||r-sy.y1);t++)t<59&&(a+=j,a>D?a=L:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},b$=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!_(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[$I]:null==n?void 0:n[$I],[qI]:null==n?void 0:n[qI]}};class S$ extends tW{constructor(){super(...arguments),this.type=S$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=mt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}S$.type="ripple";const k$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class A$ extends Az{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class M$ extends IW{constructor(){super(...arguments),this.type=LO.correlation,this.transformerConstructor=A$,this._viewBox=new je}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){u(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){u(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){u(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;YL(this._dataSet,"correlation",_$);const s=new Ca;XL(s,"dataview",Ma),YL(s,"correlationCenter",x$);const n=new Ba(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new tF(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const t=this._createMark(M$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:$I});t&&(t.setMarkConfig({zIndex:MD.Node}),this._nodePointMark=t);const e=this._createMark(M$.mark.ripplePoint,{key:$I,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});e&&(this._ripplePointMark=e);const i=this._createMark(M$.mark.centerPoint,{key:$I,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(i.setMarkConfig({zIndex:MD.Node}),this._centerPointMark=i)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[f$],y:t=>t[m$],size:t=>t[v$],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},BD.STATE_NORMAL,TD.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},BD.STATE_NORMAL,TD.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},BD.STATE_NORMAL,TD.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},BD.STATE_NORMAL,TD.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(mz(null===(e=bI.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),vz("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}M$.type=LO.correlation,M$.mark=g$,M$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},M$.transformerConstructor=A$;const w$=()=>{tj(),eW(),hM(),bI.registerMark(S$.type,S$),bI.registerGraphicComponent("symbol",(t=>Tg(t))),bI.registerSeries(M$.type,M$),bI.registerAnimation("correlation",((t,e)=>Object.assign({appear:k$(0,e)},mF)))},T$=Object.assign(Object.assign({},lz),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class C$ extends tW{constructor(){super(...arguments),this.type=C$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}C$.type="liquid";const B$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class E$ extends qF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class P$ extends Mz{constructor(){super(...arguments),this.type=LO.liquid,this.transformerConstructor=ej,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Ig({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Tg({x:s,y:n,size:r,symbolType:B$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){u(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=aI(this._spec.outlineMargin),this._paddingSpec=aI(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Ut(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(P$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(P$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(P$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(P$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",TD.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",TD.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",TD.Series)}initTooltip(){this._tooltipHelper=new E$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(mz(null===(i=bI.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),vz("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(mz(null===(s=bI.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),vz("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(jL.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=OM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}P$.type=LO.liquid,P$.mark=T$,P$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},P$.transformerConstructor=ej;const R$=t=>G(t).join(",");class O$ extends qF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>R$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>R$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const I$=Object.assign(Object.assign({},lz),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class L$ extends Az{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const D$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?eY(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class F$ extends Mz{constructor(){super(...arguments),this.type=LO.venn,this.transformerConstructor=L$,this._viewBox=new je}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:KI)}initData(){var t;super.initData(),YL(this._dataSet,"venn",D$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(F$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(F$.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},BD.STATE_NORMAL,TD.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},BD.STATE_NORMAL,TD.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},BD.STATE_HOVER,TD.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>R$(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},BD.STATE_NORMAL,TD.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>R$(t.sets)},BD.STATE_NORMAL,TD.Series))}initTooltip(){this._tooltipHelper=new O$(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:R$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return R$(i)}legendSelectedFilter(t,e){if(t.type===n.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[R$(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>G(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(R$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(mz(null===(e=bI.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),vz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(mz(null===(e=bI.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),vz(t.name,this._spec,this._markAttributeContext)))}))}}F$.type=LO.venn,F$.mark=I$,F$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},F$.transformerConstructor=L$;class z$ extends VV{constructor(){super(...arguments),this.type=LO.mosaic,this.transformerConstructor=HV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(cL),this.setFieldX2(hL)),this.setFieldY(uL),this.setFieldY2(dL)):(t&&(this.setFieldY(cL),this.setFieldY2(hL)),this.setFieldX(uL),this.setFieldX2(dL)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&d(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];d(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}z$.type=LO.mosaic,z$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},z$.transformerConstructor=HV;class j$ extends LH{_isValidSeries(t){return t===LO.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class H$ extends OH{constructor(){super(...arguments),this.transformerConstructor=j$,this.type="map",this.seriesType=LO.map}}H$.type="map",H$.seriesType=LO.map,H$.transformerConstructor=j$;const V$=()=>{fV(),_N(),lN(),bI.registerSeries(bN.type,bN),bI.registerImplement("registerMap",ZL),bI.registerImplement("unregisterMap",JL),yF(),bI.registerChart(H$.type,H$)};class N$ extends LH{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=G(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return u(r)&&n.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),u(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class W$ extends N${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),d(l.type)&&(l.type="linear"),d(o.type)&&(o.type="band");const h=pj(l,{min:0,max:1});d(l.min)&&(l.min=h.min),d(l.max)&&(l.max=h.max),s&&Object.assign(l,yI({},s,l)),n&&Object.assign(o,yI({},n,o))}}class U$ extends N${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class G$ extends N${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class Y$ extends OH{constructor(){super(...arguments),this.transformerConstructor=G$}}Y$.transformerConstructor=G$;class X$ extends Y${constructor(){super(...arguments),this.transformerConstructor=G$,this.type="pie",this.seriesType=LO.pie}}X$.type="pie",X$.seriesType=LO.pie,X$.transformerConstructor=G$;class $$ extends U${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Bj,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Bj,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&d(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=G(t.crosshair||{}).map((t=>yI({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const K$=(t,e)=>{if(!t)return null;const i=Nz(t,(t=>"angle"===t.getOrient()),e),s=Nz(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&gB(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=wO({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=TO(u),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=Hz(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&gB(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=wO({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=TO(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=Hz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class q$ extends OH{constructor(){super(...arguments),this.transformerConstructor=$$,this.type="rose",this.seriesType=LO.rose}_setModelOption(){this._modelOption.getDimensionInfo=K$}}q$.type="rose",q$.seriesType=LO.rose,q$.transformerConstructor=$$,U(q$,HH);const Z$=()=>{pV(),fV(),UH(),WH(),mU(),bI.registerChart(q$.type,q$)};class J$ extends U${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=yI({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=G(t.crosshair||{}).map((t=>yI({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class Q$ extends OH{constructor(){super(...arguments),this.transformerConstructor=J$,this.type="radar",this.seriesType=LO.radar}_setModelOption(){this._modelOption.getDimensionInfo=K$}}Q$.type="radar",Q$.seriesType=LO.radar,Q$.transformerConstructor=J$,U(Q$,HH);const tK=()=>{pV(),fV(),vV(),UH(),WH(),MU(),bI.registerChart(Q$.type,Q$)};class eK extends LH{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=p(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{P(e,"trimPadding")&&yI(e,xD(this.type,t))})),this._transformAxisSpec(t)}}class iK extends OH{constructor(){super(...arguments),this.transformerConstructor=eK,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=qH(t,e,i))&&void 0!==s?s:[],...null!==(n=K$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=JH,this._modelOption.getRectByDimensionData=nV}}iK.type="common",iK.transformerConstructor=eK,U(iK,HH);class sK extends DH{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class nK extends OH{constructor(){super(...arguments),this.transformerConstructor=sK}}nK.transformerConstructor=sK,U(nK,HH);class rK extends sK{transformSpec(t){super.transformSpec(t),_D(t)}}class aK extends nK{constructor(){super(...arguments),this.transformerConstructor=rK,this.type="histogram",this.seriesType=LO.bar}_setModelOption(){this._modelOption.getDimensionInfo=qH,this._modelOption.getDimensionInfoByValue=JH,this._modelOption.getRectByDimensionData=nV}}aK.type="histogram",aK.seriesType=LO.bar,aK.transformerConstructor=rK;const oK=()=>{pV(),fV(),vV(),UH(),WH(),NV(),bI.registerTransform("bin",Xr),bI.registerChart(aK.type,aK)};class lK extends W${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class hK extends OH{constructor(){super(...arguments),this.transformerConstructor=lK,this.type="circularProgress",this.seriesType=LO.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=K$}}hK.type="circularProgress",hK.seriesType=LO.circularProgress,hK.transformerConstructor=lK,U(hK,HH);const cK=()=>{pV(),fV(),UH(),WH(),WU(),bI.registerChart(hK.type,hK)};class dK extends W${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=LO.circularProgress,e}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===LO.gauge||t.type===LO.circularProgress));d(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(d(a.radiusField)&&d(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),d(a.valueField)&&d(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===LO.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:MD.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),d(i.angle.type)&&(i.angle.type="linear"),d(i.radius.type)&&(i.radius.type="linear"),d(i.angle.zIndex)&&(i.angle.zIndex=MD.Region+50)}}class uK extends OH{constructor(){super(...arguments),this.transformerConstructor=dK,this.type="gauge",this.seriesType=LO.gaugePointer}}uK.type="gauge",uK.seriesType=LO.gaugePointer,uK.transformerConstructor=dK;const pK=()=>{fV(),n$(),bI.registerSeries(a$.type,a$),YW(),HU(),uU(),WU(),bI.registerChart(uK.type,uK)};class gK extends LH{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class fK extends OH{constructor(){super(...arguments),this.transformerConstructor=gK,this.type="wordCloud",this.seriesType=LO.wordCloud}}fK.transformerConstructor=gK;class mK extends fK{constructor(){super(...arguments),this.transformerConstructor=gK,this.type="wordCloud",this.seriesType=LO.wordCloud}}mK.type="wordCloud",mK.seriesType=LO.wordCloud,mK.transformerConstructor=gK;const vK=()=>{fV(),PY(),bI.registerChart(mK.type,mK)};class _K extends LH{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class yK extends OH{constructor(){super(...arguments),this.transformerConstructor=_K,this.type="funnel",this.seriesType=LO.funnel}}yK.type="funnel",yK.seriesType=LO.funnel,yK.transformerConstructor=_K;const bK=()=>{fV(),ZY(),bI.registerChart(yK.type,yK)};class xK extends DH{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="band"),d(i.type)&&(i.type="linear");const n=pj(i,{min:0,max:1});d(i.min)&&(i.min=n.min),d(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="linear"),d(e.type)&&(e.type="band");const n=pj(s,{min:0,max:1});d(s.min)&&(s.min=n.min),d(s.max)&&(s.max=n.max)}}}class SK extends OH{constructor(){super(...arguments),this.transformerConstructor=xK,this.type="linearProgress",this.seriesType=LO.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=qH,this._modelOption.getDimensionInfoByValue=JH,this._modelOption.getRectByDimensionData=nV}}SK.type="linearProgress",SK.seriesType=LO.linearProgress,SK.transformerConstructor=xK,U(SK,HH);const kK=()=>{pV(),fV(),UH(),WH(),qU(),bI.registerChart(SK.type,SK)};class AK extends DH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),_D(t)}}class MK extends OH{constructor(){super(...arguments),this.transformerConstructor=AK,this.type="rangeColumn",this.seriesType=LO.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=qH,this._modelOption.getDimensionInfoByValue=JH,this._modelOption.getRectByDimensionData=nV}}MK.type="rangeColumn",MK.seriesType=LO.rangeColumn,MK.transformerConstructor=AK;const wK=()=>{pV(),fV(),UH(),WH(),CW(),bI.registerChart(MK.type,MK)};class TK extends LH{_getDefaultSeriesSpec(t){const e=u(t.startAngle)?t.startAngle:-90,i=u(t.endAngle)?t.endAngle:e+ae(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class CK extends OH{constructor(){super(...arguments),this.transformerConstructor=TK,this.type="sunburst",this.seriesType=LO.sunburst}}CK.type="sunburst",CK.seriesType=LO.sunburst,CK.transformerConstructor=TK;const BK=()=>{fV(),fX(),bI.registerChart(CK.type,CK)};class EK extends LH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class PK extends OH{constructor(){super(...arguments),this.transformerConstructor=EK,this.type="circlePacking",this.seriesType=LO.circlePacking}}PK.type="circlePacking",PK.seriesType=LO.circlePacking,PK.transformerConstructor=EK;const RK=()=>{fV(),xX(),bI.registerChart(PK.type,PK)};class OK extends LH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class IK extends OH{constructor(){super(...arguments),this.transformerConstructor=OK,this.type="treemap",this.seriesType=LO.treemap}}IK.type="treemap",IK.seriesType=LO.treemap,IK.transformerConstructor=OK;const LK=()=>{fV(),$X(),bI.registerChart(IK.type,IK)};class DK extends WV{transformSpec(t){super.transformSpec(t),t.legends&&G(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),_D(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class FK extends UV{constructor(){super(...arguments),this.transformerConstructor=DK,this.type="waterfall",this.seriesType=LO.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=qH,this._modelOption.getDimensionInfoByValue=JH,this._modelOption.getRectByDimensionData=nV}}FK.type="waterfall",FK.seriesType=LO.waterfall,FK.transformerConstructor=DK;const zK=()=>{pV(),fV(),vV(),UH(),WH(),KN(),bI.registerChart(FK.type,FK)};class jK extends DH{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),_D(t)}}class HK extends OH{constructor(){super(...arguments),this.transformerConstructor=jK,this.type="boxPlot",this.seriesType=LO.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=qH,this._modelOption.getDimensionInfoByValue=JH,this._modelOption.getRectByDimensionData=nV}}HK.type="boxPlot",HK.seriesType=LO.boxPlot,HK.transformerConstructor=jK;const VK=()=>{pV(),fV(),UH(),WH(),vW(),bI.registerTransform("boxplot",$r),bI.registerChart(HK.type,HK)};class NK extends LH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class WK extends OH{constructor(){super(...arguments),this.transformerConstructor=NK,this.type="sankey",this.seriesType=LO.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=IL(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}WK.type="sankey",WK.seriesType=LO.sankey,WK.transformerConstructor=NK;const UK=()=>{fV(),yo.load(wM),HX(),bI.registerChart(WK.type,WK)};class GK extends DH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),_D(t)}}class YK extends OH{constructor(){super(...arguments),this.transformerConstructor=GK,this.type="rangeArea",this.seriesType=LO.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=qH,this._modelOption.getDimensionInfoByValue=JH,this._modelOption.getRectByDimensionData=nV}}YK.type="rangeArea",YK.seriesType=LO.rangeArea,YK.transformerConstructor=GK;const XK=()=>{pV(),fV(),vV(),UH(),WH(),xV(),hH(),rH(),bI.registerSeries(OW.type,OW),bI.registerChart(YK.type,YK)};class $K extends DH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class KK extends OH{constructor(){super(...arguments),this.transformerConstructor=$K,this.type="heatmap",this.seriesType=LO.heatmap}}KK.type="heatmap",KK.seriesType=LO.heatmap,KK.transformerConstructor=$K;const qK=()=>{fV(),p$(),bI.registerChart(KK.type,KK)};class ZK extends LH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class JK extends OH{constructor(){super(...arguments),this.transformerConstructor=ZK,this.type="correlation",this.seriesType=LO.correlation}}JK.type="correlation",JK.seriesType=LO.correlation,JK.transformerConstructor=ZK;const QK=()=>{fV(),w$(),bI.registerChart(JK.type,JK)};function tq(t){var e,i;const s=Object.assign({},t);return E(t.style)||(s.textStyle=RL(t.style)),E(t.textStyle)||yI(s.textStyle,RL(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&RL(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&RL(s.background.style),s}const eq=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},iq=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const p={};c.forEach((t=>{p[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:qI;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===p[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===p[t.source]&&!0===p[t.target])))):u(g)&&(t=t.filter((t=>!0===p[r.getSeriesFieldValue(t,g)]))),t)};class sq extends Lj{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=MD.Legend,this.layoutLevel=wD.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{BO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),BO(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=tI(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;u(s)&&(this._seriesUserId=G(s)),u(e)&&(this._regionUserId=G(e)),u(n)&&(this._seriesIndex=G(n)),u(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(N(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new tF(this._option,t),this._initSelectedData(),BO(this._regions,(t=>{t.event.on(jL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;d(t)||JSON.stringify(n)===JSON.stringify(t)||(BO(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(jL.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)N(s,this._cacheAttrs)||this._legendComponent.setAttributes(yI({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(yI({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());N(t,this._cacheAttrs)||this._legendComponent.setAttributes(yI({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(jL.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}sq.specKey="legends";class nq extends sq{constructor(){super(...arguments),this.type=n.discreteLegend,this.name=n.discreteLegend}static getSpecInfo(t){return HF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),BO(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:nD.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){YL(this._option.dataSet,"discreteLegendFilter",iq),YL(this._option.dataSet,"discreteLegendDataMake",eq);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return BO(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!ob(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return c(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=yL(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(e){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(e,i){const s=t(e,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=e;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=tq(n):l.title={visible:!1},E(r.focusIconStyle)||RL(r.focusIconStyle),r.shape&&(r.shape=BL(r.shape)),r.label&&(r.label=BL(r.label)),r.value&&(r.value=BL(r.value)),r.background&&(r.background=BL(r.background)),eI(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),eI(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),eI(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(E(a.railStyle)||RL(a.railStyle),E(a.sliderStyle)||RL(a.sliderStyle)):(E(a.textStyle)||RL(a.textStyle),a.handler&&BL(a.handler)),l.pager=a,o.visible&&!E(o.style)&&(yI(l,o.style),u(o.padding)&&(l.padding=o.padding)),l}(this._spec,e)),{maxWidth:e.width,maxHeight:e.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return FR}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(ER.legendItemClick,(e=>{const i=P(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(jL.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(ER.legendItemHover,(t=>{const e=P(t,"detail");this.event.emit(jL.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(ER.legendItemUnHover,(t=>{const e=P(t,"detail");this.event.emit(jL.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return c(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=jF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=jF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}nq.specKey="legends",nq.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},nq.type=n.discreteLegend;const rq=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},aq=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!p(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!E(o)){const[e,i]=o;return a?a(t,o,l):h(t)?CL(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function oq(e){const i=yI({},e),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:d,background:p={},type:g,id:f,visible:m,orient:v,position:_,data:y,defaultSelected:b,field:x,filter:S,regionId:k,regionIndex:A,seriesIndex:M,seriesId:w,padding:T}=i,C=t(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?C.title=tq(s):C.title={visible:!1},C.showHandler=!1!==n.visible,E(n.style)||(C.handlerStyle=RL(n.style)),u(r.width)&&(C.railWidth=r.width),u(r.height)&&(C.railHeight=r.height),E(r.style)||(C.railStyle=RL(r.style)),E(a.style)||(C.trackStyle=RL(a.style)),C.startText=BL(o),C.endText=BL(l),C.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return c(i)?e.style=(t,e,s)=>RL(i(t,e,s)):E(i)||(e.style=RL(i)),e}(h),E(d)||(C.sizeBackground=RL(d)),p.visible&&!E(p.style)&&(yI(C,p.style),u(p.padding)&&(C.padding=p.padding)),C}const lq={color:NR,size:UR},hq={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},cq=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},hq),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},dq={horizontal:cq(!0),vertical:cq(!1)},uq=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},hq),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},pq={horizontal:uq(!0),vertical:uq(!1)},gq=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],fq=[2,10];class mq extends sq{static getSpecInfo(t){const e=HF(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?n.colorLegend:n.sizeLegend})),e}constructor(t,e){super(t,e),this.type=n.colorLegend,this.name=n.colorLegend;const i="color"===this._spec.type?n.colorLegend:n.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),BO(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData,customFilter:this._spec.customFilter},level:nD.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){YL(this._option.dataSet,"continuousLegendFilter",aq),YL(this._option.dataSet,"continuousLegendDataMake",rq);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>EO(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=yL(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!ob(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=yL(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),E(r)&&(r="color"===this._legendType?gq:fq);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 h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},oq(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return lq[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",bt((e=>{const i=P(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(jL.legendFilter,{model:this,value:i,event:e})}),30))}}}mq.specKey="legends",mq.builtInTheme={colorLegend:dq,sizeLegend:pq},mq.type=n.continuousLegend;const vq=()=>{bI.registerComponent(mq.type,mq)},_q=(t,e)=>u(e)?t.map((t=>e[t])):void 0,yq=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),bq=t=>!d(t)&&(_(t)?t.length>0&&t.every(u):Object.keys(t).length>0);function xq(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),p=i.getOption(),g=p.getRegionsInUserIdOrIndex(u(c.regionId)?[c.regionId]:void 0,u(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=Sq(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=p.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>yq(i,s)(t)&&yq(n,r)(t)&&(d(a)||yq([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),k=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{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=>x(t))))&&void 0!==i?i:[]}}))}];u(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=p.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:HL.chart,event:k({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=p.globalInstance;return OF.globalConfig.uniqueTooltip&&OF.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=p.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:HL.chart,event:k(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=p.globalInstance;return OF.globalConfig.uniqueTooltip&&OF.hideTooltip(a.id),m}return"none"}const Sq=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),p=e.getMeasureField(),g=e.getSeriesField(),f=u(g)?t[g]:void 0,m=u(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=_q(c,t);let _=_q(p,t);const y=bq(_),b=!y&&u(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(yq(c,v));if(!y&&(_=_q(p,i),!bq(_)))return;const n=e.type===LO.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=gB(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>d(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(yq(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=_q(p,o),!bq(_))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(yq(c,n));if(!y&&(_=_q(p,r),!bq(_)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===LO.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(yq(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=_q(p,i),!bq(_))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(yq(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=_q(p,a),h=_,!bq(_)&&!a)return;bq(_)||(_=[null])}const u=e.dataToPosition(a);d(u)||isNaN(u.x)||isNaN(u.y)||s.push({pos:u,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},kq=t=>u(t)&&!_(t),Aq=t=>u(t)&&_(t),Mq=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class wq extends Ij{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=yI({},...Mq.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=yI({},s);Mq.forEach((t=>{delete r[t]})),delete r.style;const a=yI({},r,i);return a.style=yI({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return u(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:sb(this._option.mode)||!eb(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,u(t.parentElement)?v(t.parentElement)&&(t.parentElement=O_.getElementById(t.parentElement)):eb(this._option.mode)&&(t.parentElement=null==tb?void 0:tb.body)}}const Tq={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class Cq extends Lj{constructor(){super(...arguments),this.layoutZIndex=1,this.type=n.tooltip,this.name=n.tooltip,this.transformerConstructor=wq,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=eb(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&kq(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):u(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&OF.globalConfig.uniqueTooltip&&l&&OF.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(jL.tooltipHide,Object.assign(Object.assign({},t),{source:HL.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(null==n?void 0:n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:HL.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(jL.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(jL.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?lV.canvas:lV.dom,n=bI.getComponentPluginInType(t);n||Zy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=bI.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(ib(s)||sb(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):p(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>p(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=x(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,xt(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=xq(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(Aq(t)){if(kq(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>zz(t,e[i])))}if(Aq(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}Cq.type=n.tooltip,Cq.transformerConstructor=wq,Cq.builtInTheme={tooltip:Tq},Cq.specKey="tooltip";var Bq,Eq;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(Bq||(Bq={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(Eq||(Eq={}));const Pq={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class Rq extends Lj{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=MD.CrossHair_Grid,this.labelZIndex=MD.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),x(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=xt((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(p(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{gB(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:VL.chart}:{source:HL.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:t=s["desktop-browser"]}=this._option,e=function(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:ib(t)||sb(t)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(t);if(e){const t=G(this.trigger||"hover"),i=t=>"click"===t?"none"===this.triggerOff?null:e.clickOut:e.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:e[t],out:i(t)})})),s}return null}_registerTooltipEvent(){this.event.on(jL.tooltipHide,{source:HL.chart},this._handleTooltipHideOrRelease),this.event.on(jL.tooltipShow,{source:HL.chart},this._handleTooltipShow),this.event.on(jL.tooltipRelease,{source:HL.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=P(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{Pq[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||x(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(e,i){var s,n,r;const a={},{line:o={},label:l={},visible:c}=e;if(a.visible=c,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=t(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(x(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=P(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==e?void 0:e.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=e.line.style.stroke);const t=P(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const e=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=e.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:c,outerBorder:d}=n,u=t(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:e.minWidth,maxWidth:e.maxWidth,padding:e.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:P(s,"stroke")}),panel:(h(e.visible)?e.visible:e)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:c,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}Rq.specKey="crosshair";const Oq={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class Iq extends Rq{static getSpecInfo(t){return HF(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=n.cartesianCrosshair,this.name=n.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=Bz(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){Bz(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(u(t.dimType)?"y"===t.dimType:Ez(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=PO(this._regions,"cartesian");e&&(QH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=iV(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new vw(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new _w(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}Iq.specKey="crosshair",Iq.builtInTheme={crosshair:Oq},Iq.type=n.cartesianCrosshair;class Lq extends Rq{static getSpecInfo(t){return HF(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=n.polarCrosshair,this.name=n.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=PO(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&u(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=uj(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=jF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:le(d,a.getInnerRadius(),o),end:le(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ce(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=le(t,o,r),d=le(t,o,h),m=me([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=mt(ne.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new vw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new bw(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new xw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new yw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=de(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=de(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?le(e,p[1]+m.offset,u):le(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}Lq.specKey="crosshair",Lq.builtInTheme={crosshair:Oq},Lq.type=n.polarCrosshair;const Dq=()=>{bI.registerComponent(Lq.type,Lq)},Fq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(d(o)||d(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},zq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(d(a)||d(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return G(r).every((i=>{t[i]>=a[0]&&t[i]<=Y(a)&&(e=!0)})),e}:t=>{let e=!1;return G(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},jq=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],p=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(d(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);u(null==t?void 0:t.max)&&u(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{d(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{G(i[e]).forEach((i=>{d(t[i])||(d(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),d(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),p.push(e)})),p},Hq=(t,e,i)=>{const s=e.domain();if(uB(e.type))return i?s[0]+(Y(s)-s[0])*(1-t):s[0]+(Y(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(Y(n)-n[0])*t;return e.invert(r)},Vq=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&uB(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(Y(n)-n[0])))},Nq=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},Wq=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},Uq=(t,e,i)=>"start"===t?"percent"===e&&u(i.start)||"value"===e&&u(i.startValue):"percent"===e&&u(i.end)||"value"===e&&u(i.endValue),Gq=(t,e,i)=>{if(uB(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class Yq{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:u(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=mt(this.getState().start+f,0,1),_=mt(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===Oz(Rz(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,h(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}U(Yq,fN);class Xq extends Lj{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:Vq(t,this._stateScale,this._isHorizontal),a="percent"===n?e:Vq(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var t;this._dataFilterEvent.initZoomEvent(),null===(t=this._relatedAxisComponent)||void 0===t||t.event.on(jL.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=Nq(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=Gq(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&Wq(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else BO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),BO(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=Rz(t),this._isHorizontal="horizontal"===Oz(this._orient),this._dataFilterEvent=new Yq(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(uB(n.type)){const r=n.domain(),a=r[0],o=Y(r)-a,l=u(t)?a+o*t:+e,h=u(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=u(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=u(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(u(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):u(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),d(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>Oz(t._orient)===Oz(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!uB(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(u(i)&&(u(i.userId)&&(this._seriesUserId=G(i.userId)),u(i.specIndex)&&(this._seriesIndex=G(i.specIndex))),u(this._spec.seriesId)){const t=G(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(u(this._spec.seriesIndex)){const t=G(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(u(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(G(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(u(this._spec.regionId)){const t=G(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};BO(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=uB(d.getScale(0).type),p=uB(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?G(g.xField):G(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?G(g.yField):G(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else BO(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;XL(r,"dataview",Ma),YL(r,"dataFilterComputeDomain",jq);const a=new Ba(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new tF(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(YL(this._option.dataSet,"dataFilterWithNewDomain",zq),YL(this._option.dataSet,"lockStatisticsFilter",Fq),BO(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>uB(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>uB(this._stateScale.type)},level:nD.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(uB(this._stateScale.type));this._stateScale.domain(a,!1),(u(this._spec.start)||u(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!N(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;Uq("start",i,this._spec)&&Uq("end",s,this._spec)&&(t="percent"===i?this._spec.start:Vq(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:Vq(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?Vq(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?Vq(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=Hq(this._start,this._stateScale,Nq(i,this._isHorizontal)),this._endValue=Hq(this._end,this._stateScale,Nq(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,uB(this._stateScale.type)&&this._stateScale.domain()[0]!==Y(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=Gq(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&BO(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new iE:new LB,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),X(t)]:[-1/0,1/0]}return e}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:TD.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,r,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),u=Wq(h);if(!this._dataUpdating&&gB(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==u?void 0:u.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(r=this._cacheRect)||void 0===r?void 0:r.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==u?void 0:u.bandSize,gB(c.type)){u&&(this._start||this._end)&&(this.type===n.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!d(t)||!d(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(Xq,fN);class $q extends Ij{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=yI({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const Kq=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),qq={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:Kq(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:Kq(!0)};class Zq extends Xq{constructor(t,e){var i;super(t,e),this.type=n.dataZoom,this.name=n.dataZoom,this.transformerConstructor=$q,this.specKey="dataZoom",this.layoutZIndex=MD.DataZoom,this.layoutLevel=wD.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange)if(i&&this._component)this._component.setStartAndEnd(t,e);else{const i=this._relatedAxisComponent,n=Hq(t,this._stateScale,Nq(i,this._isHorizontal)),r=Hq(e,this._stateScale,Nq(i,this._isHorizontal));if(!u(n)||!u(r))return;this._start=t,this._end=e;(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(jL.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new iE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(Nq(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=Nq(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),d(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),d(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const u=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=u?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new iE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(Nq(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!uB(t.type)||e[0]!==Y(e))&&(!gB(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(G(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:u(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:Nq(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>Hq(t,this._stateScale,Nq(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new PP(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>Hq(t,this._stateScale,Nq(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:RL(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:RL(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:RL(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:RL(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:RL(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:RL(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:RL(g.style)},selectedBackgroundStyle:RL(this._spec.selectedBackground.style),dragMaskStyle:RL(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:yI(RL(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},RL(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:yI(RL(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},RL(null===(d=m.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=jF(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(Nq(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}Zq.type=n.dataZoom,Zq.transformerConstructor=$q,Zq.builtInTheme={dataZoom:qq},Zq.specKey="dataZoom";const Jq=()=>{bI.registerComponent(Zq.type,Zq)},Qq={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class tZ extends Xq{constructor(t,e){var i;super(t,e),this.type=n.scrollBar,this.name=n.scrollBar,this.specKey="scrollBar",this.layoutZIndex=MD.DataZoom,this.layoutLevel=wD.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}_handleChange(t,e,i){super._handleChange(t,e,i);const s=bO(this._start,t)&&bO(this._end,e);if(this._shouldChange&&(!s||!1===this._spec.realTime)){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this._relatedAxisComponent,n=Nq(s,this._isHorizontal),r=Hq(t,this._stateScale,n),a=Hq(e,this._stateScale,n);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,r,a):this._handleStateChange(r,a))&&this.event.emit(jL.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:u(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new SM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return d(i)||(s.padding=i),E(null==t?void 0:t.style)||(s.railStyle=RL(t.style)),E(null==e?void 0:e.style)||(s.sliderStyle=RL(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}tZ.type=n.scrollBar,tZ.builtInTheme={scrollBar:Qq},tZ.specKey="scrollBar";const eZ=()=>{bI.registerComponent(tZ.type,tZ)},iZ=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),G(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},sZ=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),nZ={title:{visible:!0,autoLimit:!1,autoFit:!1,style:sZ("l1FontSize","primaryFontColor")},content:{visible:!0,style:sZ("l2FontSize","tertiaryFontColor")}};class rZ extends Lj{constructor(){super(...arguments),this.type=n.indicator,this.name=n.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=MD.Indicator,this.layoutLevel=wD.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return HF(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=G(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IL(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IL(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){YL(this._option.dataSet,"indicatorFilter",iZ);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new tF(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const e=this._regions[0],{width:i,height:s}=e.getLayoutRect(),{x:n,y:r}=e.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,p=t(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return G(o).forEach((t=>{const e=yI({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},PL(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?lI(l,this._computeLayoutRadius()):0,dy:h?lI(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!u(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},PL(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},p)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)N(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new XR(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":c(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}rZ.type=n.indicator,rZ.builtInTheme={indicator:nZ},rZ.specKey="indicator";const aZ=()=>{bI.registerComponent(rZ.type,rZ)},oZ=["sum","average","min","max","variance","standardDeviation","median"];function lZ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function hZ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.x)&&lZ(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=eI(t.x)?pZ(t.x,n)+r.x:gZ(l.getXAxisHelper(),[t.x])+r.x,h}function cZ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.y)&&lZ(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=eI(t.y)?pZ(t.y,n)+r.y:gZ(l.getYAxisHelper(),[t.y])+r.y,h}function dZ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.angle)&&lZ(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),gZ(a.angleAxisHelper,[t.angle])}function uZ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.radius)&&lZ(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),gZ(a.radiusAxisHelper,[t.radius])}function pZ(t,e){return Number(t.substring(0,t.length-1))*e/100}function gZ(t,e){const i=t.getScale(0);return uB(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function fZ(t){return oZ.includes(t)}function mZ(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),p={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},k={min:null,max:null};return f.forEach((t=>{const e=u(t.x),i=u(t.y);let s,r;if(e&&i)s=hZ(t,_,n,p,c,o),r=cZ(t,y,n,p,d,o),vZ(s,b,S,g.length),vZ(r,x,k,g.length),g.push([{x:s,y:r}]);else if(e){s=hZ(t,_,n,p,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);vZ(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=cZ(t,y,n,p,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);vZ(r,x,k,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,k),g}function vZ(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=u(t.angle),i=u(t.radius);if(e&&i){const e=dZ(t,l,n,r),i=uZ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=dZ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=uZ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function yZ(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=_(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=eI(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=eI(i)?Number(i.substring(0,i.length-1))*f/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=G(t.x),S=G(t.y);1===b.length&&x(b[0])&&lZ(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===S.length&&x(S[0])&&lZ(y,S[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",S[0])),n.push({x:gZ(d.getXAxisHelper(),b)+p.x+m,y:gZ(d.getYAxisHelper(),S)+p.y+v})})),n}function bZ(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=G(t.angle),u=G(t.radius);1===d.length&&x(d[0])&&lZ(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&x(u[0])&&lZ(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:gZ(l.angleAxisHelper,d),radius:gZ(l.radiusAxisHelper,u)})})),s}function xZ(t,e,i){let{x:s,y:n}=t;return eI(s)&&(s=pZ(s,e)),eI(n)&&(n=pZ(n,i)),{x:s,y:n}}function SZ(t,e,i){let s;if(s=c(t)?G(t(e.getData().getLatestData(),e)):G(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=xZ(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>xZ(t,n,r)))}function kZ(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function AZ(e,i,s){const{labelBackground:n={},style:r,shape:a}=e,o=t(e,["labelBackground","style","shape"]);if(!1!==e.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},RL(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},wZ(RL(n.style),i,s)),u(n.padding)&&(t.padding=ni(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=wZ(RL(r),i,s)),t}return{visible:!1}}function MZ(t,e,i){for(const s in t)c(t[s])&&(t[s]=t[s](e,i));return t}function wZ(t,e,i){return c(t)?t(e,i):t}function TZ(t,e){return c(t)?t(e):t}function CZ(t,e,i){return u(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function BZ(t){return{isXProcess:u(t.x),isYProcess:u(t.y),isX1Process:u(t.x1),isY1Process:u(t.y1),isAngleProcess:u(t.angle),isRadiusProcess:u(t.radius),isAngle1Process:u(t.angle1),isRadius1Process:u(t.radius1),isCoordinatesProcess:u(t.coordinates),isValidProcess:u(t.process)}}function EZ(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=BZ(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function PZ(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=BZ(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function RZ(t){return{doXYProcess:u(t.x)&&u(t.y),doPolarProcess:u(t.angle)&&u(t.radius),doGeoProcess:u(t.areaName)}}function OZ(e,i){let s;if(i.coordinates){const e=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=e,o=t(e,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(c(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=G(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;u(r)&&(c=G(i)[r]),n&&G(i).includes(n)&&(c=n);let d=s;u(l)&&(d=G(s)[l]),a&&G(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),v(t[c])&&fZ(t[c])?h.x={field:c,aggrType:t[c]}:h.x=G(c).map((e=>t[e])),v(t[d])&&fZ(t[d])?h.y={field:d,aggrType:t[d]}:h.y=G(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;u(r)&&(a=G(s)[r]),n&&G(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),v(t[a])&&fZ(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=G(a).map((e=>t[e])),v(t[l])&&fZ(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=G(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((t=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(u(t.x)){const s=t.x;_(s)?i.x=s.map((i=>LZ(i,e,t))):i.x=LZ(s,e,t)}if(u(t.y)){const s=t.y;_(s)?i.y=s.map((i=>LZ(i,e,t))):i.y=LZ(s,e,t)}if(u(t.angle)){const s=t.angle;_(s)?i.angle=s.map((i=>LZ(i,e,t))):i.angle=LZ(s,e,t)}if(u(t.radius)){const s=t.radius;_(s)?i.radius=s.map((i=>LZ(i,e,t))):i.radius=LZ(s,e,t)}if(u(t.areaName)){const s=t.areaName;i.areaName=LZ(s,e,t)}t.getRefRelativeSeries&&(i.getRefRelativeSeries=t.getRefRelativeSeries),n.push(i)})),n}const IZ={min:(t,e)=>xO(t[0].latestData,e.field),max:(t,e)=>SO(t[0].latestData,e.field),sum:function(t,e){return kO(t[0].latestData,e.field)},average:function(t,e){return AO(t[0].latestData,e.field)},variance:function(t,e){return MO(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(MO(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ht(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function LZ(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(c(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return IZ[i](e,{field:s})}return t}function DZ(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class FZ extends Lj{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return HF(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return v(e)&&fZ(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];G(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ca;return e.registerParser("array",i),new Ba(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(u(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=PO(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){d(this._spec.offsetX)||(this._layoutOffsetX=sI(this._spec.offsetX,e.width,e)),d(this._spec.offsetY)||(this._layoutOffsetY=sI(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();YL(this._option.dataSet,"markerAggregation",OZ),YL(this._option.dataSet,"markerFilter",DZ);const i=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function zZ(t,e){return function(t,e,i){const{predict:s}=Lt(t,(t=>t[e]),(t=>t[i])),n=xO(t,e),r=SO(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class jZ extends FZ{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=MD.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=EZ(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:wZ(RL(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>AZ(t,this._markerData,this._markAttributeContext))),state:{line:MZ(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:MZ(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:MZ(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return MZ(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return MZ(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:wZ(RL(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:wZ(RL(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||G(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=kZ([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=G((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=G(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=EZ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;YL(this._option.dataSet,"markerAggregation",OZ),YL(this._option.dataSet,"markerRegression",zZ),YL(this._option.dataSet,"markerFilter",DZ);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Ba(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}jZ.specKey="markLine";const HZ=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),VZ={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},NZ={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:HZ(!1),endSymbol:HZ(!0),label:VZ};class WZ extends jZ{constructor(){super(...arguments),this.type=n.markLine,this.name=n.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new mR(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=u(e.coordinates),o=u(e.process),l=o&&u(e.process.x),h=o&&u(e.process.y),c=u(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:p,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=EZ(e);let y=[];if(p||f||g||m||v||a&&l||a&&h){const t=mZ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=yZ(i,r,d,e.coordinatesOffset):c&&(y=SZ(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(eI(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:p,limitRect:g}=r;if(!p||p.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(p[0],p[1],h,d);let m;m=o&&u(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(p[0],p[1],h,d));const v=G((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=G(r.label),y=G(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=EZ(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&u(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&u(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&u(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}WZ.type=n.markLine,WZ.coordinateType="cartesian",WZ.builtInTheme={markLine:NZ};const UZ=()=>{bI.registerComponent(WZ.type,WZ),fR()};class GZ extends jZ{constructor(){super(...arguments),this.type=n.polarMarkLine,this.name=n.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=EZ(this._spec);return e||i?new yR(t):new mR(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=EZ(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=_Z(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>le(f,t.radius,t.angle)))}}else u&&(p=bZ(i,r,a),g={points:p.map((t=>le(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=EZ(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}GZ.type=n.polarMarkLine,GZ.coordinateType="polar",GZ.builtInTheme={polarMarkLine:NZ};const YZ=()=>{bI.registerComponent(GZ.type,GZ),yR._animate=qP,fR()};class XZ extends Lj{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=n.title,this.specKey=n.title,this.layoutType="normal",this.layoutZIndex=MD.Title,this.layoutLevel=wD.Title,this._orient="top",this._orient=tI(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return HF(t,this.specKey,n.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=sI(this._spec.width,a.width,null,a.width),l=sI(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=u(this._spec.text)&&""!==this._spec.text,d=u(this._spec.subtext)&&""!==this._spec.subtext,p=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(p.textStyle.width=h),d&&(p.subtextStyle.width=h),u(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?p.textStyle.width=t:delete p.textStyle.width,d&&(p.subtextStyle.width=t)}return p}_createOrUpdateTitleComponent(t){if(this._titleComponent)N(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new GR(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}XZ.type=n.title,XZ.specKey=n.title,XZ.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};const $Z=()=>{bI.registerComponent(XZ.type,XZ)};class KZ extends FZ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=MD.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=PZ(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:wZ(RL(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>AZ(t,this._markerData,this._markAttributeContext))),state:{area:MZ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>MZ(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return MZ(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||G(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=kZ([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=G(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=G(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=PZ(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}KZ.specKey="markArea";const qZ={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class ZZ extends KZ{constructor(){super(...arguments),this.type=n.markArea,this.name=n.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new _R(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=PZ(i),d=u(i.positions),p=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=mZ(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=mZ(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=yZ(s,a,p,i.coordinatesOffset):d&&(f=SZ(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=PZ(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}ZZ.type=n.markArea,ZZ.coordinateType="cartesian",ZZ.builtInTheme={markArea:qZ};const JZ=()=>{bI.registerComponent(ZZ.type,ZZ),vR()};class QZ extends KZ{constructor(){super(...arguments),this.type=n.polarMarkArea,this.name=n.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=PZ(this._spec);return i||e||s?new bR(t):new _R(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=PZ(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=_Z(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=bZ(i,r,c),u={points:d.map((t=>le(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=PZ(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}QZ.type=n.polarMarkArea,QZ.coordinateType="polar",QZ.builtInTheme={polarMarkArea:qZ};const tJ=()=>{bI.registerComponent(QZ.type,QZ),bR._animate=JP,vR()},eJ=t=>RL(Object.assign({},t)),iJ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},RL(t.style))}),sJ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=eJ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=eJ(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},RL(Object.assign({},y)));var y;const b=iJ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=iJ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=iJ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=iJ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),A=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:k})});return t.visible||(A.controller.visible=!1,A.slider.visible=!1),A},nJ=t=>"left"===t||"right"===t,rJ=t=>"top"===t||"bottom"===t,aJ={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class oJ extends Lj{constructor(){super(...arguments),this.layoutZIndex=MD.Player,this.layoutLevel=wD.Player,this.specKey="player",this.type=n.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},sJ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},sJ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?N(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new oO(t):this._playerComponent=new cO(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...G(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...G(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...G(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...G(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=nJ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=nJ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...G(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...G(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...G(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...G(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(jL.rendered,this.autoPlayCallback),this._option.globalInstance.on(jL.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(eO.end,(()=>{var t;this.event.emit(jL.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(eO.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(eO.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(jL.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(eO.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(jL.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(eO.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(jL.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(eO.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(jL.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=nJ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=rJ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return x(this._spec.width)?Math.min(t.width,Number(this._spec.width)):nJ(this._orient)?this._maxSize():t.width}_computeHeight(t){return x(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):rJ(this._orient)?this._maxSize():t.height}_computeDx(t){return nJ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return rJ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];this._option.globalInstance.updateFullData(e.data),this.event.emit(jL.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}release(){this._option.globalInstance.off(jL.rendered,this.autoPlayCallback)}}oJ.builtInTheme={player:aJ},oJ.specKey="player",oJ.type=n.player;const lJ=()=>{bI.registerComponent(oJ.type,oJ)};class hJ extends Lj{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.layoutType="none",this.layoutZIndex=MD.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,N(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=WO({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==CD.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),f(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}hJ.type=n.label;class cJ extends _W{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}cJ.type="text",cJ.constructorType="label";const dJ=()=>{yW(),bI.registerMark(cJ.constructorType,cJ)};class uJ extends Ij{_initTheme(t,e){return{spec:t,theme:this._theme}}}class pJ extends hJ{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.specKey="label",this.transformerConstructor=uJ,this.layoutZIndex=MD.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,r)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:n.label,specInfoPath:["component",this.specKey,r],regionIndexes:[r]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(jL.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(FL.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(FL.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),BO(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&u(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(u(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n),c(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",TD.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=yI({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},FN(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[lL])):t=>t.filter((t=>t.data[oL]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?zN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}pJ.type=n.label,pJ.specKey="label",pJ.transformerConstructor=uJ;class gJ extends hJ{constructor(){super(...arguments),this.type=n.totalLabel,this.name=n.totalLabel,this.specKey="totalLabel",this.layoutZIndex=MD.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var r;null===(r=t.seriesIndexes)||void 0===r||r.forEach((t=>{const{spec:r}=e.series[t],a=r[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:n.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[rL]},"normal",TD.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return yI({textStyle:{pickable:!0===this._spec.interactive},position:fJ(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[lL]:t.data[oL]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>zN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function fJ(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}gJ.type=n.totalLabel,gJ.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},gJ.specKey="totalLabel";const mJ=()=>{bI.registerGraphicComponent(gJ.type,(t=>new rP(t))),dJ(),jj(),bI.registerComponent(gJ.type,gJ,!0)};class vJ extends FZ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=MD.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=RZ(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w,T,C,B,E,P,R,O,I;const{itemContent:L={},itemLine:D={},targetSymbol:F={}}=this._spec,j=L,{type:H="text",text:V,symbol:N,image:W,richText:U,customMark:G,textStyle:Y,symbolStyle:X,imageStyle:$,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=j,Q=t(j,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(e=null==V?void 0:V.state)&&void 0!==e?e:J,it={dx:0,dy:0},et=AZ(Object.assign(Object.assign({},V),{style:z(it,null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==U?void 0:U.state)&&void 0!==r?r:J,it={width:100,height:100},et=wZ(z(it,null!==(o=null!==(a=null==U?void 0:U.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==N?void 0:N.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=RL(wZ(z(it,null!==(c=null!==(h=null==N?void 0:N.style)&&void 0!==h?h:X)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==W?void 0:W.state)&&void 0!==d?d:J,it={width:80,height:80},et=wZ(z(it,null!==(p=null!==(u=null==W?void 0:W.style)&&void 0!==u?u:$)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=wZ(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:TZ(L.offsetX,this._relativeSeries.getRegion()),offsetY:TZ(L.offsetX,this._relativeSeries.getRegion())},Q),{style:wZ(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(k=F.size)&&void 0!==k?k:20,style:wZ(F.style,this._markerData,this._markAttributeContext)},state:{line:MZ(null!==(M=null===(A=this._spec.itemLine.line)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:MZ(null!==(T=null===(w=this._spec.itemLine.startSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineEndSymbol:MZ(null!==(B=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:MZ(tt,this._markerData,this._markAttributeContext),textBackground:MZ(null===(P=null===(E=this._spec.itemContent.text)||void 0===E?void 0:E.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:MZ(null!==(O=null===(R=this._spec.targetSymbol)||void 0===R?void 0:R.state)&&void 0!==O?O:{},this._markerData,this._markAttributeContext)},animation:null!==(I=this._spec.animation)&&void 0!==I&&I,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=t(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:RL(rt.style)}):{visible:!1};return new SR(st)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=kZ([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:CZ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:CZ(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=RZ(t);(u(t.coordinate)||e||i||s)&&this._initCommonDataView()}}vJ.specKey="markPoint";const _J={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class yJ extends vJ{constructor(){super(...arguments),this.type=n.markPoint,this.name=n.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=u(s.x)&&u(s.y),o=u(s.coordinate),l=u(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=mZ(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=yZ(n,r,h,s.coordinatesOffset)[0]:l&&(c=SZ(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=RZ(t),i=u(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}yJ.type=n.markPoint,yJ.coordinateType="cartesian",yJ.builtInTheme={markPoint:_J};const bJ=()=>{bI.registerComponent(yJ.type,yJ),xR()};class xJ extends vJ{constructor(){super(...arguments),this.type=n.polarMarkPoint,this.name=n.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=_Z(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:le({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}xJ.type=n.polarMarkPoint,xJ.coordinateType="polar",xJ.builtInTheme={polarMarkPoint:_J};const SJ=()=>{bI.registerComponent(xJ.type,xJ),xR()};class kJ extends vJ{constructor(){super(...arguments),this.type=n.geoMarkPoint,this.name=n.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{u(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}kJ.type=n.geoMarkPoint,kJ.coordinateType="geo",kJ.builtInTheme={geoMarkPoint:_J};const AJ=()=>{bI.registerComponent(kJ.type,kJ),xR()},MJ="inBrush",wJ="outOfBrush";class TJ extends Lj{constructor(){super(...arguments),this.layoutType="none",this.type=n.brush,this.name=n.brush,this.specKey="brush",this.layoutZIndex=MD.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return HF(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),MJ,TD.Series),i.setMarkStyle(s,Object.assign({},e),wJ,TD.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&G(t).includes(n.userId.toString())||e&&G(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){u(this._spec.regionId)||u(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(u(this._spec.brushLinkSeriesId)||u(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(G(this._spec.brushLinkSeriesId),G(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){u(this._spec.axisId)?G(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):u(this._spec.axisIndex)?G(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new gO(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:RL(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r),this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(lO.brushActive,(i=>{this._initMarkBrushState(e,wJ),this._emitEvent(jL.brushActive,t,i)})),r.addEventListener(lO.drawStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(jL.brushStart,t,e)})),r.addEventListener(lO.moveStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(jL.brushStart,t,e)})),r.addEventListener(lO.drawing,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(jL.brushChange,t,e)})),r.addEventListener(lO.moving,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(jL.brushChange,t,e)})),r.addEventListener(lO.brushClear,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0),this._initMarkBrushState(e,""),this._emitEvent(jL.brushClear,t,i)})),r.addEventListener(lO.drawEnd,(i=>{var s;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:n}=i.detail,{updateElementsState:r=!0}=this._spec;if(null===(s=this._spec)||void 0===s?void 0:s.onBrushEnd)!0===this._spec.onBrushEnd(i)?(this.clearGraphic(),this._initMarkBrushState(e,""),this._emitEvent(jL.brushClear,t,i)):(this._spec.onBrushEnd(i),this._emitEvent(jL.brushEnd,t,i));else{const e=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&e.length>0||!r)&&this._setAxisAndDataZoom(n,t),this._emitEvent(jL.brushEnd,t,i)}})),r.addEventListener(lO.moveEnd,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec,n=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&n.length>0||s)&&this._setAxisAndDataZoom(i,t),this._emitEvent(jL.brushEnd,t,e)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},RL(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(MJ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(MJ),i.addState(wJ,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(MJ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(MJ),i.addState(wJ,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Be(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(MJ),s.removeState(wJ),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=Y(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}TJ.type=n.brush,TJ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},TJ.specKey="brush";const CJ=()=>{bI.registerComponent(TJ.type,TJ)};class BJ extends Lj{constructor(){super(...arguments),this.type=n.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=MD.CustomMark,this.layoutLevel=wD.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${UI}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=mz({},vz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(d(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),u(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new je).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new je;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}BJ.type=n.customMark,BJ.specKey="customMark";const EJ=()=>{bI.registerComponent(BJ.type,BJ)};class PJ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:c(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&u(e.modelId)){if(u(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&u(e.modelKey)&&"modelIndex"in e&&u(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>RJ(t))),a=n.filter((t=>!RJ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>RJ(t))),h=o.filter((t=>!RJ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function RJ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}PJ.type="grid";const OJ=()=>{bI.registerLayout(PJ.type,PJ)},IJ=()=>{yo.load(fw)},LJ="vchart-tooltip",DJ=`${LJ}-container`,FJ=`${LJ}-title`,zJ=`${LJ}-content-box`,jJ={offsetX:10,offsetY:10},HJ="99999999999999";function VJ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const NJ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,WJ=t=>v(t)&&""!==(null==t?void 0:t.trim())||x(t)?VJ(t):"",UJ=(t,e)=>{let i;if(u(t))if(x(t))i=t;else if(c(t)){const s=t(e);x(s)&&(i=s)}return i},GJ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},YJ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=GJ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class XJ extends hj{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,d,g;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,S="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,w=m[y],T=GF(null==w?void 0:w.position,b,e),C=null!==(r=GF(null==w?void 0:w.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:GI,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:YI;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=eb(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),N&&!P){const t=this._getParentElement(m);j=null!==(d=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==d?d:v;const e=null!==(g=this._compiler.getCanvas())&&void 0!==g?g:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=NJ(e,F),V=NJ(t,j)}const W=V/H,U={},G={x:T,y:T},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==S?void 0:S.series)||void 0===r?void 0:r.coordinate)&&S.datum&&S.datum.length){L=!0;const t=f(S,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:E;switch(YJ(t,n)){case-2:U[e]=a-i*W-c;break;case-1.5:U[e]=a+c;break;case 0:U[e]=(a+o)/2-i*W/2;break;case-1:U[e]=(a+o)/2-i*W-c;break;case 1:U[e]=(a+o)/2+c;break;case 1.5:U[e]=o-i*W-c;break;case 2:U[e]=o+c}}},$=["x","y"];if(p(T))if(p(K=T)&&(u(K.left)||u(K.right)||u(K.top)||u(K.bottom))){const{left:t,right:e,top:i,bottom:s}=T;U.left=UJ(t,_),U.top=UJ(i,_),U.right=UJ(e,_),U.bottom=UJ(s,_)}else(t=>p(t)&&(u(t.x)||u(t.y)))(T)&&$.forEach((t=>{const e=T[t];x(e)||c(e)?U[Y[t][0]]=UJ(e,_):X(e,t)}));else u(T)&&(X({orient:T,mode:C},"x"),X({orient:T,mode:C},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?B:E,s="x"===t?O:I,n="x"===t?A:M,r=YJ(G[t],t);if(k(U[Y[t][0]]))q[t]=U[Y[t][0]];else if(k(U[Y[t][1]]))q[t]=s-i*W-U[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*W/2:e-i*W-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]u(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",KJ=(t={},e={})=>{var i,s;u(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return u(n)&&(e.color=n),u(t.fontWeight)&&(e.fontWeight=t.fontWeight),u(t.textAlign)&&(e.textAlign=t.textAlign),u(t.fontSize)&&(e.fontSize=$J(t.fontSize)),u(t.maxWidth)&&(e.maxWidth=$J(t.maxWidth)),t.multiLine||u(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},qJ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?sI(e,t.fontSize):0},ZJ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return u(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),u(r)&&(o=ni(r),a.padding=$J(o)),{panelStyle:a,panelPadding:o}};function JJ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const QJ=t=>{bI.registerComponentPlugin(t.type,t)};class tQ extends XJ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(tQ.type),this.type=lV.dom,this._tooltipContainer=null==tb?void 0:tb.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(tb&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=ZJ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:$J(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=KJ(h),x=KJ(u),S=KJ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=$J(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=$J(null!==(s=u.spacing)&&void 0!==s?s:26),S[A]=$J(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(qJ(p),qJ(u));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(FJ))),l=a.find((t=>t.className.includes(zJ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(FJ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(JJ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${LJ}-column`),e.classList.add(`${LJ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(zJ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];JJ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));JJ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${LJ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=WJ(e.key),e.keyStyle&&KJ(e.keyStyle,l)):"value"===i?(o.innerHTML=WJ(e.value),e.valueStyle&&KJ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,g=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?VJ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const _=()=>c?VJ(c):m,y=g,b=t=>new wg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let k,A;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;A=t.toString(),k=t.bounds}else S.isSvg&&S.svgCache&&(A=S.svgCache.map((t=>t.path.toString())).join(),k=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new je));let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const w=fh.IsGradientStr(u);if(!u||v(u)&&!w||d)return m=d?"none":u?VJ(u):"currentColor",`\n \n \n \n `;const T=w?fh.Parse(u):p(u)?u:null;if(T){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=T.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===T.gradient?t=`\n ${i}\n `:"linear"===T.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),JJ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(zJ))),h=[...o.children].find((t=>t.className.includes(FJ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(u(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(FJ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=sI(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,JJ(l,c))}const p=l.children,g=[];if(p){for(let i=0;i{QJ(tQ)},iQ={fontFamily:uI.fontFamily,spacing:10,wordBreak:"break-word"},sQ=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},pf||(pf=df.CreateGraphic("richtext",{})),pf.setAttributes(a),pf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function nQ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:iQ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:u(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const rQ=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return u(a)&&(r.cornerRadius=[a,a,a,a]),r};class aQ extends XJ{constructor(){super(aQ.type),this.type=lV.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new yO({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:p,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ni(d.padding),b=aI(d.padding),x=nQ(Object.assign({textAlign:"right"===_?"right":"left"},p),i),S=nQ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=nQ(m,i),A={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},M={panel:rQ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:A,key:S,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:w={},content:T=[]}=t;let C=b.left+b.right,B=b.top+b.bottom,E=0;const P=!!T.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=T.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:p,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,w={height:0,spaceRow:null!=y?y:v};if(u(h)){const i=yI({},S,nQ(b,void 0,{})),{width:s,height:n,text:r}=sQ(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(u(m)){const t=yI({},k,nQ(x,void 0,{})),{width:e,height:s,text:n}=sQ(m,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};M?t.stroke=d:t.fill=d,t.stroke=null!=p?p:d,t.lineWidth=g,w.shape=t;const e=null!=f?f:A.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aW.autoWidth&&!1!==W.multiLine;if(j){W=yI({},x,nQ(V,void 0,{})),U()&&(W.multiLine=null===(r=W.multiLine)||void 0===r||r,W.maxWidth=null!==(a=W.maxWidth)&&void 0!==a?a:P?Math.ceil(E):void 0);const{text:t,width:e,height:i}=sQ(H,W);M.title.value=Object.assign(Object.assign({width:U()?Math.min(e,null!==(o=W.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},W),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return B+=z,M.title.width=D,M.title.height=F,U()?C+=E||D:C+=Math.max(D,E),P&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-L-R-S.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=B,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?u(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}aQ.type=lV.canvas;const oQ=()=>{QJ(aQ)},lQ=(t="chart",e,i)=>{var s,r,a,o,l,h,c,d,u,p,g;const f={modelInfo:[]};if("chart"===t)f.isChart=!0,f.modelInfo.push({spec:e,type:"chart"});else if("region"===t)f.modelType="region",f.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(r=e.series)||void 0===r||r.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(LO).includes(t))f.modelType="series",f.specKey="series",f.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&f.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(n).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=bI.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=G(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=G(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=bI.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=G(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);G(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},hQ=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:u,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=lQ(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!d(e)||G(e).some((e=>c(e)?e(t,i,s):fI(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=yI({},i),m=c(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:yI(f,m),hasChanged:!0};const i=yI({},t,m);mI(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[u])?f[u].push(t):d(f[u])?f[u]="component"===h?t:[t]:f[u]=[f[u],t]}return{chartSpec:f,hasChanged:!0}},cQ=t=>{bI.registerChartPlugin(t.type,t)};class dQ extends hj{constructor(){super(dQ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[dQ.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[dQ.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=_I(this._option.globalInstance.getSpec(),["data",dQ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=_I(this._baseChartSpec,["data",dQ.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(u(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(u(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(u(t.minWidth)&&e.width{const n=hQ(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=_I(i,["data",dQ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}dQ.pluginType="chart",dQ.specKey="media",dQ.type="MediaQueryPlugin";const uQ=()=>{cQ(dQ)},pQ=/\{([^}]+)\}/,gQ=/\{([^}]+)\}/g,fQ=/:/;class mQ extends hj{constructor(){super(mQ.type),this.type="formatterPlugin",this._timeModeFormat={utc:gi.getInstance().timeUTCFormat,local:gi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Si.getInstance().format,this._numericSpecifier=Si.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[mQ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;c(r)?this._formatter=r:(this._formatter=this._format.bind(this),c(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),bI.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=pQ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(gQ,((t,i)=>{if(!fQ.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(yi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}mQ.pluginType="chart",mQ.specKey="formatter",mQ.type="formatterPlugin";const vQ=()=>{cQ(mQ)};class _Q extends hj{constructor(){super(_Q.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[_Q.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=pN(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom{cQ(_Q)};OF.useRegisters([()=>{pV(),fV(),vV(),UH(),WH(),CH(),yH(),Jz(),tj(),xF(),_F(),hH(),rH(),bI.registerSeries(BH.type,BH),bI.registerChart(_V.type,_V)},()=>{pV(),fV(),vV(),WH(),CH(),yH(),Jz(),xV(),tj(),AV(),hH(),rH(),bI.registerSeries(wV.type,wV),UH(),bI.registerChart(CV.type,CV)},()=>{pV(),fV(),vV(),WH(),NV(),UH(),bI.registerChart(UV.type,UV)},()=>{fV(),JW(),bI.registerChart(X$.type,X$)},()=>{pV(),fV(),vV(),UH(),bI.registerChart(iK.type,iK),WH()},rH,hH,()=>{bI.registerComponent(nq.type,nq)},()=>{bI.registerComponent(Cq.type,Cq)},()=>{bI.registerComponent(Iq.type,Iq)},()=>{bI.registerGraphicComponent(pJ.type,(t=>new rP(t))),dJ(),jj(),bI.registerComponent(pJ.type,pJ,!0,1/0)},oQ]),OF.useRegisters([()=>{mk(yo)}]);export{TD as AttributeLevel,cj as AxisSyncPlugin,aQ as CanvasTooltipHandler,jL as ChartEvent,_Q as ChartResizeZoomPlugin,YI as DEFAULT_CHART_HEIGHT,GI as DEFAULT_CHART_WIDTH,DF as DEFAULT_CLOSE_STROKE_JOIN,$I as DEFAULT_DATA_INDEX,KI as DEFAULT_DATA_KEY,qI as DEFAULT_DATA_SERIES_FIELD,fL as DEFAULT_KEY,kD as DEFAULT_LAYOUT_RECT_LEVEL,AD as DEFAULT_LAYOUT_RECT_LEVEL_MIN,LF as DEFAULT_LINEAR_INTERPOLATE,mL as DEFAULT_MAP_LOOK_UP_KEY,XI as DEFAULT_MEASURE_CANVAS_ID,ZI as DEFAULT_SERIES_STYLE_NAME,IF as DEFAULT_SMOOTH_INTERPOLATE,_T as DefaultTicker,FF as Direction,tQ as DomTooltipHandler,bI as Factory,mQ as FormatterPlugin,wD as LayoutLevel,MD as LayoutZIndex,uL as MOSAIC_CAT_END_PERCENT,dL as MOSAIC_CAT_START_PERCENT,cL as MOSAIC_VALUE_END_PERCENT,hL as MOSAIC_VALUE_START_PERCENT,bT as ManualTicker,dQ as MediaQuery,UI as PREFIX,s as RenderModeEnum,gL as SEGMENT_FIELD_END,pL as SEGMENT_FIELD_START,tL as STACK_FIELD_END,nL as STACK_FIELD_END_OffsetSilhouette,iL as STACK_FIELD_END_PERCENT,JI as STACK_FIELD_KEY,QI as STACK_FIELD_START,sL as STACK_FIELD_START_OffsetSilhouette,eL as STACK_FIELD_START_PERCENT,rL as STACK_FIELD_TOTAL,lL as STACK_FIELD_TOTAL_BOTTOM,aL as STACK_FIELD_TOTAL_PERCENT,oL as STACK_FIELD_TOTAL_TOP,BD as STATE_VALUE_ENUM,$C as StreamLight,DI as ThemeManager,nD as TransformLevel,SD as USER_LAYOUT_RECT_LEVEL,OF as VChart,rI as boundsInRect,MI as builtinThemes,sI as calcLayoutNumber,nI as calcPadding,VO as computeActualDataScheme,oI as convertPoint,rf as createArc,ef as createArea,Pp as createGroup,Eg as createLine,Ig as createRect,Kg as createRichText,Tg as createSymbol,Ag as createText,gI as darkTheme,hI as dataScheme,OF as default,wI as defaultThemeName,WO as getActualColor,lI as getActualNumValue,XO as getColorSchemeBySeries,HO as getDataScheme,kI as getFunnelTheme,II as getMergedTheme,HF as getSpecInfo,PI as getTheme,BI as hasThemeMerged,UO as isColorKey,eI as isPercent,iI as isPercentOffset,GO as isProgressiveDataColorScheme,dI as isTokenKey,tI as isValidOrient,pI as lightTheme,VF as lookup,WI as measureText,aI as normalizeLayoutPaddingSpec,NO as queryColorFromColorScheme,cI as queryToken,kF as registerAnimate,VK as registerBoxplotChart,CJ as registerBrush,oQ as registerCanvasTooltipHandler,pH as registerCartesianLogAxis,fH as registerCartesianSymlogAxis,dH as registerCartesianTimeAxis,cQ as registerChartPlugin,yQ as registerChartResizeZoomPlugin,RK as registerCirclePackingChart,cK as registerCircularProgressChart,vq as registerContinuousLegend,QK as registerCorrelationChart,EJ as registerCustomMark,XL as registerDataSetInstanceParser,YL as registerDataSetInstanceTransform,Jq as registerDataZoom,eQ as registerDomTooltipHandler,CF as registerElementHighlight,PF as registerElementSelect,vQ as registerFormatPlugin,bK as registerFunnelChart,pK as registerGaugeChart,_N as registerGeoCoordinate,AJ as registerGeoMarkPoint,OJ as registerGridLayout,qK as registerHeatmapChart,oK as registerHistogramChart,aZ as registerIndicator,kK as registerLinearProgressChart,V$ as registerMapChart,JZ as registerMarkArea,UZ as registerMarkLine,bJ as registerMarkPoint,uQ as registerMediaQuery,lJ as registerPlayer,gU as registerPolarBandAxis,Dq as registerPolarCrossHair,uU as registerPolarLinearAxis,tJ as registerPolarMarkArea,YZ as registerPolarMarkLine,SJ as registerPolarMarkPoint,IJ as registerPoptip,tK as registerRadarChart,XK as registerRangeAreaChart,wK as registerRangeColumnChart,Z$ as registerRoseChart,UK as registerSankeyChart,sN as registerScatterChart,eZ as registerScrollBar,BK as registerSunburstChart,EI as registerTheme,$Z as registerTitle,mJ as registerTotalLabel,LK as registerTreemapChart,zK as registerWaterfallChart,vK as registerWordCloudChart,RI as removeTheme,OI as themeExist,TI as themes,uI as token,YO as transformColorSchemeToStandardStruct,RL as transformToGraphic,NF as version,O_ as vglobal,qy as warn}; +let XJ=class t extends DJ{constructor(e){super(z({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),y=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=y*this.gridSize;const _=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,_,b);const C=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const w=[];let M,T=S;const B=[x/2,S/2,x/2,S/2],E=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tB[1]&&(B[1]=t),eB[2]&&(B[2]=e))}};for(;T--;)for(M=x;M--;)E(T,M,w);return{datum:t,occupied:w,bounds:B,gw:S,gh:x,fillTextOffsetX:_,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),q(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(p(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?WJ(t,o,l.width,l.height,h):"geometric"===t.type&&YJ(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(A(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=PJ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};XJ.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class KJ extends DJ{constructor(t){super(z({},KJ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}KJ.defaultOptions={enlarge:!1};const qJ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},ZJ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?JJ(t.fontFamily):"sans-serif",d=t.fontStyle?JJ(t.fontStyle):"normal",u=t.fontWeight?JJ(t.fontWeight):"normal",p=t.rotate?JJ(t.rotate):0,g=JJ(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?JJ(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",y=null!==(r=t.shrink)&&void 0!==r&&r,_=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,S=t.minFontSize,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},qJ),t.as):qJ,C=t.depth_3d,w=t.postProjection;let M=t.fontSize?JJ(t.fontSize):14;const T=t.fontSizeRange;if(T&&!x(M)){const t=M,e=tQ(eQ(t,l),T);M=i=>e(t(i))}let B=FJ;"fast"===t.layoutType?B=KJ:"grid"===t.layoutType&&(B=XJ);const E=new B(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:M,shrink:y,clip:b,enlarge:_,minFontSize:S,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:E}:E.output()},JJ=t=>v(t)||x(t)||c(t)||y(t)?t:e=>e[t.field],QJ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),tQ=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=QJ(t[0]),n=QJ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(QJ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},eQ=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function iQ(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{hw.registerGrammarTransform("wordcloud",{transform:ZJ}),F$(),hw.registerAnimation("wordCloud",((t,e)=>({appear:IZ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:Dz.disappear.duration}}))),hw.registerSeries(sQ.type,sQ)},rQ=t=>c(t)?t():t,aQ=(t,e)=>{var i,s,n,r;const a=t.map((t=>Object.assign({},t)));if(!a||0===a.length)return a;const{asTransformRatio:o,asReachRatio:l,asHeightRatio:h,asValueRatio:c,asNextValueRatio:d,asLastValueRatio:u,asLastValue:p,asCurrentValue:g,asNextValue:f}=e,m=rQ(e.valueField),v=null!==(i=rQ(e.heightVisual))&&void 0!==i&&i,y=null===(s=rQ(e.isCone))||void 0===s||s,_=rQ(e.range),b=a.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[m])||-1/0)),-1/0),x=a.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[m])||1/0)),1/0),S=[null!==(n=null==_?void 0:_.min)&&void 0!==n?n:x,null!==(r=null==_?void 0:_.max)&&void 0!==r?r:b];return a.forEach(((t,e)=>{var i,s;const n=Number.parseFloat(t[m]),r=Number.parseFloat(null===(i=a[e-1])||void 0===i?void 0:i[m]),_=Number.parseFloat(null===(s=a[e+1])||void 0===s?void 0:s[m]),b=A(_*n)&&0!==n?_/n:0,x=A(n*r)&&0!==r?n/r:0;p&&(t[p]=r),f&&(t[f]=_),o&&(t[o]=b),l&&(t[l]=0===e?1:x),h&&(t[h]=!0===v?b:1/a.length),c&&(t[c]=n/S[1]),d&&(t[d]=e===a.length-1?y?0:t[c]:_/S[1]),u&&(t[u]=0===e?1:r/S[1]),g&&(t[g]=n)})),a},oQ=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},lQ=`${Rw}_FUNNEL_TRANSFORM_RATIO`,hQ=`${Rw}_FUNNEL_REACH_RATIO`,cQ=`${Rw}_FUNNEL_HEIGHT_RATIO`,dQ=`${Rw}_FUNNEL_VALUE_RATIO`,uQ=`${Rw}_FUNNEL_LAST_VALUE_RATIO`,pQ=`${Rw}_FUNNEL_NEXT_VALUE_RATIO`,gQ=`${Rw}_FUNNEL_LAST_VALUE`,fQ=`${Rw}_FUNNEL_CURRENT_VALUE`,mQ=`${Rw}_FUNNEL_NEXT_VALUE`,vQ=`${Rw}_FUNNEL_TRANSFORM_LEVEL`;class yQ extends xH{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[hQ])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return u(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class _Q extends yz{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class bQ extends _Q{constructor(){super(...arguments),this.type=bQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}bQ.type="polygon";const xQ=()=>{hw.registerMark(bQ.type,bQ),$R(),HR(),rI.registerBuiltInAnimate("growPointsOut",YI),hw.registerGraphicComponent("polygon",rf)},SQ=Object.assign(Object.assign({},RH),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class AQ extends $H{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class kQ extends ij{constructor(){super(...arguments),this.type=kC.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=AQ,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;zM(this._dataSet,"funnel",aQ),zM(this._dataSet,"funnelTransform",oQ);const t=new Oa(this._dataSet,{name:`${Rw}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new KF(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:()=>this.getValueField(),isCone:()=>this._spec.isCone,asCurrentValue:fQ,asTransformRatio:lQ,asReachRatio:hQ,asHeightRatio:cQ,asValueRatio:dQ,asNextValueRatio:pQ,asLastValueRatio:uQ,asLastValue:gQ,asNextValue:mQ,range:()=>this._spec.range}}),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.transform({type:"funnelTransform",options:{asIsTransformLevel:vQ}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},kQ.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:GH(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},kQ.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(kQ.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(kQ.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new yQ(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,s;const n=this._funnelMark;n&&this.setMarkStyle(n,{points:t=>this.getPoints(t),visible:t=>u(t[this._valueField]),fill:this.getColorAttribute()},"normal",xF.Series);const r=this._funnelTransformMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",xF.Series);const a=this._funnelOuterLabelMark.label;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",xF.Series),c(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(a,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",xF.User_Mark));const o=this._funnelOuterLabelMark.line;if(o&&a){this.setMarkStyle(o,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",xF.Series);const n=null!==(i=null===(e=null===(t=this._spec.outerLabel)||void 0===t?void 0:t.line)||void 0===e?void 0:e.visible)&&void 0!==i?i:null===(s=this._spec.outerLabel)||void 0===s?void 0:s.visible;u(n)&&o.setVisible(n)}}initLabelMarkStyle(t){var e;if(!t)return;const i=t.getTarget(),s=t.getComponent();if(i===this._funnelMark){this._labelMark=t,this.setMarkStyle(t,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",xF.Series);const i=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&aA(i,this._funnelOuterLabelMark.label,s),this._funnelOuterLabelMark.line&&aA(i,this._funnelOuterLabelMark.line,null!==(e=this._funnelOuterLabelMark.label)&&void 0!==e?e:s)}else this._funnelTransformMark&&i===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*Sk(hQ).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",xF.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(NH(null===(s=hw.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),VH("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(NH(hw.getAnimationInKey("fadeInOut")(),VH(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(NH(hw.getAnimationInKey("funnel")({},o),VH(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(NH(null===(a=hw.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),VH("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[uQ])/2:this._getSecondaryAxisLength(t[dQ])/2,n=this._getSecondaryAxisLength(t[dQ])/2):(s=this._getSecondaryAxisLength(t[dQ])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[pQ])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[vQ])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return u(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[zw]===t[zw]));if(!u(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(x(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_{xQ(),F$(),GK(),hw.registerSeries(kQ.type,kQ),hw.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},Fz))),hw.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Ez,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),Hz()},wQ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},MQ=t=>{const e=t.filter((t=>t.context.diffState===SF.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},TQ=(t,e,i)=>{if(E(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},BQ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MQ(i.parent.children),a=TQ(r,s,n);return wQ(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MQ(i.parent.children),a=TQ(r,s,n);return wQ(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),EQ=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},PQ=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MQ(i.parent.children),a=EQ(r);return wQ(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MQ(i.parent.children),a=EQ(r);return wQ(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),OQ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},RQ=(t,e={})=>{if(!t)return[];const i=[];return zZ(t,i,e),i},IQ=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new uJ(i).layout(t,{width:s,height:n})};class DQ extends xH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var LQ;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(LQ||(LQ={}));const FQ=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(d(n))return t;if(i.type===LQ.DrillDown){return G(fM(t,n,s,"children"))}if(i.type===LQ.DrillUp){const e=mM(t,n,s,"children");if(e)return G(e)}return t};class zQ{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=BK(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(n.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;zM(t,"drillFilter",FQ),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(d(t.datum)||d(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!y(t)||E(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:LQ.DrillDown},e().reRunAllTransform(),i.emit(PM.drill,{value:{path:t,type:LQ.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!y(n)||E(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:LQ.DrillUp},i().reRunAllTransform(),s.emit(PM.drill,{value:{path:n,type:LQ.DrillUp},model:this}),n}}const HQ=Object.assign(Object.assign({},RH),{sunburst:{name:"sunburst",type:"arc"}}),jQ=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:wH,operations:["max","min","values"]}),t.push({key:MH,operations:["values"]}),t),NQ={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class VQ extends J${constructor(){super(...arguments),this.type=kC.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:MH),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:zw},getRawData:()=>this.getRawData()}),this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),zM(this._dataSet,"sunburstLayout",IQ),zM(this._dataSet,"flatten",RQ),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[u(this._centerX)?this._centerX:this.getLayoutRect().width/2,u(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return jQ(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(zM(t.dataSet,"addVChartProperty",gH),t.transform({type:"addVChartProperty",options:{beforeCall:PH.bind(this),call:OH}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(VQ.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){d(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(u(this._offsetX)?this._offsetX:0),y:t=>t.y+(u(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},AF.STATE_NORMAL,xF.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(VQ.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return p(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(u(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(u(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},AF.STATE_NORMAL,xF.Series)}initTooltip(){this._tooltipHelper=new DQ(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(G(this.__innerRadius))[0],outerRadius:this._computeRadius(G(this.__outerRadius))[0],startAngle:G(this._startAngle)[0],endAngle:G(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(NH(null===(e=hw.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),VH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(NH(null===(e=hw.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),VH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}VQ.type=kC.sunburst,VQ.mark=HQ,VQ.builtInTheme={sunburst:NQ},U(VQ,zQ);const WQ=()=>{hw.registerSeries(VQ.type,VQ),cq(),F$(),Hz(),hw.registerAnimation("sunburst",((t,e)=>({appear:OQ(0,e),enter:BQ(t),exit:PQ(t),disappear:{duration:Dz.disappear.duration}})))},UQ=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new tJ(i).layout(t,{width:s,height:n})};class GQ extends xH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const YQ=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},XQ=Object.assign(Object.assign({},RH),{circlePacking:{name:"circlePacking",type:"arc"}});class KQ extends rj{constructor(){super(...arguments),this.type=kC.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:MH),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:zw},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();d(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),zM(this._dataSet,"circlePackingLayout",UQ),zM(this._dataSet,"flatten",RQ),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(zM(t.dataSet,"addVChartProperty",gH),t.transform({type:"addVChartProperty",options:{beforeCall:PH.bind(this),call:OH}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(KQ.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){d(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},AF.STATE_NORMAL,xF.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(KQ.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},AF.STATE_NORMAL,xF.Series)}getStatisticFields(){return jQ(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new GQ(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(NH(null===(i=hw.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),VH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(NH(null===(e=hw.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),VH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}KQ.type=kC.circlePacking,KQ.mark=XQ,KQ.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},U(KQ,zQ);const $Q=()=>{hw.registerSeries(KQ.type,KQ),cq(),F$(),zz(),hw.registerAnimation("circlePacking",((t,e)=>({appear:YQ(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:Dz.disappear.duration}})))},qQ=(t,e,i)=>{e.forEach((e=>{d(e[i])||t.add(e[i]),e.children&&e.children.length>0&&qQ(t,e.children,i)}))},ZQ=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},JQ=(t,e)=>{const i=c(e)?e():e;if(!t||!(null==i?void 0:i.view)||!t.length)return[];const s=i.view();if(s.x1-s.x0==0||s.y1-s.y0==0||s.x1-s.x0==-1/0||s.x1-s.x0==1/0||s.y1-s.y0==-1/0||s.y1-s.y0==1/0)return[];const n=t[0],r=QQ(n,i),a=new hJ(i),o=[];return o.push(a.layout(r,s)),o},QQ=(t,e)=>{if("source"===e.sourceField&&"target"===e.targetField&&"value"===e.valueField)return t;const i=t.links;return i?Object.assign(Object.assign({},t),{links:i.map((t=>{const i={};return Object.keys(t).forEach((s=>{s===e.sourceField?i.source=t[e.sourceField]:s===e.targetField?i.target=t[e.targetField]:s===e.valueField?i.value=t[e.valueField]:i[s]=t[s]})),i}))}):t},t0=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},e0=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class i0 extends xH{constructor(){super(...arguments),this._getDimensionData=t=>{if(!d(null==t?void 0:t.source)&&!d(null==t?void 0:t.target)){if(x(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const s0=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),n0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:s0(t),r0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class a0 extends kI{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class o0 extends kI{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const l0=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},h0=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class c0 extends v${constructor(){super(...arguments),this.type=c0.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?h0:l0,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}c0.type="linkPath";const d0=Object.assign(Object.assign({},RH),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class u0 extends $H{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const p0=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&mz(t,e),fz(t,e,s,n)};class g0 extends rj{constructor(){super(...arguments),this.type=kC.sankey,this.transformerConstructor=u0,this._nodeLayoutZIndex=_F.Node,this._labelLayoutZIndex=_F.Label,this._viewBox=new Ne,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(u(a))return a;if(u(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(u(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=x(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getGraphics();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getGraphics();s&&s.length&&(i.forEach((t=>{mz(t,[AF.STATE_SANKEY_EMPHASIS,AF.STATE_SANKEY_EMPHASIS_REVERSE])})),s.forEach((t=>{mz(t,[AF.STATE_SANKEY_EMPHASIS,AF.STATE_SANKEY_EMPHASIS_REVERSE])})),this._needClear=!1)},this._handleNodeAdjacencyClick=t=>{const e=wM(t),i=[e.key];if(this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=wM(t);n.source===e.key?(i.includes(n.target)||i.push(n.target),mz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE),fz(t,AF.STATE_SANKEY_EMPHASIS,!0)):n.target===e.key?(i.includes(n.source)||i.push(n.source),mz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE),fz(t,AF.STATE_SANKEY_EMPHASIS,!0)):(mz(t,AF.STATE_SANKEY_EMPHASIS),fz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=wM(t),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach((e=>{e===t?(mz(e,AF.STATE_SANKEY_EMPHASIS_REVERSE),p0(e,AF.STATE_SANKEY_EMPHASIS,{ratio:1})):(mz(e,AF.STATE_SANKEY_EMPHASIS),fz(e,AF.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=wM(t),s=this._nodeMark.getGraphics();if(!s||!s.length)return;const n=this._linkMark.getGraphics();if(!n||!n.length)return;const r=(null===(e=wM(n[0]))||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=wM(n),d=(null==c?void 0:c.parents)?"parents":"source";if(G(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;const n=wM(t);e.includes(null!==(s=n.key)&&void 0!==s?s:n.index)?(mz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE),fz(t,AF.STATE_SANKEY_EMPHASIS,!0)):(mz(t,AF.STATE_SANKEY_EMPHASIS),fz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(G(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const a=wM(s),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return mz(s,AF.STATE_SANKEY_EMPHASIS_REVERSE),void p0(s,AF.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),mz(s,AF.STATE_SANKEY_EMPHASIS_REVERSE),void p0(s,AF.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});mz(s,AF.STATE_SANKEY_EMPHASIS),fz(s,AF.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{const e=this._nodeMark.getGraphics();if(!e||!e.length)return;const i=this._linkMark.getGraphics();if(!i||!i.length)return;if("source"===(wM(t)?"parents":"source"))this._linkMark&&i.forEach((t=>{mz(t,[AF.STATE_SANKEY_EMPHASIS,AF.STATE_SANKEY_EMPHASIS_REVERSE])})),this._nodeMark&&e.forEach((t=>{mz(t,[AF.STATE_SANKEY_EMPHASIS,AF.STATE_SANKEY_EMPHASIS_REVERSE])}));else{const s=wM(t),n=[s.source,s.target],r=[];G(s.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),i.forEach((t=>{const e=wM(t),i=e.datum;if(e.source===s.source&&e.target===s.target)return mz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE),void p0(t,AF.STATE_SANKEY_EMPHASIS,{ratio:1});const a=i?i.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(s.source)&&e.includes(s.target)})):null;if(a&&a.length){n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target);const i=a.filter((t=>t.parents.some(((e,i)=>{var n;return e.key===s.source&&(null===(n=t.parents[i+1])||void 0===n?void 0:n.key)===s.target})))).reduce(((t,e)=>t+e.value),0),r=i/e.value;return mz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE),void p0(t,AF.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===e.source&&t.target===e.target));if(o)return n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target),mz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE),void p0(t,AF.STATE_SANKEY_EMPHASIS,{ratio:o.value/e.value});mz(t,AF.STATE_SANKEY_EMPHASIS),fz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(e,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){super.initData();const t=this.getViewData(),e=this.getRawData();if(e&&t){zM(this._dataSet,"sankeyLayout",JQ),zM(this._dataSet,"sankeyFormat",ZQ),e.transform({type:"sankeyFormat"},!1),t.transform({type:"sankeyLayout",options:()=>{var t,e,i,s;return{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse}},level:qM.sankeyLayout});const{dataSet:i}=this._option;zM(i,"sankeyNodes",t0),zM(i,"flatten",RQ);const s=new Oa(i,{name:`sankey-node-${this.id}-data`});s.parse([this.getViewData()],{type:"dataview"}),s.transform({type:"sankeyNodes"}),s.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),s.transform({type:"addVChartProperty",options:{beforeCall:BH.bind(this),call:EH}},!1),this._nodesSeriesData=s,zM(i,"sankeyLinks",e0);const n=new Oa(i,{name:`sankey-link-${this.id}-data`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyLinks"}),n.transform({type:"addVChartProperty",options:{beforeCall:BH.bind(this),call:EH}},!1),this._linksSeriesData=n}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(g0.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(g0.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=G(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=G(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},AF.STATE_NORMAL,xF.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",xF.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(i.setGlyphConfig({direction:this.direction}),this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},AF.STATE_NORMAL,xF.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",xF.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(d(t)||d(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=cH(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(NH(null===(i=hw.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),VH("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(NH(null===(s=hw.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),VH("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:RM.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{mz(t,[AF.STATE_SANKEY_EMPHASIS_REVERSE,AF.STATE_SANKEY_EMPHASIS]),e.includes(wM(t).key)?fz(t,AF.STATE_SANKEY_EMPHASIS,!0):fz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new i0(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!d(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new FC;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{u(t[i])&&e.add(t[i]),u(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return qQ(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}g0.type=kC.sankey,g0.transformerConstructor=u0,g0.mark=d0,g0.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const f0=()=>{qX(),y$(),FR(),hw.registerGraphicComponent("path",(t=>Ng(t))),hw.registerMark(c0.type,c0),F$(),hw.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:n0(t,e)},Fz))),hw.registerAnimation("sankeyLinkPath",((t,e)=>({appear:r0(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:Dz.disappear.duration}}))),rI.registerBuiltInAnimate("linkPathGrowOut",o0),rI.registerBuiltInAnimate("linkPathGrowIn",a0),Hz(),hw.registerSeries(g0.type,g0)},m0=(t,e)=>{let i={},s=e.fields;if(c(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=RQ(n);return i=AH([{latestData:r}],e),i};class v0 extends xH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const y0=Object.assign(Object.assign({},RH),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),_0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class b0 extends $H{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const x0=(t,e)=>{const i=c(e)?e():e,s=i.getViewBox();if(s){const e=new mJ(i).layout(t,s),n=[];return zZ(e,n,{maxDepth:null==i?void 0:i.maxDepth}),n.forEach((t=>{t&&[MH,"name"].forEach((e=>{t[e]=t.datum[t.depth][i.nameField]}))})),n}return[]};class S0 extends rj{constructor(){super(...arguments),this.type=kC.treemap,this.transformerConstructor=b0,this._categoryField="name",this._valueField="value",this._viewBox=new Ne,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:MH),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ue),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:zw},getRawData:()=>this.getRawData()}),A(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t;super.initData(),zM(this._dataSet,"treemap",x0),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:()=>{var t,e,i,s;return{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(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!==(s=this._spec.minVisibleArea)&&void 0!==s?s:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(zM(this._rawData.dataSet,"addVChartProperty",gH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:PH.bind(this),call:OH}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=m0([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){zM(this._dataSet,"hierarchyDimensionStatistics",m0),zM(this._dataSet,"flatten",RQ);const i=new Oa(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 jQ(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(S0.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(S0.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},AF.STATE_NORMAL,xF.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()},AF.STATE_NORMAL,xF.Series)}_initRichStyleOfLabelMark(t){"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},AF.STATE_NORMAL,xF.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},AF.STATE_NORMAL,xF.Series),this._initRichStyleOfLabelMark(t))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},AF.STATE_NORMAL,xF.Series),this._initRichStyleOfLabelMark(t))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(NH(null===(e=hw.getAnimationInKey("treemap"))||void 0===e?void 0:e(),VH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new v0(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(BM.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(BM.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}S0.type=kC.treemap,S0.mark=y0,S0.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},S0.transformerConstructor=b0,U(S0,zQ),U(S0,PK);const A0=()=>{hw.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),hw.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),qX(),F$(),hw.registerAnimation("treemap",((t,e)=>({appear:_0(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:Dz.disappear.duration}}))),Hz(),hw.registerSeries(S0.type,S0)},k0=Object.assign(Object.assign({},nZ),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),C0=Object.assign(Object.assign({},RH),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),w0={type:"fadeIn"};function M0(t,e){return"fadeIn"===e?w0:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class T0 extends $H{constructor(){super(...arguments),this._supportStack=!1}}class B0 extends xH{enableByType(t){return"dimension"!==t}}const E0="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",P0={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:E0,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:E0,fill:"#ddd"}}};class O0 extends aZ{constructor(){super(...arguments),this.type=kC.gaugePointer,this.transformerConstructor=T0,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(O0.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},O0.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(O0.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new B0(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return u(this.radiusAxisHelper)&&u(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=K(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(NH(null===(i=hw.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),VH("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}O0.type=kC.gaugePointer,O0.mark=C0,O0.builtInTheme={gaugePointer:P0},O0.transformerConstructor=T0;const R0=()=>{hw.registerSeries(O0.type,O0),kK(),qX(),hw.registerAnimation("gaugePointer",((t,e)=>{const i=M0(t,e);return{appear:i,enter:i,disappear:{duration:Dz.disappear.duration}}})),Dq(),Rq()};class I0 extends $H{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class D0 extends aZ{constructor(){super(...arguments),this.type=kC.gauge,this.transformerConstructor=I0,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=ae(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();zM(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[sM]=t[this._angleField[0]],t[iM]=e>0?i[e-1][sM]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(D0.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(D0.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t&&"segment"===t.name){const e=this.getSpec().segment;if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,xF.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?jC(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?jC(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return u(t[iM])?this.angleAxisHelper.dataToPosition([t[iM]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[sM]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(NH(null===(i=hw.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),VH("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}D0.type=kC.gauge,D0.mark=k0,D0.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},D0.transformerConstructor=I0;class L0 extends yz{constructor(){super(...arguments),this.type=L0.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Qp(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="rect":a.symbolType=o,a}}L0.type="cell";function F0(t){return!1===t?{}:{type:"fadeIn"}}class z0 extends xH{enableByType(t){return"dimension"!==t}}const H0=Object.assign(Object.assign({},RH),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class j0 extends $H{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}const N0={valueField:!0};class V0 extends rj{constructor(){super(...arguments),this.type=kC.heatmap,this.transformerConstructor=j0}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=G(t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),N0)})}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(V0.mark.cell,{isSeriesMark:!0},{morph:GH(this._spec,V0.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(V0.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",xF.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=ai(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",xF.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=nj(this);this._cellMark.setAnimationConfig(NH(null===(i=hw.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),VH("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new z0(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}V0.type=kC.heatmap,V0.mark=H0,V0.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},V0.transformerConstructor=j0;const W0=()=>{F$(),hw.registerMark(L0.type,L0),hw.registerGraphicComponent("symbol",Qp),$R(),QR(),pN(),hw.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},Fz),{appear:F0(e)}))),aW(),SW(),hw.registerSeries(V0.type,V0)},U0=Object.assign(Object.assign({},RH),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),G0=`${Rw}_CORRELATION_X`,Y0=`${Rw}_CORRELATION_Y`,X0=`${Rw}_CORRELATION_SIZE`,K0=t=>c(t)?t():t,$0=(t,e)=>{var i,s,n,r,a,o,l,h;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const c=t,u=e.view();if(u.x1-u.x0==0||u.y1-u.y0==0||u.x1-u.x0==-1/0||u.x1-u.x0==1/0||u.y1-u.y0==-1/0||u.y1-u.y0==1/0)return t;const p=ae(null!==(i=K0(e.startAngle))&&void 0!==i?i:-90),g=ae(null!==(s=K0(e.endAngle))&&void 0!==s?s:270),f=Math.max((u.x1-u.x0)/2,(u.y1-u.y0)/2),m=Pt(null!==(n=K0(e.innerRadius))&&void 0!==n?n:0,f),v=Pt(K0(e.outerRadius),f),_=K0(e.center),b=[x(null==_?void 0:_[0])?_[0]:u.x0+Pt(null!==(r=null==_?void 0:_[0])&&void 0!==r?r:"50%",u.x1-u.x0),x(null==_?void 0:_[1])?_[1]:u.y0+Pt(null!==(a=null==_?void 0:_[1])&&void 0!==a?a:"50%",u.y1-u.y0)],S=Et(K0(e.field)),A=c.map(S),[k,C]=Rt(A),w=k===C?t=>(m+v)/2:t=>m+(v-m)*(t-k)/(C-k),M=K0(e.radiusField),T=K0(e.radiusRange),B=d(M)?S:Et(M),E=null!==(o=null==T?void 0:T[1])&&void 0!==o?o:5;let P=t=>E;if(B){const[t,e]=B!==S?Rt(c.map(B)):[k,C],i=null!==(l=null==T?void 0:T[0])&&void 0!==l?l:5,s=null!==(h=null==T?void 0:T[1])&&void 0!==h?h:5;t!==e&&(P=n=>i+(s-i)*(B(n)-t)/(e-t))}const O=Math.min(p,g),R=Math.max(p,g),I=q0(O,R,c.length),D=[],L=(R-O)/60;return c.forEach(((t,e)=>{const i=w(A[e]),s=P(t);let n,r,a=I[e];for(let t=0;t<60&&(n=b[0]+i*Math.cos(a),r=b[1]+i*Math.sin(a),Z0({x:n,y:r,size:s},D)||n-su.x1||r-su.y1);t++)t<59&&(a+=L,a>R?a=O:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},Z0=(t,e)=>!(!e||!e.length)&&e.some((e=>{const i=e.x,s=e.y,n=e.size;return Math.pow(t.x-i,2)+Math.pow(t.y-s,2)c(t)?t():t,Q0=(t,e)=>{if(!t||!y(t))return[];const i=J0(e.keyword),s=J0(e.categoryField),n=t[0].latestData[0];return{[s]:i,[Fw]:null==n?void 0:n[Fw],[Hw]:null==n?void 0:n[Hw]}};class t1 extends v${constructor(){super(...arguments),this.type=t1.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=vt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}t1.type="ripple";const e1=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class i1 extends $H{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class s1 extends J${constructor(){super(...arguments),this.type=kC.correlation,this.transformerConstructor=i1,this._viewBox=new Ne}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){u(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){u(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){u(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){if(super.initData(),!this._data)return;zM(this._dataSet,"correlation",$0);const t=new Pa;HM(t,"dataview",Ta),zM(t,"correlationCenter",Q0);const e=new Oa(t,{name:`${this.type}_${this.id}_center`});e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"correlationCenter",options:{keyword:()=>{var t,e,i;return null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:""},categoryField:()=>this._spec.categoryField}}),this._centerSeriesData=new KF(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:()=>this._spec.valueField,radiusRange:()=>this._spec.sizeRange,radiusField:()=>this._spec.sizeField,center:()=>[this._spec.centerX,this._spec.centerY],innerRadius:()=>this._spec.innerRadius,outerRadius:()=>this._spec.outerRadius,startAngle:()=>this._spec.startAngle,endAngle:()=>this._spec.endAngle}})}initMark(){const t=this._createMark(s1.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:Fw});t&&(t.setMarkConfig({zIndex:_F.Node}),this._nodePointMark=t);const e=this._createMark(s1.mark.ripplePoint,{key:Fw,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});e&&(this._ripplePointMark=e);const i=this._createMark(s1.mark.centerPoint,{key:Fw,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(i.setMarkConfig({zIndex:_F.Node}),this._centerPointMark=i)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[G0],y:t=>t[Y0],size:t=>t[X0],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},AF.STATE_NORMAL,xF.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},AF.STATE_NORMAL,xF.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},AF.STATE_NORMAL,xF.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},AF.STATE_NORMAL,xF.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(NH(null===(e=hw.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),VH("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}s1.type=kC.correlation,s1.mark=U0,s1.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},s1.transformerConstructor=i1;const n1=()=>{vN(),y$(),QR(),hw.registerMark(t1.type,t1),hw.registerGraphicComponent("symbol",(t=>Qp(t))),hw.registerSeries(s1.type,s1),hw.registerAnimation("correlation",((t,e)=>Object.assign({appear:e1(0,e)},Lz)))},r1=Object.assign(Object.assign({},RH),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class a1 extends v${constructor(){super(...arguments),this.type=a1.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}a1.type="liquid";const o1=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class l1 extends xH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class h1 extends ij{constructor(){super(...arguments),this.type=kC.liquid,this.transformerConstructor=yN,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=ag({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Qp({x:s,y:n,size:r,symbolType:o1(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){u(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=$C(this._spec.outlineMargin),this._paddingSpec=$C(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Gt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(h1.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(h1.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(h1.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(h1.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",xF.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",xF.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",xF.Series)}initTooltip(){this._tooltipHelper=new l1(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(NH(null===(i=hw.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),VH("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(NH(null===(s=hw.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),VH("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(PM.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=wA(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}h1.type=kC.liquid,h1.mark=r1,h1.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},h1.transformerConstructor=yN;const c1=t=>G(t).join(",");class d1 extends xH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>c1(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>c1(null==t?void 0:t[this.series.getDimensionField()[0]])}}const u1=Object.assign(Object.assign({},RH),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class p1 extends $H{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const g1=(t,e)=>{const i=c(e)?e():e,s=i.getViewBox();return s&&(null==t?void 0:t.length)?TJ(Object.assign({setField:i.setField,valueField:i.valueField},s),t):[]};class f1 extends ij{constructor(){super(...arguments),this.type=kC.venn,this.transformerConstructor=p1,this._viewBox=new Ne}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:zw)}initData(){var t;super.initData(),zM(this._dataSet,"venn",g1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:()=>({getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField})})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(f1.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(f1.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},AF.STATE_NORMAL,xF.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},AF.STATE_NORMAL,xF.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},AF.STATE_HOVER,xF.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>c1(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},AF.STATE_NORMAL,xF.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>c1(t.sets)},AF.STATE_NORMAL,xF.Series))}initTooltip(){this._tooltipHelper=new d1(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:c1(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return c1(i)}legendSelectedFilter(t,e){if(t.type===n.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[c1(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>G(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(c1(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(NH(null===(e=hw.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),VH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(NH(null===(e=hw.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),VH(t.name,this._spec,this._markAttributeContext)))}))}}f1.type=kC.venn,f1.mark=u1,f1.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},f1.transformerConstructor=p1;class m1 extends iK{constructor(){super(...arguments),this.type=kC.mosaic,this.transformerConstructor=tK}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(Qw),this.setFieldX2(Jw)),this.setFieldY(eM),this.setFieldY2(tM)):(t&&(this.setFieldY(Qw),this.setFieldY2(Jw)),this.setFieldX(eM),this.setFieldX2(tM)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&d(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];d(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}m1.type=kC.mosaic,m1.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},m1.transformerConstructor=tK;class v1 extends GW{_isValidSeries(t){return t===kC.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class y1 extends VW{constructor(){super(...arguments),this.transformerConstructor=v1,this.type="map",this.seriesType=kC.map}}y1.type="map",y1.seriesType=kC.map,y1.transformerConstructor=v1;const _1=()=>{CU(),RK(),kK(),hw.registerSeries(DK.type,DK),hw.registerImplement("registerMap",WM),hw.registerImplement("unregisterMap",UM),Hz(),hw.registerChart(y1.type,y1)};class b1 extends GW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=G(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return u(r)&&n.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),u(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class x1 extends b1{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY","clamp"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),d(l.type)&&(l.type="linear"),d(o.type)&&(o.type="band");const h=IN(l,{min:0,max:1});d(l.min)&&(l.min=h.min),d(l.max)&&(l.max=h.max),s&&Object.assign(l,lw({},s,l)),n&&Object.assign(o,lw({},n,o))}}class S1 extends b1{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class A1 extends b1{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class k1 extends VW{constructor(){super(...arguments),this.transformerConstructor=A1}}k1.transformerConstructor=A1;class C1 extends k1{constructor(){super(...arguments),this.transformerConstructor=A1,this.type="pie",this.seriesType=kC.pie}}C1.type="pie",C1.seriesType=kC.pie,C1.transformerConstructor=A1;class w1 extends S1{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["radius","outerRadius","innerRadius"]),n.radius=null!==(e=t.radius)&&void 0!==e?e:qN,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:qN,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&d(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=G(t.crosshair||{}).map((t=>lw({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const M1=(t,e)=>{if(!t)return null;const i=_j(t,(t=>"angle"===t.getOrient()),e),s=_j(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Tk(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=mk({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=vk(u),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=vj(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Tk(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=mk({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=vk(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=vj(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class T1 extends VW{constructor(){super(...arguments),this.transformerConstructor=w1,this.type="rose",this.seriesType=kC.rose}_setModelOption(){this._modelOption.getDimensionInfo=M1}}T1.type="rose",T1.seriesType=kC.rose,T1.transformerConstructor=w1,U(T1,qW);const B1=()=>{AU(),CU(),tU(),QW(),Fq(),hw.registerChart(T1.type,T1)};class E1 extends S1{_getDefaultSeriesSpec(t){var e,i,s,n;const r=super._getDefaultSeriesSpec(t),a=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e,"series","radar","area");return this._addSeriesRelatedSpecKeys(["line","point","area"]),r.line=t.line,r.point=t.point,r.stack=t.stack,r.percent=t.percent,r.area=lw({visible:null!==(s=null==a?void 0:a.visible)&&void 0!==s&&s},t.area),r.seriesMark=null!==(n=t.seriesMark)&&void 0!==n?n:"area",r.activePoint=t.activePoint,r.pointDis=t.pointDis,r.pointDisMul=t.pointDisMul,r.markOverlap=t.markOverlap,r}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=G(t.crosshair||{}).map((t=>lw({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class P1 extends VW{constructor(){super(...arguments),this.transformerConstructor=E1,this.type="radar",this.seriesType=kC.radar}_setModelOption(){this._modelOption.getDimensionInfo=M1}}P1.type="radar",P1.seriesType=kC.radar,P1.transformerConstructor=E1,U(P1,qW);const O1=()=>{AU(),CU(),MU(),tU(),QW(),Yq(),hw.registerChart(P1.type,P1)};class R1 extends GW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=p(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{P(e,"trimPadding")&&lw(e,fF(this.type,t))})),this._transformAxisSpec(t)}}class I1 extends VW{constructor(){super(...arguments),this.transformerConstructor=R1,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=aU(t,e,i))&&void 0!==s?s:[],...null!==(n=M1(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=lU,this._modelOption.getRectByDimensionData=gU}}I1.type="common",I1.transformerConstructor=R1,U(I1,qW);class D1 extends YW{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class L1 extends VW{constructor(){super(...arguments),this.transformerConstructor=D1}}L1.transformerConstructor=D1,U(L1,qW);class F1 extends D1{transformSpec(t){super.transformSpec(t),hF(t)}}class z1 extends L1{constructor(){super(...arguments),this.transformerConstructor=F1,this.type="histogram",this.seriesType=kC.bar}_setModelOption(){this._modelOption.getDimensionInfo=aU,this._modelOption.getDimensionInfoByValue=lU,this._modelOption.getRectByDimensionData=gU}}z1.type="histogram",z1.seriesType=kC.bar,z1.transformerConstructor=F1;const H1=()=>{AU(),CU(),MU(),tU(),QW(),sK(),hw.registerTransform("bin",qr),hw.registerChart(z1.type,z1)};class j1 extends x1{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["cornerRadius","progress","track","roundCap"]),s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class N1 extends VW{constructor(){super(...arguments),this.transformerConstructor=j1,this.type="circularProgress",this.seriesType=kC.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=M1}}N1.type="circularProgress",N1.seriesType=kC.circularProgress,N1.transformerConstructor=j1,U(N1,qW);const V1=()=>{AU(),CU(),tU(),QW(),gZ(),hw.registerChart(N1.type,N1)};class W1 extends x1{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["pin","pinBackground","pointer"]),e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=kC.circularProgress,e}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===kC.gauge||t.type===kC.circularProgress));d(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(d(a.radiusField)&&d(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),d(a.valueField)&&d(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===kC.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:_F.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),d(i.angle.type)&&(i.angle.type="linear"),d(i.radius.type)&&(i.radius.type="linear"),d(i.angle.zIndex)&&(i.angle.zIndex=_F.Region+50)}}class U1 extends VW{constructor(){super(...arguments),this.transformerConstructor=W1,this.type="gauge",this.seriesType=kC.gaugePointer}}U1.type="gauge",U1.seriesType=kC.gaugePointer,U1.transformerConstructor=W1;const G1=()=>{CU(),R0(),hw.registerSeries(D0.type,D0),cq(),cZ(),Rq(),gZ(),hw.registerChart(U1.type,U1)};class Y1 extends GW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class X1 extends VW{constructor(){super(...arguments),this.transformerConstructor=Y1,this.type="wordCloud",this.seriesType=kC.wordCloud}}X1.transformerConstructor=Y1;class K1 extends X1{constructor(){super(...arguments),this.transformerConstructor=Y1,this.type="wordCloud",this.seriesType=kC.wordCloud}}K1.type="wordCloud",K1.seriesType=kC.wordCloud,K1.transformerConstructor=Y1;const $1=()=>{CU(),nQ(),hw.registerChart(K1.type,K1)};class q1 extends GW{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class Z1 extends VW{constructor(){super(...arguments),this.transformerConstructor=q1,this.type="funnel",this.seriesType=kC.funnel}}Z1.type="funnel",Z1.seriesType=kC.funnel,Z1.transformerConstructor=q1;const J1=()=>{CU(),CQ(),hw.registerChart(Z1.type,Z1)};class Q1 extends YW{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",this._addSeriesRelatedSpecKeys(["cornerRadius"]),s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="band"),d(i.type)&&(i.type="linear");const n=IN(i,{min:0,max:1});d(i.min)&&(i.min=n.min),d(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="linear"),d(e.type)&&(e.type="band");const n=IN(s,{min:0,max:1});d(s.min)&&(s.min=n.min),d(s.max)&&(s.max=n.max)}}}class t2 extends VW{constructor(){super(...arguments),this.transformerConstructor=Q1,this.type="linearProgress",this.seriesType=kC.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=aU,this._modelOption.getDimensionInfoByValue=lU,this._modelOption.getRectByDimensionData=gU}}t2.type="linearProgress",t2.seriesType=kC.linearProgress,t2.transformerConstructor=Q1,U(t2,qW);const e2=()=>{AU(),CU(),tU(),QW(),AZ(),hw.registerChart(t2.type,t2)};class i2 extends YW{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),hF(t)}}class s2 extends VW{constructor(){super(...arguments),this.transformerConstructor=i2,this.type="rangeColumn",this.seriesType=kC.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=aU,this._modelOption.getDimensionInfoByValue=lU,this._modelOption.getRectByDimensionData=gU}}s2.type="rangeColumn",s2.seriesType=kC.rangeColumn,s2.transformerConstructor=i2;const n2=()=>{AU(),CU(),tU(),QW(),Y$(),hw.registerChart(s2.type,s2)};class r2 extends GW{_getDefaultSeriesSpec(t){const e=u(t.startAngle)?t.startAngle:-90,i=u(t.endAngle)?t.endAngle:e+oe(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class a2 extends VW{constructor(){super(...arguments),this.transformerConstructor=r2,this.type="sunburst",this.seriesType=kC.sunburst}}a2.type="sunburst",a2.seriesType=kC.sunburst,a2.transformerConstructor=r2;const o2=()=>{CU(),WQ(),hw.registerChart(a2.type,a2)};class l2 extends GW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class h2 extends VW{constructor(){super(...arguments),this.transformerConstructor=l2,this.type="circlePacking",this.seriesType=kC.circlePacking}}h2.type="circlePacking",h2.seriesType=kC.circlePacking,h2.transformerConstructor=l2;const c2=()=>{CU(),$Q(),hw.registerChart(h2.type,h2)};class d2 extends GW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class u2 extends VW{constructor(){super(...arguments),this.transformerConstructor=d2,this.type="treemap",this.seriesType=kC.treemap}}u2.type="treemap",u2.seriesType=kC.treemap,u2.transformerConstructor=d2;const p2=()=>{CU(),A0(),hw.registerChart(u2.type,u2)};class g2 extends nK{transformSpec(t){super.transformSpec(t),t.legends&&G(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),hF(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["bar","stackLabel","leaderLine","total","calculationMode"]),e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class f2 extends rK{constructor(){super(...arguments),this.transformerConstructor=g2,this.type="waterfall",this.seriesType=kC.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=aU,this._modelOption.getDimensionInfoByValue=lU,this._modelOption.getRectByDimensionData=gU}}f2.type="waterfall",f2.seriesType=kC.waterfall,f2.transformerConstructor=g2;const m2=()=>{AU(),CU(),MU(),tU(),QW(),d$(),hw.registerChart(f2.type,f2)};class v2 extends YW{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),hF(t)}}class y2 extends VW{constructor(){super(...arguments),this.transformerConstructor=v2,this.type="boxPlot",this.seriesType=kC.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=aU,this._modelOption.getDimensionInfoByValue=lU,this._modelOption.getRectByDimensionData=gU}}y2.type="boxPlot",y2.seriesType=kC.boxPlot,y2.transformerConstructor=v2;const _2=()=>{AU(),CU(),tU(),QW(),D$(),hw.registerTransform("boxplot",Zr),hw.registerChart(y2.type,y2)};class b2 extends GW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class x2 extends VW{constructor(){super(...arguments),this.transformerConstructor=b2,this.type="sankey",this.seriesType=kC.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=wM(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}x2.type="sankey",x2.seriesType=kC.sankey,x2.transformerConstructor=b2;const S2=()=>{CU(),NU(),f0(),hw.registerChart(x2.type,x2)};class A2 extends YW{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["area","point","line"]),s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),hF(t)}}class k2 extends VW{constructor(){super(...arguments),this.transformerConstructor=A2,this.type="rangeArea",this.seriesType=kC.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=aU,this._modelOption.getDimensionInfoByValue=lU,this._modelOption.getRectByDimensionData=gU}}k2.type="rangeArea",k2.seriesType=kC.rangeArea,k2.transformerConstructor=A2;const C2=()=>{AU(),CU(),MU(),tU(),QW(),PU(),aW(),SW(),hw.registerSeries(Z$.type,Z$),hw.registerChart(k2.type,k2)};class w2 extends YW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class M2 extends VW{constructor(){super(...arguments),this.transformerConstructor=w2,this.type="heatmap",this.seriesType=kC.heatmap}}M2.type="heatmap",M2.seriesType=kC.heatmap,M2.transformerConstructor=w2;const T2=()=>{CU(),W0(),hw.registerChart(M2.type,M2)};class B2 extends GW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class E2 extends VW{constructor(){super(...arguments),this.transformerConstructor=B2,this.type="correlation",this.seriesType=kC.correlation}}E2.type="correlation",E2.seriesType=kC.correlation,E2.transformerConstructor=B2;const P2=()=>{CU(),n1(),hw.registerChart(E2.type,E2)};function O2(t){var e,i;const s=Object.assign({},t);return E(t.style)||(s.textStyle=AM(t.style)),E(t.textStyle)||lw(s.textStyle,AM(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&AM(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&AM(s.background.style),s}function R2(t){const e=t=>function(t){return u(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:u(t.texturePadding)?t.texturePadding:1,textureSize:u(t.textureSize)?t.textureSize:4}):t}(t);if(c(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else E(t.style)||(t.style=e(t.style));return E(t.state)||Object.keys(t.state).forEach((i=>{if(c(t.state[i])){const s=t.state[i];t.state[i]=(...t)=>e(s(...t))}else E(t.state[i])||(t.state[i]=e(t.state[i]))})),t}const I2=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},D2=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const p={};c.forEach((t=>{p[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:Hw;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===p[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===p[t.source]&&!0===p[t.target])))):u(g)&&(t=t.filter((t=>!0===p[r.getSeriesFieldValue(t,g)]))),t)},L2={position:!0,item:!0,title:!0,pager:!0,background:!0};class F2 extends iV{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=_F.Legend,this.layoutLevel=bF.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{_k(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),_k(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=WC(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;u(s)&&(this._seriesUserId=G(s)),u(e)&&(this._regionUserId=G(e)),u(n)&&(this._seriesIndex=G(n)),u(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const s=!V(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):s&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(s&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,s=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>V(null==i?void 0:i[t],null==s?void 0:s[t])||L2[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new KF(this._option,t),this._initSelectedData(),_k(this._regions,(t=>{t.event.on(PM.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;d(t)||JSON.stringify(n)===JSON.stringify(t)||(_k(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(PM.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(lw({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(lw({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(lw({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(PM.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}F2.specKey="legends";class z2 extends F2{constructor(){super(...arguments),this.type=n.discreteLegend,this.name=n.discreteLegend}static getSpecInfo(t){return dH(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),_k(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:qM.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){zM(this._option.dataSet,"discreteLegendFilter",D2),zM(this._option.dataSet,"discreteLegendDataMake",I2);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return _k(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!_A(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return c(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=lM(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(e){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(e,i,s){const{title:n={},item:r={},pager:a={},background:o={},type:l,id:h,visible:d,orient:p,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=e,S=t(e,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:k={},pager:C={},background:w={}}=e;A=I(A),k=I(k),C=I(C),w=I(w);const M=S;if(c(M.maxRow)||c(M.maxCol)){const t=WC(s)?s:WC(p)?p:"left";c(M.maxRow)&&(M.maxRow=M.maxRow({rect:i,orient:t,id:h})),c(M.maxCol)&&(M.maxCol=M.maxCol({rect:i,orient:t,id:h}))}return A.visible?M.title=O2(A):M.title={visible:!1},E(k.focusIconStyle)||AM(k.focusIconStyle),k.shape&&(k.shape=R2(bM(k.shape))),k.label&&(k.label=bM(k.label)),k.value&&(k.value=bM(k.value)),k.background&&(k.background=bM(k.background)),UC(k.maxWidth)&&(k.maxWidth=Number(k.maxWidth.substring(0,k.maxWidth.length-1))*i.width/100),UC(k.width)&&(k.width=Number(k.width.substring(0,k.width.length-1))*i.width/100),UC(k.height)&&(k.height=Number(k.height.substring(0,k.height.length-1))*i.width/100),M.item=k,"scrollbar"===C.type?(E(C.railStyle)||AM(C.railStyle),E(C.sliderStyle)||AM(C.sliderStyle)):(E(C.textStyle)||AM(C.textStyle),C.handler&&bM(C.handler)),M.pager=C,w.visible&&!E(w.style)&&(lw(M,w.style),u(w.padding)&&(M.padding=w.padding)),M}(this._spec,e,this.layoutOrient)),{maxWidth:e.width,maxHeight:e.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return ZY}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(UY.legendItemClick,(e=>{const i=P(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(PM.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(UY.legendItemHover,(t=>{const e=P(t,"detail");this.event.emit(PM.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(UY.legendItemUnHover,(t=>{const e=P(t,"detail");this.event.emit(PM.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,datum:t.datum,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(s)?s:1,strokeOpacity:A(n)?n:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return c(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=cH(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=cH(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}z2.specKey="legends",z2.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},z2.type=n.discreteLegend;const H2=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;A(n)&&(t=Math.min(n,t)),A(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},j2=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!p(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!E(o)){const[e,i]=o;return a?a(t,o,l):h(t)?vM(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function N2(e){const i=lw({},e),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:d,background:p={},type:g,id:f,visible:m,orient:v,position:y,data:_,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:C,seriesId:w,padding:M}=i,T=t(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?T.title=O2(s):T.title={visible:!1},T.showHandler=!1!==n.visible,E(n.style)||(T.handlerStyle=AM(n.style)),u(r.width)&&(T.railWidth=r.width),u(r.height)&&(T.railHeight=r.height),E(r.style)||(T.railStyle=AM(r.style)),E(a.style)||(T.trackStyle=AM(a.style)),T.startText=bM(o),T.endText=bM(l),T.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return c(i)?e.style=(t,e,s)=>AM(i(t,e,s)):E(i)||(e.style=AM(i)),e}(h),E(d)||(T.sizeBackground=AM(d)),p.visible&&!E(p.style)&&(lw(T,p.style),u(p.padding)&&(T.padding=p.padding)),T}const V2={color:iX,size:nX},W2={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},U2=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},W2),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},G2={horizontal:U2(!0),vertical:U2(!1)},Y2=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},W2),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},X2={horizontal:Y2(!0),vertical:Y2(!1)},K2=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],$2=[2,10];class q2 extends F2{static getSpecInfo(t){const e=dH(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?n.colorLegend:n.sizeLegend})),e}constructor(t,e){super(t,e),this.type=n.colorLegend,this.name=n.colorLegend;const i="color"===this._spec.type?n.colorLegend:n.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),_k(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData,customFilter:this._spec.customFilter},level:qM.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){zM(this._option.dataSet,"continuousLegendFilter",j2),zM(this._option.dataSet,"continuousLegendDataMake",H2);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>bk(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=lM(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!_A(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=lM(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),E(r)&&(r="color"===this._legendType?K2:$2);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 h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},N2(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return V2[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((e=>{const i=P(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(PM.legendFilter,{model:this,value:i,event:e})}),30))}}}q2.specKey="legends",q2.builtInTheme={colorLegend:G2,sizeLegend:X2},q2.type=n.continuousLegend;const Z2=()=>{hw.registerComponent(q2.type,q2)},J2=(t,e)=>u(e)?t.map((t=>e[t])):void 0,Q2=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),t5=t=>!d(t)&&(y(t)?t.length>0&&t.every(u):Object.keys(t).length>0);function e5(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),p=i.getOption(),g=p.getRegionsInUserIdOrIndex(u(c.regionId)?[c.regionId]:void 0,u(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=i5(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=p.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>Q2(i,s)(t)&&Q2(n,r)(t)&&(d(a)||Q2([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{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=>x(t))))&&void 0!==i?i:[]}}))}];u(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=p.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:OM.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=p.globalInstance;return iH.globalConfig.uniqueTooltip&&iH.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=p.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:OM.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=p.globalInstance;return iH.globalConfig.uniqueTooltip&&iH.hideTooltip(a.id),m}return"none"}const i5=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),p=e.getMeasureField(),g=e.getSeriesField(),f=u(g)?t[g]:void 0,m=u(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=J2(c,t);let y=J2(p,t);const _=t5(y),b=!_&&u(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(Q2(c,v));if(!_&&(y=J2(p,i),!t5(y)))return;const n=e.type===kC.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=Tk(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>d(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(Q2(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=J2(p,o),!t5(y))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(Q2(c,n));if(!_&&(y=J2(p,r),!t5(y)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===kC.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(Q2(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=J2(p,i),!t5(y))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:y,hasMeasureData:_,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(Q2(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=J2(p,a),h=y,!t5(y)&&!a)return;t5(y)||(y=[null])}const u=e.dataToPosition(a);d(u)||isNaN(u.x)||isNaN(u.y)||s.push({pos:u,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},s5=t=>u(t)&&!y(t),n5=t=>u(t)&&y(t),r5=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class a5 extends eV{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=lw({},...r5.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=lw({},s);r5.forEach((t=>{delete r[t]})),delete r.style;const a=lw({},r,i);return a.style=lw({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return u(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:fA(this._option.mode)||!pA(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,u(t.parentElement)?v(t.parentElement)&&(t.parentElement=t_.getElementById(t.parentElement)):pA(this._option.mode)&&(t.parentElement=null==uA?void 0:uA.body)}}const o5={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class l5 extends iV{constructor(){super(...arguments),this.layoutZIndex=1,this.type=n.tooltip,this.name=n.tooltip,this.transformerConstructor=a5,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=pA(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&s5(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):u(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&iH.globalConfig.uniqueTooltip&&l&&iH.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(PM.tooltipHide,Object.assign(Object.assign({},t),{source:OM.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(null==n?void 0:n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:OM.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(PM.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(PM.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?yU.canvas:yU.dom,n=hw.getComponentPluginInType(t);n||hA("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=hw.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(gA(s)||fA(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):p(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>p(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=x(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,St(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=e5(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(n5(t)){if(s5(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>fj(t,e[i])))}if(n5(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}l5.type=n.tooltip,l5.transformerConstructor=a5,l5.builtInTheme={tooltip:o5},l5.specKey="tooltip";var h5,c5;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(h5||(h5={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(c5||(c5={}));const d5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},u5={labelZIndex:!0,gridZIndex:!0},p5={xField:!0,yField:!0,categoryField:!0,valueField:!0},g5={visible:!0,width:!0,style:!0};class f5 extends iV{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=_F.CrossHair_Grid,this.labelZIndex=_F.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),x(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(p(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Tk(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!V(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||u5[i]||p5[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||g5[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:RM.chart}:{source:OM.chart};y(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:t=s["desktop-browser"]}=this._option,e=function(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:gA(t)||fA(t)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(t);if(e){const t=G(this.trigger||"hover"),i=t=>"click"===t?"none"===this.triggerOff?null:e.clickOut:e.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:e[t],out:i(t)})})),s}return null}_registerTooltipEvent(){this.event.on(PM.tooltipHide,{source:OM.chart},this._handleTooltipHideOrRelease),this.event.on(PM.tooltipShow,{source:OM.chart},this._handleTooltipShow),this.event.on(PM.tooltipRelease,{source:OM.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=P(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{d5[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||x(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(e,i){var s,n,r;const a={},{line:o={},label:l={},visible:c}=e;if(a.visible=c,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=t(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(x(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=P(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==e?void 0:e.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=e.line.style.stroke);const t=P(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const e=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=e.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:c,outerBorder:d}=n,u=t(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:e.minWidth,maxWidth:e.maxWidth,padding:e.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:P(s,"stroke")}),panel:(h(e.visible)?e.visible:e)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:c,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}f5.specKey="crosshair";const m5={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class v5 extends f5{static getSpecInfo(t){return dH(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=n.cartesianCrosshair,this.name=n.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=aj(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){aj(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(u(t.dimType)?"y"===t.dimType:oj(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=xk(this._regions,"cartesian");e&&(hU(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=uU(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new iG(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new sG(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}v5.specKey="crosshair",v5.builtInTheme={crosshair:m5},v5.type=n.cartesianCrosshair;class y5 extends f5{static getSpecInfo(t){return dH(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=n.polarCrosshair,this.name=n.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=xk(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&u(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=RN(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=cH(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:he(d,a.getInnerRadius(),o),end:he(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=de(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=he(t,o,r),d=he(t,o,h),m=ve([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=vt(re.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new iG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new rG(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new aG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new nG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=ue(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=ue(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?he(e,p[1]+m.offset,u):he(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}y5.specKey="crosshair",y5.builtInTheme={crosshair:m5},y5.type=n.polarCrosshair;const _5=()=>{hw.registerComponent(y5.type,y5)},b5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(d(o)||d(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},x5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(d(a)||d(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return G(r).every((i=>{t[i]>=a[0]&&t[i]<=Y(a)&&(e=!0)})),e}:t=>{let e=!1;return G(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},S5=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],p=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(d(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);u(null==t?void 0:t.max)&&u(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{d(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{G(i[e]).forEach((i=>{d(t[i])||(d(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),d(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),p.push(e)})),p},A5=(t,e,i)=>{const s=e.domain();if(wk(e.type))return i?s[0]+(Y(s)-s[0])*(1-t):s[0]+(Y(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(Y(n)-n[0])*t;return e.invert(r)},k5=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&wk(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(Y(n)-n[0])))},C5=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},w5=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},M5=(t,e,i)=>"start"===t?"percent"===e&&u(i.start)||"value"===e&&u(i.startValue):"percent"===e&&u(i.end)||"value"===e&&u(i.endValue),T5=(t,e,i)=>{if(wk(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class B5{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:u(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=vt(this.getState().start+f,0,1),y=vt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(A(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===cj(hj(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,h(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}U(B5,PK);class E5 extends iV{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:k5(t,this._stateScale,this._isHorizontal),a="percent"===n?e:k5(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var t;this._dataFilterEvent.initZoomEvent(),null===(t=this._relatedAxisComponent)||void 0===t||t.event.on(PM.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=C5(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=T5(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&w5(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else _k(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),_k(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=hj(t),this._isHorizontal="horizontal"===cj(this._orient),this._dataFilterEvent=new B5(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.change=!0,i.reRender=!0,!i.reCompile&&this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0),i}_getComponentOnlySpecKeys(){return null}_isComponentOnlySpecChange(t,e){const i=this._getComponentOnlySpecKeys();if(!i)return!1;return Object.keys(Object.assign(Object.assign({},e),t)).every((s=>V(null==e?void 0:e[s],null==t?void 0:t[s])||i[s]))}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(wk(n.type)){const r=n.domain(),a=r[0],o=Y(r)-a,l=u(t)?a+o*t:+e,h=u(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=u(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=u(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(u(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):u(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),d(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>cj(t._orient)===cj(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!wk(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(u(i)&&(u(i.userId)&&(this._seriesUserId=G(i.userId)),u(i.specIndex)&&(this._seriesIndex=G(i.specIndex))),u(this._spec.seriesId)){const t=G(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(u(this._spec.seriesIndex)){const t=G(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(u(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(G(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(u(this._spec.regionId)){const t=G(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};_k(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=wk(d.getScale(0).type),p=wk(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?G(g.xField):G(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?G(g.yField):G(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else _k(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;HM(r,"dataview",Ta),zM(r,"dataFilterComputeDomain",S5);const a=new Oa(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new KF(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(zM(this._option.dataSet,"dataFilterWithNewDomain",x5),zM(this._option.dataSet,"lockStatisticsFilter",b5),_k(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>wk(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>wk(this._stateScale.type)},level:qM.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(wk(this._stateScale.type));this._stateScale.domain(a,!1),(u(this._spec.start)||u(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!V(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;M5("start",i,this._spec)&&M5("end",s,this._spec)&&(t="percent"===i?this._spec.start:k5(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:k5(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?k5(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?k5(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=A5(this._start,this._stateScale,C5(i,this._isHorizontal)),this._endValue=A5(this._end,this._stateScale,C5(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,wk(this._stateScale.type)&&this._stateScale.domain()[0]!==Y(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=T5(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&_k(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);A(null==i?void 0:i.min)&&A(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new mC:new $k,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),X(t)]:[-1/0,1/0]}return e}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:xF.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,r,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),u=w5(h);if(!this._dataUpdating&&Tk(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==u?void 0:u.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(r=this._cacheRect)||void 0===r?void 0:r.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==u?void 0:u.bandSize,Tk(c.type)){u&&(this._start||this._end)&&(this.type===n.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!d(t)||!d(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(E5,PK);class P5 extends eV{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=lw({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const O5=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),R5={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:O5(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:O5(!0)},I5={width:!0,height:!0,showDetail:!0,middleHandler:!0,background:!0,startHandler:!0,endHandler:!0,startText:!0,endText:!0,dragMask:!0,selectedBackground:!0,backgroundChart:!0,selectedBackgroundChart:!0,showBackgroundChart:!0};class D5 extends E5{constructor(t,e){var i;super(t,e),this.type=n.dataZoom,this.name=n.dataZoom,this.transformerConstructor=P5,this.specKey="dataZoom",this.layoutZIndex=_F.DataZoom,this.layoutLevel=bF.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange)if(i&&this._component)this._component.setStartAndEnd(t,e);else{const i=this._relatedAxisComponent,n=A5(t,this._stateScale,C5(i,this._isHorizontal)),r=A5(e,this._stateScale,C5(i,this._isHorizontal));if(!u(n)||!u(r))return;this._start=t,this._end=e;(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(PM.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new mC),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(C5(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=C5(t,this._isHorizontal),this.effect.onZoomChange())}_getComponentOnlySpecKeys(){return I5}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),d(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),d(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const u=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=u?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new mC;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(C5(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!wk(t.type)||e[0]!==Y(e))&&(!Tk(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(G(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:u(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:C5(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>A5(t,this._stateScale,C5(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new UG(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>A5(t,this._stateScale,C5(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:AM(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:AM(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:AM(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:AM(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:AM(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:AM(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:AM(g.style)},selectedBackgroundStyle:AM(this._spec.selectedBackground.style),dragMaskStyle:AM(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:lw(AM(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},AM(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:lw(AM(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},AM(null===(d=m.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=cH(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(C5(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}D5.type=n.dataZoom,D5.transformerConstructor=P5,D5.builtInTheme={dataZoom:R5},D5.specKey="dataZoom";const L5=()=>{hw.registerComponent(D5.type,D5)},F5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},z5={width:!0,height:!0,rail:!0,slider:!0,round:!0,innerPadding:!0,minSliderSize:!0};class H5 extends E5{constructor(t,e){var i;super(t,e),this.type=n.scrollBar,this.name=n.scrollBar,this.specKey="scrollBar",this.layoutZIndex=_F.DataZoom,this.layoutLevel=bF.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}_handleChange(t,e,i){super._handleChange(t,e,i);const s=ck(this._start,t)&&ck(this._end,e);if(this._shouldChange&&(!s||!1===this._spec.realTime)){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this._relatedAxisComponent,n=C5(s,this._isHorizontal),r=A5(t,this._stateScale,n),a=A5(e,this._stateScale,n);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,r,a):this._handleStateChange(r,a))&&this.event.emit(PM.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentOnlySpecKeys(){return z5}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:u(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new HU(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return d(i)||(s.padding=i),E(null==t?void 0:t.style)||(s.railStyle=AM(t.style)),E(null==e?void 0:e.style)||(s.sliderStyle=AM(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}H5.type=n.scrollBar,H5.builtInTheme={scrollBar:F5},H5.specKey="scrollBar";const j5=()=>{hw.registerComponent(H5.type,H5)},N5=(t,e)=>{const{datum:i,title:s,content:n}=c(e)?e():e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),G(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},V5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),W5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:V5("l1FontSize","primaryFontColor")},content:{visible:!0,style:V5("l2FontSize","tertiaryFontColor")}};class U5 extends iV{constructor(){super(...arguments),this.type=n.indicator,this.name=n.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=_F.Indicator,this.layoutLevel=bF.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return dH(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=G(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex))}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(wM(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(wM(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){zM(this._option.dataSet,"indicatorFilter",N5);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:()=>({title:this._title,content:this._content,datum:()=>this._activeDatum})}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new KF(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const e=this._regions[0],{width:i,height:s}=e.getLayoutRect(),{x:n,y:r}=e.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,p=t(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return G(o).forEach((t=>{const e=lw({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},SM(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?ZC(l,this._computeLayoutRadius()):0,dy:h?ZC(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!u(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},SM(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},p)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)V(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new oX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":c(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}U5.type=n.indicator,U5.builtInTheme={indicator:W5},U5.specKey="indicator";const G5=()=>{hw.registerComponent(U5.type,U5)},Y5=["sum","average","min","max","variance","standardDeviation","median"];function X5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function K5(t,e){return t?`${t}_${e}_extend`:`marker_${e}_extend`}function $5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return x(t.x)&&X5(e,t.x,i)&&(null===(l=null==h?void 0:(o=h.getXAxisHelper()).setExtendDomain)||void 0===l||l.call(o,K5(a,"xAxis"),t.x)),c=UC(t.x)?Q5(t.x,n)+r.x:t3(h.getXAxisHelper(),[t.x])+r.x,c}function q5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return x(t.y)&&X5(e,t.y,i)&&(null===(l=null===(o=h.getYAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,K5(a,"yAxis"),t.y)),c=UC(t.y)?Q5(t.y,n)+r.y:t3(h.getYAxisHelper(),[t.y])+r.y,c}function Z5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return x(t.angle)&&X5(e,t.angle,i)&&(null===(a=null===(r=o.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,K5(n,"angleAxis"),t.angle)),t3(o.angleAxisHelper,[t.angle])}function J5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return x(t.radius)&&X5(e,t.radius,i)&&(null===(a=null===(r=o.radiusAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,K5(n,"radiusAxis"),t.radius)),t3(o.radiusAxisHelper,[t.radius])}function Q5(t,e){return Number(t.substring(0,t.length-1))*e/100}function t3(t,e){const i=t.getScale(0);return wk(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function e3(t){return Y5.includes(t)}function i3(t,e,i,s,n,r=!1,a){const o=e.getRegion(),l=o.getLayoutStartPoint(),h=i.getRegion(),c=h.getLayoutStartPoint(),d=Math.abs(Math.min(l.x,c.x)-Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width)),p=Math.abs(Math.min(l.y,c.y)-Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height)),g={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},f=[],m=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,v=s.getXAxisHelper(),y=s.getYAxisHelper(),_=v.getScale(0).domain(),b=y.getScale(0).domain(),x=r&&!v.isContinuous&&!!v.getBandwidth,S=r&&!y.isContinuous&&!!y.getBandwidth,A={min:null,max:null},k={min:null,max:null};return m.forEach((t=>{const e=u(t.x),i=u(t.y);let s,r;if(e&&i)s=$5(t,_,n,g,d,l,a),r=q5(t,b,n,g,p,l,a),s3(s,x,A,f.length),s3(r,S,k,f.length),f.push([{x:s,y:r}]);else if(e){s=$5(t,_,n,g,d,l,a),r=Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height);const e=Math.min(l.y,c.y);s3(s,x,A,f.length),f.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(l.x,c.x),r=q5(t,b,n,g,p,l,a);const e=Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width);s3(r,S,k,f.length),f.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(f,v,y,A,k),f}function s3(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=u(t.angle),i=u(t.radius);if(e&&i){const e=Z5(t,h,n,a,r),i=J5(t,c,n,a,r);o.push([{angle:e,radius:i}])}else if(e){const e=Z5(t,h,n,a,r);o.push([{angle:e,radius:-d},{angle:e,radius:d}])}else if(i){const e=J5(t,c,n,a,r);o.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),o}function r3(t,e){return(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e}function a3(t,e,i,s,n){const r=[],a=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,o=y(s);return i&&a.forEach((t=>{!function(t,e,i,s){var n,r,a,o;const l=e.getXAxisHelper().getScale(0).domain(),h=e.getYAxisHelper().getScale(0).domain(),c=G(t.x),d=G(t.y);1===c.length&&x(c[0])&&X5(l,c[0],i)&&(null===(r=null===(n=e.getXAxisHelper())||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,K5(s,"xAxis"),c[0])),1===d.length&&x(d[0])&&X5(h,d[0],i)&&(null===(o=null===(a=e.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,K5(s,"yAxis"),d[0]))}(t,r3(t,e),i,n)})),a.forEach(((t,i)=>{const n=r3(t,e),a=n.getRegion(),l=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();let d=0,u=0;if(s){const t=o?s[i]:s,e=t.x,n=t.y;e&&(d=UC(e)?Number(e.substring(0,e.length-1))*h/100:e),n&&(u=UC(n)?Number(n.substring(0,n.length-1))*c/100:n)}const p=G(t.x),g=G(t.y);r.push({x:t3(n.getXAxisHelper(),p)+l.x+d,y:t3(n.getYAxisHelper(),g)+l.y+u})})),r}function o3(t,e,i,s){const n=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var r,a,o,l;const h=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,c=h.angleAxisHelper.getScale(0).domain(),d=h.radiusAxisHelper.getScale(0).domain(),u=G(t.angle),p=G(t.radius);1===u.length&&x(u[0])&&X5(c,u[0],i)&&(null===(a=null===(r=h.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,K5(s,"angleAxis"),u[0])),1===p.length&&x(p[0])&&X5(d,p[0],i)&&(null===(l=null===(o=h.radiusAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,K5(s,"radiusAxis"),p[0])),n.push({angle:t3(h.angleAxisHelper,u),radius:t3(h.radiusAxisHelper,p)})})),n}function l3(t,e,i){let{x:s,y:n}=t;return UC(s)&&(s=Q5(s,e)),UC(n)&&(n=Q5(n,i)),{x:s,y:n}}function h3(t,e,i){let s;if(s=c(t)?G(t(e.getData().getLatestData(),e)):G(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=l3(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>l3(t,n,r)))}function c3(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function d3(e,i,s){const{labelBackground:n={},style:r,shape:a}=e,o=t(e,["labelBackground","style","shape"]);if(!1!==e.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},AM(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},p3(AM(n.style),i,s)),u(n.padding)&&(t.padding=ai(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=p3(AM(r),i,s)),t}return{visible:!1}}function u3(t,e,i){for(const s in t)c(t[s])&&(t[s]=t[s](e,i));return t}function p3(t,e,i){return c(t)?t(e,i):t}function g3(t,e){return c(t)?t(e):t}function f3(t,e,i){return u(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function m3(t){return{isXProcess:u(t.x),isYProcess:u(t.y),isX1Process:u(t.x1),isY1Process:u(t.y1),isAngleProcess:u(t.angle),isRadiusProcess:u(t.radius),isAngle1Process:u(t.angle1),isRadius1Process:u(t.radius1),isCoordinatesProcess:u(t.coordinates),isValidProcess:u(t.process)}}function v3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=m3(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function y3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=m3(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function _3(t){return{doXYProcess:u(t.x)&&u(t.y),doPolarProcess:u(t.angle)&&u(t.radius),doGeoProcess:u(t.areaName)}}function b3(e,i){let s;if(i.coordinates){const e=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=e,o=t(e,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(c(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=G(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;u(r)&&(c=G(i)[r]),n&&G(i).includes(n)&&(c=n);let d=s;u(l)&&(d=G(s)[l]),a&&G(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),v(t[c])&&e3(t[c])?h.x={field:c,aggrType:t[c]}:h.x=G(c).map((e=>t[e])),v(t[d])&&e3(t[d])?h.y={field:d,aggrType:t[d]}:h.y=G(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;u(r)&&(a=G(s)[r]),n&&G(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),v(t[a])&&e3(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=G(a).map((e=>t[e])),v(t[l])&&e3(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=G(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((t=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(u(t.x)){const s=t.x;y(s)?i.x=s.map((i=>S3(i,e,t))):i.x=S3(s,e,t)}if(u(t.y)){const s=t.y;y(s)?i.y=s.map((i=>S3(i,e,t))):i.y=S3(s,e,t)}if(u(t.angle)){const s=t.angle;y(s)?i.angle=s.map((i=>S3(i,e,t))):i.angle=S3(s,e,t)}if(u(t.radius)){const s=t.radius;y(s)?i.radius=s.map((i=>S3(i,e,t))):i.radius=S3(s,e,t)}if(u(t.areaName)){const s=t.areaName;i.areaName=S3(s,e,t)}t.getRefRelativeSeries&&(i.getRefRelativeSeries=t.getRefRelativeSeries),n.push(i)})),n}const x3={min:(t,e)=>dk(t[0].latestData,e.field),max:(t,e)=>uk(t[0].latestData,e.field),sum:function(t,e){return pk(t[0].latestData,e.field)},average:function(t,e){return gk(t[0].latestData,e.field)},variance:function(t,e){return fk(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(fk(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function S3(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(c(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return x3[i](e,{field:s})}return t}function A3(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}const k3=t=>{var e;const i=null===(e=null==t?void 0:t.dataSet)||void 0===e?void 0:e.dataViewMap;return i?Object.values(i).filter(Boolean):[]},C3=(t,e)=>{var i,s;null===(i=null==t?void 0:t.target)||void 0===i||i.removeListener("change",e.reRunAllTransform),null===(s=null==t?void 0:t.target)||void 0===s||s.removeListener("markRunning",e.markRunning)},w3=t=>{if(!t)return;k3(t).forEach((e=>{C3(e,t)}));const e=null==t?void 0:t.rawData;Array.isArray(e)&&e.forEach((e=>{C3(e,t)}))},M3=(t,e)=>{if(!t)return;const i=new Set(k3(t)),s=[],n=t=>{const r=null==t?void 0:t.rawData;Array.isArray(r)&&r.forEach((t=>{i.has(t)&&e(t)&&!s.includes(t)&&(s.push(t),n(t))}))};n(t),(t=>{const e=Array.from(new Set(t.filter(Boolean)));e.length&&(e.forEach(w3),e.forEach((t=>{var e;null===(e=t.destroy)||void 0===e||e.call(t)})))})([t,...s])},T3="__vchart_marker_coordinate__",B3=["coordinate","coordinates","x","y","x1","y1","angle","angle1","radius","radius1"],E3=["position","positions","coordinatesOffset","regionRelative"],P3=["offsetX","offsetY","confine"],O3=t=>Array.isArray(t)?t.map(O3):t&&"object"==typeof t?"function"!=typeof t.formatMethod?t:Object.assign(Object.assign({},t),{formatMethod:"__vchart_marker_format_method__"}):t,R3=t=>{if(Array.isArray(t))return t.map(R3);if(!t||"object"!=typeof t)return t;const e=Object.assign({},t);return Object.keys(e).forEach((t=>{"style"===t||t.endsWith("Style")?e[t]="__vchart_marker_style__":e[t]=R3(e[t])})),e},I3=(t,e)=>{if(!t||"object"!=typeof t)return t;const i=Object.assign({},t);e.normalizeDomainPosition&&B3.forEach((t=>{i[t]=T3})),e.normalizeAutoRange&&"autoRange"in i&&(i.autoRange="__vchart_marker_auto_range__"),E3.forEach((t=>{t in i&&(i[t]=T3)})),"label"in i&&(i.label=O3(i.label)),Object.keys(i).forEach((t=>{i[t]=R3(i[t])}));const s=i.itemContent;if(s&&"object"==typeof s){i.itemContent=Object.assign({},s),P3.forEach((t=>{t in i.itemContent&&(i.itemContent[t]=T3)}));const t=i.itemContent.text;t&&"object"==typeof t&&(i.itemContent.text=Object.assign(Object.assign({},O3(t)),{text:"__vchart_marker_text__"}))}return i};class D3 extends iV{constructor(){super(...arguments),this.layoutType="none",this._markerDataChangeHandler=null,this._markerDataOwned=!1,this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return dH(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getAutoRangeExtendDomainKeyPrefix(){return`marker_${this.type}_${this.id}`}_getAutoRangeExtendDomainKey(t){return`${this._getAutoRangeExtendDomainKeyPrefix()}_${t}_extend`}_clearAutoRangeExtendDomain(){var t,e;G(null===(e=(t=this._option).getAllSeries)||void 0===e?void 0:e.call(t)).forEach((t=>{var e,i,s,n,r,a,o,l,h,c;null===(s=null===(i=null===(e=null==t?void 0:t.getXAxisHelper)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.setExtendDomain)||void 0===s||s.call(i,this._getAutoRangeExtendDomainKey("xAxis"),void 0),null===(a=null===(r=null===(n=null==t?void 0:t.getYAxisHelper)||void 0===n?void 0:n.call(t))||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,this._getAutoRangeExtendDomainKey("yAxis"),void 0),null===(l=null===(o=null==t?void 0:t.angleAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,this._getAutoRangeExtendDomainKey("angleAxis"),void 0),null===(c=null===(h=null==t?void 0:t.radiusAxisHelper)||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,this._getAutoRangeExtendDomainKey("radiusAxis"),void 0)}))}_updateMarkerLayout(){this._clearAutoRangeExtendDomain(),this._markerLayout()}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return v(e)&&e3(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];G(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Pa;return e.registerParser("array",i),new Oa(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}_setMarkerData(t,e=!1){this._releaseMarkerData(),this._markerData=t,this._markerDataOwned=e}_bindMarkerDataChange(){var t;(null===(t=this._markerData)||void 0===t?void 0:t.target)&&(this._markerDataChangeHandler=()=>{this._updateMarkerLayout()},this._markerData.target.on("change",this._markerDataChangeHandler))}_releaseMarkerData(){const t=this._markerData;(null==t?void 0:t.target)&&this._markerDataChangeHandler&&t.target.removeListener("change",this._markerDataChangeHandler),this._markerDataChangeHandler=null,this._markerDataOwned&&M3(t,(t=>t.name===`${this.type}_${this.id}_data`)),this._markerData=null,this._markerDataOwned=!1}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._updateMarkerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(u(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._updateMarkerLayout.bind(this)))}clear(){super.clear(),this._markerComponent=null,this._firstSeries=null}release(){this._releaseMarkerData(),super.release()}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=xk(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){d(this._spec.offsetX)||(this._layoutOffsetX=YC(this._spec.offsetX,e.width,e)),d(this._spec.offsetY)||(this._layoutOffsetY=YC(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reRender=!0,i.change=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake||i.reCompile||!this._isAutoRangeSpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,scaleDomain:!0,layout:!0,render:!0}):i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){const i=!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange);return V(I3(e,{normalizeDomainPosition:i}),I3(t,{normalizeDomainPosition:i}))}_isAutoRangeSpecChange(t,e){return!(!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange))&&V(I3(e,{normalizeDomainPosition:!0,normalizeAutoRange:!0}),I3(t,{normalizeDomainPosition:!0,normalizeAutoRange:!0}))}reInit(t){super.reInit(t),this._releaseMarkerData(),this._bindSeries(),this._initDataView(),this._buildMarkerAttributeContext(),this._markerComponent&&this._updateMarkerLayout()}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();zM(this._option.dataSet,"markerAggregation",b3),zM(this._option.dataSet,"markerFilter",A3),this._releaseMarkerData();const i=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(i,!0),this._bindMarkerDataChange()}}function L3(t,e){return function(t,e,i){const{predict:s}=Lt(t,(t=>t[e]),(t=>t[i])),n=dk(t,e),r=uk(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class F3 extends D3{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=_F.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=v3(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:p3(AM(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>d3(t,this._markerData,this._markAttributeContext))),state:{line:u3(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:u3(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:u3(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return u3(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return u3(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:p3(AM(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:p3(AM(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||G(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=c3([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=G((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=G(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=v3(t);if(this._setMarkerData(this._getRelativeDataView()),!(i||s||n||r||a||o||l||h||c||d||e))return;zM(this._option.dataSet,"markerAggregation",b3),zM(this._option.dataSet,"markerRegression",L3),zM(this._option.dataSet,"markerFilter",A3);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Oa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(m,!0),this._bindMarkerDataChange()}}F3.specKey="markLine";const z3=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),H3={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},j3={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:z3(!1),endSymbol:z3(!0),label:H3};class N3 extends F3{constructor(){super(...arguments),this.type=n.markLine,this.name=n.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new EY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=u(e.coordinates),o=u(e.process),l=o&&u(e.process.x),h=o&&u(e.process.y),c=u(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:p,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:y}=v3(e);let _=[];if(p||f||g||m||v||a&&l||a&&h){const t=i3(i,s,n,r,d,!1,this._getAutoRangeExtendDomainKeyPrefix());_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=a3(i,r,d,e.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):c&&(_=h3(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n,r,a,o,l;const h=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const l=this._startRelativeSeries,d=this._endRelativeSeries,{multiSegment:p,mainSegmentIndex:g}=this._spec.line||{},{connectDirection:f}=this._spec;let{expandDistance:m=0}=this._spec;const{points:v,limitRect:y}=h,_=G(v).filter(Boolean);if(c(m)){const n=null===(t=null==l?void 0:l.getRegion)||void 0===t?void 0:t.call(l),r=null===(e=null==d?void 0:d.getRegion)||void 0===e?void 0:e.call(d);m=m(this._markerData,Object.assign(Object.assign({},this.getMarkAttributeContext()),{region:null===(s=null===(i=this._relativeSeries)||void 0===i?void 0:i.getRegion)||void 0===s?void 0:s.call(i),startRegion:n,endRegion:r,coordinatePoints:_}))}let b;if(UC(m)){const t=l.getRegion(),e=t.getLayoutStartPoint(),i=d.getRegion(),s=i.getLayoutStartPoint();if("bottom"===f||"top"===f){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));b=Number(m.substring(0,m.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));b=Number(m.substring(0,m.length-1))*n/100}}else b=m;if(!v||v.length<2)return void(null===(n=this._markerComponent)||void 0===n||n.setAttributes(h));const x=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(v[0],v[1],f,b);let S;S=p&&u(g)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(v[0],v[1],f,b));const k=G((null!==(a=null===(r=this._markerComponent)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{}).label),C=G(h.label),w=G(this._spec.label);null===(o=this._markerComponent)||void 0===o||o.setAttributes({points:p?[[x[0],x[1]],[x[1],x[2]],[x[2],x[3]]]:x,label:C.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=S.dx)&&void 0!==i?i:0,h=null!==(s=S.dy)&&void 0!==s?s:0;const c=null!==(n=w[e])&&void 0!==n?n:w[0];return A(null==c?void 0:c.refX)&&(a+=c.refX),A(null==c?void 0:c.refY)&&(o+=c.refY),A(null==c?void 0:c.dx)&&(l+=c.dx),A(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),S),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=k[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:y,multiSegment:p,mainSegmentIndex:g,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(l=this._markerComponent)||void 0===l||l.setAttributes(h)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=v3(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&u(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&u(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&u(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}N3.type=n.markLine,N3.coordinateType="cartesian",N3.builtInTheme={markLine:j3};const V3=()=>{hw.registerComponent(N3.type,N3),BY()};class W3 extends F3{constructor(){super(...arguments),this.type=n.polarMarkLine,this.name=n.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=v3(this._spec);return e||i?new RY(t):new EY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=v3(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=n3(i,s,n,r,a,this._getAutoRangeExtendDomainKeyPrefix());p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>he(f,t.radius,t.angle)))}}else u&&(p=o3(i,r,a,this._getAutoRangeExtendDomainKeyPrefix()),g={points:p.map((t=>he(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=v3(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}W3.type=n.polarMarkLine,W3.coordinateType="polar",W3.builtInTheme={polarMarkLine:j3};const U3=()=>{hw.registerComponent(W3.type,W3),RY._animate=cY,BY()};class G3 extends iV{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=n.title,this.specKey=n.title,this.layoutType="normal",this.layoutZIndex=_F.Title,this.layoutLevel=bF.Title,this._orient="top",this._orient=WC(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return dH(t,this.specKey,n.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,s&&!i.reMake&&(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}afterSetLayoutStartPoint(t){A(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),A(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:A(t.width())?t.width():0,height:this._spec.height?this._spec.height:A(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=YC(this._spec.width,a.width,null,a.width),l=YC(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=u(this._spec.text)&&""!==this._spec.text,d=u(this._spec.subtext)&&""!==this._spec.subtext,p=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(p.textStyle.width=h),d&&(p.subtextStyle.width=h),u(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?p.textStyle.width=t:delete p.textStyle.width,d&&(p.subtextStyle.width=t)}return p}_createOrUpdateTitleComponent(t){if(this._titleComponent)V(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new rX(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}G3.type=n.title,G3.specKey=n.title,G3.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};const Y3=()=>{hw.registerComponent(G3.type,G3)};class X3 extends D3{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=_F.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=y3(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:p3(AM(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>d3(t,this._markerData,this._markAttributeContext))),state:{area:u3(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>u3(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return u3(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||G(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=c3([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=G(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=G(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=y3(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}X3.specKey="markArea";const K3={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class $3 extends X3{constructor(){super(...arguments),this.type=n.markArea,this.name=n.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new OY(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=y3(i),d=u(i.positions),p=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=i3(s,n,r,a,p,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=i3(s,n,r,a,p,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=a3(s,a,p,i.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):d&&(f=h3(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=y3(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}$3.type=n.markArea,$3.coordinateType="cartesian",$3.builtInTheme={markArea:K3};const q3=()=>{hw.registerComponent($3.type,$3),PY()};class Z3 extends X3{constructor(){super(...arguments),this.type=n.polarMarkArea,this.name=n.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=y3(this._spec);return i||e||s?new IY(t):new OY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=y3(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=n3(i,s,n,r,c,this._getAutoRangeExtendDomainKeyPrefix());l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=o3(i,r,c,this._getAutoRangeExtendDomainKeyPrefix()),u={points:d.map((t=>he(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=y3(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Z3.type=n.polarMarkArea,Z3.coordinateType="polar",Z3.builtInTheme={polarMarkArea:K3};const J3=()=>{hw.registerComponent(Z3.type,Z3),IY._animate=uY,PY()},Q3=t=>AM(Object.assign({},t)),t4=t=>Object.assign(Object.assign({},t),{style:Object.assign({},AM(t.style))}),e4=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=Q3(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Q3(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),y=(_=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},AM(Object.assign({},_)));var _;const b=t4(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=t4(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=t4(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=t4(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:y}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},i4=t=>"left"===t||"right"===t,s4=t=>"top"===t||"bottom"===t,n4={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class r4 extends iV{constructor(){super(...arguments),this.layoutZIndex=_F.Player,this.layoutLevel=bF.Player,this.specKey="player",this.type=n.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},e4(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},e4(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?V(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new xX(t):this._playerComponent=new kX(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...G(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...G(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...G(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...G(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=i4(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=i4(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...G(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...G(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...G(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...G(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(PM.rendered,this.autoPlayCallback),this._option.globalInstance.on(PM.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(fX.end,(()=>{var t;this.event.emit(PM.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(fX.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(fX.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(PM.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(fX.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(PM.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(fX.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(PM.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(fX.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(PM.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.type)!==(null==t?void 0:t.type)?(i.reMake=!0,i):(!s||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i)}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),A(t.x)){const e=i4(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(A(t.y)){const e=s4(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return x(this._spec.width)?Math.min(t.width,Number(this._spec.width)):i4(this._orient)?this._maxSize():t.width}_computeHeight(t){return x(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):s4(this._orient)?this._maxSize():t.height}_computeDx(t){return i4(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return s4(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];this._option.globalInstance.updateFullData(e.data),this.event.emit(PM.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}release(){this._option.globalInstance.off(PM.rendered,this.autoPlayCallback)}}r4.builtInTheme={player:n4},r4.specKey="player",r4.type=n.player;const a4=()=>{hw.registerComponent(r4.type,r4)};class o4 extends iV{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.layoutType="none",this.layoutZIndex=_F.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,V(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=OC({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==SF.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),f(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}o4.type=n.label;class l4 extends L${constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}l4.type="text",l4.constructorType="label";const h4=()=>{F$(),hw.registerMark(l4.constructorType,l4)};class c4 extends eV{_initTheme(t,e){return{spec:t,theme:this._theme}}}class d4 extends o4{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.specKey="label",this.transformerConstructor=c4,this.layoutZIndex=_F.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,r)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:n.label,specInfoPath:["component",this.specKey,r],regionIndexes:[r]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(PM.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(BM.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(BM.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),_k(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&u(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(u(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n),c(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",xF.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=lw({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},JK(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[Zw])):t=>t.filter((t=>t.data[qw]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?QK(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}d4.type=n.label,d4.specKey="label",d4.transformerConstructor=c4;class u4 extends o4{constructor(){super(...arguments),this.type=n.totalLabel,this.name=n.totalLabel,this.specKey="totalLabel",this.layoutZIndex=_F.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var r;null===(r=t.seriesIndexes)||void 0===r||r.forEach((t=>{const{spec:r}=e.series[t],a=r[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:n.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[Kw]},"normal",xF.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return lw({textStyle:{pickable:!0===this._spec.interactive},position:p4(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[Zw]:t.data[qw]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>QK({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function p4(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}u4.type=n.totalLabel,u4.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},u4.specKey="totalLabel";const g4=()=>{hw.registerGraphicComponent(u4.type,(t=>new SG(t))),h4(),aV(),hw.registerComponent(u4.type,u4,!0)};class f4 extends D3{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=_F.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=_3(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y,_,b,x,S,A,k,C,w,M,T,B,E,P,O,R,I,D;const{itemContent:L={},itemLine:F={},targetSymbol:H={}}=this._spec,j=this._relativeSeries.getRegion(),N=L,{type:V="text",text:W,symbol:U,image:G,richText:Y,customMark:X,textStyle:K,symbolStyle:$,imageStyle:q,richTextStyle:Z,customMarkStyle:J,style:Q={},state:tt={}}=N,et=t(N,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let it=null,st=null,nt=V,rt={};if("text"===V){it=null!==(e=null==W?void 0:W.state)&&void 0!==e?e:tt;const r=null!==(n=null!==(s=null!==(i=null==W?void 0:W.style)&&void 0!==i?i:null==W?void 0:W.textStyle)&&void 0!==s?s:K)&&void 0!==n?n:Q;(t=>"rich"===(null==t?void 0:t.type))(r)?(nt="richText",rt={width:100,height:100},st=p3(z(rt,(e=>{if(!e)return e;const{type:i,text:s,textConfig:n}=e,r=t(e,["type","text","textConfig"]),a=Object.assign({},r),o=u(n)?n:s;return u(o)&&(a.textConfig=o),a})(r)),this._markerData,this._markAttributeContext)):(rt={dx:0,dy:0},st=d3(Object.assign(Object.assign({},W),{style:z(rt,r)}),this._markerData,this._markAttributeContext))}else"richText"===V?(it=null!==(r=null==Y?void 0:Y.state)&&void 0!==r?r:tt,rt={width:100,height:100},st=p3(z(rt,null!==(o=null!==(a=null==Y?void 0:Y.style)&&void 0!==a?a:Z)&&void 0!==o?o:Q),this._markerData,this._markAttributeContext)):"symbol"===V?(it=null!==(l=null==U?void 0:U.state)&&void 0!==l?l:tt,rt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},st=AM(p3(z(rt,null!==(c=null!==(h=null==U?void 0:U.style)&&void 0!==h?h:$)&&void 0!==c?c:Q),this._markerData,this._markAttributeContext))):"image"===V?(it=null!==(d=null==G?void 0:G.state)&&void 0!==d?d:tt,rt={width:80,height:80},st=p3(z(rt,null!==(g=null!==(p=null==G?void 0:G.style)&&void 0!==p?p:q)&&void 0!==g?g:Q),this._markerData,this._markAttributeContext)):"custom"===V&&(it=null!==(f=null==X?void 0:X.state)&&void 0!==f?f:tt,st=p3(null!==(v=null!==(m=null==X?void 0:X.style)&&void 0!==m?m:J)&&void 0!==v?v:Q,this._markerData,this._markAttributeContext));const at={zIndex:this.layoutZIndex,interactive:null===(y=this._spec.interactive)||void 0===y||y,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(b=this._spec.interactive)||void 0===b||b,position:{x:0,y:0},clipInRange:null!==(x=this._spec.clip)&&void 0!==x&&x,itemContent:Object.assign(Object.assign({type:nt,offsetX:g3(L.offsetX,j),offsetY:g3(L.offsetY,j)},et),{style:p3(st,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(S=H.offset)&&void 0!==S?S:0,visible:null!==(A=H.visible)&&void 0!==A&&A,size:null!==(k=H.size)&&void 0!==k?k:20,style:p3(H.style,this._markerData,this._markAttributeContext)},state:{line:u3(null!==(w=null===(C=this._spec.itemLine.line)||void 0===C?void 0:C.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineStartSymbol:u3(null!==(T=null===(M=this._spec.itemLine.startSymbol)||void 0===M?void 0:M.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineEndSymbol:u3(null!==(E=null===(B=this._spec.itemLine.endSymbol)||void 0===B?void 0:B.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext),itemContent:u3(it,this._markerData,this._markAttributeContext),textBackground:u3(null===(O=null===(P=this._spec.itemContent.text)||void 0===P?void 0:P.labelBackground)||void 0===O?void 0:O.state,this._markerData,this._markAttributeContext),targetItem:u3(null!==(I=null===(R=this._spec.targetSymbol)||void 0===R?void 0:R.state)&&void 0!==I?I:{},this._markerData,this._markAttributeContext)},animation:null!==(D=this._spec.animation)&&void 0!==D&&D,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:ot,line:lt={}}=F,ht=t(F,["visible","line"]);at.itemLine=!1!==ot?Object.assign(Object.assign({},ht),{visible:!0,lineStyle:AM(lt.style)}):{visible:!1};return new LY(at)}_markerLayout(){var e,i,s,n,r,a,o,l,h,c,d,p,g;const f=this._spec,m=this._markerData,v=this._relativeSeries,{point:y}=this._computePointsAttr(),_=this._getRelativeDataView().latestData,b=m?m.latestData[0]&&m.latestData[0].latestData?m.latestData[0].latestData:m.latestData:_,{itemLine:x={},itemContent:S={}}=this._spec,A=this._relativeSeries.getRegion(),{visible:k,line:C={}}=x,w=t(x,["visible","line"]),M=!1!==k?Object.assign(Object.assign({},w),{visible:!0,lineStyle:AM(C.style)}):{visible:!1},T=d3(Object.assign(Object.assign({},S.text),{style:z({dx:0,dy:0},null!==(i=null===(e=S.text)||void 0===e?void 0:e.style)&&void 0!==i?i:S.style)}),m,this._markAttributeContext);let B;if(f.clip||(null===(s=f.itemContent)||void 0===s?void 0:s.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=c3([v.getRegion()]);B={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(n=this._markerComponent.attribute)&&void 0!==n?n:{},e=null!==(a=null===(r=t.itemContent)||void 0===r?void 0:r.textStyle)&&void 0!==a?a:{},i=null===(o=this._spec.itemContent.text)||void 0===o?void 0:o.text,s=g3(S.offsetX,A),f=g3(S.offsetY,A);this._markerComponent.setAttributes({position:void 0===y?{x:null,y:null}:y,itemContent:Object.assign(Object.assign({},t.itemContent),{panel:null!==(l=T.panel)&&void 0!==l?l:null===(h=t.itemContent)||void 0===h?void 0:h.panel,padding:null!==(c=T.padding)&&void 0!==c?c:null===(d=t.itemContent)||void 0===d?void 0:d.padding,textStyle:Object.assign(Object.assign(Object.assign({},e),null!==(p=T.textStyle)&&void 0!==p?p:{}),{text:(null===(g=this._spec.itemContent.text)||void 0===g?void 0:g.formatMethod)?this._spec.itemContent.text.formatMethod(b,_):u(i)?i:e.text}),offsetX:f3(y,s,A),offsetY:f3(y,f,A)}),itemLine:M,limitRect:B,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=_3(t);(u(t.coordinate)||e||i||s)&&this._initCommonDataView()}}f4.specKey="markPoint";const m4={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class v4 extends f4{constructor(){super(...arguments),this.type=n.markPoint,this.name=n.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=u(s.x)&&u(s.y),o=u(s.coordinate),l=u(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=i3(n,r,r,r,h,!1,this._getAutoRangeExtendDomainKeyPrefix()))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=a3(n,r,h,s.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix())[0]:l&&(c=h3(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=_3(t),i=u(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}v4.type=n.markPoint,v4.coordinateType="cartesian",v4.builtInTheme={markPoint:m4};const y4=()=>{hw.registerComponent(v4.type,v4),DY()};class _4 extends f4{constructor(){super(...arguments),this.type=n.polarMarkPoint,this.name=n.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=n3(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e,this._getAutoRangeExtendDomainKeyPrefix())[0][0];return{point:he({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}_4.type=n.polarMarkPoint,_4.coordinateType="polar",_4.builtInTheme={polarMarkPoint:m4};const b4=()=>{hw.registerComponent(_4.type,_4),DY()};class x4 extends f4{constructor(){super(...arguments),this.type=n.geoMarkPoint,this.name=n.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{u(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}x4.type=n.geoMarkPoint,x4.coordinateType="geo",x4.builtInTheme={geoMarkPoint:m4};const S4=()=>{hw.registerComponent(x4.type,x4),DY()},A4="inBrush",k4="outOfBrush",C4={style:!0,inBrush:!0,outOfBrush:!0};class w4 extends iV{constructor(){super(...arguments),this.layoutType="none",this.type=n.brush,this.name=n.brush,this.specKey="brush",this.layoutZIndex=_F.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return dH(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),A4,xF.Series),i.setMarkStyle(s,Object.assign({},e),k4,xF.Series))}))}))}reInit(t){super.reInit(t),this.init()}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&G(t).includes(n.userId.toString())||e&&G(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){u(this._spec.regionId)||u(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(u(this._spec.brushLinkSeriesId)||u(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(G(this._spec.brushLinkSeriesId),G(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){u(this._spec.axisId)?G(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):u(this._spec.axisIndex)?G(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return V(e,t)||(i.change=!0,i.reRender=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||C4[i]))}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){var i;const s=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(Object.assign({brushStyle:AM(null===(i=this._spec)||void 0===i?void 0:i.style)},s)),this._initMarkBrushState(e,""),n.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new TX(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:AM(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r),this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(SX.brushActive,(i=>{this._initMarkBrushState(e,k4),this._emitEvent(PM.brushActive,t,i)})),r.addEventListener(SX.drawStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(PM.brushStart,t,e)})),r.addEventListener(SX.moveStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(PM.brushStart,t,e)})),r.addEventListener(SX.drawing,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(PM.brushChange,t,e)})),r.addEventListener(SX.moving,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(PM.brushChange,t,e)})),r.addEventListener(SX.brushClear,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0),this._initMarkBrushState(e,""),this._emitEvent(PM.brushClear,t,i)})),r.addEventListener(SX.drawEnd,(i=>{var s;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:n}=i.detail,{updateElementsState:r=!0}=this._spec;if(r&&this._handleBrushChange(t,i),null===(s=this._spec)||void 0===s?void 0:s.onBrushEnd)!0===this._spec.onBrushEnd(i)?(this.clearGraphic(),this._initMarkBrushState(e,""),this._emitEvent(PM.brushClear,t,i)):(this._spec.onBrushEnd(i),this._emitEvent(PM.brushEnd,t,i));else{const e=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&e.length>0||!r)&&this._setAxisAndDataZoom(n,t),this._emitEvent(PM.brushEnd,t,i)}})),r.addEventListener(SX.moveEnd,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&this._handleBrushChange(t,e);const n=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&n.length>0||s)&&this._setAxisAndDataZoom(i,t),this._emitEvent(PM.brushEnd,t,e)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},AM(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_setBrushState(t,e){var i;const s=null!==(i=t.currentStates)&&void 0!==i?i:[];gz(t,[...s.filter((t=>t!==A4&&t!==k4)),e])}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(this._setBrushState(i,A4),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(this._setBrushState(i,k4),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(this._setBrushState(i,A4),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(this._setBrushState(i,k4),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Ee(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;mz(s,[A4,k4]),i&&fz(s,i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=Y(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}w4.type=n.brush,w4.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},w4.specKey="brush";const M4=()=>{hw.registerComponent(w4.type,w4)},T4={style:!0,state:!0};class B4 extends iV{constructor(){super(...arguments),this.type=n.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=_F.CustomMark,this.layoutLevel=bF.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${Rw}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=NH({},VH(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(d(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),u(t.dataId)||A(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i.change=!0,i.reRender=!0,i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||T4[i]))}reInit(t){super.reInit(t),this._updateMarkStyleWithSpec(this._spec,this.getMarks()[0]),this.getMarks().forEach((t=>{t.commit(!1,!0)}))}_updateMarkStyleWithSpec(t,e){var i,s,n,r;if(t&&e&&(this.initMarkStyleWithSpec(e,t),"group"===t.type)){const a=null!==(n=null===(s=(i=e).getMarks)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[];null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._updateMarkStyleWithSpec(t,a[e])}))}}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ne).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ne;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}B4.type=n.customMark,B4.specKey="customMark";const E4=()=>{hw.registerComponent(B4.type,B4)};class P4{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(A(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:c(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&u(e.modelId)){if(u(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&u(e.modelKey)&&"modelIndex"in e&&u(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>O4(t))),a=n.filter((t=>!O4(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>O4(t))),h=o.filter((t=>!O4(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);A(h.width)||(h.width=l.width),A(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function O4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}P4.type="grid";const R4=()=>{hw.registerLayout(P4.type,P4)},I4=()=>{tG(qy()),tG(mb()),vb()},D4="vchart-tooltip",L4=`${D4}-container`,F4=`${D4}-title`,z4=`${D4}-content-box`,H4={offsetX:10,offsetY:10},j4="99999999999999";function N4(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const V4=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,W4=t=>v(t)&&""!==(null==t?void 0:t.trim())||x(t)?N4(t):"",U4=(t,e)=>{let i;if(u(t))if(x(t))i=t;else if(c(t)){const s=t(e);x(s)&&(i=s)}return i},G4={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},Y4=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=G4[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class X4 extends EN{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,d,g;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,S="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:k,offsetY:C}=this._option,w=m[_],M=mH(null==w?void 0:w.position,b,e),T=null!==(r=mH(null==w?void 0:w.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,O=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==O?void 0:O.width)&&void 0!==o?o:Iw,I=null!==(l=null==O?void 0:O.height)&&void 0!==l?l:Dw;let D=!1;const L={width:0,height:0};let F,z={x:0,y:0},H={x:0,y:0},j=1,N=1;const V=pA(this._env);if(V&&!m.confine?(L.width=window.innerWidth,L.height=window.innerHeight):(L.width=R,L.height=I),V&&!P){const t=this._getParentElement(m);H=null!==(d=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==d?d:v;const e=null!==(g=this._compiler.getCanvas())&&void 0!==g?g:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-H.x,y:F.y-H.y},j=V4(e,F),N=V4(t,H)}const W=N/j,U={},G={x:M,y:M},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?k:C;if("mark"===i){D=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==S?void 0:S.series)||void 0===r?void 0:r.coordinate)&&S.datum&&S.datum.length){D=!0;const t=f(S,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(D){const e=Y[n][0],i="x"===n?B:E;switch(Y4(t,n)){case-2:U[e]=a-i*W-c;break;case-1.5:U[e]=a+c;break;case 0:U[e]=(a+o)/2-i*W/2;break;case-1:U[e]=(a+o)/2-i*W-c;break;case 1:U[e]=(a+o)/2+c;break;case 1.5:U[e]=o-i*W-c;break;case 2:U[e]=o+c}}},K=["x","y"];if(p(M))if((t=>p(t)&&(u(t.left)||u(t.right)||u(t.top)||u(t.bottom)))(M)){const{left:t,right:e,top:i,bottom:s}=M;U.left=U4(t,y),U.top=U4(i,y),U.right=U4(e,y),U.bottom=U4(s,y)}else(t=>p(t)&&(u(t.x)||u(t.y)))(M)&&K.forEach((t=>{const e=M[t];x(e)||c(e)?U[Y[t][0]]=U4(e,y):X(e,t)}));else u(M)&&(X({orient:M,mode:T},"x"),X({orient:M,mode:T},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?B:E,s="x"===t?R:I,n="x"===t?k:C,r=Y4(G[t],t);if(A(U[Y[t][0]]))$[t]=U[Y[t][0]];else if(A(U[Y[t][1]]))$[t]=s-i*W-U[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+n:0===r?e-i*W/2:e-i*W-n}$[t]*=j,V&&($[t]+=z[t]),$[t]/=N;const a="x"===t?L.width:L.height,o=m.confine?-(H[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/N:-H[t]/N,l=a/N+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(D?$[t]=l:($[t]-=0===r?n+i/2:2*n+i,$[t]u(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",$4=(t={},e={})=>{var i,s;u(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return u(n)&&(e.color=n),u(t.fontWeight)&&(e.fontWeight=t.fontWeight),u(t.textAlign)&&(e.textAlign=t.textAlign),u(t.fontSize)&&(e.fontSize=K4(t.fontSize)),u(t.maxWidth)&&(e.maxWidth=K4(t.maxWidth)),t.multiLine||u(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},q4=(t={})=>{const{lineHeight:e}=t;return t.fontSize?YC(e,t.fontSize):0},Z4=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return u(l)&&(a.borderRadius=A(l)?`${l}px`:`${l}`),u(r)&&(o=ai(r),a.padding=K4(o)),{panelStyle:a,panelPadding:o}};function J4(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const Q4=t=>{hw.registerComponentPlugin(t.type,t)};class t8 extends X4{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(t8.type),this.type=yU.dom,this._tooltipContainer=null==uA?void 0:uA.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(uA&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=Z4(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),A(g)&&(y.marginBottom=`${g}px`);const _={width:K4(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=$4(h),x=$4(u),S=$4(p),k="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[k]=K4(null!==(i=c.spacing)&&void 0!==i?i:8),x[k]=K4(null!==(s=u.spacing)&&void 0!==s?s:26),S[k]=K4(null!==(n=p.spacing)&&void 0!==n?n:0);const C=Math.max(q4(p),q4(u));return y.lineHeight=C>0?`${C}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(F4))),l=a.find((t=>t.className.includes(z4)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(F4),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(J4(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${D4}-column`),e.classList.add(`${D4}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(z4),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];J4(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));J4(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${D4}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=W4(e.key),e.keyStyle&&$4(e.keyStyle,l)):"value"===i?(o.innerHTML=W4(e.value),e.valueStyle&&$4(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,g=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?N4(t.shapeLineWidth)+"px":"0px";let m="currentColor";const y=()=>c?N4(c):m,_=g,b=t=>new Jp({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ne));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const w=su.IsGradientStr(u);if(!u||v(u)&&!w||d)return m=d?"none":u?N4(u):"currentColor",`\n \n \n \n `;const M=w?su.Parse(u):p(u)?u:null;if(M){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=M.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===M.gradient?t=`\n ${i}\n `:"linear"===M.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),J4(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(z4))),h=[...o.children].find((t=>t.className.includes(F4)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(u(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(F4)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=YC(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,J4(l,c))}const p=l.children,g=[];if(p){for(let i=0;i{Q4(t8)},i8={fontFamily:ew.fontFamily,spacing:10,wordBreak:"break-word"},s8=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=xf({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n});return{width:r.width(),height:r.height(),text:s}};function n8(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:i8),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:u(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const r8=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return u(a)&&(r.cornerRadius=[a,a,a,a]),r};class a8 extends X4{constructor(){super(a8.type),this.type=yU.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new RX({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:p,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=ai(d.padding),b=$C(d.padding),x=n8(Object.assign({textAlign:"right"===y?"right":"left"},p),i),S=n8(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=n8(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},C={panel:r8(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:w={},content:M=[]}=t;let T=b.left+b.right,B=b.top+b.bottom,E=0;const P=!!M.length;let O=0,R=0,I=0,D=0;if(P){const t=[],e=[],i=[],s=[];let n=0;C.content=M.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:p,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:C}=r,w={height:0,spaceRow:null!=_?_:v};if(u(h)){const i=lw({},S,n8(b,void 0,{})),{width:s,height:n,text:r}=s8(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),y?e.push(s):t.push(s),o=Math.max(o,n)}if(u(m)){const t=lw({},A,n8(x,void 0,{})),{width:e,height:s,text:n}=s8(m,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};C?t.stroke=d:t.fill=d,t.stroke=null!=p?p:d,t.lineWidth=g,w.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aW.autoWidth&&!1!==W.multiLine;if(H){W=lw({},x,n8(N,void 0,{})),U()&&(W.multiLine=null===(r=W.multiLine)||void 0===r||r,W.maxWidth=null!==(a=W.maxWidth)&&void 0!==a?a:P?Math.ceil(E):void 0);const{text:t,width:e,height:i}=s8(j,W);C.title.value=Object.assign(Object.assign({width:U()?Math.min(e,null!==(o=W.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},W),{text:t}),L=C.title.value.width,F=C.title.value.height,z=F+(P?C.title.spaceRow:0)}return B+=z,C.title.width=L,C.title.height=F,U()?T+=E||L:T+=Math.max(L,E),P&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=T-b.left-b.right-D-O-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=T,C.panel.height=B,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?u(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}a8.type=yU.canvas;const o8=()=>{Q4(a8)},l8=(t="chart",e,i)=>{var s,r,a,o,l,h,c,d,u,p,g;const f={modelInfo:[]};if("chart"===t)f.isChart=!0,f.modelInfo.push({spec:e,type:"chart"});else if("region"===t)f.modelType="region",f.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(r=e.series)||void 0===r||r.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(kC).includes(t))f.modelType="series",f.specKey="series",f.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&f.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(n).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=hw.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=G(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=G(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=hw.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=G(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);G(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},h8=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:u,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=l8(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!d(e)||G(e).some((e=>c(e)?e(t,i,s):nw(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=lw({},i),m=c(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:lw(f,m),hasChanged:!0};const i=lw({},t,m);rw(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);y(f[u])?f[u].push(t):d(f[u])?f[u]="component"===h?t:[t]:f[u]=[f[u],t]}return{chartSpec:f,hasChanged:!0}},c8=t=>{hw.registerChartPlugin(t.type,t)};class d8 extends EN{constructor(){super(d8.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[d8.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[d8.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=ow(this._option.globalInstance.getSpec(),["data",d8.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=ow(this._baseChartSpec,["data",d8.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(u(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(u(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(u(t.minWidth)&&e.width{const n=h8(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=ow(i,["data",d8.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}d8.pluginType="chart",d8.specKey="media",d8.type="MediaQueryPlugin";const u8=()=>{c8(d8)},p8=/\{([^}]+)\}/,g8=/\{([^}]+)\}/g,f8=/:/;class m8 extends EN{constructor(){super(m8.type),this.type="formatterPlugin",this._timeModeFormat={utc:vi.getInstance().timeUTCFormat,local:vi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ci.getInstance().format,this._numericSpecifier=Ci.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[m8.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;c(r)?this._formatter=r:(this._formatter=this._format.bind(this),c(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),hw.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=p8.test(i),this._isNumericFormatterCache.set(i,s))),s){return i.replace(g8,((t,i)=>{if(!f8.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}))}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(Si.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}m8.pluginType="chart",m8.specKey="formatter",m8.type="formatterPlugin";const v8=()=>{c8(m8)};class y8 extends EN{constructor(){super(y8.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[y8.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=BK(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom{c8(y8)};iH.useRegisters([()=>{AU(),CU(),MU(),tU(),QW(),DW(),wW(),fN(),vN(),Nz(),zz(),aW(),SW(),hw.registerSeries(LW.type,LW),hw.registerChart(TU.type,TU)},()=>{AU(),CU(),MU(),QW(),DW(),wW(),fN(),PU(),vN(),IU(),aW(),SW(),hw.registerSeries(jX.type,jX),tU(),hw.registerChart(VX.type,VX)},()=>{AU(),CU(),MU(),QW(),sK(),tU(),hw.registerChart(rK.type,rK)},()=>{CU(),yq(),hw.registerChart(C1.type,C1)},()=>{AU(),CU(),MU(),tU(),hw.registerChart(I1.type,I1),QW()},SW,aW,()=>{hw.registerComponent(z2.type,z2)},()=>{hw.registerComponent(l5.type,l5)},()=>{hw.registerComponent(v5.type,v5)},()=>{hw.registerGraphicComponent(d4.type,(t=>new SG(t))),h4(),aV(),hw.registerComponent(d4.type,d4,!0,1/0)},o8]),iH.useRegisters([()=>{YP(e_)}]);export{xF as AttributeLevel,PN as AxisSyncPlugin,a8 as CanvasTooltipHandler,PM as ChartEvent,y8 as ChartResizeZoomPlugin,Dw as DEFAULT_CHART_HEIGHT,Iw as DEFAULT_CHART_WIDTH,rH as DEFAULT_CLOSE_STROKE_JOIN,Fw as DEFAULT_DATA_INDEX,zw as DEFAULT_DATA_KEY,Hw as DEFAULT_DATA_SERIES_FIELD,nM as DEFAULT_KEY,vF as DEFAULT_LAYOUT_RECT_LEVEL,yF as DEFAULT_LAYOUT_RECT_LEVEL_MIN,nH as DEFAULT_LINEAR_INTERPOLATE,rM as DEFAULT_MAP_LOOK_UP_KEY,Lw as DEFAULT_MEASURE_CANVAS_ID,jw as DEFAULT_SERIES_STYLE_NAME,sH as DEFAULT_SMOOTH_INTERPOLATE,SL as DefaultTicker,aH as Direction,t8 as DomTooltipHandler,hw as Factory,m8 as FormatterPlugin,bF as LayoutLevel,_F as LayoutZIndex,eM as MOSAIC_CAT_END_PERCENT,tM as MOSAIC_CAT_START_PERCENT,Qw as MOSAIC_VALUE_END_PERCENT,Jw as MOSAIC_VALUE_START_PERCENT,lH as ManualTicker,d8 as MediaQuery,Rw as PREFIX,s as RenderModeEnum,sM as SEGMENT_FIELD_END,iM as SEGMENT_FIELD_START,Ww as STACK_FIELD_END,Xw as STACK_FIELD_END_OffsetSilhouette,Gw as STACK_FIELD_END_PERCENT,Nw as STACK_FIELD_KEY,Vw as STACK_FIELD_START,Yw as STACK_FIELD_START_OffsetSilhouette,Uw as STACK_FIELD_START_PERCENT,Kw as STACK_FIELD_TOTAL,Zw as STACK_FIELD_TOTAL_BOTTOM,$w as STACK_FIELD_TOTAL_PERCENT,qw as STACK_FIELD_TOTAL_TOP,AF as STATE_VALUE_ENUM,rL as StreamLight,Cw as ThemeManager,qM as TransformLevel,mF as USER_LAYOUT_RECT_LEVEL,iH as VChart,KC as boundsInRect,gw as builtinThemes,YC as calcLayoutNumber,XC as calcPadding,EC as computeActualDataScheme,qC as convertPoint,Xg as createArc,Ug as createArea,ef as createGroup,ig as createLine,ag as createRect,zg as createRichText,Qp as createSymbol,Xp as createText,sw as darkTheme,JC as dataScheme,iH as default,fw as defaultThemeName,OC as getActualColor,ZC as getActualNumValue,LC as getColorSchemeBySeries,BC as getDataScheme,uw as getFunnelTheme,Aw as getMergedTheme,dH as getSpecInfo,bw as getTheme,yw as hasThemeMerged,RC as isColorKey,UC as isPercent,GC as isPercentOffset,IC as isProgressiveDataColorScheme,tw as isTokenKey,WC as isValidOrient,iw as lightTheme,uH as lookup,Ow as measureText,$C as normalizeLayoutPaddingSpec,PC as queryColorFromColorScheme,QC as queryToken,Wz as registerAnimate,_2 as registerBoxplotChart,M4 as registerBrush,o8 as registerCanvasTooltipHandler,FX as registerCartesianLogAxis,HX as registerCartesianSymlogAxis,DX as registerCartesianTimeAxis,c8 as registerChartPlugin,_8 as registerChartResizeZoomPlugin,c2 as registerCirclePackingChart,V1 as registerCircularProgressChart,Z2 as registerContinuousLegend,P2 as registerCorrelationChart,E4 as registerCustomMark,HM as registerDataSetInstanceParser,zM as registerDataSetInstanceTransform,L5 as registerDataZoom,e8 as registerDomTooltipHandler,Kz as registerElementHighlight,Zz as registerElementSelect,v8 as registerFormatPlugin,J1 as registerFunnelChart,G1 as registerGaugeChart,RK as registerGeoCoordinate,S4 as registerGeoMarkPoint,R4 as registerGridLayout,T2 as registerHeatmapChart,H1 as registerHistogramChart,G5 as registerIndicator,e2 as registerLinearProgressChart,_1 as registerMapChart,q3 as registerMarkArea,V3 as registerMarkLine,y4 as registerMarkPoint,u8 as registerMediaQuery,a4 as registerPlayer,Dq as registerPolarBandAxis,_5 as registerPolarCrossHair,Rq as registerPolarLinearAxis,J3 as registerPolarMarkArea,U3 as registerPolarMarkLine,b4 as registerPolarMarkPoint,I4 as registerPoptip,O1 as registerRadarChart,C2 as registerRangeAreaChart,n2 as registerRangeColumnChart,B1 as registerRoseChart,S2 as registerSankeyChart,_K as registerScatterChart,j5 as registerScrollBar,o2 as registerSunburstChart,_w as registerTheme,Y3 as registerTitle,g4 as registerTotalLabel,p2 as registerTreemapChart,m2 as registerWaterfallChart,$1 as registerWordCloudChart,xw as removeTheme,Sw as themeExist,mw as themes,ew as token,DC as transformColorSchemeToStandardStruct,AM as transformToGraphic,pH as version,t_ as vglobal,lA as warn}; diff --git a/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js b/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js index a1c3dbd4cd..4083c32746 100644 --- a/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js +++ b/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js @@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -function t(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(n||(n={}));var a={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var _=t=>Array.isArray?Array.isArray(t):l(t,"Array");var y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>x(t)&&Number.isFinite(t);var A=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var M=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const T=Object.prototype;var C=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||T)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(y(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(C(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var P=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function L(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!u(n[a])||"object"!=typeof n[a]||s&&_(t[a])?F(t,a,n[a]):D(t,e,a,i,s)}}}}function D(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(y(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function H(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function N(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(H(t)!==H(e))return!1;if(c(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!N(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!N(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function tt(t){return Number(t)}function et(t,e,i=tt){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const it="undefined"!=typeof console;function st(t,e,i){const s=[e].concat([].slice.call(i));it&&console[t].apply(console,s)}var nt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(nt||(nt={}));class rt{static getInstance(t,e){return rt._instance&&x(t)?rt._instance.level(t):rt._instance||(rt._instance=new rt(t,e)),rt._instance}static setInstance(t){return rt._instance=t}static setInstanceLevel(t){rt._instance?rt._instance.level(t):rt._instance=new rt(t)}static clearInstance(){rt._instance=null}constructor(t=nt.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=nt.Info}canLogDebug(){return this._level>=nt.Debug}canLogError(){return this._level>=nt.Error}canLogWarn(){return this._level>=nt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):st(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=nt.Warn&&st(this._method||"warn","WARN",t),this}info(...t){return this._level>=nt.Info&&st(this._method||"log","INFO",t),this}debug(...t){return this._level>=nt.Debug&&st(this._method||"log","DEBUG",t),this}}function at(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(t[n],e)>0?s=n:i=n+1}return i}rt._instance=null;const ot=(t,e)=>lt(0,t.length,(i=>e(t[i]))),lt=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ht=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(Q)),et(i,.5)},ct=1e-10,dt=1e-10;function ut(t,e,i=dt,s=ct){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function pt(t,e,i,s){return t>e&&!ut(t,e,i,s)}function gt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var mt=function(t,e,i){return ti?i:t};var vt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function _t(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let yt=!1;try{yt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){yt=!1}function bt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&yt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=m(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function xt(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),bt(t,e,{leading:s,trailing:n,maxWait:e})}function St(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function At(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}yt=!1;const wt=4294967296;const Tt=t=>e=>P(e,t),Ct=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||Tt)(i)},Bt=(t,e={})=>{if(_(t)){const i=t.map((t=>Ct(t,e)));return t=>i.map((e=>e(t)))}return Ct(t,e)},Et=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Pt=t=>0,Rt=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function It(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Lt(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!d(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:u,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)u+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!d(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!d(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:u,b:p},predict:g,rSquared:It(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Ot(f.min,f);for(let r=0;r=1?zt:t<=-1?-zt:Math.asin(t)}function qt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Zt(t,e){return t[0]*e[1]-t[1]*e[0]}function Jt(t,e){let i=0;for(let s=0;s0?i:0}function ee(t,e){return Qt(t+e,10**Math.max(te(t),te(e)))}function ie(t,e){return Qt(t-e,10**Math.max(te(t),te(e)))}class se{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new se(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ne{static distancePP(t,e){return Xt($t(t.x-e.x,2)+$t(t.y-e.y,2))}static distanceNN(t,e,i,s){return Xt($t(t-i,2)+$t(e-s,2))}static distancePN(t,e,i){return Xt($t(e-t.x,2)+$t(i-t.y,2))}static pointAtPP(t,e,i){return new se((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function re(t){return t*(Math.PI/180)}function ae(t){return 180*t/Math.PI}const oe=(t=0)=>{if(t<0)for(;t<-jt;)t+=jt;else if(t>0)for(;t>jt;)t-=jt;return t};function le(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function he(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ce(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function de(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ue(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=de(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function pe(t){return(t=de(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function ge(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function fe(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ve(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ye(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var _e;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(_e||(_e={}));const ye=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function be(t,e,i){if(!t||!e)return _e.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ye(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Ae({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?re(t.angle):t.angle,s=Me(t);return[Ae({x:t.x1,y:t.y1},i,s),Ae({x:t.x2,y:t.y1},i,s),Ae({x:t.x2,y:t.y2},i,s),Ae({x:t.x1,y:t.y2},i,s)]}function Te(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?re(t.angle):t.angle;let u=i?re(90-t.angle):t.angle+zt;const p=i?re(e.angle):e.angle;let g=i?re(90-e.angle):e.angle+zt;u>Ht&&(u-=Ht),g>Ht&&(g-=Ht);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ce=1e-8;function Be(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function Ie(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Le{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=Ie(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(v(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(d(t))return{width:0,height:0};if(d(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(d(this._numberCharSize)){const t=this._standardMethod(Le.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Le.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Le.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Le.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Le.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Le.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Le.NUMBERS_CHAR_SET="0123456789",Le.FULL_SIZE_CHAR="字";const De=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),Fe=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return ze(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class He extends je{}class Ve extends je{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ve(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Ae({x:this.x1,y:this.y1},this.angle,t),Ae({x:this.x2,y:this.y1},this.angle,t),Ae({x:this.x1,y:this.y2},this.angle,t),Ae({x:this.x2,y:this.y2},this.angle,t)]}}class Ne{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ne,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ne;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ne(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=ae(r.rotateDeg),r}}class We{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Ue(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Ge(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Ye=/^#([0-9a-f]{3,8})$/,Xe={transparent:4294967040},$e={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ke(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function qe(t){return x(t)?new ei(t>>16,t>>8&255,255&t,1):_(t)?new ei(t[0],t[1],t[2]):new ei(255,255,255)}function Ze(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Je(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Qe=(t,e)=>{const i=Ye.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ei((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?qe(t):8===e?new ei(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ti{static Brighter(t,e=1){return 1===e?t:new ti(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ti(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ti?t:new ti(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u(Xe[t]))return function(t){return x(t)?new ei(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ei(t[0],t[1],t[2],t[3]):new ei(255,255,255,1)}(Xe[t]);if(u($e[t]))return qe($e[t]);const e=`${t}`.trim().toLowerCase(),i=Qe(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ei(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Ue(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ei(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ti.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ei(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Ge(this.color.r,this.color.g,this.color.b),r=Ue(d(t)?n.h:mt(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ei(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Qe(e,!0);return null!=i?i:this}setColorName(t){const e=$e[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ti(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Ze(t.color.r),this.color.g=Ze(t.color.g),this.color.b=Ze(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ei{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Ke(this.r)+Ke(this.g)+Ke(this.b)+(1===this.opacity?"":Ke(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Ge(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ii(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new ei(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Ge});function ni(t){if(k(t))return[t,t,t,t];if(_(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(p(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ri(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function ai(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function oi(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const li=1e-10;function hi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+li)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=pi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ne.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ci(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-li,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ci(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function di(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ci(t,t-(i*i-e*e+t*t)/(2*i))+ci(e,s)}function ui(t,e){const i=ne.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function pi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let mi;function vi(t,e){const i=fi(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class _i{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const yi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function bi(t){let e;if(e=yi.exec(t))return new _i({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});rt.getInstance().error("invalid format: "+t)}const xi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Si{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return Si.instance||(Si.instance=new Si),Si.instance}newFormat(t){const e=bi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):ki[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=ki[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,k=p,A=t;if("c"===d)k=g(A)+k,A="";else{A=+A;let t=A<0||1/A<0;if(A=isNaN(A)?m:g(Math.abs(A),h),c&&(A=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(A)),t&&0==+A&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,k=("s"===d?xi[8+mi/3]:"")+k+(t&&"("===n?")":""),f)for(e=-1,r=A.length;++ex||x>57){k=(46===x?_+A.slice(e+1):A.slice(e))+k,A=A.slice(0,e);break}}l&&!a&&(A=y(A,1/0));let M=S.length+A.length+k.length,w=M>1)+S+A+k+w.slice(M);break;default:A=w+S+A+k}return b(A)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=bi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=fi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=xi[8+n/3];return function(t){return s(r*t)+a}}}const ki={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>vi(100*t,e),r:vi,s:function(t,e){const i=fi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(mi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+fi(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function Ai(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ci(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ci(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Jt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Pi(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ti(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Ji=Math.sqrt,Qi=Math.tan;function ts(t){return t>1?0:t<-1?Fi:Math.acos(t)}function es(t){return t>1?zi:t<-1?-zi:Math.asin(t)}function is(){}function ss(t,e){t&&rs.hasOwnProperty(t.type)&&rs[t.type](t,e)}var ns={Feature:function(t,e){ss(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sFi?t+Math.round(-t/Hi)*Hi:t,e]}function _s(t,e,i){return(t%=Hi)?e||i?ms(bs(t),xs(e,i)):bs(t):e||i?xs(e,i):vs}function ys(t){return function(e,i){return[(e+=t)>Fi?e-Hi:e<-Fi?e+Hi:e,i]}}function bs(t){var e=ys(t);return e.invert=ys(-t),e}function xs(t,e){var i=Yi(t),s=qi(t),n=Yi(e),r=qi(e);function a(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*i+o*s;return[Gi(l*n-c*r,o*i-h*s),es(c*n+l*r)]}return a.invert=function(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*n-l*r;return[Gi(l*n+h*r,o*i+c*s),es(c*i-o*s)]},a}function Ss(t,e){(e=cs(e))[0]-=t,fs(e);var i=ts(-e[1]);return((-e[2]<0?-i:i)+Hi-Di)%Hi}function ks(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:is,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function As(t,e){return Wi(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function Ts(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Os(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function Is(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ks(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Os(a);var t=function(t,e){var i=Ps(e),s=e[1],n=qi(s),r=[qi(i),-Yi(i),0],a=0,o=0;Es.reset(),1===n?s=zi+Di:-1===n&&(s=-zi-Di);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Fi,T=f*x;if(Es.add(Gi(T*A*qi(M),m*S+T*Yi(M))),a+=w?k+A*Hi:k,w^p>=i^y>=i){var C=us(cs(u),cs(_));fs(C);var B=us(r,C);fs(B);var E=(w^k>=0?-1:1)*es(B[2]);(s>E||s===E&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-Di||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Ls))}return u}}function Ls(t){return t.length>1}function Ds(t,e){return((t=t.x)[0]<0?t[1]-zi-Di:zi-t[1])-((e=e.x)[0]<0?e[1]-zi-Di:zi-e[1])}1===(Cs=Rs).length&&(Bs=Cs,Cs=function(t,e){return Rs(Bs(t),e)});var Fs=Is((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Fi:-Fi,l=Wi(r-i);Wi(l-Fi)0?zi:-zi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Fi&&(Wi(i-n)Di?Ui((qi(e)*(r=Yi(s))*qi(i)-qi(s)*(n=Yi(e))*qi(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*zi,s.point(-Fi,n),s.point(0,n),s.point(Fi,n),s.point(Fi,0),s.point(Fi,-n),s.point(0,-n),s.point(-Fi,-n),s.point(-Fi,0),s.point(-Fi,n);else if(Wi(t[0]-e[0])>Di){var r=t[0]0,n=Wi(e)>Di;function r(t,i){return Yi(t)*Yi(i)>e}function a(t,i,s){var n=[1,0,0],r=us(cs(t),cs(i)),a=ds(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=us(n,r),u=gs(n,h);ps(u,gs(r,c));var p=d,g=ds(u,p),f=ds(p,p),m=g*g-f*(ds(u,u)-1);if(!(m<0)){var v=Ji(m),_=gs(p,(-g-v)/f);if(ps(_,u),_=hs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Wi(_[0]-b)Fi^(b<=_[0]&&_[0]<=x)){var w=gs(p,(-g+v)/f);return ps(w,u),[_,hs(w)]}}}function o(e,i){var n=s?t:Fi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Is(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Fi:-Fi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||As(e,p)||As(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&As(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Yi(e),o=qi(e),l=s*i;null==n?(n=e+s*Hi,r=e-l/2):(n=Ss(a,n),r=Ss(a,r),(s>0?nr)&&(n+=s*Hi));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Wi(s[0]-t)0?0:3:Wi(s[0]-i)0?2:1:Wi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,_,y=a,b=ks(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(k(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=Os(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ws(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function k(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&m)y.point(r,a);else{var l=[g=Math.max(Hs,Math.min(js,g)),f=Math.max(Hs,Math.min(js,f))],b=[r=Math.max(Hs,Math.min(js,r)),a=Math.max(Hs,Math.min(js,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ns(t){return t}var Ws,Us,Gs,Ys,Xs=Ri(),$s=Ri(),Ks={point:is,lineStart:is,lineEnd:is,polygonStart:function(){Ks.lineStart=qs,Ks.lineEnd=Qs},polygonEnd:function(){Ks.lineStart=Ks.lineEnd=Ks.point=is,Xs.add(Wi($s)),$s.reset()},result:function(){var t=Xs/2;return Xs.reset(),t}};function qs(){Ks.point=Zs}function Zs(t,e){Ks.point=Js,Ws=Gs=t,Us=Ys=e}function Js(t,e){$s.add(Ys*t-Gs*e),Gs=t,Ys=e}function Qs(){Js(Ws,Us)}var tn=Ks,en=1/0,sn=en,nn=-en,rn=nn;var an,on,ln,hn,cn={point:function(t,e){tnn&&(nn=t);ern&&(rn=e)},lineStart:is,lineEnd:is,polygonStart:is,polygonEnd:is,result:function(){var t=[[en,sn],[nn,rn]];return nn=rn=-(sn=en=1/0),t}},dn=0,un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn={point:xn,lineStart:Sn,lineEnd:Mn,polygonStart:function(){bn.lineStart=wn,bn.lineEnd=Tn},polygonEnd:function(){bn.point=xn,bn.lineStart=Sn,bn.lineEnd=Mn},result:function(){var t=yn?[vn/yn,_n/yn]:mn?[gn/mn,fn/mn]:pn?[dn/pn,un/pn]:[NaN,NaN];return dn=un=pn=gn=fn=mn=vn=_n=yn=0,t}};function xn(t,e){dn+=t,un+=e,++pn}function Sn(){bn.point=kn}function kn(t,e){bn.point=An,xn(ln=t,hn=e)}function An(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,xn(ln=t,hn=e)}function Mn(){bn.point=xn}function wn(){bn.point=Cn}function Tn(){Bn(an,on)}function Cn(t,e){bn.point=Bn,xn(an=ln=t,on=hn=e)}function Bn(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,vn+=(n=hn*t-ln*e)*(ln+t),_n+=n*(hn+e),yn+=3*n,xn(ln=t,hn=e)}var En=bn;function Pn(t){this._context=t}Pn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Hi)}},result:is};var Rn,On,In,Ln,Dn,Fn=Ri(),zn={point:is,lineStart:function(){zn.point=jn},lineEnd:function(){Rn&&Hn(On,In),zn.point=is},polygonStart:function(){Rn=!0},polygonEnd:function(){Rn=null},result:function(){var t=+Fn;return Fn.reset(),t}};function jn(t,e){zn.point=Hn,On=Ln=t,In=Dn=e}function Hn(t,e){Ln-=t,Dn-=e,Fn.add(Ji(Ln*Ln+Dn*Dn)),Ln=t,Dn=e}var Vn=zn;function Nn(){this._string=[]}function Wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Un(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ls(t,i(s))),s.result()}return r.area=function(t){return ls(t,i(tn)),tn.result()},r.measure=function(t){return ls(t,i(Vn)),Vn.result()},r.bounds=function(t){return ls(t,i(cn)),cn.result()},r.centroid=function(t){return ls(t,i(En)),En.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ns):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Nn):new Pn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Gn(t){return function(e){var i=new Yn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Yn(){}function Xn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ls(i,t.stream(cn)),e(cn.result()),null!=s&&t.clipExtent(s),t}function $n(t,e,i){return Xn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Kn(t,e,i){return $n(t,[[0,0],e],i)}function qn(t,e,i){return Xn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Zn(t,e,i){return Xn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Nn.prototype={_radius:4.5,_circle:Wn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Wn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Yn.prototype={constructor:Yn,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Jn=16,Qn=Yi(30*Ni);function tr(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,k=Ji(b*b+x*x+S*S),A=es(S/=k),M=Wi(Wi(S)-1)e||Wi((v*B+_*E)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ni:0,B()):[m*Vi,v*Vi,_*Vi]},T.angle=function(t){return arguments.length?(y=t%360*Ni,B()):y*Vi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},T.precision=function(t){return arguments.length?(a=tr(o,w=t*t),E()):Ji(w)},T.fitExtent=function(t,e){return $n(T,t,e)},T.fitSize=function(t,e){return Kn(T,t,e)},T.fitWidth=function(t,e){return qn(T,t,e)},T.fitHeight=function(t,e){return Zn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,B()}}function ar(t){var e=0,i=Fi/3,s=rr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ni,i=t[1]*Ni):[e*Vi,i*Vi]},n}function or(t,e){var i=qi(t),s=(i+qi(e))/2;if(Wi(s)2?t[2]*Ni:0),e.invert=function(e){return(e=t.invert(e[0]*Ni,e[1]*Ni))[0]*=Vi,e[1]*=Vi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===gr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function mr(t){return Qi((zi+t)/2)}function vr(t,e){var i=Yi(t),s=t===e?qi(t):$i(i/Yi(e))/$i(mr(e)/mr(t)),n=i*Ki(mr(t),s)/s;if(!s)return gr;function r(t,e){n>0?e<-zi+Di&&(e=-zi+Di):e>zi-Di&&(e=zi-Di);var i=n/Ki(mr(e),s);return[i*qi(s*t),n-i*Yi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Zi(s)*Ji(t*t+i*i),a=Gi(t,Wi(i))*Zi(i);return i*s<0&&(a-=Fi*Zi(t)*Zi(i)),[a/s,2*Ui(Ki(n/r,1/s))-zi]},r}function _r(t,e){return[t,e]}function yr(t,e){var i=Yi(t),s=t===e?qi(t):(i-Yi(e))/(e-t),n=i/s+t;if(Wi(s)Di&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Cr.invert=dr(es),Br.invert=dr((function(t){return 2*Ui(t)})),Er.invert=function(t,e){return[-e,2*Ui(Xi(t))-zi]};var Or={exports:{}},Ir=function(t,e){this.p1=t,this.p2=e};Ir.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ir.prototype.run=function(){return this.p2[0]-this.p1[0]},Ir.prototype.slope=function(){return this.rise()/this.run()},Ir.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ir.prototype.isVertical=function(){return!isFinite(this.slope())},Ir.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ir.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ir.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ir.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},Ir.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Lr=Ir,Dr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Lr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Dr(t.slice(0,s),e),o=Dr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Fr=Dr;!function(t){var e=Fr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=jr(Nr,e),{tolerance:s}=i;return zr(t,s)};var Ur;!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"}(Ur||(Ur={}));const Gr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],k=new Set,A=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),k.has(i)||(k.add(i),S.push(i),_(m)?A.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):A.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let M=0;const w=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/M:0,w.push(y[t])}return w},Xr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",k=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",A=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(u=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==u?u:"percentage",w=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],T=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=T.length?T:void 0,B=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:k,percentageName:M,valuesName:A,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!w.length)return Yr(t,B);const E={};return t.forEach((t=>{const e=w.map((e=>null==t?void 0:t[e])).join("-&&-");E[e]?E[e].push(t):E[e]=[t]})),Object.values(E).map((t=>{const e=[...T,...w];return Yr(t,Object.assign(Object.assign({},B),{groupField:e.length?e:void 0,n:t.length}))})).flat()},$r=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const k=!!(null==e?void 0:e.includeValues),A=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=A.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",w=null!==(a=A.count)&&void 0!==a?a:"count",T=null!==(o=A.mean)&&void 0!==o?o:"mean",C=null!==(l=A.q1)&&void 0!==l?l:"q1",B=null!==(h=A.median)&&void 0!==h?h:"median",E=null!==(c=A.q3)&&void 0!==c?c:"q3",P=null!==(u=A.iqr)&&void 0!==u?u:"iqr",R=null!==(p=A.min)&&void 0!==p?p:"min",O=null!==(g=A.max)&&void 0!==g?g:"max",I=null!==(f=A.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=A.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=A.outliers)&&void 0!==v?v:"outliers",F=null!==(y=A.values)&&void 0!==y?y:"values",z=new Map,j=new Map,H=new Map,V=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),k&&j.set(r,[]),_(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),k){const t=j.get(r);t&&t.push(i)}}_(S)&&(S=[mt(Math.min.apply(null,S),0,1),mt(Math.max.apply(null,S),0,1)]);const N=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[w]=s,f[T]=o,f[C]=l,f[B]=h,f[E]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,k&&(f[F]=j.get(t)||[]),N.push(f)}return N};var Kr={},qr={};function Zr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Jr(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function Qr(t,e){var i=t+"",s=i.length;return s9999?"+"+Qr(e,6):Qr(e,4))+"-"+Qr(t.getUTCMonth()+1,2)+"-"+Qr(t.getUTCDate(),2)+(r?"T"+Qr(i,2)+":"+Qr(s,2)+":"+Qr(n,2)+"."+Qr(r,3)+"Z":n?"T"+Qr(i,2)+":"+Qr(s,2)+":"+Qr(n,2)+"Z":s||i?"T"+Qr(i,2)+":"+Qr(s,2)+"Z":"")}function ea(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return qr;if(h)return h=!1,Kr;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a0}function ua(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=ra(t));var r=[];switch(t.type){case"GeometryCollection":return pa(t,(function(t){fa(t,s)})),t;case"FeatureCollection":return ua(t,(function(t){ua(fa(t,s),(function(t){r.push(t)}))})),oi(r)}return fa(t,s)}function fa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return pa(t,(function(t){fa(t,e)})),t;case"LineString":return ma(ca(t),e),t;case"Polygon":return va(ca(t),e),t;case"MultiLineString":return ca(t).forEach((function(t){ma(t,e)})),t;case"MultiPolygon":return ca(t).forEach((function(t){va(t,e)})),t;case"Point":case"MultiPoint":return t}}function ma(t,e){da(t)===e&&t.reverse()}function va(t,e){da(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=_a(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Sa=(t,e={},i)=>{i.type=Ur.GEO;const s=jr(ba,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(xa(t))})):e.push(xa(t))})),e})(t);let l=t.features;return o&&(l=ga(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=ya.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=ya.bounds(t);t.bbox=e}})),t.features=l,t},ka={},Aa=(t,e,i)=>{i.type=Ur.GEO;const s=jr(ba,ka,e),{object:n}=s;if(!v(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Rr(a,t)}))}:Rr(a,o));var a,o;return Sa(r,s,i)},Ma=(t,e,i)=>{const s=!h(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!_(t))throw new TypeError("Invalid data: must be DataView array!");return _(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let wa=0;function Ta(t="dataset"){return wa>1e8&&(wa=0),t+"_"+wa++}class Ca{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:Ta("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:rt.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Ba{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&N(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ta("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&N(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Ba||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Gr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Un();const Ea={},Pa={albers:hr,albersusa:function(){var t,e,i,s,n,r,a=hr(),o=lr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=lr().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}},Ra=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Oa(t,e){return function i(){const s=e();return s.type=t,s.path=Un().projection(s),s.copy=s.copy||function(){const t=i();return Ra.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Ia{static GenAutoIncrementId(){return Ia.auto_increment_id++}}Ia.auto_increment_id=0;class La{constructor(t){this.id=Ia.GenAutoIncrementId(),this.registry=t}}const Da="named",Fa="inject",za="multi_inject",ja="inversify:tagged",Ha="inversify:paramtypes";class Va{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Da?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Na=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Wa(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Na.hasOwnMetadata(t,e)&&(r=Na.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Na.defineMetadata(t,r,e)}(ja,t,i.toString(),s)}function Ua(t){return(e,i,s)=>{Wa(e,0,s,t)}}function Ga(t){return e=>(i,s,n)=>Ua(new Va(t,e))(i,s,n)}const Ya=Ga(Fa),Xa=Ga(za);function $a(){return function(t){return Na.defineMetadata(Ha,null,t),t}}function Ka(t){return Ua(new Va(Da,t))}const qa="Singleton",Za="Transient",Ja="ConstantValue",Qa="DynamicValue",to="Factory",eo="Function",io="Instance",so="Invalid";class no{constructor(t,e){this.id=Ia.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=so,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new no(this.serviceIdentifier,this.scope);return t.activated=t.scope===qa&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class ro{getConstructorMetadata(t){return{compilerGeneratedMetadata:Na.getMetadata(Ha,t),userGeneratedMetadata:Na.getMetadata(ja,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const ao=(oo=Da,t=>{const e=e=>{if(null==e)return!1;if(e.key===oo&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const co=Symbol("ContributionProvider");class uo{constructor(t,e){this.serviceIdentifier=t,this.container=e,go.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function po(t,e){t(co).toDynamicValue((({container:t})=>new uo(e,t))).inSingletonScope().whenTargetNamed(e)}class go{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}go.store=new Map;class fo{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class mo extends fo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const vo=Symbol.for("EnvContribution"),_o=Symbol.for("VGlobal"),yo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Za,this.options=e,this.id=Ia.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new ro}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,Da,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new no(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new ho(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[Fa],multiInject:s[za]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ja:case eo:e=t.cache;break;case io:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===qa&&(t.cache=e,t.activated=!0)}},bo=Symbol.for("RenderService");const xo=new class{get renderService(){return this._renderService||(this._renderService=yo.get(bo)),this._renderService}};let So=0;class ko{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=xo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++So,t),this.tryRunAnimationFrameNextFrame(),So}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class Ao{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Mo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},To=function(t,e){return function(i,s){e(i,s,t)}},Co=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let Bo=class extends Ao{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Ia.GenAutoIncrementId(),this.hooks={onSetEnv:new mo(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new ko);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Co(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Eo,Po,Ro,Oo;Bo=Mo([$a(),To(0,Ya(co)),To(0,Ka(vo)),wo("design:paramtypes",[Object])],Bo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Eo||(Eo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Po||(Po={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Ro||(Ro={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Oo||(Oo={}));const Io=jt-1e-8;class Lo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Io)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=jt)<0&&(s+=jt),(n%=jt)<0&&(n+=jt),nn;++o,a-=zt)g(a);else for(a=s-s%zt+zt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Fo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,zo={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},jo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Ho,Vo,No,Wo,Uo,Go;var Yo,Xo,$o,Ko,qo,Zo;function Jo(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),f=Math.cos(n),m=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,k=i+m,A=S+y*m,M=k-y*f;return[h*b+c*x,d*b+u*x,h*A+c*M,d*A+u*M,h*S+c*k,d*S+u*k]}function Qo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=re(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let k=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;k<0&&(k=0);let A=Math.sqrt(k);r===n&&(A=-A);const M=.5*(y+x)-A*(S-b),w=.5*(b+S)+A*(x-y),T=Math.atan2(b-w,y-M);let C=Math.atan2(S-w,x-M)-T;C<0&&1===r?C+=jt:C>0&&0===r&&(C-=jt);const B=Math.ceil(Math.abs(C/(zt+.001))),E=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function el(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=ll(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function cl(t,e){const{p0:i,p1:s}=t,n=ne.pointAtPP(i,s,e);return[new dl(i,n),new dl(n,s)]}class dl extends il{constructor(t,e){super(),this.type=qo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ne.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Nt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ne.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Ko.ROW?Vt(this.p0.x-this.p1.x):t===Ko.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class ul{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new hl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new dl(new se(this._lastX,this._lastY),new se(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Ko.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===Ko.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class pl extends ul{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function gl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function fl(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?Ko.ROW:Ko.COLUMN;return"monotoneY"===t?new pl(t,s):new ul(t,s)}class ml{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 vl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=fl("linear",i,t);return function(t,e){gl(t,e,1)}(new ml(n,s),t),n}function _l(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class yl{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&_l(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:_l(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 bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("basis",i,t);return function(t,e){gl(t,e,2)}(new yl(n,s),t),n}function xl(t){return t<0?-1:1}function Sl(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(xl(r)+xl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function kl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Al(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class Ml{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Al(this,this._t0,kl(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Al(this,kl(this,e=Sl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Al(this,this._t0,e=Sl(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class wl extends Ml{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Tl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("monotoneX",i,t);return function(t,e){gl(t,e,2)}(new Ml(n,s),t),n}function Cl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("monotoneY",i,t);return function(t,e){gl(t,e,2)}(new wl(n,s),t),n}let Bl=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class El extends Bl{lineEnd(){this.context.closePath()}}function Pl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ul("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ko.ROW:Ko.COLUMN);return Rl(new Bl(r,e,n),t),r}function Rl(t,e){return gl(t,e,1)}class Ol extends ml{lineEnd(){this.context.closePath()}}function Il(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=fl("linear",i,t);return function(t,e){gl(t,e,1)}(new Ol(n,s),t),n}function Ll(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Dt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Dt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function Dl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return vl(i,n);const o=fl(t,r,i);return gl(new e(o,s,a),i,2),o}}const Fl=Dl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const zl=Dl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class jl extends il{constructor(t,e,i){super(),this.type=qo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return ol(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,sl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Ko.ROW?Vt(this.p0.x-this.p2.x):t===Ko.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Ut(t-.01,0),i=Gt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Nt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=ol(i,s,n,e),a=ne.pointAtPP(i,s,e),o=ne.pointAtPP(s,n,e);return[new jl(i,a,r),new jl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Hl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new dl(new se(this._lastX,this._lastY),new se(t,e))}quadraticCurveTo(t,e,i,s){const n=new jl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new hl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Vl(t,e,i){var s,n;switch(e){case"linear":default:return vl(t,i);case"basis":return bl(t,i);case"monotoneX":return Tl(t,i);case"monotoneY":return Cl(t,i);case"step":return Pl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ul("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ko.ROW:Ko.COLUMN);return Rl(new El(r,e,n),t),r}(t,.5,i);case"stepBefore":return Pl(t,0,i);case"stepAfter":return Pl(t,1,i);case"catmullRom":return Fl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return zl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Il(t,i)}}class Nl extends Do{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Lo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([jo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([jo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([jo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([jo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([jo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([jo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([jo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([jo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([jo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Hl(this);el(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[jo.M]=t=>`M${t[1]} ${t[2]}`,t[jo.L]=t=>`L${t[1]} ${t[2]}`,t[jo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[jo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[jo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[jo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tGo){let t,e=No;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),el(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Ko.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===Ko.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{rt.getInstance().warn("空函数")}}),ah=Object.assign(Object.assign({},Jl),{points:[],cornerRadius:0,closePath:!0}),oh=Object.assign(Object.assign({},Jl),{width:100,height:100,spikes:5,thickness:.5}),lh=Object.assign(Object.assign({},Jl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Jl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const hh=Object.assign(Object.assign({},Jl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),ch=Object.assign(Object.assign(Object.assign({},Jl),Kl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),dh=Object.assign(Object.assign(Object.assign({},Jl),Kl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),uh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Jl),{fill:!0,cornerRadius:0,cornerType:"round"}),ph=Object.assign(Object.assign({},uh),{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}),gh=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=m("shape",/^(circle)/i,0);return t&&(t.style=f()||h()),t}()||function(){const t=m("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return m("extent-keyword",t.extentKeywords,1)}function c(){if(m("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=m("hex",t.hexColor,1)||m("rgba",t.rgbaColor,1)||m("rgb",t.rgbColor,1)||m("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return m("%",t.percentageValue,1)||m("position-keyword",t.positionKeywords,1)||f()}function f(){return m("px",t.pixelValue,1)||m("em",t.emValue,1)}function m(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class fh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(fh.IsGradientStr(t))try{const e=gh(t)[0];if(e){if("linear"===e.type)return fh.ParseLinear(e);if("radial"===e.type)return fh.ParseRadial(e);if("conic"===e.type)return fh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2,n=parseFloat(e.value)/180*Ft-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ht,stops:fh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:fh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2;let n="angular"===e.type?parseFloat(e.value)/180*Ft:0;for(;n<0;)n+=Ht;for(;n>=Ht;)n-=Ht;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const _h={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"}},yh=!0,bh=!1,xh=/\w|\(|\)|-/,Sh=/[.?!,;:/,。?!、;:]/,kh=/\S/,Ah=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Mh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=xo.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=wh(t,a)),a}function wh(t,e,i=!1){let s=e;for(;xh.test(t[s-1])&&xh.test(t[s])||Sh.test(t[s]);)if(s--,s<=0)return i?Th(t,e):e;return s}function Th(t,e){let i=e;for(;xh.test(t[i+1])&&xh.test(t[i])||Sh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Ch(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=xo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Bh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Eh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=ch.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wh(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){rt.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=wh(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};Eh=Bh([$a()],Eh);var Ph=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Rh=Symbol.for("TextMeasureContribution");let Oh=class extends Eh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Oh=Ph([$a()],Oh);const Ih=Symbol.for("CanvasFactory"),Lh=Symbol.for("Context2dFactory");function Dh(t){return yo.getNamed(Ih,xo.global.env)(t)}const Fh=1e-4,zh=Math.sqrt(3),jh=1/3;function Hh(t){return t>-Qh&&tQh||t<-Qh}const Nh=[0,0],Wh=[0,0],Uh=[0,0];function Gh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Yh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Xh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function $h(t){return(t%=Ht)<0&&(t+=Ht),t}function Kh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Ht);let d=Math.atan2(l,o);return d<0&&(d+=Ht),d>=s&&d<=n||d+Ht>=s&&d+Ht<=n}function Jh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(Hh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const ec=[-1,-1,-1],ic=[-1,-1];function sc(){const t=ic[0];ic[0]=ic[1],ic[1]=t}function nc(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Hh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,jh):Math.pow(i,jh),s=s<0?-Math.pow(-s,jh):Math.pow(s,jh);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+zh*Math.sin(e)))/(3*a),h=(-o+i*(s-zh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,ec);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&sc(),p=Xh(e,s,r,o,ic[0]),u>1&&(g=Xh(e,s,r,o,ic[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Hh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,ec);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=Yh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);ec[0]=-l,ec[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ht-1e-4){s=0,n=Ht;const e=r?1:-1;return a>=ec[0]+t&&a<=ec[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ht,n+=Ht);let c=0;for(let e=0;e<2;e++){const i=ec[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ht+t),(t>=s&&t<=n||t+Ht>=s&&t+Ht<=n)&&(t>Ft/2&&t<1.5*Ft&&(e=-e),c+=e)}}return c}function oc(t){return Math.round(t/Ft*1e8)/1e8%2*Ft}function lc(t,e){let i=oc(t[0]);i<0&&(i+=Ht);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ht?n=i+Ht:e&&i-n>=Ht?n=i-Ht:!e&&i>n?n=i+(Ht-oc(i-n)):e&&i1&&(i||(h+=Pe(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;hc[0]=S,hc[1]=k,lc(hc,Boolean(a[6])),S=hc[0],k=hc[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-m)*_/_+m;switch(f){case jo.M:u=m,p=v,c=u,d=p;break;case jo.L:if(i){if(Jh(c,d,m,v,e,s,n))return!0}else h+=Pe(c,d,m,v,s,n)||0;c=m,d=v;break;case jo.C:if(i){if(qh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=nc(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case jo.Q:if(i){if(Kh(c,d,m,v,_,y,e,s,n))return!0}else h+=rc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case jo.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Pe(c,d,o,l,s,n),i){if(Zh(m,v,_,A,A+M,w,e,T,n))return!0}else h+=ac(m,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+m,d=Math.sin(A+M)*_+v;break;case jo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Jh(u,p,o,p,e,s,n)||Jh(o,p,o,l,e,s,n)||Jh(o,l,u,l,e,s,n)||Jh(u,l,u,p,e,s,n))return!0}else h+=Pe(o,p,o,l,s,n),h+=Pe(u,l,u,p,s,n);break;case jo.Z:if(i){if(Jh(c,d,u,p,e,s,n))return!0}else h+=Pe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const gc=Symbol.for("VWindow"),fc=Symbol.for("WindowHandlerContribution");let mc=class extends Ao{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){super(),this.hooks={onChange:new mo(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(yo.getNamed(fc,t.env).configure(this,t),this.actived=!0)},this._uid=Ia.GenAutoIncrementId(),this.global=xo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&ut(this.width,t.width())&&ut(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};mc=uc([$a(),pc("design:paramtypes",[])],mc);var vc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_c=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yc=function(t,e){return function(i,s){e(i,s,t)}};let bc=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=xo.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=dc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Kl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Le(Object.assign({defaultFontParams:{fontFamily:Kl.fontFamily,fontSize:Kl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=yo.get(gc),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var xc;bc=vc([$a(),yc(0,Ya(co)),yc(0,Ka(Rh)),_c("design:paramtypes",[Object])],bc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(xc||(xc={}));const Sc=new Ne;let kc=class{constructor(){this.matrix=new Ne}init(t){return this.mode=xc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=xc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Sc.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Sc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}scale(t,e,i){return this.mode===xc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===xc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Sc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}translate(t,e){return this.mode===xc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===xc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};kc=vc([$a(),_c("design:paramtypes",[])],kc);const Ac={arc:Ql,area:th,circle:eh,line:nh,path:rh,symbol:hh,text:ch,rect:lh,polygon:ah,star:oh,richtext:dh,richtextIcon:ph,image:uh,group:ih,glyph:sh},Mc=Object.keys(Ac);function wc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Tc={arc:Object.assign({},Ac.arc),area:Object.assign({},Ac.area),circle:Object.assign({},Ac.circle),line:Object.assign({},Ac.line),path:Object.assign({},Ac.path),symbol:Object.assign({},Ac.symbol),text:Object.assign({},Ac.text),rect:Object.assign({},Ac.rect),polygon:Object.assign({},Ac.polygon),star:Object.assign({},Ac.star),richtext:Object.assign({},Ac.richtext),richtextIcon:Object.assign({},Ac.richtextIcon),image:Object.assign({},Ac.image),group:Object.assign({},Ac.group),glyph:Object.assign({},Ac.glyph)};class Cc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Mc.forEach((t=>{this._defaultTheme[t]=Object.create(Tc[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,rt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Mc.forEach((s=>{const n=Object.create(Tc[s]);t&&t[s]&&wc(n,t[s]),i[s]&&wc(n,i[s]),e[s]&&wc(n,e[s]),this.combinedTheme[s]=n})),e.common&&Mc.forEach((t=>{wc(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Bc=new Cc;function Ec(t,e){return t.glyphHost?Ec(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)):Bc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Ec(t.attachedThemeGraphic)||Bc.getTheme()}var Pc=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Rc extends o{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=Ia.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Pc(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&rt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(jc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=jc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=jc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=jc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=zc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(jc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(jc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,jc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):jc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof Dc))return void rt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=zc.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Hc(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Lc,this.rootWheelEvent=new Dc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&v(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class Uc{static GetImage(t,e){var i;const s=Uc.cache.get(t);s?"fail"===s.loadState?xo.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Uc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Uc.cache.get(t);s?"fail"===s.loadState?xo.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Uc.cache.set(t,s),s.dataPromise=xo.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Uc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Uc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=xo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=xo.global.loadBlob(t):"json"===e&&(i.dataPromise=xo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Uc.isLoading&&Uc.toLoadAueue.length){Uc.isLoading=!0;const t=Uc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Uc.cache.set(i,n),n.dataPromise=xo.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Uc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Uc.loading()})).catch((t=>{console.error(t),Uc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Uc.loading()}))}}),0)}static loadImage(t,e){const i=Gc(t,Uc.toLoadAueue);if(-1!==i)return Uc.toLoadAueue[i].marks.push(e),void Uc.loading();Uc.toLoadAueue.push({url:t,marks:[e]}),Uc.loading()}static improveImageLoading(t){const e=Gc(t,Uc.toLoadAueue);if(-1!==e){const t=Uc.toLoadAueue.splice(e,1);Uc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Gc(t,e){for(let i=0;it?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?($c[0]=t[0],$c[2]=t[0],$c[1]=t[1],$c[3]=t[1],$c):t:t:0,qc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Zc=[1,2,3,0,1,2,3,0];function Jc(t,e,i,s){for(;t>=Ht;)t-=Ht;for(;t<0;)t+=Ht;for(;t>e;)e+=Ht;qc[0].x=i,qc[1].y=i,qc[2].x=-i,qc[3].y=-i;const n=Math.ceil(t/zt)%4,r=Math.ceil(e/zt)%4;if(s.add(Wt(t)*i,Yt(t)*i),s.add(Wt(e)*i,Yt(e)*i),n!==r||e-t>Ft){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}id.TimeOut=1e3/60;const sd=new id,nd=(t,e)=>{const i=((t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class rd{bounds(t,e){if(x(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}}function ad(t,e,i,s,n){return n?t.arc(i,s,e,0,jt,!1,n):t.arc(i,s,e,0,jt),!1}var od=new class extends rd{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return ad(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ad(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var ld=new class extends rd{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function hd(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var cd=new class extends rd{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return hd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return hd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return hd(t,this.parseSize(e)/2+n,i,s,r)}};function dd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var ud=new class extends rd{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return dd(t,this.parseSize(e)/2+n,i,s)}};function pd(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class gd extends rd{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return pd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return pd(t,this.parseSize(e)/2,i,s,n)}}var fd=new gd;var md=new class extends gd{constructor(){super(...arguments),this.type="triangle"}};const vd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),_d=Math.sin(jt/10)*vd,yd=-Math.cos(jt/10)*vd;function bd(t,e,i,s){const n=_d*e,r=yd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=jt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var xd=new class extends rd{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return bd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return bd(t,this.parseSize(e)/2+n,i,s)}};const Sd=Xt(3);function kd(t,e,i,s){const n=e,r=n/Sd,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Ad=new class extends rd{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return kd(t,this.parseSize(e)/2+n,i,s)}};function Md(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var wd=new class extends rd{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};function Td(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Cd=new class extends rd{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Td(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Td(t,this.parseSize(e)/2+n,i,s)}};const Bd=-.5,Ed=Xt(3)/2,Pd=1/Xt(12);function Rd(t,e,i,s){const n=e/2,r=e*Pd,a=n,o=e*Pd+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Bd*n-Ed*r+i,Ed*n+Bd*r+s),t.lineTo(Bd*a-Ed*o+i,Ed*a+Bd*o+s),t.lineTo(Bd*l-Ed*h+i,Ed*l+Bd*h+s),t.lineTo(Bd*n+Ed*r+i,Bd*r-Ed*n+s),t.lineTo(Bd*a+Ed*o+i,Bd*o-Ed*a+s),t.lineTo(Bd*l+Ed*h+i,Bd*h-Ed*l+s),t.closePath(),!1}var Od=new class extends rd{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/2+n,i,s)}};function Id(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var Ld=new class extends rd{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return Id(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s,n)}};function Dd(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var Fd=new class extends rd{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return Dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};function zd(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var jd=new class extends rd{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2,i,s,n)}};const Hd=Xt(3);function Vd(t,e,i,s){const n=e*Hd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Nd=new class extends rd{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Vd(t,this.parseSize(e)/2/Hd,i,s)}drawOffset(t,e,i,s,n){return Vd(t,this.parseSize(e)/2/Hd+n,i,s)}};function Wd(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var Ud=new class extends rd{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return Wd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Wd(t,this.parseSize(e)/4+n,i,s)}};function Gd(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var Yd=new class extends rd{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function Xd(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var $d=new class extends rd{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return Xd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Xd(t,this.parseSize(e)/4+n,i,s)}};function Kd(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var qd=new class extends rd{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return Kd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Kd(t,this.parseSize(e)/4+n,i,s)}};function Zd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Jd=new class extends rd{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Zd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function Qd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var tu=new class extends rd{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function eu(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var iu=new class extends rd{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return eu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return eu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function su(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function nu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ru=new class extends rd{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return x(e)?nu(t,e,i,s):su(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?nu(t,e+2*n,i,s):su(t,[e[0]+2*n,e[1]+2*n],i,s)}};const au=new He;class ou{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),el(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(el(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{au.x1=i.bounds.x1*t,au.y1=i.bounds.y1*t,au.x2=i.bounds.x2*t,au.y2=i.bounds.y2*t,e.union(au)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const lu={};[od,ld,cd,ud,Nd,md,xd,Ad,wd,Cd,Od,Ld,Fd,fd,jd,Ud,Yd,$d,qd,ru,Jd,tu,iu].forEach((t=>{lu[t.type]=t}));const hu={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class cu{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function du(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function uu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=uu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=du(t,"--\x3e",r+4,"Comment is not closed.");else{const a=uu(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new cu(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new cu(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function fu(t,e){return mu(t)}function mu(t,e){const i={};for(let e=0;eMu.set(t,!0)));const wu=new Map;function Tu(t){if(Mu.has(t))return!0;if(wu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>wu.set(t,!0)));const Cu=ku(),Bu=ku(),Eu=ku(),Pu=ku(),Ru=ku(),Ou=ku(),Iu=ku(),Lu=ku(),Du=ku(),Fu=ku();ku();const zu=ku();ku();const ju=ku();ku();const Hu=ku(),Vu=ku(),Nu=Symbol.for("GraphicService"),Wu=Symbol.for("GraphicCreator"),Uu={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Gu=Object.keys(Uu),Yu={duration:200,easing:"cubicOut"};function Xu(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function $u(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Ku(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 qu(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*f,t[1]=y*n+b*l+x*u+S*m,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*f,t[5]=y*n+b*l+x*u+S*m,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*f,t[9]=y*n+b*l+x*u+S*m,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Zu(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class Ju{constructor(){this.pools=[]}static identity(t){return Xu(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return Ju.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ip=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const sp=new Ne(1,0,0,1,0,0),np={x:0,y:0};let rp=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this.path=new Nl,this._clearMatrix=new Ne(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Qu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},np),function(t,e,i){return cc(t,0,!1,e,i)}(this.path.commandList,np.x,np.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},np);const i=mh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return cc(t,e,!0,i,s)}(this.path.commandList,i,np.x,np.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(sp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Qu.free(t))),this.stack.length=0}};rp=ep([$a(),ip("design:paramtypes",[Object,Number])],rp);const ap={WIDTH:500,HEIGHT:500,DPR:1};class op{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=ap.WIDTH,height:n=ap.HEIGHT,dpr:r=ap.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var lp;op.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(lp||(lp={}));class hp{static Get(t,e=lp.Color1,i=[0,0,0,1]){if(e===lp.Color1){const e=hp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ti.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];hp.store1[t]=e,hp.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=hp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ti.parseColorString(t);return n&&(hp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],hp.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===lp.Color1){if(hp.store1[t])return;hp.store1[t]=i,hp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(hp.store255[t])return;hp.store255[t]=i,hp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function cp(t,e=!1){return Array.isArray(t)&&x(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function dp(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return up(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):up(t,e,i,s,n)}function up(t,e,i,s,n){if(!t||!e)return t&&cp(t)||e&&cp(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=hp.Get(t,lp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=hp.Get(e,lp.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:cp(a)})))});return o?dp(r,l,i,s,n):dp(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:mp(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:mp(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:mp(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),cp(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}function pp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}hp.store255={},hp.store1={};const gp=[0,0,0,0],fp=[0,0,0,0];function mp(t,e,i){return hp.Get(t,lp.Color255,gp),hp.Get(e,lp.Color255,fp),`rgba(${Math.round(gp[0]+(fp[0]-gp[0])*i)},${Math.round(gp[1]+(fp[1]-gp[1])*i)},${Math.round(gp[2]+(fp[2]-gp[2])*i)},${gp[3]+(fp[3]-gp[3])*i})`}class vp{static GetCanvas(){try{return vp.canvas||(vp.canvas=xo.global.createCanvas({})),vp.canvas}catch(t){return null}}static GetCtx(){if(!vp.ctx){const t=vp.GetCanvas();vp.ctx=t.getContext("2d")}return vp.ctx}}class _p extends We{static getInstance(){return _p._instance||(_p._instance=new _p),_p._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=vp.GetCanvas(),s=vp.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new _p(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class yp{static GetSize(t){for(let e=0;e=t)return yp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=yp.GenKey(t,e,i,s,n),l=yp.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=yp.GenKey(t,e,i,s,n);yp.cache[l]?yp.cache[l].push({width:a,height:o,pattern:r}):yp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}yp.cache={},yp.ImageSize=[20,40,80,160,320,640,1280,2560];const bp=new He,xp=new Ne;new He;const Sp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],kp=["x","y"],Ap=["scaleX","scaleY"],Mp=["angle"],wp=new se,Tp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Cp extends Rc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=lu[t];if(e)return e;if(e=Cp.userSymbolMap[t],e)return e;if(!0===((i=t=hu[t]||t).startsWith("{const e=(new Nl).fromString(t.d),i={};Gu.forEach((e=>{t[e]&&(i[Uu[e]]=t[e])})),n.push({path:e,attribute:i}),bp.union(e.bounds)}));const r=bp.width(),a=bp.height(),o=1/Ut(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new ou(t,n,!0);return Cp.userSymbolMap[t]=l,l}var i;const s=(new Nl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Ut(n,r);s.transform(0,0,a,a);const o=new ou(t,s);return Cp.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Kc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Lo(t);return el(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ne),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Yo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Yo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Yo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Yo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Yo.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&Yo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Yo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Xo.GLOBAL){const i=new se(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i))}_setAttributes(t,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Yu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:$o.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:$o.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:$o.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if(this.currentStates){const i=_(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stateSort&&(t=t.sort(this.stateSort));const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=Yo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Yo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Yo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Yo.UPDATE_SHAPE_AND_BOUNDS)===Yo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Yo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Yo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Yo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Yo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Yo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Yo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Yo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Yo.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Gl.x,y:e=Gl.y,scaleX:i=Gl.scaleX,scaleY:s=Gl.scaleY,angle:n=Gl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Wt(a),f=Yt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,k=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+d*v-x*_-k*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),xo.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Gl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=xp.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:$o.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:xo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return v(t,!0)?this.pathProxy=(new Nl).fromString(t):this.pathProxy=new Nl,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),xo.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Fc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||xo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new rp(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Bp;Cp.userSymbolMap={},Cp.mixin(Vc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Bp||(Bp={}));let Ep=class t extends Cp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ou,this._childUpdateTag=Yo.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 Cc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Cc)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Xo.GLOBAL){const i=new se(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&Yo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Gl.x,y:e=Gl.y,dx:i=Gl.dx,dy:s=Gl.dy,scaleX:n=Gl.scaleX,scaleY:r=Gl.scaleY,angle:a=Gl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Ec(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return xo.graphicService.updateTempAABBBounds(i),xo.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Yo.CLEAR_BOUNDS,this._childUpdateTag&=Yo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Yo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Yo.UPDATE_BOUNDS||(this._childUpdateTag|=Yo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&Yo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=xo.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Pp(t){return new Ep(t)}Ep.NOWORK_ANIMATE_ATTR=Tp;class Rp extends Ep{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Cc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{xo.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{xo.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Op=Symbol.for("TransformUtil"),Ip=Symbol.for("GraphicUtil"),Lp=Symbol.for("LayerService"),Dp=Symbol.for("StaticLayerHandlerContribution"),Fp=Symbol.for("DynamicLayerHandlerContribution"),zp=Symbol.for("VirtualLayerHandlerContribution");var jp,Hp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Np=jp=class{static GenerateLayerId(){return`${jp.idprefix}_${jp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=xo.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?yo.get(Dp):"dynamic"===t?yo.get(Fp):yo.get(zp),e}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Rp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:jp.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};Np.idprefix="visactor_layer",Np.prefix_count=0,Np=jp=Hp([$a(),Vp("design:paramtypes",[])],Np);var Wp=new La((t=>{t(_o).to(Bo).inSingletonScope(),t(gc).to(mc),t(Ip).to(bc).inSingletonScope(),t(Op).to(kc).inSingletonScope(),t(Lp).to(Np).inSingletonScope()}));function Up(t,e){return!(!t&&!e)}function Gp(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Yp(t,e,i){return i&&t*e>0}function Xp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function $p(t,e){return t*e>0}function Kp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function qp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,k=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let A=(S*y-_*k)/b,M=(-S*_-y*k)/b;const w=(S*y+_*k)/b,T=(-S*_+y*k)/b,C=A-m,B=M-v,E=w-m,P=T-v;return C*C+B*B>E*E+P*P&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function Zp(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const k=n*Wt(c),A=n*Yt(c),M=s*Wt(u),w=s*Yt(u);let T,C,B,E;if((b>Dt||y>Dt)&&(T=n*Wt(d),C=n*Yt(d),B=s*Wt(p),E=s*Yt(p),r1?0:P<-1?Ft:Math.acos(P))/2),l=Xt(t[0]*t[0]+t[1]*t[1]);S=Gt(b,(s-l)/(o-1)),x=Gt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:k,yors:A,xirs:B,yirs:E,xore:T,yore:C,xire:M,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Jp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ht-Dt)e.moveTo(i+n*Wt(o),s+n*Yt(o)),e.arc(i,s,n,o,l,!c),r>Dt&&(e.moveTo(i+r*Wt(l),s+r*Yt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Zp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Dt){const t=Gt(v,m),r=Gt(_,m),o=qp(g,f,u,p,n,t,Number(c)),l=qp(b,x,S,k,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,n,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Wt(Nt(l.y01,l.x01)),s+l.cy+r*Yt(Nt(l.y01,l.x01))):e.moveTo(i+b,s+n*Yt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Wt(M),s+n*Yt(M));if(!(r>Dt)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Dt){const t=Gt(E,w),n=Gt(P,w),o=qp(S,k,b,x,r,-n,Number(c)),l=qp(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,r,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Wt(Nt(l.y01,l.x01)),s+l.cy+t*Yt(Nt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),!a||a[2]?e.arc(i,s,r,C,B,c):e.moveTo(i+r*Wt(B),s+r*Yt(B))}return a?a[3]&&e.lineTo(i+n*Wt(o),s+n*Yt(o)):e.closePath(),d}const Qp=Symbol.for("ArcRenderContribution"),tg=Symbol.for("AreaRenderContribution"),eg=Symbol.for("CircleRenderContribution"),ig=Symbol.for("GroupRenderContribution"),sg=Symbol.for("ImageRenderContribution"),ng=Symbol.for("PathRenderContribution"),rg=Symbol.for("PolygonRenderContribution"),ag=Symbol.for("RectRenderContribution"),og=Symbol.for("SymbolRenderContribution"),lg=Symbol.for("TextRenderContribution"),hg=Symbol.for("InteractiveSubRenderContribution");function cg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function dg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var ug=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gg=function(t,e){return function(i,s){e(i,s,t)}};function fg(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Xu(t),$u(t,t,[n+o,r+l,a+h]),$u(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),$u(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=tp.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}$u(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,f),$u(i,i,[-s[0],-s[1],0]),qu(t,t,i)}}let mg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new mo(["graphic"]),onSetStage:new mo(["graphic","stage"]),onRemove:new mo(["graphic"]),onRelease:new mo(["graphic"]),onAddIncremental:new mo(["graphic","group","stage"]),onClearIncremental:new mo(["graphic","group","stage"]),beforeUpdateAABBBounds:new mo(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new mo(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new mo(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new He,this.tempAABBBounds2=new He}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Lo(t);return el(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=dg(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=cg(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){xu(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;xu(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&ze(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};mg=ug([$a(),gg(0,Ya(Wu)),pg("design:paramtypes",[Object])],mg);const vg=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},_g=["radius","startAngle","endAngle",...Sp];class yg extends Cp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Pu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Ec(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ht-Dt?i.set(-r,-r,r,r):Jc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,_g)}needUpdateTag(t){return super.needUpdateTag(t,_g)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Nl,s.arc(0,0,r,a,o),s}clone(){return new yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yg.NOWORK_ANIMATE_ATTR}}function bg(t){return new yg(t)}yg.NOWORK_ANIMATE_ATTR=Tp;class xg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Eo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Vu,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Ec(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new kg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Ae(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=xo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){xu(n,o/Math.abs(r+a),!0,l),i.union(n)}return xo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||xo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ze(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=xo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),k=new xg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:A}=k;return this.cache.layoutData=k,this.clearUpdateShapeTag(),this._AABBBounds.set(A.xOffset,A.yOffset,A.xOffset+A.width,A.yOffset+A.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,k=m?0:this.guessLineHeightBuf(h),A=this.getLineHeight(this.attribute,r,k);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const M=xo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),w={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:A},T=new xg(a,w,M),C=_(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/A),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Ut(e,a)}));const t=cg(_,a),e=this.cache.verticalList.length*v,i=dg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Au.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Ut(e,a)}));const x=cg(_,a),S=this.cache.verticalList.length*v,k=dg(y,S,d);return this._AABBBounds.set(k,x,k+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=nd(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Sg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Sg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return kg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return kg.baselineMapAlign}getAlignMapBaseline(){return kg.alignMapBaseline}}function Ag(t){return new kg(t)}kg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Tp),kg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},kg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Mg=["symbolType","size",...Sp];let wg=class t extends Cp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Hu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Ec(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;xu(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Nl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Nl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Tg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Tp);const Cg=["segments","points","curveType","curveTension",...Sp];let Bg=class t extends Cp{constructor(t={}){super(t),this.type="line",this.numberType=Lu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=td(i,s,e))}getGraphicTheme(){return Ec(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),xo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Cg)}needUpdateTag(t){return super.needUpdateTag(t,Cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Nl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Eg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const Pg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},Rg=["width","x1","y1","height","cornerRadius",...Sp];class Og extends Cp{constructor(t){super(t),this.type="rect",this.numberType=zu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Ec(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Rg)}needUpdateTag(t){return super.needUpdateTag(t,Rg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Pg(e);return t=new Nl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Og(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Og.NOWORK_ANIMATE_ATTR}}function Ig(t){return new Og(t)}Og.NOWORK_ANIMATE_ATTR=Tp;class Lg extends Cp{constructor(t){super(t),this.type="glyph",this.numberType=Ru,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Ec(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Lg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Lg.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Lg(t)}Lg.NOWORK_ANIMATE_ATTR=Tp;class Fg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=_h[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function zg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class jg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=nd(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Ch(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Ch(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=zg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Mh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Hg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...Sp];class Vg extends Cp{constructor(t){super(t),this.type="image",this.numberType=Iu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Ec(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return uh[t]}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}clone(){return new Vg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Ng(t){return new Vg(t)}Vg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Tp);class Wg extends Vg{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Kc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Kc(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=uh.width,height:e=uh.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Ug{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Wg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=_h[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof jg){const e=kh.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Wg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Ch(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||bh;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Ah(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||yh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?vh(t,s,{AABBBounds:i}):s,Ah(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Wg)break;const{width:n}=Ch(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Wg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Gg{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=_h[this.direction]}store(t){if(t instanceof Wg){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 Ug(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Wg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Mh(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new jg(i,t.newLine,t.character,t.ascentDescentMode),new jg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Yg=!1;try{Yg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Yg=!1}const Xg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Sp];class $g extends Cp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ju,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:dh.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:dh.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:dh.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:dh.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:dh.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:dh.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:dh.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:dh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Ec(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&$g.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&$g.splitText(t.text).length>1)))}static splitText(t){if(Yg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=$g.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),xo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||xo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Xg)}needUpdateTag(t){return super.needUpdateTag(t,Xg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!$g.AllSingleCharacter(_)&&(_=$g.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,k="number"==typeof s&&Number.isFinite(s)&&s>0,A="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!k||r<=s),w=new Fg(0,0,(A?n:S?i:0)||0,(M?r:k?s:0)||0,a,o,l,h,c,d||"horizontal",!A&&S,!M&&k,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),T=new Gg(w);if(T.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new $g(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return $g.NOWORK_ANIMATE_ATTR}}function Kg(t){return new $g(t)}$g.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Tp);const qg=["path","customPath",...Sp];class Zg extends Cp{constructor(t){super(t),this.type="path",this.numberType=Du}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Nl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Nl?this.cache:t.path)}getGraphicTheme(){return Ec(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new Nl).fromString(t.path):t.customPath&&(this.cache=new Nl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}toCustomPath(){return(new Nl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Tp);const Qg=["segments","points","curveType","curveTension",...Sp];class tf extends Cp{constructor(t){super(t),this.type="area",this.numberType=Eu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Ec(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),xo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=td(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Nl;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new tf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tf.NOWORK_ANIMATE_ATTR}}function ef(t){return new tf(t)}tf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const sf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Sp];class nf extends Cp{constructor(t){super(t),this.type="arc",this.numberType=Cu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(x(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=oe(e),i=e+r,s&&Vt(r)Dt&&o>Dt)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=Xt(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Dt&&l>Dt){const i=e>t?1:-1;let s=Kt(Number(l)/o*Yt(g)),n=Kt(Number(l)/a*Yt(g));return(f-=2*s)>Dt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Dt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Ec(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);vg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Dt?i.set(0,0,0,0):Math.abs(o-l)>Ht-Dt?i.set(-s,-s,s,s):(Jc(l,o,s,i),Jc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,sf)}needUpdateTag(t){return super.needUpdateTag(t,sf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ht-Dt)n.moveTo(0+h*Wt(a),0+h*Yt(a)),n.arc(0,0,h,a,o,!d),l>Dt&&(n.moveTo(0+l*Wt(o),0+l*Yt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Wt(a),e=h*Yt(a),i=l*Wt(o),s=l*Yt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new nf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nf.NOWORK_ANIMATE_ATTR}}function rf(t){return new nf(t)}nf.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Tp);const af=["points","cornerRadius",...Sp];class of extends Cp{constructor(t){super(t),this.type="polygon",this.numberType=Fu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Ec(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),xo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=td(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,af)}needUpdateTag(t){return super.needUpdateTag(t,af)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Nl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new of(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return of.NOWORK_ANIMATE_ATTR}}function lf(t){return new of(t)}of.NOWORK_ANIMATE_ATTR=Tp;class hf extends Ep{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function cf(t){return new hf(t)}const df=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let uf,pf;function gf(t){return uf||(uf=df.CreateGraphic("text",{})),uf.initAttributes(t),uf.AABBBounds}var ff=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vf=function(t,e){return function(i,s){e(i,s,t)}};class _f{constructor(){this.time=Zo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:k=l.backgroundClip,backgroundPosition:A=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(xf(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Ec(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}k&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:A}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){Tf(t,e,i,s)}}const yf=new _f,bf=new Set(["top","center","bottom"]);function xf(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Sf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const kf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Af(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Mf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:bf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Af(s,e,"left","center","right"),y:Af(n,i,"top","center","bottom")}}function wf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Tf(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=function(t){if(!t)return null;const e=wf(t.naturalWidth,t.videoWidth,t.width),i=wf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}(e),{backgroundRepeatMode:m,backgroundSizing:v}=function({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=kf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Sf({backgroundFit:e,backgroundKeepAspectRatio:i})}}({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let _=p,y=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Mf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(_=i*(g/s),y=g):"repeat-y"===m&&(y=s*(p/i),_=p);const n=t.dpr,r=dc.allocate({width:_,height:y,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,_,y),a.drawImage(e,0,0,_,y),e=r.nativeCanvas),dc.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}let Cf=class{constructor(t){this.subRenderContribitions=t,this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Cf=ff([$a(),vf(0,Ya(co)),vf(0,Ka(hg)),mf("design:paramtypes",[Object])],Cf);const Bf=new class{constructor(){this.time=Zo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Ef=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class Pf{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=dc.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),dc.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Ht),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=dc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),k=u.gutterColumn?u.gutterColumn:2*y,A=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Tg({}));const M=u.columns?v/u.columns:b,w=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-k,w-A],symbolType:t});const T=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:mh(e,o,e.dpr),c=o/T,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:T+u*h,innerRadius:w-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),Jp(t,e,i,s,T+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/k,(S-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},If=Rf,Lf=yf;const Df=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:mh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Ff=Rf,zf=yf;const jf=new class extends _f{constructor(){super(...arguments),this.time=Zo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:_=l.backgroundScale,backgroundOffsetX:y=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(xf(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:_,backgroundOffsetX:y,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Hf=Ft/2;function Vf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],k=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!K(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Hf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Hf,!1)}if(o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),!K(S,k)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Hf,Ft,!1)}if(o&&o[3]?o[3](k[0],k[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ft,Ft+Hf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Nf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Wf{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,x1:A,y1:M,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:A-i)||0,C=(null!=C?C:M-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:mh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,T-o*g,C-o*g)):(e.beginPath(),Vf(e,u,p,T-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}let Uf=class{constructor(){this.time=Zo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Uf=Nf([$a()],Uf);let Gf=class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Vf(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Gf=Nf([$a()],Gf);const Yf=new Wf,Xf=Rf,$f=yf;const Kf=new class extends Wf{constructor(){super(...arguments),this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},qf=yf;const Zf=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,A=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:mh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&A(p,"outerBorder"),m&&A(g,"innerBorder")}},Jf=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Qf=Rf,tm=yf;const em={x:0,y:0,z:0,lastModelMatrix:null};class im{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Bf),this.builtinContributions.push(Ef),this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Zo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Zo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Ec(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,_=Yp(d,u,h),y=$p(d,g),b=Up(h),x=Gp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return el(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Yp(o,l,n),p=$p(o,c),g=Up(n,r),f=Gp(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;em.x=n,em.y=r,em.z=a,em.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=tp.allocate(),n=tp.allocate();fg(n,t,e),qu(s,d||s,n),em.x=0,em.y=0,em.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),tp.free(n)}if(g&&!d){const s=t.getOffsetXY(e);em.x+=s.x,em.y+=s.y,em.z=a,i.setTransformForCurrent()}else if(p)em.x=0,em.y=0,em.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);em.x+=s.x,em.y+=s.y,this.transformWithoutTranslate(i,em.x,em.y,em.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),em.x=0,em.y=0,em.z=0;return em}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,f,m,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&tp.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var sm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rm=function(t,e){return function(i,s){e(i,s,t)}};let am=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Cu,this.builtinContributions=[Of,Lf,If],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nDt){const t=Gt(b,y),r=Gt(x,y),a=qp(v,_,f,m,n,t,Number(u)),o=qp(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Nt(o.y11,o.x11),Nt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Dt)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Dt){const t=Gt(E,T),n=Gt(P,T),a=qp(M,w,k,A,r,-n,Number(u)),o=qp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),T0&&e.arc(i+a.cx,s+a.cy,n,Nt(a.y01,a.x01),Nt(a.y11,a.x11),!u);const t=Nt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Wt(B),s+r*Yt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Ec(t,null==r?void 0:r.theme).arc;const{fill:c=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:k=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;A+=b,M-=x;let w=0;const T=(h(S)&&S||S[0])&&"conical"===c.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i){var e;let i=!0;if(h(t,!0)){for(let s=0;s<4;s++)Xc[s]=t,i&&(i=!(null!==(e=Xc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Xc[e]=!!t[e],i&&(i=!!Xc[e]);else Xc[0]=!1,Xc[1]=!1,Xc[2]=!1,Xc[3]=!1;return{isFullStroke:i,stroke:Xc}})(d);if((_||B)&&(e.beginPath(),Jp(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,B,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,B,v,o))),!B&&y&&(e.beginPath(),Jp(t,e,i,s,A,M,E),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(h(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Vt(h-r)>=Ht-Dt){e.beginPath();const r=Math.abs(A-M)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,A,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Ht;for(;i>Ht;)i-=Ht;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),dp(o.color,l.color,h,!1)}(0,0,h,n);a||Yp&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),T&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};am=sm([$a(),rm(0,Ya(co)),rm(0,Ka(Qp)),nm("design:paramtypes",[Object])],am);var om=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hm=function(t,e){return function(i,s){e(i,s,t)}};let cm=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pu,this.builtinContributions=[Df,zf,Ff],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function dm(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=ll(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function um(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function pm(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=um(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),dm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Ko.ROW:"y"===s?u=Ko.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let fm=class extends im{constructor(){super(...arguments),this.numberType=Lu}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();pm(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Vl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Gt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function mm(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),dm(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),dm(t,l,1,s),o=!1):o=!0}t.closePath()}fm=gm([$a()],fm);const vm=new class extends Pf{constructor(){super(...arguments),this.time=Zo.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:ed(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:ed(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:ed(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:ed(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},_m=yf;var ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xm=function(t,e){return function(i,s){e(i,s,t)}};let Sm=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eu,this.builtinContributions=[vm,_m],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Ec(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:k}=S,A=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:w,points:T,segments:C}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===M&&!C&&!T.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,A,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Vl(E(t.points,x),B,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Vl(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(T,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Vl(e,B,{curveTension:b}),n=Vl(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,k,v,A,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,k,v,A,y,r[u],[g,t.attribute],Gt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,A,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=Ko.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),k=Vt(y.y-b.y);x=null==y.x1?Ko.ROW:null==y.y1?Ko.COLUMN:Number.isFinite(S+k)?S>k?Ko.ROW:Ko.COLUMN:Ko.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Ko.ROW:Ko.COLUMN,Number.isFinite(c)||(o=Ko.COLUMN),Number.isFinite(d)||(o=Ko.ROW);const u=i*(o===Ko.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),pm(t,i[0]?e.top:e.bottom,l,x===Ko.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,A-h,M-c,o),t.stroke()}})(),!1}};Sm=ym([$a(),xm(0,Ya(co)),xm(0,Ka(tg)),bm("design:paramtypes",[Object])],Sm);const km=Rf,Am=yf;var Mm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tm=function(t,e){return function(i,s){e(i,s,t)}};let Cm=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[Am,km],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Ec(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)el(t.pathShape.commandList,e,i,s,1,1,f);else{el((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Cm=Mm([$a(),Tm(0,Ya(co)),Tm(0,Ka(ng)),wm("design:paramtypes",[Object])],Cm);var Bm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Em=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pm=function(t,e){return function(i,s){e(i,s,t)}};let Rm=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=zu,this.builtinContributions=[Yf,$f,Xf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Ec(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:k=l.y,fillStrokeOrder:A=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:b-S)||0,T=(null!=T?T:x-k)||0;const C=Xp(g,f,w,T,h),B=Kp(g,v,w,T,M),E=Up(h,c),P=Gp(d,m);if(!t.valid||!y)return;if(!E&&!P)return;if(!(C||B||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,T)):(e.beginPath(),Vf(e,i,s,w,T,u,"bevel"!==p));const R={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,P,C,B,l,n,a,o,R),A?(this._runStroke(t,e,i,s,l,R,B,S,k,o),this._runFill(t,e,i,s,l,R,C,S,k,a)):(this._runFill(t,e,i,s,l,R,C,S,k,a),this._runStroke(t,e,i,s,l,R,B,S,k,o)),this.afterRenderStep(t,e,i,s,E,P,C,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Rm=Bm([$a(),Pm(0,Ya(co)),Pm(0,Ka(ag)),Em("design:paramtypes",[Object])],Rm);var Om=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Im=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lm=function(t,e){return function(i,s){e(i,s,t)}};let Dm=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Hu,this.builtinContributions=[Zf,tm,Qf,Jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Ec(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,k=t.getParsedPath();if(!k)return;const{keepDirIn3d:A=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,T=s,C=M;const B=e.camera;if(A&&B&&e.project){const t=e.project(i,s,M);e.camera=null,_(c)&&(c[0],c[1]),w=t.x,T=t.y,C=void 0}!1===k.draw(e,c,w,T,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,k,a)):(this._runFill(t,e,i,s,l,x,y,d,u,k,a),this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Dm=Om([$a(),Lm(0,Ya(co)),Lm(0,Ka(og)),Im("design:paramtypes",[Object])],Dm);const Fm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new He)}allocate(t,e,i,s){if(!this.pools.length)return(new He).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new He(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const zm=new class extends _f{constructor(){super(...arguments),this.time=Zo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,_,y,b,x,S;const{backgroundOpacity:k=l.backgroundOpacity,opacity:A=l.opacity,backgroundMode:M=l.backgroundMode,backgroundFit:w=l.backgroundFit,backgroundKeepAspectRatio:T=l.backgroundKeepAspectRatio,backgroundScale:C=l.backgroundScale,backgroundOffsetX:B=l.backgroundOffsetX,backgroundOffsetY:E=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:R=l.backgroundClip,backgroundCornerRadius:O=l.backgroundCornerRadius}=t.attribute;let I,{background:L}=t.attribute;if(!L)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=p(L)&&L.background?L:null,j=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(g=z.dx)&&void 0!==g?g:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(_=z.height)&&void 0!==_?_:e.height();if(F=Fm.allocate(i,s,i+n,s+r),L=z.background,!j){const t=F.width(),e=F.height();F.set((null!==(y=z.x)&&void 0!==y?y:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,j||(F=gf(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const i=t.resources.get(L);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),j&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=k*A,R&&(e.beginPath(),O?Vf(e,F.x1,F.y1,F.width(),F.height(),O,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:M,backgroundFit:w,backgroundKeepAspectRatio:T,backgroundScale:C,backgroundOffsetX:B,backgroundOffsetY:E,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=k*A,e.fillStyle=L,O?(Vf(e,F.x1,F.y1,F.width(),F.height(),O,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Fm.free(F),D()}};var jm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vm=function(t,e){return function(i,s){e(i,s,t)}};let Nm=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Vu,this.builtinContributions=[zm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Ec(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=nd(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:k,sVisible:A,doFill:M,doStroke:w}=S,T=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,w,k,A,d,n,a,o),T&&this.transformUseContext2d(t,d,C,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Qu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Qu.free(t)}w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Ut(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}T&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,w,k,A,d,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!d(c),y=_?c.width:i.clipedWidth,b=_?0:cg(u,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Wm(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Km=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qm=function(t,e){return function(i,s){e(i,s,t)}};let Zm=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[Xm,Ym],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:b}=f;e.beginPath(),c<=0||_(c)&&c.every((t=>0===t))?Wm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Wm(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=Um(d,u),b=Um(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Gm(h,_,y,d,u),k=Gm(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=Um(A,M),T=Gm(h,Um(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const B=Math.atan2(k.y-T.y,k.x-T.x);let E=B-C;E<0&&(C=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&t.arcTo(h.x+i,h.y+s,k.x+i,k.y+s,v),t.lineTo(k.x+i,k.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Zm=$m([$a(),qm(0,Ya(co)),qm(0,Ka(rg)),Km("design:paramtypes",[Object])],Zm);var Jm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tv=function(t,e){return function(i,s){e(i,s,t)}};let ev=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Ou}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(jf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Ec(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:k=l.fillStrokeOrder,cornerType:A=l.cornerType,x:M=l.x,y:w=l.y}=t.attribute,T=Xp(p,m,g,f,c),C=Kp(p,v,g,f),B=Up(c,u),E=Gp(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(T||C||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Vf(e,i,s,g,f,y,"bevel"!==A));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(jf));const P={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Zo.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,T,C,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):T&&(e.setCommonStyle(t,t.attribute,M-i,w-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,w-s,l),e.stroke()))};k?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===Zo.afterFillStroke&&r.drawShape(t,e,i,s,B,E,T,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=xo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Ec(t,null==s?void 0:s.theme).group,i=tp.allocate(),n=tp.allocate();fg(n,t,e),qu(i,p||i,n),a.modelMatrix=i,tp.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&tp.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};ev=Jm([$a(),tv(0,Ya(co)),tv(0,Ka(ig)),Qm("design:paramtypes",[Object])],ev);var iv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nv=function(t,e){return function(i,s){e(i,s,t)}};const rv=["","repeat-x","repeat-y","repeat"];function av({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=function(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?rv[i]:"no-repeat"}(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const ov={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function lv(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=av({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?function(t){return{backgroundMode:ov[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Tf(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}let hv=class extends im{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Iu,this.builtinContributions=[Kf,qf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,k=this.valid(t,l,a);if(!k)return;const{fVisible:A,sVisible:M,doFill:w,doStroke:T}=k;if(!S||!t.resources)return;const C=t.resources.get(S);if("success"!==C.state)return;const B=t.width,E=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,B,E):(Vf(e,i,s,B,E,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{w&&(a?a(e,t.attribute,l):A&&(e.setCommonStyle(t,t.attribute,i,s,l),lv(e,C.data,i,s,B,E,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},O=()=>{T&&(o?o(e,t.attribute,l):M&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=function({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0,imagePosition:a="top-left"}){const{repeatMode:o,sizingMode:l}=av({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===o&&("cover"===l||"auto"===l||1!==s||0!==n||0!==r)}({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),L=P||I;g?(O(),L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,A,!1,l,n,a),R(),L&&e.restore()):(L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,A,!1,l,n,a),R(),L&&e.restore(),O()),this.afterRenderStep(t,e,i,s,w,!1,A,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&v(s))return void Uc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Ec(t).image;this._draw(t,a,!1,i)}};hv=iv([$a(),nv(0,Ya(co)),nv(0,Ka(sg)),sv("design:paramtypes",[Object])],hv);const cv=Symbol.for("IncrementalDrawContribution"),dv=Symbol.for("ArcRender"),uv=Symbol.for("AreaRender"),pv=Symbol.for("CircleRender"),gv=Symbol.for("GraphicRender"),fv=Symbol.for("GroupRender"),mv=Symbol.for("LineRender"),vv=Symbol.for("PathRender"),_v=Symbol.for("PolygonRender"),yv=Symbol.for("RectRender"),bv=Symbol.for("SymbolRender"),xv=Symbol.for("TextRender"),Sv=Symbol.for("RichTextRender"),kv=Symbol.for("GlyphRender"),Av=Symbol.for("ImageRender"),Mv=Symbol.for("DrawContribution"),wv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Bu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Ht;for(;o<0;)o+=Ht;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var Tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Bv=Symbol.for("DrawItemInterceptor"),Ev=new He,Pv=new He;class Rv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Ev.copy(s.dirtyBounds),Pv.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Qu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Ev),s.backupDirtyBounds.copy(Pv)),!0}}class Ov{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Iv=class{constructor(){this.order=1,this.interceptors=[new Rv,new Dv,new Lv,new Ov]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&tp.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Fv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jv=function(t,e){return function(i,s){e(i,s,t)}};let Hv=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Hv=Fv([$a(),jv(0,Ya(Mv)),zv("design:paramtypes",[Object])],Hv);var Vv=new La((t=>{t(bo).to(Hv)}));const Nv=Symbol.for("PickerService"),Wv=Symbol.for("GlobalPickerService"),Uv=Symbol.for("PickItemInterceptor"),Gv=Symbol.for("PickServiceInterceptor");var Yv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Xv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Xv=Yv([$a()],Xv);let $v=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Ec(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Qu.allocateByObj(a),u=new se(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};$v=Yv([$a()],$v);let Kv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new se(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Kv=Yv([$a()],Kv);let qv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=wv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};qv=Yv([$a()],qv);var Zv=new La(((t,e,i)=>{i(Nv)||(t(Wv).toSelf(),t(Nv).toService(Wv)),t(qv).toSelf().inSingletonScope(),t(Uv).toService(qv),t($v).toSelf().inSingletonScope(),t(Uv).toService($v),t(Kv).toSelf().inSingletonScope(),t(Uv).toService(Kv),po(t,Uv),t(Xv).toSelf().inSingletonScope(),t(Gv).toService(Xv),po(t,Gv)})),Jv=new La((t=>{t(Nu).to(mg),t(Wu).toConstantValue(df)}));const Qv=Symbol.for("AutoEnablePlugins"),t_=Symbol.for("PluginService");var e_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},i_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s_=function(t,e){return function(i,s){e(i,s,t)}};let n_=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&&yo.isBound(Qv)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};n_=e_([$a(),s_(0,Ya(co)),s_(0,Ka(Qv)),i_("design:paramtypes",[Object])],n_);var r_=new La((t=>{t(t_).to(n_),function(t,e){t(co).toDynamicValue((({container:t})=>new uo(e,t))).whenTargetNamed(e)}(t,Qv)})),a_=new La((t=>{po(t,vo)})),o_=new La((t=>{t(Rh).to(Oh).inSingletonScope(),po(t,Rh)})),l_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},h_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let c_=class{constructor(){this.type="static",this.offscreen=!1,this.global=xo.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Dh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};c_=l_([$a(),h_("design:paramtypes",[])],c_);var d_=new La((t=>{t(c_).toSelf(),t(Dp).toService(c_)}));var u_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function p_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function g_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=p_(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=p_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var v_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},__=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},y_=function(t,e){return function(i,s){e(i,s,t)}};let b_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):g_(e,Jl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new je,this.backupDirtyBounds=new je,this.global=xo.global,this.layerService=xo.layerService,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ve(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Jl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Qu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=m_(e,i,Jl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!xe(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Fm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Qu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Fm.free(n),Qu.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||yo.get(cv);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let S_=class extends fm{constructor(){super(...arguments),this.numberType=Lu}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Ec(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=Yp(u,p,c),_=$p(u,g),y=Up(c),b=Gp(d,f);if(!t.valid||!m)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};S_=x_([$a()],S_);var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let A_=class extends Sm{constructor(){super(...arguments),this.numberType=Eu}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Ec(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Yp(u,d,c),f=Up(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};A_=k_([$a()],A_);var M_,w_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},T_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},C_=function(t,e){return function(i,s){e(i,s,t)}},B_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(M_||(M_={}));let E_=class extends b_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=M_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new mo([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return B_(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Jl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return B_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return B_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>B_(this,void 0,void 0,(function*(){if(2!==t.count)yield f_(t,Jl.zIndex,((i,s)=>{if(this.status===M_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return B_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return B_(this,void 0,void 0,(function*(){this.rendering&&(this.status=M_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=M_.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 B_(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:()=>B_(this,void 0,void 0,(function*(){yield f_(t,Jl.zIndex,(t=>B_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};E_=w_([$a(),C_(0,Xa(gv)),C_(1,Ya(S_)),C_(2,Ya(A_)),C_(3,Ya(co)),C_(3,Ka(Bv)),T_("design:paramtypes",[Array,Object,Object,Object])],E_);var P_=new La((t=>{t(_f).toSelf().inSingletonScope(),t(Pf).toSelf().inSingletonScope(),t(Mv).to(b_),t(cv).to(E_),t(fv).to(ev).inSingletonScope(),t(gv).toService(fv),po(t,ig),t(Cf).toSelf().inSingletonScope(),po(t,hg),po(t,gv),t(Iv).toSelf().inSingletonScope(),t(Bv).toService(Iv),po(t,Bv)}));function R_(){R_.__loaded||(R_.__loaded=!0,yo.load(Wp),yo.load(Jv),yo.load(Vv),yo.load(Zv),yo.load(r_),function(t){t.load(a_),t.load(o_),t.load(d_)}(yo),function(t){t.load(P_)}(yo))}R_.__loaded=!1,R_();const O_=yo.get(_o);xo.global=O_;const I_=yo.get(Ip);xo.graphicUtil=I_;const L_=yo.get(Op);xo.transformUtil=L_;const D_=yo.get(Nu);xo.graphicService=D_;const F_=yo.get(Lp);xo.layerService=F_;class z_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class j_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=xo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=xo.global.getRequestAnimationFrame();this.rafId=t((()=>{xo.global.devicePixelRatio!==this.dpr&&(this.dpr=xo.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=xo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class H_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,xo.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const V_=new He;class N_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()}));const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(V_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(V_,t.parent&&t.parent.globalTransMatrix)))})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let W_;function U_(){!function(){if(null==W_)try{const t=document.createElement("canvas"),e=t.getContext("2d");W_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),W_&&(W_=!!document.createElement)}catch(t){W_=!1}}();const t=xo.global&&xo.global.env;return t?"browser"===t:W_}let G_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};G_._pluginClasses={};const Y_="white";class X_ extends Ep{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:Y_}set background(t){this._background=t,this.syncBackgroundImage(t)}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}syncBackgroundImage(t){var e;const i=null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t;this.backgroundImg=!1,this.isImageBackgroundSource(i)&&this.loadImage(i,!0)}isImageBackgroundSource(t){if(!t)return!1;if("string"==typeof t)return t.startsWith("{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Cc,this.hooks={beforeRender:new mo(["stage"]),afterRender:new mo(["stage"]),afterClearScreen:new mo(["stage"]),afterClearRect:new mo(["stage"])},this.global=xo.global,!this.global.env&&U_()&&this.global.setEnv("browser"),this.window=yo.get(gc),this.renderService=yo.get(bo),this.pluginService=yo.get(t_),this.layerService=yo.get(Lp),this.graphicService=yo.get(Nu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:Y_,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&this.syncBackgroundImage(this._background),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Wc(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,k=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,k=Math.cos(d)*Math.cos(u)*1);const A=G_.getPlugin("DirectionalLight");A&&(this.light=new A(f,m,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,k],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=G_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=G_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new z_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new j_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new H_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new je;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new N_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=G_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=G_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=G_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new se(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=yo.get(gc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=yo.get(Nv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var $_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},K_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let q_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new He}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return K_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};q_=$_([$a()],q_);var Z_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},J_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Q_=class{constructor(){this._uid=Ia.GenAutoIncrementId(),this.viewBox=new He,this.modelMatrix=new Ne(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};Q_=Z_([$a(),J_("design:paramtypes",[])],Q_);var ty=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ey=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iy=function(t,e){return function(i,s){e(i,s,t)}};let sy=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=xo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new He).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ne(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new se(e.x,e.y),a=Ec(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new se(e.x,e.y);l.transformPoint(a,a);const o=Ec(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&tp.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Qu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function ny(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function ry(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function dy(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),my=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},vy=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new je;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return my(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return my(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);vy(n[0],s,i),vy(n[1],e-s,i)}};let _y=!1;const yy=new La((t=>{_y||(_y=!0,t(am).toSelf().inSingletonScope(),t(dv).to(am).inSingletonScope(),t(gv).toService(dv),t(Qp).toService(Cf),po(t,Qp))}));let by=!1;const xy=new La((t=>{by||(by=!0,t(Rm).toSelf().inSingletonScope(),t(yv).to(Rm).inSingletonScope(),t(gv).toService(yv),t(Gf).toSelf(),t(Uf).toSelf(),t(ag).toService(Gf),t(ag).toService(Uf),t(ag).toService(Cf),po(t,ag))}));let Sy=!1;const ky=new La((t=>{Sy||(Sy=!0,t(fm).toSelf().inSingletonScope(),t(S_).toSelf().inSingletonScope(),t(mv).to(fm).inSingletonScope(),t(gv).toService(mv))}));let Ay=!1;const My=new La((t=>{Ay||(Ay=!0,t(Sm).toSelf().inSingletonScope(),t(uv).to(Sm).inSingletonScope(),t(gv).toService(uv),t(tg).toService(Cf),po(t,tg),t(A_).toSelf().inSingletonScope())}));let wy=!1;const Ty=new La((t=>{wy||(wy=!0,t(Dm).toSelf().inSingletonScope(),t(bv).to(Dm).inSingletonScope(),t(gv).toService(bv),t(og).toService(Cf),po(t,og))}));let Cy=!1;const By=new La((t=>{Cy||(Cy=!0,t(cm).toSelf().inSingletonScope(),t(pv).to(cm).inSingletonScope(),t(gv).toService(pv),t(eg).toService(Cf),po(t,eg))}));let Ey=!1;const Py=new La((t=>{Ey||(Ey=!0,t(xv).to(Nm).inSingletonScope(),t(gv).toService(xv),t(lg).toService(Cf),po(t,lg))}));let Ry=!1;const Oy=new La((t=>{Ry||(Ry=!0,t(Cm).toSelf().inSingletonScope(),t(vv).to(Cm).inSingletonScope(),t(gv).toService(vv),t(ng).toService(Cf),po(t,ng))}));let Iy=!1;const Ly=new La((t=>{Iy||(Iy=!0,t(_v).to(Zm).inSingletonScope(),t(gv).toService(_v),t(rg).toService(Cf),po(t,rg))}));var Dy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Fy=class{constructor(){this.numberType=Ru}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Ec(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Fy=Dy([$a()],Fy);let zy=!1;const jy=new La((t=>{zy||(zy=!0,t(kv).to(Fy).inSingletonScope(),t(gv).toService(kv))}));var Hy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ny=class extends im{constructor(){super(),this.numberType=ju,this.builtinContributions=[zm],this.init()}drawShape(t,e,i,s,n){const r=Ec(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Yp(o,l,!0),d=Yp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Ec(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Vf(e,i-t,s-n,v,_,f,!0)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Ec(t).richtext;this._draw(t,s,!1,i)}};Ny=Hy([$a(),Vy("design:paramtypes",[])],Ny);let Wy=!1;const Uy=new La((t=>{Wy||(Wy=!0,t(Sv).to(Ny).inSingletonScope(),t(gv).toService(Sv))}));let Gy=!1;const Yy=new La((t=>{Gy||(Gy=!0,t(Av).to(hv).inSingletonScope(),t(gv).toService(Av),t(sg).toService(Cf),po(t,sg))}));function Xy(t){const e=[];for(let i=0;i=0&&n>=0&&srt.getInstance().info(`[VChart log]: ${t}`,...e),qy=(t,e)=>(c(Jy.warnHandler)&&Jy.warnHandler.call(null,t,e),e?rt.getInstance().warn(`[VChart warn]: ${t}`,e):rt.getInstance().warn(`[VChart warn]: ${t}`)),Zy=(t,e,i)=>{if(!c(Jy.errorHandler))throw new Error(t);Jy.errorHandler.call(null,t,e)},Jy={silent:!1,warnHandler:!1,errorHandler:!1},Qy=U_(),tb=Qy&&globalThis?globalThis.document:void 0;function eb(t){return("desktop-browser"===t||"mobile-browser"===t)&&Qy}function ib(t){return sb(t)||"mobile-browser"===t}function sb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let nb=0;function rb(){return nb>=9999999&&(nb=0),nb++}function ab(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function ob(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}const lb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class hb extends Ep{constructor(t,e){super(t),this._skipRenderAttributes=lb,(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){d(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},Fb=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class zb extends o{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=zc.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=zc.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||Db(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=Fb(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=zc.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=Fb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Db(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=zc.now()-i>this.config.press.time&&Fb(s[0],t){xo.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Vb=[0,0,0];let Nb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Yl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},$l),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Kl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this._clearMatrix=new Ne(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&rt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Qu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Ht;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*y),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&yp.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Zu(Vb,[t,e,i],this.modelMatrix),t=Vb[0],e=Vb[1],i=Vb[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(Zu(Vb,[t,e,i],this.modelMatrix),t=Vb[0],e=Vb[1],i=Vb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Zu(Vb,[e,i,s],this.modelMatrix),e=Vb[0],i=Vb[1],s=Vb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t,e=xo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=xo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Kl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Kl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Zu(Vb,[e,i,s],this.modelMatrix),e=Vb[0],i=Vb[1],s=Vb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=vh(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:mh(this,a,this.dpr),r.strokeStyle=vh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Ie(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=Ie(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Qu.free(t))),this.stack.length=0}};Nb.env="browser",Nb=jb([$a(),Hb("design:paramtypes",[Object,Number])],Nb);var Wb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ub=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Gb=class extends op{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=xo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Nb(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function Yb(t,e){return new La((i=>{i(Ih).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Lh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Gb.env="browser",Gb=Wb([$a(),Ub("design:paramtypes",[Object])],Gb);const Xb=Yb(Gb,Nb);var $b=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qb=function(t,e){return function(i,s){e(i,s,t)}};let Zb=class extends sy{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=dc.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Qb=class{constructor(){this.type="group",this.numberType=Ou}contains(t,e,i){return!1}};Qb=Jb([$a()],Qb);const tx=new La(((t,e,i,s)=>{tx.__vloaded||(tx.__vloaded=!0,t(Ib).to(Qb).inSingletonScope(),t(Lb).toService(Ib),po(t,Lb))}));tx.__vloaded=!1;var ex=tx;const ix=new La(((t,e,i,s)=>{i(Zb)||t(Zb).toSelf().inSingletonScope(),i(Nv)?s(Nv).toService(Zb):t(Nv).toService(Zb)}));var sx,nx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ax=sx=class extends Q_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${sx.idprefix}_${sx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=xo.global,this.viewBox=new He,this.modelMatrix=new Ne(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:sx.GenerateCanvasId(),canvasControled:!0};this.canvas=new Gb(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new Gb({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};ax.env="browser",ax.idprefix="visactor_window",ax.prefix_count=0,ax=sx=nx([$a(),rx("design:paramtypes",[])],ax);const ox=new La((t=>{t(ax).toSelf(),t(fc).toDynamicValue((t=>t.container.get(ax))).whenTargetNamed(ax.env)}));var lx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cx=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class dx{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function ux(t,e=!1){const i=document.createElement("img");if(xo.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let px=class extends q_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new dx(t)}return new He}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return ux(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return ux(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:Ia.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return cx(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};px=lx([$a(),hx("design:paramtypes",[])],px);const gx=new La((t=>{gx.isBrowserBound||(gx.isBrowserBound=!0,t(px).toSelf().inSingletonScope(),t(vo).toService(px))}));function fx(t,e=!0){fx.__loaded||(fx.__loaded=!0,t.load(gx),t.load(Xb),t.load(ox),e&&function(t){t.load(ex),t.load(ix)}(t))}gx.isBrowserBound=!1,fx.__loaded=!1;var mx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_x=function(t,e){return function(i,s){e(i,s,t)}};let yx=class extends sy{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new rp(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};yx=mx([$a(),_x(0,Ya(co)),_x(0,Ka(cb)),_x(1,Ya(co)),_x(1,Ka(Uv)),_x(2,Ya(co)),_x(2,Ka(Gv)),vx("design:paramtypes",[Object,Object,Object])],yx);const bx=new La((t=>{bx.__vloaded||(bx.__vloaded=!0,po(t,cb))}));bx.__vloaded=!1;var xx=bx;class Sx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:mh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mx=function(t,e){return function(i,s){e(i,s,t)}};let wx=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Cu}};wx=kx([$a(),Mx(0,Ya(dv)),Ax("design:paramtypes",[Object])],wx);let Tx=!1;const Cx=new La(((t,e,i,s)=>{Tx||(Tx=!0,t(db).to(wx).inSingletonScope(),t(cb).toService(db))}));var Bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ex=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Px=function(t,e){return function(i,s){e(i,s,t)}};let Rx=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Eu}};Rx=Bx([$a(),Px(0,Ya(uv)),Ex("design:paramtypes",[Object])],Rx);let Ox=!1;const Ix=new La(((t,e,i,s)=>{Ox||(Ox=!0,t(ub).to(Rx).inSingletonScope(),t(cb).toService(ub))}));var Lx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fx=function(t,e){return function(i,s){e(i,s,t)}};let zx=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Pu}};zx=Lx([$a(),Fx(0,Ya(pv)),Dx("design:paramtypes",[Object])],zx);let jx=!1;const Hx=new La(((t,e,i,s)=>{jx||(jx=!0,t(pb).to(zx).inSingletonScope(),t(cb).toService(pb))}));class Vx{constructor(){this.type="glyph",this.numberType=Ru}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var Nx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ux=function(t,e){return function(i,s){e(i,s,t)}};let Gx=class extends Vx{constructor(t){super(),this.canvasRenderer=t}};Gx=Nx([$a(),Ux(0,Ya(kv)),Wx("design:paramtypes",[Object])],Gx);let Yx=!1;const Xx=new La(((t,e,i,s)=>{Yx||(Yx=!0,t(xb).to(Gx).inSingletonScope(),t(Gx).toService(xb))}));var $x=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Kx=class{constructor(){this.type="image",this.numberType=Iu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Kx=$x([$a()],Kx);let qx=!1;const Zx=new La(((t,e,i,s)=>{qx||(qx=!0,t(gb).to(Kx).inSingletonScope(),t(Kx).toService(gb))}));var Jx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tS=function(t,e){return function(i,s){e(i,s,t)}};let eS=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};eS=Jx([$a(),tS(0,Ya(mv)),Qx("design:paramtypes",[Object])],eS);let iS=!1;const sS=new La(((t,e,i,s)=>{iS||(iS=!0,t(fb).to(eS).inSingletonScope(),t(cb).toService(fb))}));var nS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aS=function(t,e){return function(i,s){e(i,s,t)}};let oS=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Fu}};oS=nS([$a(),aS(0,Ya(_v)),rS("design:paramtypes",[Object])],oS);let lS=!1;const hS=new La(((t,e,i,s)=>{lS||(lS=!0,t(bb).to(oS).inSingletonScope(),t(cb).toService(bb))}));var cS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uS=function(t,e){return function(i,s){e(i,s,t)}};let pS=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Du}};pS=cS([$a(),uS(0,Ya(vv)),dS("design:paramtypes",[Object])],pS);let gS=!1;const fS=new La(((t,e,i,s)=>{gS||(gS=!0,t(mb).to(pS).inSingletonScope(),t(cb).toService(mb))})),mS=new He;class vS{constructor(){this.type="rect",this.numberType=zu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||x(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:mh(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;mS.setValue(i.x1,i.y1,i.x2,i.y2),mS.expand(-r/2),h=!mS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var _S=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bS=function(t,e){return function(i,s){e(i,s,t)}};let xS=class extends vS{constructor(t){super(),this.canvasRenderer=t}};xS=_S([$a(),bS(0,Ya(yv)),yS("design:paramtypes",[Object])],xS);let SS=!1;const kS=new La(((t,e,i,s)=>{SS||(SS=!0,t(vb).to(xS).inSingletonScope(),t(cb).toService(vb))}));let AS=!1;const MS=new La(((t,e,i,s)=>{AS||(AS=!0,t(gb).to(Kx).inSingletonScope(),t(Kx).toService(gb))}));var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CS=function(t,e){return function(i,s){e(i,s,t)}};let BS=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Hu}};BS=wS([$a(),CS(0,Ya(bv)),TS("design:paramtypes",[Object])],BS);let ES=!1;const PS=new La(((t,e,i,s)=>{ES||(ES=!0,t(_b).to(BS).inSingletonScope(),t(cb).toService(_b))}));var RS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let OS=class{constructor(){this.type="text",this.numberType=Vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};OS=RS([$a()],OS);let IS=!1;const LS=new La(((t,e,i,s)=>{IS||(IS=!0,t(yb).to(OS).inSingletonScope(),t(cb).toService(yb))})),DS=new La(((t,e,i,s)=>{i(yx)||t(yx).toSelf().inSingletonScope(),i(Nv)?s(Nv).toService(yx):t(Nv).toService(yx)}));class FS{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var zS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let HS=class extends Nb{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ne(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};HS.env="node",HS=zS([$a(),jS("design:paramtypes",[Object,Number])],HS);var VS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let WS=class extends op{constructor(t){super(t)}init(){this._context=new HS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}};WS.env="node",WS=VS([$a(),NS("design:paramtypes",[Object])],WS);const US=Yb(WS,HS);var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XS=function(t,e){return function(i,s){e(i,s,t)}};let $S=class extends Q_{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:Ia.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new WS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new WS({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};$S.env="node",$S=GS([$a(),XS(0,Ya(_o)),YS("design:paramtypes",[Object])],$S);const KS=new La((t=>{t($S).toSelf(),t(fc).toDynamicValue((t=>t.container.get($S))).whenTargetNamed($S.env)}));var qS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZS=class extends q_{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return sd.call(t)}}getCancelAnimationFrame(){return t=>{sd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};ZS=qS([$a()],ZS);const JS=new La((t=>{JS.isNodeBound||(JS.isNodeBound=!0,t(ZS).toSelf().inSingletonScope(),t(vo).toService(ZS))}));function QS(t,e=!0){QS.__loaded||(QS.__loaded=!0,t.load(JS),t.load(US),t.load(KS))}JS.isNodeBound=!1,QS.__loaded=!1;var tk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ek=class extends Nb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:mh(this,l,this.dpr),r.strokeStyle=vh(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=xo.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,xo.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:Ie(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:Ie(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}};ek.env="harmony",ek=tk([$a()],ek);var ik=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let nk=class extends op{constructor(t){super(t)}init(){this._context=new ek(this,this._dpr)}resize(t,e){}release(...t){}};nk.env="harmony",nk=ik([$a(),sk("design:paramtypes",[Object])],nk);var rk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ok=function(t,e){return function(i,s){e(i,s,t)}};class lk{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 hk=class extends Q_{get container(){return null}constructor(t){super(),this.global=t,this.type="harmony",this.eventManager=new lk}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Ia.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new nk(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}this.canvas=new nk({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};hk.env="harmony",hk=rk([$a(),ok(0,Ya(_o)),ak("design:paramtypes",[Object])],hk);const ck=new La((t=>{t(hk).toSelf(),t(fc).toDynamicValue((t=>t.container.get(hk))).whenTargetNamed(hk.env)})),dk=Yb(nk,ek);var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let gk=class extends q_{constructor(){super(),this.type="harmony",this.supportEvent=!0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0,this.rafSTO=new id(0)}configure(t,e){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){}loadSvg(t){return Promise.reject()}createCanvas(t){return function(t,e,i){const s=new OffscreenCanvas(t,e),n=s.getContext("2d");return new FS({width:t,height:e,context:n,_c:s,getBoundingClientRect:()=>({width:t,height:e}),getContext:()=>n},n,1,t,e,i)}(t.width,t.height,t.id)}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return null}getRootElement(){return null}getDocument(){return null}release(...t){}};gk=uk([$a(),pk("design:paramtypes",[])],gk);const fk=new La((t=>{fk.isHarmonyBound||(fk.isHarmonyBound=!0,t(gk).toSelf().inSingletonScope(),t(vo).toService(gk))}));function mk(t,e=!0){mk.__loaded||(mk.__loaded=!0,t.load(fk),t.load(dk),t.load(ck),e&&function(t){t.load(xx),t.load(DS),t.load(Cx),t.load(Ix),t.load(Hx),t.load(Xx),t.load(Zx),t.load(sS),t.load(hS),t.load(fS),t.load(kS),t.load(MS),t.load(PS),t.load(LS)}(t))}fk.isHarmonyBound=!1,mk.__loaded=!1;var vk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_k=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yk=function(t,e){return function(i,s){e(i,s,t)}};let bk=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Cu}};bk=vk([$a(),yk(0,Ya(dv)),_k("design:paramtypes",[Object])],bk);let xk=!1;const Sk=new La(((t,e,i,s)=>{xk||(xk=!0,t(Sb).to(bk).inSingletonScope(),t(Lb).toService(Sb))}));var kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mk=function(t,e){return function(i,s){e(i,s,t)}};let wk=class extends vS{constructor(t){super(),this.canvasRenderer=t}};wk=kk([$a(),Mk(0,Ya(yv)),Ak("design:paramtypes",[Object])],wk);let Tk=!1;const Ck=new La(((t,e,i,s)=>{Tk||(Tk=!0,t(Cb).to(wk).inSingletonScope(),t(Lb).toService(Cb))}));class Bk extends im{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:mh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&tp.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var Ek=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rk=function(t,e){return function(i,s){e(i,s,t)}};let Ok=class extends Bk{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};Ok=Ek([$a(),Rk(0,Ya(mv)),Pk("design:paramtypes",[Object])],Ok);let Ik=!1;const Lk=new La(((t,e,i,s)=>{Ik||(Ik=!0,t(wb).to(Ok).inSingletonScope(),t(Lb).toService(wb))}));var Dk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zk=function(t,e){return function(i,s){e(i,s,t)}};let jk=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Eu}};jk=Dk([$a(),zk(0,Ya(uv)),Fk("design:paramtypes",[Object])],jk);let Hk=!1;const Vk=new La(((t,e,i,s)=>{Hk||(Hk=!0,t(kb).to(jk).inSingletonScope(),t(Lb).toService(kb))}));class Nk extends im{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&tp.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var Wk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gk=function(t,e){return function(i,s){e(i,s,t)}};let Yk=class extends Nk{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Hu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:mh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&tp.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Yk=Wk([$a(),Gk(0,Ya(bv)),Uk("design:paramtypes",[Object])],Yk);let Xk=!1;const $k=new La(((t,e,i,s)=>{Xk||(Xk=!0,t(Bb).to(Yk).inSingletonScope(),t(Lb).toService(Bb))}));var Kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zk=function(t,e){return function(i,s){e(i,s,t)}};let Jk=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Pu}};Jk=Kk([$a(),Zk(0,Ya(pv)),qk("design:paramtypes",[Object])],Jk);let Qk=!1;const tA=new La(((t,e,i,s)=>{Qk||(Qk=!0,t(Ab).to(Jk).inSingletonScope(),t(Lb).toService(Ab))}));var eA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sA=function(t,e){return function(i,s){e(i,s,t)}};let nA=class extends Nk{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Vu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=dg(a,u,n),v=cg(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&tp.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};nA=eA([$a(),sA(0,Ya(xv)),iA("design:paramtypes",[Object])],nA);let rA=!1;const aA=new La(((t,e,i,s)=>{rA||(rA=!0,t(Eb).to(nA).inSingletonScope(),t(Lb).toService(Eb))}));var oA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hA=function(t,e){return function(i,s){e(i,s,t)}};let cA=class extends Bk{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Du}};cA=oA([$a(),hA(0,Ya(vv)),lA("design:paramtypes",[Object])],cA);let dA=!1;const uA=new La(((t,e,i,s)=>{dA||(dA=!0,t(Tb).to(cA).inSingletonScope(),t(Lb).toService(Tb))}));var pA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fA=function(t,e){return function(i,s){e(i,s,t)}};let mA=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Fu}};mA=pA([$a(),fA(0,Ya(_v)),gA("design:paramtypes",[Object])],mA);let vA=!1;const _A=new La(((t,e,i,s)=>{vA||(vA=!0,t(Pb).to(mA).inSingletonScope(),t(Lb).toService(Pb))}));var yA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xA=function(t,e){return function(i,s){e(i,s,t)}};let SA=class extends Vx{constructor(t){super(),this.canvasRenderer=t}};SA=yA([$a(),xA(0,Ya(kv)),bA("design:paramtypes",[Object])],SA);let kA=!1;const AA=new La(((t,e,i,s)=>{kA||(kA=!0,t(Ob).to(SA).inSingletonScope(),t(Lb).toService(Ob))}));var MA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TA=function(t,e){return function(i,s){e(i,s,t)}};let CA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ju}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};CA=MA([$a(),TA(0,Ya(Sv)),wA("design:paramtypes",[Object])],CA);let BA=!1;const EA=new La(((t,e,i,s)=>{BA||(BA=!0,t(Rb).to(CA).inSingletonScope(),t(Lb).toService(Rb))}));var PA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OA=function(t,e){return function(i,s){e(i,s,t)}};let IA=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Iu}};IA=PA([$a(),OA(0,Ya(Av)),RA("design:paramtypes",[Object])],IA);let LA=!1;const DA=new La(((t,e,i,s)=>{LA||(LA=!0,t(Mb).to(IA).inSingletonScope(),t(Lb).toService(Mb))})),FA=U_();function zA(){zA.__loaded||(zA.__loaded=!0,df.RegisterGraphicCreator("arc",rf),yo.load(yy),yo.load(FA?Sk:Cx))}zA.__loaded=!1;const jA=zA;function HA(){HA.__loaded||(HA.__loaded=!0,df.RegisterGraphicCreator("area",ef),yo.load(My),yo.load(FA?Vk:Ix))}HA.__loaded=!1;const VA=HA;function NA(){NA.__loaded||(NA.__loaded=!0,df.RegisterGraphicCreator("circle",bg),yo.load(By),yo.load(FA?tA:Hx))}NA.__loaded=!1;const WA=NA;function UA(){UA.__loaded||(UA.__loaded=!0,df.RegisterGraphicCreator("glyph",Dg),yo.load(jy),yo.load(FA?AA:Xx))}UA.__loaded=!1;const GA=UA;function YA(){YA.__loaded||(YA.__loaded=!0,df.RegisterGraphicCreator("group",Pp))}YA.__loaded=!1;const XA=YA;function $A(){$A.__loaded||($A.__loaded=!0,df.RegisterGraphicCreator("image",Ng),yo.load(Yy),yo.load(FA?DA:Zx))}$A.__loaded=!1;const KA=$A;function qA(){qA.__loaded||(qA.__loaded=!0,df.RegisterGraphicCreator("line",Eg),yo.load(ky),yo.load(FA?Lk:sS))}qA.__loaded=!1;const ZA=qA;function JA(){JA.__loaded||(JA.__loaded=!0,df.RegisterGraphicCreator("path",Jg),yo.load(Oy),yo.load(FA?uA:fS))}JA.__loaded=!1;const QA=JA;function tM(){tM.__loaded||(tM.__loaded=!0,df.RegisterGraphicCreator("polygon",lf),yo.load(Ly),yo.load(FA?_A:hS))}tM.__loaded=!1;const eM=tM;function iM(){iM.__loaded||(iM.__loaded=!0,df.RegisterGraphicCreator("rect",Ig),yo.load(xy),yo.load(FA?Ck:kS))}iM.__loaded=!1;const sM=iM;function nM(){nM.__loaded||(nM.__loaded=!0,df.RegisterGraphicCreator("richtext",Kg),yo.load(Uy),yo.load(FA?EA:MS))}nM.__loaded=!1;const rM=nM;function aM(){aM.__loaded||(aM.__loaded=!0,df.RegisterGraphicCreator("shadowRoot",cf))}aM.__loaded=!1;const oM=aM;function lM(){lM.__loaded||(lM.__loaded=!0,df.RegisterGraphicCreator("symbol",Tg),yo.load(Ty),yo.load(FA?$k:PS))}lM.__loaded=!1;const hM=lM;function cM(){cM.__loaded||(cM.__loaded=!0,df.RegisterGraphicCreator("text",Ag),yo.load(Py),yo.load(FA?aA:LS))}cM.__loaded=!1;const dM=cM;function uM(){XA(),sM()}const pM=-.5*Math.PI,gM=1.5*Math.PI,fM="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var mM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(mM||(mM={}));const vM={[mM.selectedReverse]:{},[mM.selected]:{},[mM.hover]:{},[mM.hoverReverse]:{}},_M={container:"",width:30,height:30,style:{}},yM="scrollDrag";function bM(){return"browser"===O_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const xM={debounce:bt,throttle:xt};uM();let SM=class t extends hb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=mt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=mt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=bM(),a="browser"===O_.env?O_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=mt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:xM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:vt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=vt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(yM,{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",xM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===O_.env?O_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(vt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ni(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ni(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=mt(t[0],0,1),c=mt(t[1],0,1),d=mt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=vt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?vt([a+i*n,a+s*n],a,n-l):vt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=bM(),e="browser"===O_.env?O_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===O_.env?O_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};SM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};var kM,AM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let MM=kM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new je).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new He,e.addEventListener("wheel",this.scroll),this.params=kM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(yM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new SM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(MM)||(t(MM).toSelf(),t(Qv).toService(MM))}));function TM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&TM(t,e)}))}const CM=t=>!d(t)&&!1!==t.visible;function BM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function EM(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const RM=["#ffffff","#000000"];function OM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ti(t).toHex(),o=new ti(e).toHex();return IM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...RM);for(const n of a)if(t!==n&&IM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function IM(t,e,i,s,n){if("lightness"===n){const i=ti.getColorBrightness(new ti(e));return ti.getColorBrightness(new ti(t))<.5?i>=.5:i<.5}return s?LM(t,e)>s:"largeText"===i?LM(t,e)>3:LM(t,e)>4.5}function LM(t,e){const i=DM(t),s=DM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function DM(t){const e=ii(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function FM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function zM(t,e){return[t[0]*e,t[1]*e]}function jM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function HM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Zt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const VM=(t,e,i,s)=>new Le(Object.assign({defaultFontParams:Object.assign({fontFamily:fM,fontSize:14},s),getTextBounds:i?void 0:gf,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function NM(t,e,i={}){if(!t)return{width:0,height:0};const s=gf({text:t,fontFamily:e.fontFamily||i.fontFamily||fM,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function WM(t,e="type"){var i,s;return p(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function UM(t){var e,i;return u(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function GM(t,e="type"){const i=WM(t,e);return"rich"===i?df.richtext(UM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),df.text(t))}function YM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const XM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function $M(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function KM(t,e){const{dx:i,dy:s}=$M(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function qM(){XA(),sM(),hM(),rM(),dM()}var ZM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nc&&(w=c,O.setAttribute("maxLineWidth",c-b[1]-b[2]))),A=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):H>0&&S.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,W=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:G(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=w-b[1]-b[3],e=I+B,i=1===H?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),k){const t=i-I/2-B+F/2;k.setAttributes({x:t})}}if(N&&1!==H){const t=w-b[1]-b[3],e=0===H?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),k){const t=e+F/2;k.setAttributes({x:t})}}if(V&&-1!==H){const t=w-b[1]-b[3],e=0===H?t/2+B/2:t;if(W(e,"right"),k){const t=e-I-B+F/2;k.setAttributes({x:t})}}"middle"===j?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===j?(M-=T,k&&k.setAttribute("y",-L/2),S.setAttribute("y",-b[2])):"top"===j&&(S.setAttribute("y",b[0]),k&&k.setAttribute("y",L/2)),E(null==m?void 0:m.text)||(O.states=m.text);const{visible:U}=a,Y=ZM(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:T,x:A,y:M}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new Nl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},JM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}JM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const QM={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}},tw={poptip:z({},QM)};var ew=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nk?q=k:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Gt(Ut(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Gt(Ut(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ft/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ft/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ft,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}lw.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};var hw=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let cw=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,lw.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new lw(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,tw.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};cw=hw([$a()],cw);var dw=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class uw{constructor(){this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let pw=class extends uw{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};pw=dw([$a()],pw);let gw=class extends uw{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};gw=dw([$a()],gw);const fw=new La(((t,e,i,s)=>{i(cw)||(t(cw).toSelf().inSingletonScope(),t(hg).toService(cw)),i(pw)||(t(pw).toSelf(),t(Qv).toService(pw)),i(gw)||(t(gw).toSelf(),t(Qv).toService(gw))}));class mw extends hb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}XA(),ZA();class vw extends mw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vw.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}vw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},XA(),sM();class _w extends mw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},_w.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}_w.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},XA(),jA();class yw extends mw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yw.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ne.distancePP(t,e);this.setAttribute("radius",i)}}yw.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},XA(),jA();class bw extends mw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},bw.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=pM,endAngle:s=gM}=this.attribute,n=s-i,r=ae(ce(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}bw.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},XA(),QA();class xw extends mw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},xw.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=le(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ne.distancePP(t,e);this.setAttribute("radius",i)}}function Sw(){XA(),ZA(),eM(),hM()}function kw(){XA(),ZA(),jA(),hM()}xw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Sw();class Aw extends hb{getStartAngle(){return de(this._startAngle)}getEndAngle(){return de(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Aw.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(Z(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=df.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),E(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=df.line;G(i)[0].cornerRadius&&(t=df.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=df.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:Z(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}Aw.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}}},kw();class Mw extends Aw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Aw.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=df.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),E(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var ww,Tw;!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.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(ww||(ww={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Tw||(Tw={}));const Cw={[Tw.selectedReverse]:{},[Tw.selected]:{},[Tw.hover]:{},[Tw.hoverReverse]:{}},Bw={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},Ew={size:8,stroke:"#000",lineWidth:1,zIndex:1};const Pw=Math.sin(Math.PI/10);function Rw(t,e=Pw){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function Ow(t,e=Pw){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function Iw(t){const e={};return TM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function Lw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Dw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return zM(r,(s?-1:1)*(n?-1:1)*t/jM(r))}function Fw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function jw(t,e,i){var s;if(Ow(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>De(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>De(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>Fe(n,r)}function Hw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!E(s.states)?(s.addState(mM.hover,!0),TM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(mM.hoverReverse,!0)})),s):i},Nw=(t,e,i)=>i?(TM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(mM.hoverReverse),t.removeState(mM.hover))})),null):i,Ww=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(mM.selected)?(TM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(mM.selectedReverse),t.removeState(mM.selected))})),null):s.name&&!E(s.states)?(s.addState(mM.selected,!0),TM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(mM.selectedReverse,!0)})),s):i};class Uw extends hb{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=p(e)?e:{};this._animationConfig={enter:!1!==i&&z({},t,r,null!=i?i:{}),exit:!1!==s&&z({},t,r,null!=s?s:{}),update:!1!==n&&(_(n)?n:z({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const Gw={type:"default",duration:300,easing:"linear"};class Yw extends Uw{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Vw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Nw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Ww(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=df.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prepare(),this._prevInnerView=this._innerView&&Iw(this._innerView),this.removeAllChild(!0),this._innerView=df.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(Gw)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=df.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=ww.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=df.group({x:0,y:0,pickable:!1});t.name=ww.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=df.group({x:0,y:0,pickable:!1});i.name=ww.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=df.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=ww.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=vM;else{const t=this.data[s],e=z({},vM,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=df.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=ww.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=vM;else{const i=z({},vM,s.state);Object.keys(i).forEach((s=>{c(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=df.group({x:0,y:0,pickable:!1});return r.name=`${ww.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=GM(this._getLabelAttribute(t,e,n,i));if(a.name=ww.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=vM;else{const s=z({},vM,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new JM(Object.assign({},e));i.name=ww.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return Lw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&c(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=Ft/2*(l.x>e.x?1:-1):h=Ft/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+P(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+P(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=c(_)?z({},Bw.label.style,_(t,e,i,s)):_;_=z(this.getLabelAlign(m,o,_.angle),_),c(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return c(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=d?d:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},TM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&N(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Xw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&jw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function $w(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function Kw(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=c(n)?n:Xw[n]||Xw.parity;if(s.length>=3&&Hw(s,r)){do{s=a(s,r)}while(s.length>=3&&Hw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);jw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),Kw(l,s,n,(t=>jw(t,l,r))),Kw(h,s,o,(t=>jw(t,h,r)||!(!n||t===l)&&jw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function Zw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},tT(t,e.attribute.angle)),{angle:Qw(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({},eT(t,e.attribute.angle)),{angle:Qw(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Ae({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function Qw(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function tT(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Qw(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function eT(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=Qw(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function iT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(E(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=Ow(h),m=Rw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function sT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class nT{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=jM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return zM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class rT{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-rT.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*rT.bounceIn(2*t):.5*rT.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ht/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ht*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ht/e)*.5+1}}static registerFunc(t,e){rT[t]=e}}function aT(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}rT.quadIn=rT.getPowIn(2),rT.quadOut=rT.getPowOut(2),rT.quadInOut=rT.getPowInOut(2),rT.cubicIn=rT.getPowIn(3),rT.cubicOut=rT.getPowOut(3),rT.cubicInOut=rT.getPowInOut(3),rT.quartIn=rT.getPowIn(4),rT.quartOut=rT.getPowOut(4),rT.quartInOut=rT.getPowInOut(4),rT.quintIn=rT.getPowIn(5),rT.quintOut=rT.getPowOut(5),rT.quintInOut=rT.getPowInOut(5),rT.backIn=rT.getBackIn(1.7),rT.backOut=rT.getBackOut(1.7),rT.backInOut=rT.getBackInOut(1.7),rT.elasticIn=rT.getElasticIn(1,.3),rT.elasticOut=rT.getElasticOut(1,.3),rT.elasticInOut=rT.getElasticInOut(1,.3*1.5),rT.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),rT.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},rT.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)rT[`flicker${t}`]=e=>aT(e,t);for(let t=2;t<10;t++)rT[`aIn${t}`]=e=>t*e*e+(1-t)*e;function oT(t,e,i){return t+(e-t)*i}const lT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=oT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=oT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=oT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=oT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=oT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=oT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=oT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=oT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=oT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=dp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?pp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=dp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?pp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=oT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=oT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=oT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=oT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=oT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=oT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=oT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=oT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=oT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=oT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=oT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=oT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=oT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=oT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=oT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=oT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=td(e,i,s),r.addUpdateBoundTag()}}};function hT(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=rT[s])&&void 0!==n?n:rT.linear:rT.linear,"wait"===t&&(this.onUpdate=cT),this.id=Ia.GenAutoIncrementId(),this.syncAttributeUpdate=cT}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=hp.Get(i,lp.Color255),r=hp.Get(s,lp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(lT["fill"===e?"fillPure":"strokePure"])}else lT[e]?t.push(lT[e]):t.push(hT)}else lT[e]?t.push(lT[e]):t.push(hT)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class uT extends dT{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class pT extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Ia.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Oo.END?this.removeAnimate(t,!0):t.status!==Oo.RUNNING&&t.status!==Oo.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const gT=new pT;gT.isGlobal=!0;class fT{constructor(t=Ia.GenAutoIncrementId(),e=gT,i){this.id=t,this.status=Oo.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new dT(Ro.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new uT(Ro.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new dT(Ro.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Oo.RUNNING&&(this.status=Oo.PAUSED)}resume(){this.status===Oo.PAUSED&&(this.status=Oo.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Oo.END&&this.onEnd(),this.status=Oo.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Oo.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Oo.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Oo.END);this.status=Oo.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const mT=new ko;class vT{constructor(){this.released=!1}tick(t,e){mT.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class _T extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Po.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Po.INITIAL,xo.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),xo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new vT;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Po.INITIAL&&(this.status=Po.PAUSE,!0)}resume(){return this.status!==Po.INITIAL&&(this.status=Po.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Po.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Po.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Po.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Po.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Po.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Po.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,xo.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function ST(t){if(!t||!c(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}xT.getInstance();class kT{static registerBuiltInAnimate(t,e){kT.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:kT.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=ST(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:kT.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=ST(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:k,priority:A=0,options:M,custom:w,customType:T,controlOptions:C}=t,B=e.animate();B.priority=A;const E=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),B.startAt(b);const O=i*x+E;O>0&&B.wait(O);let I=null,L=t.to,D=t.from;L||(I||(I=this.createPropsFromChannel(g,e)),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e)),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,w,T,D,L,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=c(_)?_(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&B.wait(F),S&&S>0&&B.loop(S),k&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,_,y,b;if(e&&i){i=ST(e);let d=this.resolveValue(o,u);"function"==typeof d&&(d=d(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),d=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},d);const x=c(h)?h.call(null,null!==(_=d&&(null===(v=d.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,d):h;d.options=x,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:kT.builtInAnimateMap[r],f=t.custom?t.customType:ST(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Oo.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}kT.builtInAnimateMap={};const AT="appear",MT="disappear",wT="update",TT="highlight",CT="unhighlight";class BT{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class ET{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=xT.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new kT(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new kT(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([AT],[{name:AT,animation:t}],e)}applyDisappearState(t,e){this.applyState([MT],[{name:MT,animation:t}],e)}applyUpdateState(t,e){this.applyState([wT],[{name:wT,animation:t}],e)}applyHighlightState(t,e){this.applyState([TT],[{name:TT,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([CT],[{name:CT,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class PT{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new ET(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new BT(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new PT)._getAnimationStateManager(t),t}}class RT{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new fT(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:gT,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new pT}createTicker(t){return new _T(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new kT(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function OT(){U(Cp,PT),U(Cp,RT)}class IT extends dT{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class LT extends IT{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class DT extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Oo.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class FT{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new kT(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function zT(t){return new FT(t)}class jT extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const HT=1e3,VT="quadInOut",NT=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],WT=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=dp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},UT=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?cy(t):[],n=cy(e);i&&s&&(i.fromTransform&&dy(s,i.fromTransform.clone().getInverse()),dy(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},YT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],XT=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!YT.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?hp.Get(t,lp.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class $T extends IT{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;UT(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&WT(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const KT=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=GT(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=XT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new $T({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:HT,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:VT);return c.play(d),c};class qT extends IT{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;UT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&WT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const ZT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>NT.includes(t))(i)||(e[i]=t[i])})),e},JT=(t,e,i)=>{const s=ZT(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=xo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},QT=(t,e,i)=>{const s=[],n=i?null:ZT(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:ZT(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Pg(t.attribute),n=py(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(xo.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=py(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(xo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=py(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(xo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return gy(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return gy(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(xo.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:fy(i)}];const s=[];return vy(i,e,s),s})(t,e).forEach((t=>{s.push(xo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return vy(l,e,h),h})(t,e).forEach((t=>{s.push(xo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=cy(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(xo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(xo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&JT(t,s,e),s};class eC extends IT{constructor(t,e,i,s,n){super(null,{},i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){super.onBind(),this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:$o.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:$o.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:$o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class iC extends eC{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let k=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(k=x,A="out"===b?x+2*Math.PI:x);const M=xo.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:k,endAngle:A,fill:!0});let w,T;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},T={startAngle:x}):(w={endAngle:x},T={endAngle:x+2*Math.PI}),super("in"===b?w:T,"in"===b?T:w,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class sC extends eC{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=xo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class nC extends IT{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=mt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new se(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=Qc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class oC extends rC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class lC extends aC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class hC extends rC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class cC extends aC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const dC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class uC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class pC extends uC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=dC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class gC extends uC{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class fC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class mC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const vC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class _C extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const bC=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class xC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>Qc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class SC extends xC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:bC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class kC extends xC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:bC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const AC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class MC extends xC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:AC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class wC extends xC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:AC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const TC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class CC extends xC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:TC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class BC extends xC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:TC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const EC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class PC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class RC extends PC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=EC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class OC extends PC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const IC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class LC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=IC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class DC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class FC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c;let d,u;super.onBind();const p=this.target.getFinalAttribute(),g=null!==(t=this.target.attribute)&&void 0!==t?t:{};switch(null===(e=this.params)||void 0===e?void 0:e.direction){case"x":d={scaleX:null!==(i=g.scaleX)&&void 0!==i?i:0},u={scaleX:null!==(s=null==p?void 0:p.scaleX)&&void 0!==s?s:1},this._updateFunction=this.updateX;break;case"y":d={scaleY:null!==(n=g.scaleY)&&void 0!==n?n:0},u={scaleY:null!==(r=null==p?void 0:p.scaleY)&&void 0!==r?r:1},this._updateFunction=this.updateY;break;default:d={scaleX:null!==(a=g.scaleX)&&void 0!==a?a:0,scaleY:null!==(o=g.scaleY)&&void 0!==o?o:0},u={scaleX:null!==(l=null==p?void 0:p.scaleX)&&void 0!==l?l:1,scaleY:null!==(h=null==p?void 0:p.scaleY)&&void 0!==h?h:1},this._updateFunction=this.updateXY}const f=this.target.getFinalAttribute();f&&this.target.setAttributes(f),this.props=u,this.from=d,this.to=u,!1!==(null===(c=this.params.controlOptions)||void 0===c?void 0:c.immediatelyApply)&&this.target.setAttributes(d)}onEnd(t){super.onEnd(t)}updateX(t){this.target.attribute.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t}updateY(t){this.target.attribute.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t}updateXY(t){this.updateX(t),this.updateY(t)}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:"scaleX"===this.propKeys[0]?this._updateFunction=this.updateX:"scaleY"===this.propKeys[0]?this._updateFunction=this.updateY:this._updateFunction=null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class zC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class jC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class HC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e;super.onBind();let{diffAttrs:i={}}=null!==(t=this.target.context)&&void 0!==t?t:{};const{options:s}=this.params;i=Object.assign({},i),(null===(e=null==s?void 0:s.excludeChannels)||void 0===e?void 0:e.length)&&s.excludeChannels.forEach((t=>{delete i[t]})),this.props=i}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i)}}class VC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class NC extends VC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),_=t.getGraphicAttribute("y"),y=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?_:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:y},to:{x:v}};case"y":return{from:{y:b},to:{y:_}};default:return{from:{x:y,y:b},to:{x:v,y:_}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class WC extends VC{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,_=v&&k(v.x)?v.x:f,y=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:_}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:y}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:_,y:y}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class UC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class GC extends UC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=ut(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class YC extends UC{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=ut(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class XC extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}onBind(){var t,e;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))}));const i=this.target.getFinalAttribute();"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&i&&this.target.setAttributes(i),!1!==(null===(e=this.params.controlOptions)||void 0===e?void 0:e.immediatelyApply)&&this.target.setAttributes(this.from)}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.target.setAttributes(this.from)}deleteSelfAttr(t){super.deleteSelfAttr(t),delete this.from[t]}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.from,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.from[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class $C extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=xo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Nl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=xo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:$o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:$o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=ll(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=ll(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=df.group({zIndex:999});e.name=ww.axisBreak,e.id=this._getNodeId(`${ww.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},Ew,s),a=null!==(e=r.size)&&void 0!==e?e:Ew.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=df.symbol(Object.assign({x:s.x,y:s.y},o));l.name=ww.axisBreakSymbol;const h=df.symbol(Object.assign({x:n.x,y:n.y},o));h.name=ww.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=df.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=ww.background,n.id=this._getNodeId("background"),n.states=z({},Cw,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new JM(Object.assign({},t));e.name=ww.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=JC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:z({},Cw,l),symbol:z({},Cw,l)});const d=new Aw(c);d.name=ww.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return ut(t[0],0)?ut(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=s,p=JC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+P(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let w,T,{angle:C}=p;if(w="start"===n?"start":"end"===n?"end":"center",d(C)&&o){C=HM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else w=this.getTextAlign(M),T=this.getTextBaseline(M,!1);let B=u;if(d(B)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(C!==Math.PI/2){const t=Math.abs(Math.cos(null!=C?C:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=s-S;else if(C&&0!==C){const t=Math.abs(Math.sin(C));B=t<1e-6?1/0:this.attribute.end.y/t}else B=s-S}const E=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:B,textStyle:Object.assign({textAlign:w,textBaseline:T},a),state:{text:z({},Cw,c.text),shape:z({},Cw,c.shape),panel:z({},Cw,c.background)}});return E.angle=C,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=s,p=JC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(d(b)&&a){b=HM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=u,k=h?h(c):c,A=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:k});return A.angle=b,l&&l.visible&&(A.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),A}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return ut(t[1],0)?i=!ut(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return tT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return eT(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=Y(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(E(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=re(e)})),Jw(i,t),!Zw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!k(i))return;const a=t[0].attribute.angle,o=Ow(a),l=Rw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=sT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Gt(c,i))}}else{if(l){const i=sT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Gt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);iT(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&qw(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=df.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=ww.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=NM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ni(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}QC.defaultAttributes=Bw,U(QC,nT);class tB{isInValidValue(t){const{startAngle:e=pM,endAngle:i=gM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=pM,endAngle:i=gM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return le(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return Dw(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function eB(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=eB(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var nB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=Fw(n,l,c,e,i);h=df.path(Object.assign(Object.assign({},a.style),{path:zw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=df.circle(t)}h.name=ww.line,h.id=this._getNodeId("line"),E(a.state)||(h.states=z({},Cw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:u={}}=a,p=nB(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=P(this.attribute.label,"style.fontSize",12)+P(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let _="middle",{position:y}=this.attribute.title;d(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},Cw,u.text),shape:z({},Cw,u.shape),panel:z({},Cw,u.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(ut(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=eB(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&iB(e,c,i)}else e.AABBBounds.width()>r&&iB(e,r,i)}else o>a.x&&h.x2>n.x2?(iB(e,n.x2-o,i),r&&sB(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return ut(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}rB.defaultAttributes=Bw,U(rB,tB);const aB=t=>t.map(((t,e)=>({index:e,value:t}))),oB=(t,e,i=0)=>{const s=new He(t).expand(i/2),n=new He(e).expand(i/2);return s.intersects(n)},lB=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=re(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=VM(a),_=t.range();let y=[];for(let i=0;i{dB[t]=!0}));const mB=t=>-Math.log(-t),vB=t=>-Math.exp(-t),_B=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,yB=t=>10===t?_B:t===Math.E?Math.exp:e=>Math.pow(t,e),bB=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),xB=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),SB=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function kB(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 AB(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function MB(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function wB(t,e,i,s){return 1===i&&(i=0),MB(t,i,s)*(e/(1-i))}function TB(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function CB(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class EB{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=TB(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=mt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const PB=Symbol("implicit");class RB extends EB{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=cB.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=PB}clone(){const t=(new RB).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==PB)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return OB(t,e,r,n)}class LB extends RB{constructor(t){super(),this.type=cB.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=wB(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[tt(t[0]),tt(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[tt(t[0]),tt(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:IB(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return IB(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=_t(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&x(this._userBandwidth)}clone(){var t,e,i;return new LB(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:DB}=si;function FB(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return St(t,e);if("string"===i){if(s=ti.parseColorString(e)){const e=DB(ti.parseColorString(t),s);return t=>e(t).formatRgb()}return St(Number(t),Number(e))}return e instanceof ei?DB(t,e):e instanceof ti?DB(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):St(Number(t),Number(e))}class zB extends EB{constructor(t=fB,e=fB){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=fB,this._piecewise=AB,this._interpolate=FB}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),St)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,tt);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=_t(i[0],i[r-1])),this._piecewise=r>2?CB:AB,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:fB),this.rescale(i)):this._clamp!==fB}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const jB=Math.sqrt(50),HB=Math.sqrt(10),VB=Math.sqrt(2),NB=[1,2,5,10],WB=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=XB(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),J(0,e).map((t=>n+t*s))):t>0?GB(0,-(e-1)/s,s):GB((e-1)/s,0,s)},UB=ft(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return WB(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return WB(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=GB(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=GB(t,e,l);return n&&r.reverse(),r})),XB=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=NB[0];return i>=jB?s=NB[3]:i>=HB?s=NB[2]:i>=VB&&(s=NB[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function $B(t,e,i){const s=(e-t)/Math.max(0,i);return XB(s)}function KB(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=$B(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function ZB(t,e){const i=x(e.forceMin),s=x(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const JB=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),QB=ft(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),tE=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=YB(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?JB(t,e,n):JB(t,e,BB(n)),h=JB(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),eE=ft(((t,e,i,s,n)=>KB(s(t),s(e),i).map((t=>BB(n(t))))));class iE extends zB{constructor(){super(...arguments),this.type=cB.Linear}clone(){var t;const e=new iE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return UB(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=YB(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return KB(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function nE(t){return e=>-t(-e)}function rE(t=Number.EPSILON){return e=>Math.max(e,t)}class aE extends zB{constructor(){super(bB(10),yB(10)),this.type=cB.Log,this._limit=rE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new aE).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=bB(this._base),s=yB(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=nE(i),this._pows=nE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=mB,this.untransformer=vB):(this._logs=i,this._pows=s,this._limit=rE(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return fB}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return QB(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return tE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return eE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return eE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(aE,sE);class oE extends iE{constructor(){super(xB(1),SB(1)),this.type=cB.Symlog,this._const=1}clone(){return(new oE).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=xB(t),this.untransformer=SB(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return QB(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return tE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return eE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return eE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(oE,sE);class lE{constructor(){this.type=cB.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!d(t)&&k(+t)?this._range[at(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new lE).domain(this._domain).range(this._range).unknown(this._unknown)}}function hE(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function cE(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!uB(t.type))return aB(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return aB([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(u(h))m=hE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=hE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=hE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=hB(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=hB(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?uE.greedy:uE.parity;for(;l.length>=3&&Hw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;jw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),cE(t,l,a,(e=>jw(e,t,i))),cE(n,l,o,(e=>jw(e,n,i)||!(!a||e===t)&&jw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return aB(m)},uE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&jw(i,t,e)||(i=t,0))))}},pE=(t,e,i,s)=>{const n=hB(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},gE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,fE=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?aB([s[s.length-1]]):aB([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(g),a=X(g);if(s.length<=f/n){const i=pE(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=vE(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=pE(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!gE(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?fE(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=VM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=le({x:0,y:0},i,t),a=Lw(r,Dw(s,r,e,n));return o=a,l=Dw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(ut(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return aB(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=_E(t,i,e),r=$(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=bE(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return aB(d)},bE=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&oB(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},xE=new Uint32Array(33),SE=new Uint32Array(33);SE[0]=0,xE[0]=~SE[0];for(let t=1;t<=32;++t)SE[t]=SE[t-1]<<1|1,xE[t]=~SE[t];function kE(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&xE[31&o]&SE[1+(31&l)])return!0}else{if(i[h]&xE[31&o])return!0;if(i[c]&SE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,xE[31&o]&SE[1+(31&l)]);else for(s(h,xE[31&o]),s(c,SE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,SE[31&a]|xE[1+(31&o)]);else for(n(l,SE[31&a]),n(h,xE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function AE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=mt(i,-o,t.width+l),d=mt(s,-o,t.width+l),u=mt(n,-a,t.height+h),p=mt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function ME(t,e,i=!1){return i?AE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function wE(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=ME(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=AE(t,r)),e.getRange(r)))}function TE(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>u(t))),p=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return TE(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return TE(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return TE(t,e,n,s,h,d)}return!1}const BE=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],EE=["top","inside-top","inside"];function PE(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const RE={mode:"same-time",duration:300,easing:"linear"};function OE(t){return 3===t||4===t}function IE(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const LE=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function DE(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}var FE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const HE=(t,e)=>Math.ceil(t)>Math.floor(e),VE=([t,e],[i,s])=>s>t&&e>i;function NE(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var WE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(mM.hover,!0),TM(this,(t=>{t===e||E(t.states)||t.addState(mM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(TM(this,(t=>{E(t.states)||(t.removeState(mM.hoverReverse),t.removeState(mM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void TM(this,(t=>{E(t.states)||(t.removeState(mM.selectedReverse),t.removeState(mM.selected))}));E(e.states)||(e.addState(mM.selected,!0),TM(this,(t=>{t===e||E(t.states)||t.addState(mM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===$o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===$o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(xe(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[DE(g,f,c,d,a,o),DE(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=df.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Nl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(c(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=c(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],u=o;if(!h(e)&&c(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?u.push(i):l.push(i)}))}c(r)?o=r(u,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(u).concat(l)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return GM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=c(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&HE(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&HE(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(ut(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(NE([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!VE([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(ME(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{v(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(ME(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(ME(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{GE[t]=e};var XE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}$E.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const KE=()=>{YE("symbol",$E),YE("line-data",$E)};var qE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}ZE.tag="rect-label",ZE.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var JE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};QE.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const tP=()=>{YE("line",QE),YE("area",QE)};var eP=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=pe(h.endAngle-d/2),g=le(c,h.outerRadius,o),f=le(c,a+e.line.line1MinLength,o),m=new iP(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=le(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):OE(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=le(t.circleCenter,v,t.middleAngle),t.labelLimit=f,pt(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=OE(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=OE(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(gt(t.pointB.x,this._line2MinLength+h)||pt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=OE(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?d(h)||"auto"===h?"edge"===c?OE(t.quadrant)?"left":"right":OE(t.quadrant)?"right":"left":h:d(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(OE(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(ut(l/2,u))g=0,f=1,m=-p;else if(ut(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?ut(v[0].y,v[1].y)?pt(t.middleAngle,-Math.PI)&>(t.middleAngle,0)||pt(t.middleAngle,Math.PI)&>(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function aP(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ne.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function oP(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=zw(t,!!n),o=zw(r,!!n);const h=ne.distancePP(s,l),c=ne.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=aP(e,t,!1,!!n),o=aP(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=zw(t,!!n),o=zw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}rP.defaultAttributes={pickable:!1};class lP extends hb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&Iw(this._innerView),this.removeAllChild(!0),this._innerView=df.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return Lw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${ww.grid}-sub`:`${ww.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=zw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=aP(t,o,!1,!!a)}const u=df.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:lP.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=zw(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),_=df.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ft/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:lP.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!ut(a.value,0)&&!ut(l.value,0),d=!ut(a.value,1)&&!ut(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}lP.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},XA(),QA();class hP extends lP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lP.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=pM,endAngle:r=gM}=this.attribute;i=Fw(t,s,ne.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(hP,nT);var cP,dP,uP,pP=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(gP,tB),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(cP||(cP={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(dP||(dP={})),function(t){t.dataZoomChange="dataZoomChange"}(uP||(uP={}));const fP="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",mP={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:fP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:fP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},vP={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}},_P=0,yP=1,bP=2,xP=3,SP=4,kP=5,AP=5,MP=999,wP=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var TP=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:bP},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:bP},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:_P},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w;const{orient:T,middleHandlerStyle:C={},startHandlerStyle:B={},endHandlerStyle:E={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=B.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=E.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t,zIndex:kP},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:kP},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=B.symbolType)&&void 0!==c?c:"square"},vP.horizontal),{zIndex:kP}),B),{pickable:!P&&(null===(d=B.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=E.symbolType)&&void 0!==u?u:"square"},vP.horizontal),{zIndex:kP}),E),{pickable:!P&&(null===(p=E.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:MP},vP.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:MP},vP.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===T?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D,zIndex:kP},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===T?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:kP},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(k=B.symbolType)&&void 0!==k?k:"square"},vP.vertical),{zIndex:kP}),B),{pickable:!P&&(null===(A=B.pickable)||void 0===A||A)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(M=E.symbolType)&&void 0!==M?M:"square",zIndex:kP},vP.vertical),E),{pickable:!P&&(null===(w=E.pickable)||void 0===w||w)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:MP},vP.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:MP},vP.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:xP},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:xP},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:yP},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:SP},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new je).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=TP(c,["formatMethod"]),{formatMethod:g}=d,f=TP(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,k={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let A,M,w,T;this._isHorizontal?(A={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},w={textAlign:wP(k,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},T={textAlign:wP(k,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:wP(k,t,"start",this._isHorizontal)?"top":"bottom"},T={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:wP(k,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),z({},p,{text:x,x:A.x,y:A.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:AP}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),z({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:AP}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new JM(e),s.name=i,t.add(s)),s}}const BP={debounce:bt,throttle:xt};class EP extends o{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=cP.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=cP.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=cP.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=cP.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=cP.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===O_.env?O_:this.stage,s=bM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===cP.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===cP.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===cP.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===cP.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(dP.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(dP.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(dP.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===cP.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(dP.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(dP.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:BP[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===O_.env?O_:this.stage,e=bM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===O_.env?O_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===O_.env?O_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:mt(e+t,0,1),end:mt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=cP.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}qM(),sM(),hM(),VA(),ZA();let PP=class t extends hb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new CP(this._getRendererAttrs()),this._interaction=new EP(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(dP.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(dP.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(uP.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(dP.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;u(t)&&u(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(uP.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...G(a))}setPreviewPointsX(t){c(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._renderer.statePointToData=t)}};var RP,OP,IP,LP;function DP(){XA(),qM(),OT()}PP.defaultAttributes=mP,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(RP||(RP={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(OP||(OP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(IP||(IP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(LP||(LP={}));class FP extends hb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Vw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Nw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Ww(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=df.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=df.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=df.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function zP(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function jP(t,e,i,s){t&&(zP(t.startSymbol,e,i,s),t.lines.forEach((t=>zP(t,e,i,s))),zP(t.line,e,i,s),zP(t.endSymbol,e,i,s))}function HP(t,e,i,s){t&&(zP(t.getTextShape(),e,i,s),zP(t.getBgRect(),e,i,s))}function VP(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function NP(t,e,i,s){t&&(VP(t.startSymbol,e,i,s),t.lines.forEach((t=>VP(t,e,i,s))),VP(t.line,e,i,s),VP(t.endSymbol,e,i,s))}function WP(t,e,i,s){t&&(VP(t.getTextShape(),e,i,s),VP(t.getBgRect(),e,i,s))}function UP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;zP(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),zP(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;zP(t.getTextShape(),e,l,n),zP(t.getBgRect(),e,l,n)}))}function GP(t,e,i,s,n){jP(t,s,i,n),G(e).forEach((t=>{HP(t,s,i,n)}))}function YP(t,e,i,s,n){zP(t,s,i,n),G(e).forEach((t=>{HP(t,s,i,n)}))}function XP(t,e,i,s,n){zP(t,s,i,n),G(e).forEach((t=>{HP(t,s,i,n)}))}function $P(t,e,i,s,n,r){var a;jP(t,n,s,r),zP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?HP(i,n,s,r):zP(i,n,s,r)}function KP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;zP(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),zP(e,n+o+l,h,r),zP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(zP(i.getTextShape(),n+o+l+h+c,d,r),zP(i.getBgRect(),n+o+l+c,d,r)):zP(i,n+o+l+c,d,r)}function qP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?UP(t,e,s,r,a):"fadeIn"===i&&GP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?UP(t,e,s,n,a):"fadeIn"===i&&GP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){NP(t,s,i,n),G(e).forEach((t=>{WP(t,s,i,n)}))}(t,e,i,s,n)}}function ZP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&YP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&YP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){VP(t,s,i,n),G(e).forEach((t=>{WP(t,s,i,n)}))}(t,e,i,s,n)}}function JP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&XP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&XP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){VP(t,s,i,n),G(e).forEach((t=>{WP(t,s,i,n)}))}(t,e,i,s,n)}}function QP(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?$P(n,r,e,i,s,o):"callIn"===t&&KP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?$P(n,r,e,i,s,a):"callIn"===t&&KP(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;NP(t,n,s,r),VP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?WP(i,n,s,r):VP(i,n,s,r)}(n,r,e,t,i,s)}}const tR={type:"clipIn",duration:500,easing:"linear",delay:0},eR={type:"fadeIn",duration:500,easing:"linear",delay:0},iR={type:"callIn",duration:500,easing:"linear",delay:0},sR={type:"fadeOut",duration:500,easing:"linear",delay:0};class nR{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new JM(Object.assign(Object.assign({},h),{state:{panel:z({},vM,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},vM,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},vM,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},vM,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class rR extends FP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=tR,this.defaultExitAnimation=sR}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;KM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U(rR,nR);const aR=.001,oR={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:RP.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]}},lR={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},hR={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:IP.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},cR={interactive:!0,label:{position:OP.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}},dR={interactive:!0,label:{autoRotate:!0,position:IP.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},uR={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},pR={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},gR={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function fR(){mR._animate=qP}DP(),Sw(),OT();class mR extends rR{markerAnimate(t){mR._animate&&this._animationConfig&&mR._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mR.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(BM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return EM(Math.abs(e),Math.PI/2,aR)||EM(Math.abs(e),3*Math.PI/2,aR)?PM(i,e,t):BM(e)?lR.postiveXAxis[t]:lR.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new Aw({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},vM,null==a?void 0:a.line),startSymbol:z({},vM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},vM,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},vM,null==a?void 0:a.line),startSymbol:z({},vM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},vM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",mR.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(mR.defaultAttributes.label)}}function vR(){_R._animate=ZP}mR.defaultAttributes=oR,DP(),eM(),OT();class _R extends FP{markerAnimate(t){_R._animate&&this._animationConfig&&_R._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},_R.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=eR,this.defaultExitAnimation=sR}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},pR[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;KM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=df.polygon(Object.assign({points:e},i));n.states=z({},vM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",_R.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},vM,null==i?void 0:i.area)),this._updateMarkLabels(_R.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}_R.defaultAttributes=cR,U(_R,nR),DP(),kw(),OT();class yR extends rR{markerAnimate(t){yR._animate&&this._animationConfig&&yR._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yR.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case IP.arcInnerStart:l=n;case IP.arcOuterStart:l=n;break;case IP.arcInnerEnd:l=r;case IP.arcOuterEnd:l=r;break;case IP.center:case IP.arcInnerMiddle:case IP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return uR[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new Mw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},vM,null==o?void 0:o.line),startSymbol:z({},vM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},vM,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},vM,null==o?void 0:o.line),startSymbol:z({},vM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},vM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",yR.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(yR.defaultAttributes.label)}}yR.defaultAttributes=hR,DP(),jA(),OT();class bR extends FP{markerAnimate(t){bR._animate&&this._animationConfig&&bR._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},bR.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=eR,this.defaultExitAnimation=sR}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case IP.center:h=(s+n)/2,c=(r+a)/2;break;case IP.arcInnerStart:h=s,c=r;break;case IP.arcOuterStart:h=n,c=r;break;case IP.arcInnerEnd:h=s,c=a;break;case IP.arcOuterEnd:h=n,c=a;break;case IP.arcInnerMiddle:h=s,c=(r+a)/2;break;case IP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},uR[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;KM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=df.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},vM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",bR.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},vM,null==o?void 0:o.area)),this._updateMarkLabels(bR.defaultAttributes.label)}isValidPoints(){return!0}}function xR(){SR._animate=QP}bR.defaultAttributes=dR,U(bR,nR),DP(),Sw(),kw(),hM(),KA(),ZA(),OT();class SR extends FP{markerAnimate(t){SR._animate&&this._animationConfig&&SR._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},SR.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=iR,this.defaultExitAnimation=sR,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return EM(Math.abs(s),Math.PI/2,aR)||EM(Math.abs(s),3*Math.PI/2,aR)?PM(t,s,n):BM(s)?gR.postiveXAxis[n]:gR.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=LP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},vM,null==p?void 0:p.textBackground),text:z({},vM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},vM,null==p?void 0:p.itemContent));const v=BM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=df.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},vM,null==s?void 0:s.itemContent)):"text"===n?o=new JM(Object.assign(Object.assign({},i),{state:{panel:z({},vM,null==s?void 0:s.textBackground),text:z({},vM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=df.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},vM,null==s?void 0:s.itemContent)):"image"===n?(o=df.image(Object.assign(Object.assign({},i),r)),o.states=z({},vM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},vM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=EM(c,0,aR)||EM(d,0,aR),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=XM(e-u,t-d),o=XM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(PR.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(PR.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===PR.focus||"focus"===o){const s=a.hasState(BR.focus);a.toggleState(BR.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[BR.unSelected,BR.unSelectedHover,BR.focus],t),this._setLegendItemState(e,BR.selected,t)})):(this._setLegendItemState(a,BR.selected,t),this._removeLegendItemState(a,[BR.unSelected,BR.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[BR.selected,BR.selectedHover,BR.focus],t),this._setLegendItemState(e,BR.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(BR.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(BR.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(ER.legendItemClick,a,t);i?(this._removeLegendItemState(a,[BR.selected,BR.selectedHover],t),this._setLegendItemState(a,BR.unSelected,t)):(this._setLegendItemState(a,BR.selected,t),this._removeLegendItemState(a,[BR.unSelected,BR.unSelectedHover],t))}else this._setLegendItemState(a,BR.selected,t),this._removeLegendItemState(a,[BR.unSelected,BR.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[BR.selected,BR.selectedHover],t),this._setLegendItemState(e,BR.unSelected,t))}))}this._dispatchLegendEvent(ER.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,BR.selected),this._removeLegendItemState(e,[BR.unSelected,BR.unSelectedHover])):(this._removeLegendItemState(e,[BR.selected,BR.selectedHover]),this._setLegendItemState(e,BR.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=wR,spaceRow:l=TR,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:k,pages:A}=this._itemContext,M=0,w=0;const T=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(A=Math.ceil((S+g)/s),b=A>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||T.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),A+=1,S=0,k+=w+l,w=0,T.length=0))),0===S&&0===k||i.setAttributes({x:S,y:k}),S+=o+g,w=Math.max(w,m),T.push(i)):(u(v)&&(f&&a?(A=Math.ceil((k+m)/v),b=A>1):v<=m?(A+=1,b=!0,k=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=k,this._itemContext.maxWidthInCol=x,this._itemContext.pages=A,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=A),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=df.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=$(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";p(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";p(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:p,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),k=this._handleStyle(y,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=ni(c);let T;!1===x.visible?(T=df.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,PR.item,t,T)):(T=df.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,PR.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?BR.selected:BR.unSelected);const C=df.group({x:0,y:0,pickable:!1});T.add(C);let B,E=0,R=0,O=0;if(v&&!1!==v.visible){const i=P(S,"style.size",10);R=_(i)?i[0]||0:i,O=P(v,"space",8);const s=df.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,PR.itemShape,t,T,S.state),s.addState(e?BR.selected:BR.unSelected),C.add(s)}let I=0;if(p){const e=P(g,"size",10);B=df.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,PR.focus,t,T),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=GM(Object.assign(Object.assign({x:R/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=k.style)||void 0===r?void 0:r.fontSize},k.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,PR.itemLabel,t,T,k.state),D.addState(e?BR.selected:BR.unSelected),C.add(D);const F=P(y,"space",8);if(u(l)){const s=P(b,"space",p?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=GM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:A.style.fontSize},A.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,PR.itemValue,t,T,A.state),r.addState(e?BR.selected:BR.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-R-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-R/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-R-O-I),E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);B&&(B.setAttribute("x",E),C.add(B));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=z.height(),V=u(this.attribute.item.width)?this.attribute.item.width:j+w[1]+w[3],N=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=V,T.attribute.height=N,B&&B.setAttribute("visible",!1),C.translateTo(-z.x1+w[3],-z.y1+w[0]),T}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new MR(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new MR(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new SM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new SM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",xt(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=wR,spaceRow:o=TR}=n,l=this._itemsContainer,{space:h=CR,defaultCurrent:c=1}=r,d=LR(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=df.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=wR,spaceRow:a=TR}=s,o=this._itemsContainer,{space:l=CR,defaultCurrent:h=1}=n,c=LR(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=df.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=df.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];ut(mt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),ut(mt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(BR.selected)?this._setLegendItemState(t,BR.selectedHover,e):this._setLegendItemState(t,BR.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===PR.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(ER.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(BR.unSelectedHover)||t.hasState(BR.selectedHover))&&(i=!0),t.removeState(BR.unSelectedHover),t.removeState(BR.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(BR.unSelectedHover)&&!t.hasState(BR.selectedHover)||(i=!0),t.removeState(BR.unSelectedHover),t.removeState(BR.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===PR.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(ER.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(ER.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==PR.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(ER.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==PR.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(ER.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(BR.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},DR,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(BR.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(c(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var zR;function jR(t){return _(t)?t:[t,t]}function HR(t){return t?"ew-resize":"ns-resize"}FR.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:wR,spaceRow:TR,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:CR,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"}(zR||(zR={})),OR();class VR extends hb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},VR.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=mt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=bM(),n="browser"===O_.env?O_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=mt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=bM(),n="browser"===O_.env?O_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?mt(t+p,h,c):mt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?mt(t+p,0,c-h):mt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(u(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=G(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:jR(p)[0],endValue:jR(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=df.group({x:0,y:0});f.name=zR.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=df.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=zR.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=df.group({x:g?v:0,y:g?0:v});f.add(_);const y=df.group({x:0,y:0});let b;if(y.name=zR.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=df.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=zR.endText,f.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=df.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=zR.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=jR(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":HR(p)},r));if(v.name=zR.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=zR.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":HR(p)},r));if(i.name=zR.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=zR.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=vt(h,i,s);c=t[0],u=t[1]}else c=i,u=mt(h,i,s);const g=this._isHorizontal;e||(c=i);const f=df.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=zR.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":HR(g);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(u,e?"end":"start"),b=df.rect(Object.assign({x:g?Math.min(_,y):0,y:g?0:Math.min(_,y),width:g?Math.abs(y-_):r,height:g?n:Math.abs(y-_),cursor:v},a));b.name=zR.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return df.symbol(t)}_renderHandlerText(t,e){return df.text(this._getHandlerTextAttributes(t,e))}_getHandlerPosition(t){return this.attribute.range&&t?"start":"end"}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return c(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":HR(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=df.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=df.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===O_.env?O_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=bM(),e="browser"===O_.env?O_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const n=t.name===zR.startHandler?this._startHandlerText:this._endHandlerText;if(n){const e=this._getHandlerPosition(t.name===zR.startHandler);n.setAttributes(this._getHandlerTextAttributes(i,e))}t.name===zR.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){const s=this._isHorizontal,n=this._getHandlerPosition(t.name===zR.startHandlerText);t.setAttributes(this._getHandlerTextAttributes(i,n));const r=t.name===zR.startHandlerText?this._startHandler:this._endHandler;r&&r.setAttributes({[s?"x":"y"]:e}),t.name===zR.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===O_.env?O_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}VR.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},IR(),OR();class NR extends RR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NR.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function WR(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}NR.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},IR(),OR(),QA();class UR extends RR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UR.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=df.group({x:0,y:0});this._innerView.add(x);const S=new VR({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:WR(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let k,A=0;"horizontal"===e?"top"===i?(k=`M0,0L${a},0L${b?0:a},12Z`,A=o):(k=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?k=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(k=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=df.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}UR.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}},XA(),dM(),rM();let GR=class t extends hb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y,b,x;const{textType:S,text:k,subtextType:A,textStyle:M={},subtext:w,subtextStyle:T={},width:C,height:B,minWidth:E,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=ni(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||u(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:k},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:k},_M),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(k)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(k)?k:[k],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==T.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=T,v=Math.max(Number.MIN_VALUE,O-H);if("rich"===A||u(T.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=T.character)&&void 0!==h?h:w},T);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===A){const o=Object.assign({html:Object.assign(Object.assign({dom:w},_M),T),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},T);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(w)?w:[w],whiteSpace:"normal"},T),{maxLineWidth:null!==(p=T.maxLineWidth)&&void 0!==p?p:C,heightLimit:null!==(g=T.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(V,W),G=H+(null!==(f=T.height)&&void 0!==f?f:N);if(u(C)&&(U=C),u(B)&&(G=B),u(E)&&UP&&(U=P),u(R)&&GO&&(G=O),z.attribute.width=U,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(m=M.width)&&void 0!==m?m:U;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(T.align)){const t=T.align?T.align:I,e=null!==(y=null!==(v=T.width)&&void 0!==v?v:M.width)&&void 0!==y?y:U;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=T.verticalAlign?T.verticalAlign:L,e=this._mainTitle?u(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=T.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};GR.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 YR={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};XA(),dM(),rM();let XR=class extends hb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},P(YR,n),e.style,{visible:e.visible});a.lineHeight=u(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=GM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const p=NM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",u(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",u(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class $R extends wg{constructor(t){super(t)}}var KR,qR;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(KR||(KR={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(qR||(qR={}));class ZR extends hb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZR.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"},ZR.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"},ZR.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},ZR.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},ZR.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{d(this._playController)&&(this._playController=new $R(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new $R(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new $R(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(KR.OnPlay)},this.pause=()=>{this._dispatchEvent(KR.OnPause)},this.forward=()=>{this._dispatchEvent(KR.OnForward)},this.backward=()=>{this._dispatchEvent(KR.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}ZR.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},ZR.defaultAttributes={[qR.Start]:{},[qR.Pause]:{},[qR.Backward]:{},[qR.Forward]:{}};const JR={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},QR=[200,10];var tO,eO;!function(t){t.Default="default",t.Reverse="reverse"}(tO||(tO={})),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"}(eO||(eO={}));const iO=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===tO.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===tO.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),sO=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===tO.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===tO.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),nO=t=>"top"===t||"bottom"===t;class rO extends hb{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},rO.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Ut(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(nO(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:QR[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:QR[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new VR(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=nO(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new ZR(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=nO(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:QR[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Ut(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(nO(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Ut(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:nO(this._orient)?t+s:(this._size.width-r)/2,y:nO(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:nO(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:nO(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Ut(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:nO(this._orient)?t+s:(this._size.width-r)/2,y:nO(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function aO(){OR(),XA(),hM()}rO.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({},JR),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},JR),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},JR),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},JR),{key:"backward",position:"start"})}},aO();class oO extends rO{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:tO.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(KR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(KR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(KR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(KR.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(eO.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(iO({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||sO({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===tO.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(eO.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=O_.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(eO.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(eO.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=O_.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(),O_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(eO.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(eO.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(eO.change),this.dispatchCustomEvent(eO.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var lO,hO=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};aO();class cO extends rO{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(KR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(KR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(KR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(KR.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(eO.change))},this.play=()=>hO(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(eO.play),this._rafId=O_.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=O_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(eO.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(eO.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(eO.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(eO.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}(lO||(lO={}));const dO={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},uO=5;const pO={debounce:bt,throttle:xt};XA(),eM();let gO=class t extends hb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=dO.updateTrigger,endTrigger:i=dO.endTrigger,brushMoved:s=!0}=this.attribute;G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:pO[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(lO.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=dO.trigger,resetTrigger:e=dO.resetTrigger}=this.attribute;G(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(lO.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(lO.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=uO}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(lO.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(lO.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent(lO.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=uO}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(lO.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(lO.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=dO.updateTrigger,endTrigger:e=dO.endTrigger}=this.attribute;G(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=df.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Ee(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};gO.defaultAttributes=dO;const fO=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},mO=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:G(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},vO={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:fM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:fM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:fM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new He).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},_O=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];XA(),sM(),hM(),dM(),rM();let yO=class t extends hb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ni(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:CM(p)&&CM(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:CM(p)&&CM(p.value)},mO(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:CM(p)&&CM(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:CM(p)&&CM(p.value)},mO(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},_M),p.value),visible:CM(p)&&CM(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=CM(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const _=CM(p)?p.height+p.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!CM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let p="right"===c?(o?d:0)+(CM(n.key)?r+n.key.spacing:0)+(CM(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(YM(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:CM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),YM(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(CM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=nd(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(CM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},mO(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},mO(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},_M),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(CM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},mO(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},mO(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>_O.includes(t)))?(this._mergeAttributes(e,s),d(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&CM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=CM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=VM(d),_=VM(u);let y=0;if(CM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(CM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&lu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return fO({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return fO({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};yO.defaultAttributes=vO;const bO=ut;function xO(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function SO(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function kO(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function AO(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function MO(t,e){const i=AO(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function wO(t,e){const i=TO(t),s=TO(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function TO(t,e={x:0,y:0}){return ne.distancePP(t,e)}function CO(t){return k(t.x)&&k(t.y)}function BO(t,e,i){let s=!1;if(e&&c(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function EO(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const PO=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function OO(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&OO(t[i],e)}}var IO,LO,DO;function FO(t){var e,i;const{type:s}=t;return s===LO.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(IO||(IO={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(LO||(LO={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(DO||(DO={}));const zO={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},jO={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function HO(t,e){var i;if(!t)return[];const s=XO(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?GO(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>UO(i)?NO(t,i,e):i)).filter(u)}))):i.map((i=>UO(i)?NO(t,i,e):i)).filter(u):[]}return[]}function VO(t,e){var i,s;return GO(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function NO(t,e,i){var s;const n=XO(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=zO[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=jO[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new ti(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ge(t,i,s),a=Ue(n,r,e.l),l=new ti(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const WO=(t,e)=>{if(e&&UO(t)){const i=NO(e,t);if(i)return i}return t};function UO(t){return t&&"palette"===t.type&&!!t.key}function GO(t){return!(!_(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function YO(t){return _(t)?{dataScheme:t}:t}function XO(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=FO(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class $O extends RB{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(!GO(this._range))return void super.range(this._range);const t=VO(this._range,this._domain);super.range(t)}}const KO={linear:iE,band:LB,point:class extends LB{constructor(t){super(!1),this.type=cB.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:RB,threshold:lE,colorOrdinal:$O};function qO(t){const e=KO[t];return e?new e:null}function ZO(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function JO(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function QO(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function tI(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function eI(t){return!!v(t)&&(!!t.endsWith("%")&&ab(t.substring(0,t.length-1)))}function iI(t){return!!p(t)&&("percent"in t||"offset"in t)}function sI(t,e,i,s=0){var n,r;return x(t)?t:eI(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function nI(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=sI(t[s],e.size,i)}))})),o}function rI(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function aI(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||eI(t)||c(t)||iI(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function oI(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const lI=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},hI=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function cI(t,e){return t&&e.key in t?t[e.key]:e.default}function dI(t){return t&&"token"===t.type&&!!t.key}const uI={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},pI={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:hI,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:uI,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},gI={name:"dark",colorScheme:{default:{dataScheme:hI,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},fI=(t,e)=>t===e||!c(t)&&!c(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>fI(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>fI(t[i],e[i])))),mI=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),mI(t[s],e.slice(1),i))},vI=t=>t instanceof Ba||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(t);function _I(t,e=["data"]){return I(t,vI,e)}function yI(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=YO(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}bI._charts={},bI._series={},bI._components={},bI._graphicComponents={},bI._marks={},bI._regions={},bI._animations={},bI._implements={},bI._chartPlugin={},bI._vChartPlugin={},bI._componentPlugin={},bI.transforms={fields:Gr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},bI.dataParser={csv:(t,e={},i)=>(i.type=Ur.DSV,ia(t)),dsv:(t,e={},i)=>{i.type=Ur.DSV;const s=jr(na,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return ea(n).parse(t)},tsv:(t,e={},i)=>(i.type=Ur.DSV,sa(t))},bI._layout={},bI._grammarTransforms={},bI._stageEventPlugins={},bI.registerStageEventPlugin=(t,e)=>{bI._stageEventPlugins[t]=e},bI.getStageEventPlugin=t=>bI._stageEventPlugins[t],bI._interactionTriggers={},bI.registerInteractionTrigger=(t,e)=>{bI._interactionTriggers[t]=e},bI._composedEventMap={},bI.registerComposedEvent=(t,e)=>{bI._composedEventMap[t]=e},bI._tooltipProcessors={},bI.registerTooltipProcessor=(t,e)=>{bI._tooltipProcessors[t]=e},bI.createTooltipProcessor=(t,e)=>{const i=bI._tooltipProcessors[t];return i?new i(e):null};const kI=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},AI=kI(),MI={[pI.name]:pI},wI=pI.name,TI=new Map(Object.keys(MI).map((t=>[t,MI[t]]))),CI=new Map,BI=new Map(Object.keys(MI).map((t=>[t,t===wI]))),EI=(t,e)=>{if(!t)return;const i=II(e);TI.set(t,i),BI.set(t,!0)},PI=(t=wI)=>(BI.has(t)&&!BI.get(t)&&EI(t,TI.get(t)),TI.get(t)),RI=t=>TI.delete(t)&&CI.delete(t)&&BI.delete(t),OI=t=>!!v(t)&&TI.has(t),II=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:wI;return xI({},PI(i),t)};class LI{static registerInstance(t){LI.instances.set(t.id,t)}static unregisterInstance(t){LI.instances.delete(t.id)}static getInstance(t){return LI.instances.get(t)}static instanceExist(t){return LI.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return LI.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}LI.instances=new Map;class DI{static registerTheme(t,e){EI(t,e)}static getTheme(t,e=!1){return PI(t)}static removeTheme(t){return RI(t)}static themeExist(t){return OI(t)}static getDefaultTheme(){return DI.themes.get(wI)}static setCurrentTheme(t){DI.themeExist(t)&&(DI._currentThemeName=t,LI.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return DI.getTheme(DI._currentThemeName,t)}static getCurrentThemeName(){return DI._currentThemeName}}function FI(t){return v(t)?DI.themeExist(t)?DI.getTheme(t):{}:p(t)?t:{}}DI.themes=TI,DI._currentThemeName=wI;const zI=["animationThreshold","colorScheme","name","padding"];function jI(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];zI.includes(n)?s[n]=r:f(r)?UO(r)?s[n]=WO(r,e):dI(r)?s[n]=cI(i,r):s[n]=jI(r,e,i):s[n]=r})),s}function HI(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=HI(t[s],e)}return i}return _(t)?t.map((t=>HI(t,e))):t}function VI(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(v(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=VI(t[s],e)}return i}return _(t)?t.map((t=>VI(t,e))):t}function NI(t,...e){return c(t)?t(...e):t}const WI=(t,e,i,s)=>((t,e,i)=>VM(t,e,i,{fontFamily:uI.fontFamily,fontSize:uI.fontSize}))(e,i,s).measure(t),UI="__VCHART",GI=500,YI=500,XI=`${UI}_MEASURE_CANVAS_ID`,$I=`${UI}_DEFAULT_DATA_INDEX`,KI=`${UI}_DEFAULT_DATA_KEY`,qI=`${UI}_DEFAULT_DATA_SERIES_FIELD`,ZI=`${UI}_DEFAULT_SERIES_STYLE_NAME`,JI=`${UI}_STACK_KEY`,QI=`${UI}_STACK_START`,tL=`${UI}_STACK_END`,eL=`${UI}_STACK_START_PERCENT`,iL=`${UI}_STACK_END_PERCENT`,sL=`${UI}_STACK_START_OffsetSilhouette`,nL=`${UI}_STACK_END_OffsetSilhouette`,rL=`${UI}_STACK_TOTAL`,aL=`${UI}_STACK_TOTAL_PERCENT`,oL=`${UI}_STACK_TOTAL_TOP`,lL=`${UI}_STACK_TOTAL_BOTTOM`,hL=`${UI}_MOSAIC_VALUE_START_PERCENT`,cL=`${UI}_MOSAIC_VALUE_END_PERCENT`,dL=`${UI}_MOSAIC_CAT_START_PERCENT`,uL=`${UI}_MOSAIC_CAT_END_PERCENT`,pL=`${UI}_SEGMENT_START`,gL=`${UI}_SEGMENT_END`,fL=`${UI}_KEY`,mL=`${UI}_MAP_LOOK_UP_KEY`;function vL(t,e){for(let i=0;it.key===e))}function yL(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function bL(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},ML(t,a,n[o],l,e,r))})),s?xL(n):n}function xL(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):xL(t[e].nodes);return t}function SL(t,e){if("values"in t&&t.values.length){const i=kO(t.values,e),s=SO(t.values,iL);t.values.forEach((t=>{t[rL]=i,t[aL]=s}))}else for(const i in t.nodes)SL(t.nodes[i],e)}function kL(t){if(!t.values.length)return;const e=t.values[t.values.length-1][tL]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)AL(t.nodes[r],e,i,s,n)}function ML(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[tL]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),ML(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const wL=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=CL(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function BL(t={}){const e=Object.assign({},t);if(c(t.style)?e.style=(e,i,s,n)=>RL(t.style(e,i,s,n)):E(t.style)||(e.style=RL(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])?i[e]=(i,s,n,r)=>RL(t.state[e](i,s,n,r)):E(t.state[e])||(i[e]=RL(t.state[e]))})),e.state=i}return e}function EL(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>RL(t[i](e,s,n,r)):E(t[i])||(e[i]=RL(t[i]))})),e}function PL(t,e){if(E(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),RL(i)}function RL(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:re(t.angle)}):t}const OL=t=>"line"===t||"area"===t,IL=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return OL(i)?e:null==e?void 0:e[0]},LL=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let DL=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=bI.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(bI.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var FL;!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"}(FL||(FL={}));const zL=["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 jL,HL,VL;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleRawDomainUpdate="scaleRawDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(jL||(jL={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(HL||(HL={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(VL||(VL={}));const NL=[VL.mark,VL.model,VL.chart,VL.vchart];class WL{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(VL.vchart,[]),this._levelNodes.set(VL.chart,[]),this._levelNodes.set(VL.model,[]),this._levelNodes.set(VL.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const UL={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class GL{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=P(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>IL(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||HL.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||HL.chart);o.get(t)||o.set(t,new WL);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||HL.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||HL.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||HL.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||HL.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?NL.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[HL.chart,HL.window,HL.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&P(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return UL[a]&&(a=UL[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?VL.model:VL.vchart:VL.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=xt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=bt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=HL.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==VL.model&&s!==VL.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=VL.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case HL.chart:return this._viewBubbles;case HL.window:return this._windowBubbles;case HL.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case HL.chart:return this._viewListeners;case HL.window:return this._windowListeners;case HL.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return zL.includes(t)||Object.values(FL).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&bI.hasInteractionTrigger(e)}}function YL(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function XL(t,e,i){t.getParser(e)||t.registerParser(e,i)}const $L=new Map;let KL;function qL(){KL||(KL=new Ca,XL(KL,"geojson",Sa),XL(KL,"topojson",Aa),YL(KL,"simplify",Wr))}function ZL(t,e,i={type:"geojson",centroid:!0}){$L.has(t)&&qy(`map type of '${t}' already exists, will be overwritten.`),qL();const s=new Ba(KL),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):p(r)&&s.transform({type:"simplify",options:r}),$L.set(t,s)}function JL(t){$L.has(t)?$L.delete(t):qy(`map type of '${t}' does not exists.`)}function QL(t,e=!1){let i=e;return t.latestData instanceof Ba&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const tD=(t,e)=>0===t.length?[]:1===t.length?QL(t[0],null==e?void 0:e.deep):t.map((t=>QL(t,null==e?void 0:e.deep)));function eD(t,e,i){YL(e=e instanceof Ca?e:t.dataSet,"copyDataView",tD);const s=new Ba(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:nD.copyDataView}),s}function iD(t,e,i=[]){var s;if(t instanceof Ba)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Ba(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return qy(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return qy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),qy("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function sD(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var nD,rD,aD,oD;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(nD||(nD={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(rD||(rD={})),function(t){t.data="data",t.mark="mark"}(aD||(aD={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(oD||(oD={}));const lD=["line","area","trail"];function hD(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(fL,i?t.slice().sort(i):t.slice()),{keys:[fL],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const cD=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function dD(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{dD(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function pD(t,e,i,s){const n=hD(t,(t=>i(t))),r=hD(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const gD=`${UI}_BuiltIn_CallBack_Disappear`;var fD;!function(t){t.render="render",t.disappear="disappear"}(fD||(fD={}));class mD{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(t,e){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(jL.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(jL.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(jL.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var t,e,i,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:g,background:f}=this._option;O_.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(t=this._option.stage)&&void 0!==t?t:new X_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:g},ReactDOM:this._option.ReactDOM,autoRefresh:u(r)?r:!u(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Pp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(u(h)?h:ib(o))&&!1!==c&&bI.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,p(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=oD.before}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(O_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=O_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>dD(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>dD(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{dD(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Ky(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===oD.before&&(this._layoutState=oD.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=oD.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),Ky(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=uD(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=pD(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=pD(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=hD(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=hD(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:gD,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{dD(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===rD.appear))?rD.appear:e.every((t=>t===rD.disappear))?rD.disappear:rD.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===HL.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:IL(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===HL.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===HL.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===HL.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===HL.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===HL.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{dD(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=uD(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return eb(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return bu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{xo.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{dD(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=O_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){O_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function vD(t,i){var s;return e(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==i?void 0:i.onError)&&void 0!==s?s:Zy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function _D(t){t.crosshair=G(t.crosshair||{}).map((e=>yI({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function yD(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ri(l,i.width,i.height);a=t,o=e}else if(h&&eb(e.mode)){let t;t=v(h)?O_.getElementById(h):h;const{width:e,height:s}=ri(t,i.width,i.height);a=e,o=s}else if(sb(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function bD(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function xD(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}const SD=9,kD=0,AD=-1;var MD,wD,TD,CD,BD,ED;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(MD||(MD={})),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"}(wD||(wD={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(TD||(TD={}));class PD{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},PD.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=G(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}PD.defaultMarkInfo={};class RD{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class OD{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>yI({},i,s,t);return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class ID extends RD{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=OD,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new PD,this._lastLayoutRect=null,this.id=rb(),this.userId=t.id,this._spec=t,this.effect={},this.event=new DL(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${UI}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=bI.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!d(e))return P(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class LD{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=wD.Region,this._willLayoutTag=!0,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=nI(aI(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:sI(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:sI(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:sI(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:sI(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:sI(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:sI(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=sI(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=sI(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=sI(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(rI(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class DD extends ID{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new LD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&N(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class FD extends OD{_initTheme(t,e){return{spec:t,theme:this._theme}}}class zD extends DD{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=FD,this.modelType="region",this.specKey="region",this.type=zD.type,this._series=[],this.layoutType="region",this.layoutZIndex=MD.Region,this.seriesDataFilterOver=()=>{this.event.emit(jL.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",MD.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",TD.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:MD.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:MD.Mark+1}))}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",TD.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",TD.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",TD.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",TD.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",TD.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||G(t.userId).includes(e.userId))&&(!u(t.specIndex)||G(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function jD(t){const e=[],i=[],s=[];return t.forEach((t=>{d(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function HD(t,e,i){e?t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function VD(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function ND(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=YD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),VD(d,!0,p,l),s&&HD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function WD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=YD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=YD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),VD(d,!1,p,o),s&&HD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function GD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=YD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=YD(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jD(t);n.length&&ND(n,e,i,!1,"left",s),r.length&&ND(r,e,i,!0,"left",s),a.length&&WD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jD(t);n.length&&UD(n,e,i,!1,"top",s),r.length&&UD(r,e,i,!0,"top",s),a.length&&GD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jD(t);n.length&&ND(n,e,i,!1,"right",s),r.length&&ND(r,e,i,!0,"right",s),a.length&&WD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jD(t);n.length&&UD(n,e,i,!1,"bottom",s),r.length&&UD(r,e,i,!0,"bottom",s),a.length&&GD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=YD(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{N(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=YD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Zy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}XD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(CD||(CD={})),function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(BD||(BD={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(ED||(ED={}));const $D=["linear","radial","conical"],KD={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const qD={};Object.values(BD).forEach((t=>{qD[t]=!0})),BD.STATE_HOVER,BD.STATE_HOVER_REVERSE,BD.STATE_SELECTED,BD.STATE_SELECTED_REVERSE,BD.STATE_DIMENSION_HOVER,BD.STATE_DIMENSION_HOVER_REVERSE;class ZD extends RD{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class JD extends ZD{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];u(s.domain)&&(n.domain=s.domain),u(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,lD.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!qD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(UI)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(UI))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(uB(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class QD extends RD{constructor(){super(...arguments),this.id=rb(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=bI.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class tF extends QD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const eF=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,iF=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=eF(l.delay,n,a,o),d=eF(l.duration,n,a,o),u=eF(l.oneByOne,n,a,o),p=eF(l.splitPath,n,a,o),g=k(u)&&u>0?t=>x(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?QT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:tC)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);KT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?QT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:tC)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>GT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>XT(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:$o.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new $T({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:HT,null!==(l=i.easing)&&void 0!==l?l:VT))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:$o.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new qT({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:HT,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:VT))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):KT(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},sF=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},nF=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class rF extends QD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new tF(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Pp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:MD.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Nl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==CD.enter&&t.context.diffState!==CD.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=t,this.model=e.model,this.key=e.key,this.state=new JD(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,re)}isUserLevel(t){return[TD.User_Mark,TD.User_Series,TD.User_Chart,TD.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&yI(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(pB(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=qO(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):$D.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):pB(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",TD.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,TD.User_Mark)}else this.setStyle(i,t,TD.User_Mark)}))}_computeGradientAttr(e){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=e,d=t(e,["gradient","scale","field"]);let p=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(p=t),g||(g=e)}const f=VO(HO(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},KD[o]),d);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==p?void 0:p.scale(t[g]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=ti.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)$D.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=VO(HO(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return hD(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return bI.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[KI],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=hD(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===rD.appear))?rD.appear:t.every((t=>t===rD.disappear))?rD.disappear:t[0];return null!=e?e:rD.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{nF(t),s.push(...t.getGraphics())})),e.forEach((t=>{nF(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);iF([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=sF(e,n),r=sF(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===rD.exit?rD.exit:i===rD.update?rD.update:rD.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===CD.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===CD.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=CD.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=CD.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=CD.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=rD.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=rD.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return cD(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=cD(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),d(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=LL(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===BD.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=bI.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=bI.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===oD.before||(this._product||this._initProduct(),Ky(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===CD.exit&&!e.isExiting)if(e.context.animationState===CD.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:CD.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Pp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{t.clearStates()}))}}var aF;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(aF||(aF={}));class oF extends rF{constructor(){super(...arguments),this.type=oF.type,this._marks=[],this._diffState=CD.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(qy("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?(qy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return dD(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===CD.update){const t=this.hasAnimation(),e=LL(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=CD.update}render(){this._isCommited&&(Ky(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}oF.type="group";const lF={measureText:WI};class hF{static instance(){return hF.instance_||(hF.instance_=new hF),hF.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class cF{constructor(){this.id=rb(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?qy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class dF extends cF{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const uF={type:"fadeIn"};function pF(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return uF;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}class gF extends DT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}afterStageRender(t,e){var i,s;return null===(s=null===(i=this.params)||void 0===i?void 0:i.callBack)||void 0===s?void 0:s.call(i,t,e,this.currentAnimationRatio,this.animationTime)}}const fF={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},mF={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},vF={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},_F=()=>{bI.registerAnimation("scaleInOut",(()=>mF))},yF=()=>{bI.registerAnimation("fadeInOut",(()=>vF))},bF=(t,e)=>({appear:pF(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:nC,duration:fF.update.duration,easing:fF.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),xF=()=>{bI.registerAnimation("line",bF)},SF=()=>{kT.registerBuiltInAnimate("growPointsIn",SC),kT.registerBuiltInAnimate("growPointsOut",kC),kT.registerBuiltInAnimate("growPointsXIn",MC),kT.registerBuiltInAnimate("growPointsXOut",wC),kT.registerBuiltInAnimate("growPointsYIn",CC),kT.registerBuiltInAnimate("growPointsYOut",BC),kT.registerBuiltInAnimate("clipIn",oC),kT.registerBuiltInAnimate("clipOut",lC)},kF=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};BD.STATE_HIGHLIGHT,BD.STATE_BLUR;class AF{constructor(t){this._markSet=new PD,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const MF={highlightState:BD.STATE_HIGHLIGHT,blurState:BD.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class wF extends AF{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},MF,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}wF.type="element-highlight",wF.defaultOptions=MF;const TF=()=>{bI.registerInteractionTrigger(wF.type,wF)},CF={state:BD.STATE_SELECTED,trigger:"click"};class BF extends AF{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},CF,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}BF.type="element-select",BF.defaultOptions=CF;const EF=()=>{bI.registerInteractionTrigger(BF.type,BF)};class PF extends cF{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class RF{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>bI.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>bI.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>bI.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return bI.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>bI.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){bI.registerTransform(t,e)}static registerFunction(t,e){t&&e&&hF.instance().registerFunction(t,e)}static unregisterFunction(t){t&&hF.instance().unregisterFunction(t)}static getFunction(t){return t?hF.instance().getFunction(t):null}static getFunctionList(){return hF.instance().getFunctionNameList()}static registerMap(t,e,i){const s=bI.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=bI.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,$L.get(e);var e}static registerSVG(t,e,i){const s=bI.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=bI.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){LI.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return rt.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=rb(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=fD.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;N(n.theme,this._spec.theme)?N(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=bD(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?bI.getSeriesBuiltInTheme(e):bI.getComponentBuiltInTheme(e);i=i?yI({},s,i[e]):s}s===t.length-1&&u(i)&&(i=jI({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},OO(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:_,stage:y,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=eb(_);if(S?fx(yo):"node"===_&&QS(yo),S&&f&&(this._container=v(f)?O_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==_&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=DI.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const k=[];!1!==b&&k.push("poptipForText"),"sankey"===e.type&&k.push("scrollbar");const A=new rt(null!==(a=this._option.logLevel)&&void 0!==a?a:nt.Error);rt.setInstance(A),(null===(o=this._option)||void 0===o?void 0:o.onError)&&A.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new mD({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new GL(this,this._compiler),this._event=new DL(this._eventDispatcher,_),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),LI.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=yI({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=HI(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;RF.getFunctionList()&&RF.getFunctionList().length&&(t=VI(t,RF)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=bI.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=bI.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=bI.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(jL.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(jL.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=xt(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return yD(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:GI,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:YI})}_initDataSet(t){this._dataSet=t instanceof Ca?t:new Ca,XL(this._dataSet,"dataview",Ma),XL(this._dataSet,"array",i),YL(this._dataSet,"copyDataView",tD);for(const t in bI.transforms)YL(this._dataSet,t,bI.transforms[t]);for(const t in bI.dataParser)XL(this._dataSet,t,bI.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(!0),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))):t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(jL.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?rD.none:rD.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,LI.unregisterInstance(this)}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return e(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Ba?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=iD(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?yI({},t[n][e.index],i):i):t[n]=s?yI({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?yI({},t[n][r],i):i)}else t.id===e&&(t[n]=s?yI({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=yI({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(jL.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=xI({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=FI(this._currentThemeName),this._currentTheme=o(a,l);else{const t=xI({},FI(p(r)&&r.type?r.type:p(n)&&n.type?n.type:this._currentThemeName),FI(n),FI(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(tw.poptip,QM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!eb(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return FI(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!DI.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=u(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield vD(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!eb(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,e):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t,e,i;null===(t=this._chart)||void 0===t||t.resetLayoutItemTag(),null===(e=this._chart)||void 0===e||e.setLayoutTag(!0,null,!1),null===(i=this._compiler)||void 0===i||i.render()}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(u(this._container))return this._container;let e;return e=v(this._canvas)?O_.getElementById(this._canvas):this._canvas,u(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?oI(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return qy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?oI(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(qy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return hF.instance().getFunction(t)}registerFunction(t,e){t&&e&&hF.instance().registerFunction(t,e)}unregisterFunction(t){t&&hF.instance().unregisterFunction(t)}getFunctionList(){return hF.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=bI.getChartPlugins();t.length>0&&(this._chartPlugin=new dF(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=bI.getVChartPlugins();e.length>0&&(this._vChartPlugin=new PF(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=fD.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;this._renderState=fD.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent()}}RF.InstanceManager=LI,RF.ThemeManager=DI,RF.globalConfig={uniqueTooltip:!0},RF.Utils=lF,RF.vglobal=O_;bI.registerRegion("region",zD),bI.registerLayout("base",XD),oM(),XA(),bI.registerMark(oF.type,oF),bI.registerStageEventPlugin("gesture",zb),TF(),EF(),EI(gI.name,gI);const OF="monotone",IF="linear",LF="bevel";var DF;function FF(t,e){return e("component",t)}function zF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=bI.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(DF||(DF={}));const jF=(t,e,i,s)=>{if(d(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},HF=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(c(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(d(i))for(let i=0;i(l(t),t)))},VF="2.0.22",NF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},WF=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?P(e,t.field):t,s){const{formatFunc:i,args:r}=zF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},UF=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const GF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function YF(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=$F(WF(h,r,a,c),p,g),o.value=$F(WF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=WF(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function XF(t,e,i,s,n,r,a){if(c(e)){YF(t,e(n,a),i,s,r,a)}else e&&YF(t,e,i,s,r,a)}const $F=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=gi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class KF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:u(n)?G(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(u(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of G(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(u(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{XF(a,t,e,i,s,n,r)})):c(t)?XF(a,t,e,i,s,n,r):t&&YF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=c(e)?e(s,n):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:WF(r.visible,t,n),value:$F(WF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:WF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=WF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&GF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const qF={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},ZF=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=vL([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return JF(a,n,o)},JF=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{ab(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{ab(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=qF[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},QF=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{ab(t[e])||(t[e]=0)}))})),t},tz=`${UI}_HIERARCHY_DEPTH`,ez=`${UI}_HIERARCHY_ROOT`,iz=`${UI}_HIERARCHY_ROOT_INDEX`;function sz(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function nz(t,e,i){t&&(i.needDefaultSeriesField&&(t[qI]=i.defaultSeriesField),t[$I]=e,t[KI]=i.getKey(t,e,i))}function rz(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function az(t,e,i,s=0,n,r){void 0===r&&(r=e),nz(t,e,i),t[tz]=s,t[ez]=n||t[i.categoryField],t[iz]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>az(e,s,i,t[tz]+1,t[ez],r)))}const oz={label:{name:"label",type:"text"}},lz=`${UI}_rect_x`,hz=`${UI}_rect_x1`,cz=`${UI}_rect_y`,dz=`${UI}_rect_y1`,uz={data:!0},pz={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},gz=[...Object.keys(fF),"normal"];function fz(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var s;let n=t;return bz(n)&&delete n.type,n.oneByOne&&(n=vz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:_z,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=yI({},o[e],a);return bz(n)&&delete n.type,n.oneByOne&&(n=vz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:_z,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function mz(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),xz(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function vz(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=c(n)?n(t,i,a):k(n)?n:0,h=c(r)?r(t,i,a):k(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):k(n)?n:0,d=c(a)?a(t,r,o):k(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function _z(t,e){var i;return null!==(i=null==t?void 0:t[$I])&&void 0!==i?i:e.context.graphicIndex}function yz(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function bz(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function xz(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),xz(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),xz(t[s],e,i))}function Sz(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class kz extends OD{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=FO(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=bI.getSeriesMarkMap(o)?function(t,e,i){const s=bI.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=yI({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return yI({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=yI({},i,s,t),n=i.label;return n&&p(n)&&_(e.label)&&(e.label=e.label.map((t=>yI({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class Az extends ID{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){u(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${UI}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=kz,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=MD.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(jL.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=Sz(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(jL.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return d(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),u(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YL(this._rawData.dataSet,"invalidTravel",QF),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=iD(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=eD(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=eD(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new tF(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=JF(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){YL(this._dataSet,"dimensionStatistics",ZF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Ba(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&vL(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){YL(this._dataSet,"dimensionStatistics",ZF);const s=new Ba(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=vL(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&vL(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Ba(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return d(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:v(t)?e=>e[t]:_(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YL(this._rawData.dataSet,"addVChartProperty",NF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:sz.bind(this),call:nz}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(jL.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(jL.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(jL.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(jL.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=fz({},mz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:ib(i)||sb(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=yI(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=yI(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=kF(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=kF(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:BD.STATE_HOVER_REVERSE,highlightState:BD.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:BD.STATE_SELECTED_REVERSE,state:BD.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=kF(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:qI;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:ZI,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,ZI,TD.User_SeriesStyle)}))}afterInitMark(){this.event.emit(jL.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",TD.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new KF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!N(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!N(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},uz),pz),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(G(t.label),G(e.label),s),!s.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>pz[i]&&!N(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!N(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ba||sD(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();Sz(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:qI,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new $O).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return HO(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:qI}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),d(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),d(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,yI({},p,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:KI}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==tL&&t!==iL&&t!==QI&&t!==eL||(t=this.getStackValueField()),null!==(e=yL(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>ab(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:qI]}}function Mz(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();uB(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function wz(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}Az.mark=oz,Az.transformerConstructor=kz;class Tz extends Az{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);uB(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${UI}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(tL),this.setFieldX2(QI)):(this.setFieldY(tL),this.setFieldY2(QI))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(iL),this.setFieldX2(eL)):(this.setFieldY(iL),this.setFieldY2(eL))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(nL),this.setFieldX2(sL)):(this.setFieldY(nL),this.setFieldY2(sL))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=G(this._spec.xField),this._specYField=G(this._spec.yField),u(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(G(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(G(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(jL.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(Mz("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function Cz(t){return"bottom"===t||"top"===t}function Bz(t){return"left"===t||"right"===t}function Ez(t){return"z"===t}function Pz(t,e){return tI(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Rz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function Oz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Cz(t)?"linear":"band":Cz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const Iz=(t,e,i)=>{var s;const n=null!==(s="band"===e?FF("axisBand",i):["linear","log","symlog"].includes(e)?FF("axisLinear",i):{})&&void 0!==s?s:{},r=Cz(t)?FF("axisX",i):Bz(t)?FF("axisY",i):FF("axisZ",i);return yI({},FF("axis",i),n,r)};class Lz{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:Zy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:Zy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>gB(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return Cz(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class Dz extends Lz{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:HL.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const Fz=(t,e)=>{var i,s;return t===e||!d(t)&&!d(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},zz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},jz=(t,e,i,s)=>{var n;const r=e.getScale(),a=gB(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:Hz(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,Vz=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(G(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class Nz extends Lz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!Fz(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:HL.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:HL.canvas}),callback:this.onMouseOut}),ib(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:HL.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),ib(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var Wz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Wz||(Wz={}));const Uz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class Gz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(Uz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",TD.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",TD.Series),this.event.on(jL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:LF,curveType:IF,closePath:!0},"normal",TD.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===OF?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",TD.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",TD.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(Uz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:yz(this._spec,Uz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Ba(this._option.dataSet,{name:`${UI}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Wz.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:TD.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:BD.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",TD.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",TD.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[Uz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Wz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,yI({},this._spec[Uz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:BD.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",TD.Series),this.event.on(jL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",TD.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",TD.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Yz=Object.assign(Object.assign({},oz),Uz),Xz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>Xz(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},$z=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class Kz extends rF{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return $z}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(pB(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?Xz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:CD.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[KI]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class qz extends Kz{constructor(){super(...arguments),this.type=qz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===LO.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}qz.type="line";const Zz=()=>{bI.registerMark(qz.type,qz),oM(),ZA(),tP(),KE(),SF(),bI.registerGraphicComponent("line",Eg)};class Jz extends rF{constructor(){super(...arguments),this.type=Jz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}Jz.type="symbol";const Qz=()=>{bI.registerMark(Jz.type,Jz),oM(),hM(),KE(),bI.registerGraphicComponent("symbol",Tg)};class tj extends kz{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function ej(t){return t.length>=2&&k(t[0])&&k(Y(t))&&Y(t)>=t[0]}function ij(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function sj(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function nj(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function rj(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function aj(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const oj=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ie(t,e),a=Math.max(te(i),te(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return aB(v)};class lj{constructor(t){this.id=rb(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class hj extends lj{constructor(){super(hj.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!uB(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(jL.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&ej(c)&&ej(d)))return;const u=ij(t,c),p=ij(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===f){if(!nj(u,p))return}else if(0===y&&0===b){if(!nj(p,u))return}else if(_||k)if(_&&!k){if(!sj(u,p))return}else if(k&&!_){if(!sj(p,u))return}else{if(f===b)return;if(f>b){if(!rj(u,p))return}else if(!rj(p,u))return}else{if(0===f&&0===y){if(!aj(u,p))return}else if(0===b&&0===g&&!aj(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){YL(e.getOption().dataSet,"tickAlign",oj);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}hj.pluginType="component",hj.type="AxisSyncPlugin";const cj={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function dj(t){let e=0;return P(t,"tick.visible")&&(e+=P(t,"tick.tickSize")),P(t,"label.visible")&&(e+=P(t,"label.space")),e}function uj(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function pj(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const gj=t=>"band"===t||"ordinal"===t||"point"===t;function fj(t,e){return{id:t,label:t,value:e,rawValue:t}}function mj(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class vj extends cF{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const _j=`${UI}_ARC_TRANSFORM_VALUE`,yj=`${UI}_ARC_RATIO`,bj=`${UI}_ARC_START_ANGLE`,xj=`${UI}_ARC_END_ANGLE`,Sj=`${UI}_ARC_K`,kj=`${UI}_ARC_MIDDLE_ANGLE`,Aj=`${UI}_ARC_QUADRANT`,Mj=`${UI}_ARC_RADIAN`,wj=-Math.PI/2,Tj=3*Math.PI/2,Cj=.6,Bj=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ue(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},Ej=(t,e,i)=>{var s;const n=null!==(s="band"===e?FF("axisBand",i):"linear"===e?FF("axisLinear",i):{})&&void 0!==s?s:{},r=FF("angle"===t?"axisAngle":"axisRadius",i);return yI({},FF("axis",i),n,r)};function Pj(t,e,i,s){switch(t){case n.cartesianBandAxis:return Iz(Pz(i,["z"]),"band",e);case n.cartesianLinearAxis:return Iz(Pz(i,["z"]),"linear",e);case n.cartesianLogAxis:return Iz(Pz(i,["z"]),"log",e);case n.cartesianSymlogAxis:return Iz(Pz(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return Iz(Pz(i),void 0,e);case n.polarBandAxis:return Ej(i.orient,"band",e);case n.polarLinearAxis:return Ej(i.orient,"linear",e);case n.polarAxis:return Ej(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=FF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>Cz(t.orient)));let g;g=u(p)?yI({},gj(p.type)?a:o,l):l;const f=r.find((t=>Bz(t.orient)));let m;return m=u(f)?yI({},gB(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=FF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?yI({},gj(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?yI({},gB(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return Rj(i,FF(t,e));default:return FF(t,e)}}const Rj=(t,e)=>{var i;const s=yI({},e,e[Rz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Oj extends OD{getTheme(t,e){return Pj(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},aI(e)),{[s]:0}))}}class Ij extends DD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Oj,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Fc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:HL.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new vj(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!N(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(t.release(!0),null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var Lj,Dj;Ij.transformerConstructor=Oj,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Lj||(Lj={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Dj||(Dj={}));class Fj extends rF{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=bI.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(FL.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}Fj.type="component";const zj=()=>{bI.registerMark(Fj.type,Fj)},jj=t=>t;class Hj extends Ij{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?Lj.circleAxis:Lj.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Dj.circleAxisGrid:Dj.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:MD.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(this._syncComponentVisibility(),(null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=fz(null===(l=bI.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:P(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:P(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:P(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:P(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:P(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:P(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:P(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this._specVisible&&(this.getVisible()||this._spec.forceInitTick||this._hideWhenEmpty)}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new tF(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&BO(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=_(a)?uB(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!uB(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return BO(this._regions,(e=>{var i;_(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(s)&&(this._regionIndex=G(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(jL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=EO(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),BO(this._regions,(t=>{t.event.on(jL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(jL.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&N(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):BO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(BO(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=BL(s=e.domainLine)).startSymbol=BL(s.startSymbol),s.endSymbol=BL(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=j(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return RL(yI({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:RL(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>RL(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=RL(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return RL(yI({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:RL(e.tick.style)),e.tick.state&&(i.tick.state=EL(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return RL(yI({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:RL(e.subTick.style)),e.subTick.state&&(i.subTick.state=EL(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=cj[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?re(p):null,textStyle:yI({},u,RL(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:RL(h.style)}),h.state&&(i.title.state.shape=EL(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:RL(o.style)}),o.state&&(i.title.state.background=EL(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=EL(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=RL(e.background.style)),e.background.state&&(i.panel.state=EL(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:NI(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:c(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return RL(yI({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:RL(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:NI(t.subGrid.alternateColor),style:RL(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=zF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){XL(this._option.dataSet,"scale",jj);const i=this.registerTicksTransform();return new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===ww.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}Hj.specKey="axes";const Vj=()=>{zj(),bI.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},Nj=[hj];class Wj extends Hj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=MD.Axis,this.layoutLevel=wD.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),BO(this._regions,(t=>{const e=this.getOrient();Cz(e)?mj(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Bz(e)?mj(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):Ez(e)&&mj(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=yI({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(yI({x:e.x,y:e.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Cz(this.getOrient()),n=t=>{var e;return(s?!Cz(t.getOrient()):Cz(t.getOrient()))&&uB(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&Y(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=Pz(e,["z"]),Ez(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!pj(e))return null;const{axisType:t,componentName:s}=Oz(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>Bz(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!pj(t))return;const{axisType:s,componentName:n}=Oz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=bI.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return Cz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):Ez(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(Nj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){Cz(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!Cz(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!Ez(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Bz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=sI(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=sI(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Cz(this.getOrient())?t.fieldX:Ez(this.getOrient())?t.fieldZ:t.fieldY,uB(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:uB(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(FL.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(Cz(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Cz(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return BO(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:Cz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Ez(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();BO(this._regions,(e=>{Cz(t)?mj(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Bz(t)?mj(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Ez(t)&&mj(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Cz(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&_(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=Cz(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=yI(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new je).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=Cz(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?mt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):mt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return fj(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:uB(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(jL.layoutEnd,this._updateAxisLayout),this.event.on(jL.layoutEnd,this._fixAxisOnZero),this.event.on(jL.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}Wj.type=n.cartesianAxis,Wj.specKey="axes";const Uj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Gj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,Xj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function $j(t,e,i="count"){const s=Xj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const Kj=Math.sqrt(50),qj=Math.sqrt(10),Zj=Math.sqrt(2);class Jj{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=uj(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=Cz(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Yj),e.sort(Yj),{domain:Gj(t,e),scope:$j(t,e,i)}}(r,Xy(t),this._spec.breaks[0].scopeType);e=Xy(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=uj(this._spec);if(u(e)||u(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=Kj?10:n>=qj?5:n>=Zj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(jL.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(jL.scaleDomainUpdate,{model:this}),this.event.emit(jL.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const t=this.collectData(0,!0),e=this.computeLinearDomain(t);this._rawDomain=e,this.event.emit(jL.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const Qj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},tH={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},eH={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},iH={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}};class sH extends Wj{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new iE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!Ez(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=Cz(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=eI(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=Xy(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YL(this._option.dataSet,t,dE),t}}sH.type=n.cartesianLinearAxis,sH.specKey="axes",sH.builtInTheme={axis:iH,axisLinear:Qj,axisX:tH,axisY:eH},U(sH,Jj);const nH=()=>{bI.registerGraphicComponent(Lj.lineAxis,((t,e)=>new QC(t,e))),bI.registerGraphicComponent(Dj.lineAxisGrid,((t,e)=>new hP(t,e))),Vj(),bI.registerComponent(sH.type,sH)};class rH{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new tF(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(jL.scaleDomainUpdate,{model:this}),this.event.emit(jL.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=G(e).concat(i);if(n.push(r),o){const e=fj(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>fj(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}this.event.emit(jL.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const aH={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class oH extends Wj{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new LB}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return YL(this._option.dataSet,t,mE),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=wB(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),p=e=>{const i=t===n?a:0;if(d(r)||t{bI.registerGraphicComponent(Lj.lineAxis,((t,e)=>new QC(t,e))),bI.registerGraphicComponent(Dj.lineAxisGrid,((t,e)=>new hP(t,e))),Vj(),bI.registerComponent(oH.type,oH,!1)};class hH extends sH{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),BO(this._regions,(t=>{Cz(this.getOrient())?mj(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):mj(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=yI({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new tF(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=gi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>fj(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>fj(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return YL(this._option.dataSet,t,dE),t}transformScaleDomain(){}}hH.type=n.cartesianTimeAxis,hH.specKey="axes",hH.builtInTheme={axis:iH,axisX:tH,axisY:eH};class cH extends sH{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new aE}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return YL(this._option.dataSet,t,dE),t}transformScaleDomain(){}}cH.type=n.cartesianLogAxis,cH.specKey="axes",cH.builtInTheme={axis:iH,axisLinear:Qj,axisX:tH,axisY:eH},U(cH,Jj);class dH extends sH{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new oE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return YL(this._option.dataSet,t,dE),t}transformScaleDomain(){}}dH.type=n.cartesianSymlogAxis,dH.specKey="axes",dH.builtInTheme={axis:iH,axisLinear:Qj,axisX:tH,axisY:eH},U(dH,Jj);const uH=`${UI}_hide_`;function pH(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const gH=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[uH]&&(pH(t,!0),t[uH]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[uH]=!0,pH(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},fH=()=>{bI.registerGrammarTransform("symbolOverlap",{transform:gH,runType:"afterEncode"})},mH={min:$,max:X,average:AO,sum:kO};function vH(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function _H(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function yH(t,e,i,s){return _H(t,e,i,"min",s)}function bH(t,e,i,s){return _H(t,e,i,"max",s)}function xH(t,e,i,s){return _H(t,e,i,"average",s)}function SH(t,e,i,s){return _H(t,e,i,"sum",s)}const kH=(t,e)=>{let i=c(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=vH;if("min"===n?l=yH:"max"===n?l=bH:"average"===n?l=xH:"sum"===n&&(l=SH),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},AH=()=>{bI.registerGrammarTransform("dataSampling",{transform:kH})};class MH extends Tz{constructor(){super(...arguments),this.type=LO.line,this.transformerConstructor=tj,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(fz(null===(i=bI.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),mz("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=wz(this);this._symbolMark.setAnimationConfig(fz(null===(s=bI.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),mz("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}MH.type=LO.line,MH.mark=Yz,MH.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},MH.transformerConstructor=tj,U(MH,Gz);class wH{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{sD(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Ba)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];qy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];qy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class TH{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{ob(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{vL(e,[{key:t,operations:uB(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&vL(e,[{key:i.field,operations:uB(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?qO("colorOrdinal"):qO(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(ob(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(N(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!N(r.specified,s.specified))return e.reMake=!0,e;s.range&&!N(s.range,n.range())&&(n.range(s.range),e.reRender=!0),ob(s.domain)?e.reRender=!0:N(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!ob(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=uB(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=uB(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;uB(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(uB(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=uB(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!E(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));uB(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class CH{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class BH extends RD{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=rb(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:GI,height:YI},this._viewRect={width:GI,height:YI},this._viewBox={x1:0,y1:0,x2:GI,y2:YI},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>G(t).some((t=>u(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=aI(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new DL(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new wH(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new CH;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=bI.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(fz({},mz("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=j(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=bI.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:MD.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=bI.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(jL.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(jL.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(jL.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof ID)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof rF))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof rF)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&sD(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=yD(this._spec,this._option,{width:GI,height:YI})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=HO(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new TH(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){bD(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=HO(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!N(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{bD(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0};this._components.forEach((s=>{var r,a;if(s.type===n.label||s.type===n.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(r=this._spec[o])&&void 0!==r?r:{};_(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,bD(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):bD(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(_(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];bD(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=nI(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(jL.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(BD.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(BD.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(BD.STATE_SELECTED)}clearHovered(){this.clearState(BD.STATE_HOVER)}_initEvent(){[jL.dataZoomChange,jL.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(FL.AFTER_MARK_RENDER_END,e)};this._event.on(FL.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:IL;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(OL(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===Wz.dimensionHover||s===Wz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>gB(t.axis.getScale().type)&&d(t.index))),o=a||r.every((t=>gB(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(n.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(n.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),r=[];s.forEach((e=>{const i=t(e);!1!==i&&r.push({axis:e,value:i})})),i.showCrosshair(r)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const EH=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)};class PH{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):mI(t,a,c.spec),mI(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=EH(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=EH(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(bI.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(bI.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=bI.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=bI.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=bI.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):jF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=jF(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class RH extends PH{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{d(i[t])&&(i[t]=n[t])})),P(i,"trimPadding")&&yI(i,xD(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class OH extends RH{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),_D(t)}}const IH=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=bL(t,!0);for(const e in o)for(const i in o[e].nodes)AL(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)kL(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&SL(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(jL.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class DH{_beforeInit(){this._dataSet&&YL(this._dataSet,"stackSplit",IH)}_initStack(){this._stack=new LH(this),this._stack.init()}}const FH={state:BD.STATE_DIMENSION_HOVER,reverseState:BD.STATE_DIMENSION_HOVER_REVERSE,trigger:Wz.dimensionHover};class zH extends AF{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},FH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=IL(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}zH.type="dimension-hover",zH.defaultOptions=FH;const jH=()=>{bI.registerInteractionTrigger(zH.type,zH)},HH=()=>{bI.registerComposedEvent(Wz.dimensionHover,Nz),bI.registerComposedEvent(Wz.dimensionClick,Dz)},VH=t=>t.fieldX[0],NH=t=>t.fieldY[0],WH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},UH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},GH=(t,e)=>t?e?VH:WH:e?NH:UH,YH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=Vz(t,(t=>Cz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=Vz(t,(t=>Bz(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{gB(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=XH(t,i,GH(e,gB(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=XH(t,i,GH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},XH=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:$H(t,s,i)},$H=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=jz(e,t,"cartesian",null!=i?i:Cz(t.getOrient())?VH:NH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},KH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let k;S&&(S._isCache=x);let A=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(gB(m.type))k=m.bandwidth(),0===k&&m.step&&(A=m.step());else if(uB(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(k=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):k=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=dj(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};ZH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&qH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=k?k:0,t[n].offsetSize=A,t[n].cacheInfo=S})),t),qH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=zF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},ZH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},JH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=QH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},QH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},tV=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return KH(c,r,e),c.xField.cacheInfo?JH(c.xField):c.yField.cacheInfo?JH(c.yField):void 0},eV=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],iV=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&eV.forEach((e=>{u(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(sV(s).every((t=>{var e;return!GF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},sV=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},nV={dom:`${UI}_TOOLTIP_HANDLER_DOM`,canvas:`${UI}_TOOLTIP_HANDLER_CANVAS`},rV={key:"其他",value:"..."};var aV;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(aV||(aV={}));class oV{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(jL.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=iV(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},rV),t):rV;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!d(e)&&GF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class lV extends oV{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!gB(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(u(s))break}return u(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const hV=()=>{bI.registerTooltipProcessor("dimension",lV)};class cV extends oV{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Xo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(IL(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const dV=()=>{bI.registerTooltipProcessor("mark",cV)};class uV extends oV{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const pV=()=>{bI.registerTooltipProcessor("group",uV)};class gV extends BH{constructor(){super(...arguments),this.transformerConstructor=OH,this.type="line",this.seriesType=LO.line}_setModelOption(){this._modelOption.getDimensionInfo=YH,this._modelOption.getDimensionInfoByValue=$H,this._modelOption.getRectByDimensionData=tV}}gV.type="line",gV.seriesType=LO.line,gV.transformerConstructor=OH,U(gV,DH);const fV=[...$z,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class mV extends Kz{constructor(){super(...arguments),this.type=mV.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return fV}_getIgnoreAttributes(){return[]}}mV.type="area";const vV=()=>{bI.registerMark(mV.type,mV),oM(),VA(),tP(),KE(),SF(),bI.registerGraphicComponent("area",ef)};class _V extends KF{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),u(e))return e}return i}}}const yV=Object.assign(Object.assign(Object.assign({},oz),Uz),{area:{name:"area",type:"area"}}),bV=()=>{bI.registerAnimation("area",bF),xF(),_F()};class xV extends tj{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||p&&!d)&&(g=h,f=l),l.style=yI({},f.style,g.style),l.state=yI({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class SV extends Tz{constructor(){super(...arguments),this.type=LO.area,this.transformerConstructor=xV,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(SV.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===OF?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return ZO(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",TD.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return ZO(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",TD.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",TD.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",TD.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[tL]},"normal",TD.Series),this.setMarkStyle(o,{curveType:a},"normal",TD.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(fz(null===(e=bI.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),mz("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(fz(null===(i=bI.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),mz("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=wz(this);this._symbolMark.setAnimationConfig(fz(null===(s=bI.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),mz("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new _V(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}SV.type=LO.area,SV.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},SV.mark=yV,SV.transformerConstructor=xV,U(SV,Gz);class kV extends RH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),_D(t)}}class AV extends BH{constructor(){super(...arguments),this.transformerConstructor=kV,this.type="area",this.seriesType=LO.area}_setModelOption(){this._modelOption.getDimensionInfo=YH,this._modelOption.getDimensionInfoByValue=$H,this._modelOption.getRectByDimensionData=tV}}AV.type="area",AV.seriesType=LO.area,AV.transformerConstructor=kV,U(AV,DH);function MV(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const wV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:MV(t,e)}),TV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:MV(t,e)}),CV={type:"fadeIn"},BV={type:"growCenterIn"};function EV(t,e){if(!1===e)return{};switch(e){case"fadeIn":return CV;case"scaleIn":return BV;default:return wV(t)}}class PV extends rF{constructor(){super(...arguments),this.type=PV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}PV.type="rect";const RV=()=>{oM(),sM(),YE("rect",ZE),bI.registerMark(PV.type,PV),kT.registerBuiltInAnimate("growHeightIn",_C),kT.registerBuiltInAnimate("growHeightOut",yC),kT.registerBuiltInAnimate("growWidthIn",LC),kT.registerBuiltInAnimate("growWidthOut",DC),kT.registerBuiltInAnimate("growCenterIn",fC),kT.registerBuiltInAnimate("growCenterOut",mC),bI.registerGraphicComponent("rect",Ig)},OV=Object.assign(Object.assign({},oz),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function IV(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=lI(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[lz]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):ZO(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[hz]):ZO(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=ZO(this._dataToPosX(t),e,i),n=ZO(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[cz]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):ZO(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[dz]):ZO(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=ZO(this._dataToPosY(t),e,i),n=ZO(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},FV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:yz(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(FV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",TD.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===n.cartesianBandAxis));let r;if(YL(this._option.dataSet,"addVChartProperty",NF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};YL(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Ba(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:sz.bind(this),call:nz}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new tF(this._option,r)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=dz,s=cz,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=hz,s=lz,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=bL(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)IV(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=ZO(this[r](t),l,i),u=ZO(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!JO(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",TD.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",TD.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,d=!1,p=1/0,g=-1/0;i.values.forEach((e=>{const i=e[QI],n=e[tL],r=e[eL],c=e[iL];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?cz:lz],i=e[a?dz:hz];l=Math.min(l,t,i),h=Math.max(h,t,i)}u(r)&&u(c)&&(d=!0,p=Math.min(p,r,c),g=Math.max(g,r,c))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[QI]:s,[tL]:o}),d?{[eL]:p,[iL]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(Ig(Object.assign(Object.assign({},m),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>ZO(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",TD.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",TD.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>ZO(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",TD.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",TD.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=d(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",TD.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",TD.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=wz(this);this._barMark.setAnimationConfig(fz(null===(e=bI.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),mz(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=u(this._spec.barWidth)&&r===n,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=a;return o&&(c=lI(this._spec.barWidth,a)),l&&(c=Math.max(c,lI(this._spec.barMinWidth,a))),h&&(c=Math.min(c,lI(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,p;"horizontal"===t?(h=this.getYAxisHelper(),c="height",p="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",p="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&u(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=lI(null!==(l=i[r-1])&&void 0!==l?l:Y(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=uB(g.type||"band");return p(e,m)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}FV.type=LO.bar,FV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},FV.mark=OV,FV.transformerConstructor=DV;const zV=()=>{AH(),RV(),bI.registerAnimation("bar",((t,e)=>({appear:EV(t,e),enter:wV(t,!1),exit:TV(t,!1),disappear:{duration:fF.disappear.duration}}))),lH(),nH(),bI.registerSeries(FV.type,FV)};class jV extends RH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),_D(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=p(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class HV extends BH{constructor(){super(...arguments),this.transformerConstructor=jV,this.type="bar",this.seriesType=LO.bar}_setModelOption(){this._modelOption.getDimensionInfo=YH,this._modelOption.getDimensionInfoByValue=$H,this._modelOption.getRectByDimensionData=tV}}HV.type="bar",HV.seriesType=LO.bar,HV.transformerConstructor=jV,U(HV,DH);const VV=[10,20],NV=cB.Linear,WV="circle",UV=cB.Ordinal,GV=["circle","square","triangle","diamond","star"],YV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},XV=Object.assign(Object.assign({},oz),{point:{name:"point",type:"symbol"}});class $V extends kz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class KV extends Tz{constructor(){super(...arguments),this.type=LO.scatter,this.transformerConstructor=$V,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(c(e))return e;if(_(e)){if(d(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${UI}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${UI}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:NV,defaultRange:VV},"size")}getShapeAttribute(t,e){return d(e)?WV:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:UV,defaultRange:GV},"shape")}initMark(){this._symbolMark=this._createMark(KV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yz(this._spec,KV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=wz(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(fz(null===(i=bI.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),mz("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:WV},BD.STATE_NORMAL,TD.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},BD.STATE_NORMAL,TD.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},BD.STATE_NORMAL,TD.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",TD.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",TD.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},BD.STATE_NORMAL,TD.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},BD.STATE_NORMAL,TD.Series))}handleZoom(t){var e,i,s,n;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.y)}))}));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==r?void 0:r.renderInner)&&r.renderInner();const a=null===(i=null==r?void 0:r.getComponent)||void 0===i?void 0:i.call(r);(null==a?void 0:a.evaluate)&&a.evaluate(null,null);const o=null===(s=null==r?void 0:r.getProduct)||void 0===s?void 0:s.call(r);o&&(null==t?void 0:t.scale)&&(null==t?void 0:t.scaleCenter)&&((null===(n=o.attribute)||void 0===n?void 0:n.postMatrix)||o.setAttributes({postMatrix:new Ne}),o.scale(t.scale,t.scale,t.scaleCenter))}handlePan(t){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}KV.type=LO.scatter,KV.mark=XV,KV.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},KV.transformerConstructor=$V;const qV=()=>{Qz(),bI.registerAnimation("scatter",((t,e)=>Object.assign({appear:YV(0,e)},mF))),lH(),nH(),bI.registerSeries(KV.type,KV)};class ZV extends RH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class JV extends BH{constructor(){super(...arguments),this.transformerConstructor=ZV,this.type="scatter",this.seriesType=LO.scatter}_setModelOption(){this._modelOption.getDimensionInfo=YH,this._modelOption.getDimensionInfoByValue=$H,this._modelOption.getRectByDimensionData=tV}}JV.type="scatter",JV.seriesType=LO.scatter,JV.transformerConstructor=ZV,U(JV,DH);class QV extends Az{constructor(){super(...arguments),this.type=LO.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return d(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${UI}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const tN=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[$I]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[mL]=e.nameMap[n]:t[mL]=n})),t.features);class eN extends KF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class iN extends rF{constructor(){super(...arguments),this.type=iN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}iN.type="path";const sN=()=>{bI.registerMark(iN.type,iN),oM(),QA(),bI.registerGraphicComponent("path",Jg)},nN=Object.assign(Object.assign({},oz),{area:{name:"area",type:"path"}});class rN{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Oa(i,e):Pa[i]?(Ea[i]||(Ea[i]=Oa(i,Pa[i])),Ea[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class aN{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class oN{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function lN(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:aN}:ib(t)||sb(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:oN}:null}const hN={debounce:bt,throttle:xt};class cN{constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=ib(this._renderMode)||sb(this._renderMode),lN(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return lN(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!Se({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:VL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:VL.chart,consume:!1}];l.on(...c,hN[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,hN[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||lN(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||lN(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return d(r)&&d(a)?s:Se({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:VL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:VL.chart,consume:!1}];l.on(...c,hN[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,hN[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){lN(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||lN(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:VL.chart},(t=>{if(!t.event)return;const{event:n}=t;Se({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:VL.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||lN(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:VL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||lN(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:VL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:VL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:VL.chart,source:HL.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:VL.chart,source:HL.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=hN[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=hN[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:VL.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:VL.chart,source:HL.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:VL.chart,source:HL.chart},this._handleDragMouseUp)}))}}function dN(t,e){return`${UI}_${e}_${t}`}class uN extends Ij{constructor(){super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=MD.Mark,this._projectionSpec={name:dN(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=u(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(d(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:n.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=yI(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var t,e,i;this.event.on(jL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new rN(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===LO.map||e.type===LO.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),BO(this._regions,(t=>{var e;if(t.type===LO.map||t.type===LO.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ne})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==LO.map&&e.type!==LO.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[mL],s=t.getDatumCenter(e);i&&u(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!N(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}uN.type=n.geoCoordinate,U(uN,cN);const pN=()=>{bI.registerComponent(uN.type,uN)};class gN extends kz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class fN extends QV{constructor(){super(...arguments),this.type=LO.map,this.transformerConstructor=gN,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),$L.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),YL(this._dataSet,"copyDataView",tD),YL(this._dataSet,"map",tN),YL(this._dataSet,"lookup",HF);const i=$L.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new Ba(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:nD.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:mL,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new tF(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(fN.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:yz(this._spec,fN.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:qI])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:qI]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",TD.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",TD.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(fz(null===(t=bI.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),mz("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new eN(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[$I]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[$I],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s,n;const{scale:r,scaleCenter:a}=t;if(1===r)return;const o=this.getRootMark().getProduct();o&&(o.attribute.postMatrix||o.setAttributes({postMatrix:new Ne}),o.scale(r,r,a));const l=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==l?void 0:l.renderInner)&&l.renderInner();const h=null===(i=null==l?void 0:l.getComponent)||void 0===i?void 0:i.call(l);(null==h?void 0:h.evaluate)&&h.evaluate(null,null);const c=null===(s=null==l?void 0:l.getProduct)||void 0===s?void 0:s.call(l);c&&r&&a&&((null===(n=c.attribute)||void 0===n?void 0:n.postMatrix)||c.setAttributes({postMatrix:new Ne}),c.scale(r,r,a))}handlePan(t){var e,i,s,n;const{delta:r}=t;if(0===r[0]&&0===r[1])return;const a=this.getRootMark().getProduct();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new Ne}),a.translate(r[0],r[1]));const o=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==o?void 0:o.renderInner)&&o.renderInner();const l=null===(i=null==o?void 0:o.getComponent)||void 0===i?void 0:i.call(o);(null==l?void 0:l.evaluate)&&l.evaluate(null,null);const h=null===(s=null==o?void 0:o.getProduct)||void 0===s?void 0:s.call(o);h&&r&&((null===(n=h.attribute)||void 0===n?void 0:n.postMatrix)||h.setAttributes({postMatrix:new Ne}),h.translate(r[0],r[1]))}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return $I}getActiveMarks(){return[this._pathMark]}}fN.type=LO.map,fN.mark=nN,fN.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},fN.transformerConstructor=gN;const mN=`${UI}_waterfall_default_seriesField`,vN=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[oL]=!0:delete t[oL]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=_N([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const f=g[0];let{start:m,end:v}=yN(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>ie(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ee(_,e)):(t[c]=+y,y=ee(y,e)),t[d]=ee(t[c],e),m=ee(m,e),b=ie(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=_N(r,t,n,a,c,h,i,e),a.push(n)})),a};function _N(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=yN(t,i,s,n,u);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=ee(i.positive,e)):(t[h]=+i.negative,i.negative=ee(i.negative,e)),t[c]=ee(t[h],e),i.end=ee(i.end,e)}i.isTotal=e,(d(p)||p===mN)&&(t[mN]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function yN(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!d(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?qy("total.collectCountField error"):n=e[a].start;o<0?qy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=ee(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const bN=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ee(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},xN={type:"fadeIn"},SN={type:"growCenterIn"};function kN(t,e){switch(e){case"fadeIn":return xN;case"scaleIn":return SN;default:return wV(t,!1)}}class AN extends rF{constructor(){super(...arguments),this.type=AN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Eg(t)}}AN.type="rule";const MN=()=>{bI.registerMark(AN.type,AN),oM(),ZA(),bI.registerGraphicComponent("line",Eg)},wN=Object.assign(Object.assign({},OV),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),TN=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:CN(t.map((t=>t.latestData)).flat(),e.fields,i)}};function CN(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>CN(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class BN{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new Ba(e instanceof Ca?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),YL(e,"dimensionTree",TN),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class EN extends DV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const PN={rect:FN,symbol:LN,arc:jN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=LN(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:HN,line:VN,area:VN,rect3d:FN,arc3d:jN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function RN(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=PN[t])&&void 0!==i?i:PN.point;return e.series.type===LO.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=IN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:NN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function ON(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==LO.sankey){const{formatFunc:t,args:n}=zF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function IN(t){return c(t)?e=>t(e.data):t}function LN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=IN(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:DN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function DN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function FN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=IN(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:zN(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function zN(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function jN(t){var e;const{labelSpec:i}=t,s=null!==(e=IN(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function HN(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=ON(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Ag(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function VN(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[qI]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function NN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class WN extends FV{constructor(){super(...arguments),this.type=LO.waterfall,this.transformerConstructor=EN,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&SL(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new BN(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],d(this._seriesField)&&(this._seriesField=mN)}getSeriesKeys(){return this._seriesField===mN?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),YL(this._dataSet,"waterfallFillTotal",bN),YL(this._dataSet,"waterfall",vN),(d(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=eD(this.getViewData(),this._dataSet,{name:`${UI}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new tF(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:QI,endAs:tL,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=wz(this);this._barMark.setAnimationConfig(fz(null===(i=bI.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),mz("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(fz(null===(s=bI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),mz("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(WN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ie(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ie(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return HN(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?ZO(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):ZO(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const t="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:e=>e.lastIndex?this.totalPositionY(e,"lastIndex",t?0:1):0,y1:e=>this.totalPositionY(e,"index",t?1:0)},"normal",TD.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:e=>e.lastIndex?this.totalPositionX(e,"lastIndex",t?0:1):0,x1:e=>this.totalPositionX(e,"index",t?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",TD.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&JO([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}WN.type=LO.waterfall,WN.mark=wN,WN.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},WN.transformerConstructor=EN;const UN=()=>{MN(),RV(),bI.registerAnimation("waterfall",((t,e)=>({appear:kN(t,e),enter:wV(t,!1),exit:TV(t,!1),disappear:{duration:fF.disappear.duration}}))),yF(),lH(),nH(),bI.registerSeries(WN.type,WN)},GN=`${UI}_BOX_PLOT_OUTLIER_VALUE`;var YN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(YN||(YN={}));const XN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];_(e)||(e=[e]),i.push(...e.map((e=>{const i={[GN]:e};return n.forEach((e=>{i[e]=t[e]})),u(r)&&(i[r]=t[r]),i})))})),i};class $N extends KF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===YN.OUTLIER)return this.series.getOutliersField();if(t===YN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case YN.MIN:return this.series.getMinField();case YN.MAX:return this.series.getMaxField();case YN.MEDIAN:return this.series.getMedianField();case YN.Q1:return this.series.getQ1Field();case YN.Q3:return this.series.getQ3Field();case YN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===YN.OUTLIER)return e[GN];if(t===YN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case YN.MIN:return e[this.series.getMinField()];case YN.MAX:return e[this.series.getMaxField()];case YN.MEDIAN:return e[this.series.getMedianField()];case YN.Q1:return e[this.series.getQ1Field()];case YN.Q3:return e[this.series.getQ3Field()];case YN.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[GN])}getDefaultContentList(t){return[{key:this.getContentKey(YN.OUTLIER),value:this.getContentValue(YN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(YN.MAX),value:this.getContentValue(YN.MAX)},{key:this.getContentKey(YN.Q3),value:this.getContentValue(YN.Q3)},{key:this.getContentKey(YN.MEDIAN),value:this.getContentValue(YN.MEDIAN)},{key:this.getContentKey(YN.Q1),value:this.getContentValue(YN.Q1)},{key:this.getContentKey(YN.MIN),value:this.getContentValue(YN.MIN)},{key:this.getContentKey(YN.SERIES_FIELD),value:this.getContentValue(YN.SERIES_FIELD)}]}}class KN extends rF{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==CD.enter&&t.context.diffState!==CD.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Dg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=bI.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const qN=()=>{bI.registerGraphicComponent("glyph",Dg),oM(),GA()},ZN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],JN=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class QN extends KN{constructor(){super(...arguments),this.type=QN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=ZN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=JN,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}QN.type="boxPlot";const tW=Object.assign(Object.assign({},oz),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),eW=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},iW=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},sW=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),nW=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let w,T,C,B,E;if("horizontal"===e){w=null===(r=null===(n=(null===(s=sW(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,T=null===(h=null===(l=null===(o=null===(a=sW(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=sW(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=sW(t,"box").attribute.width,i=sW(t,"box").attribute.x;B=i,E=i+e}else{w=null===(m=null===(f=(null===(g=sW(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,T=null===(b=null===(y=null===(_=null===(v=sW(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=sW(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=sW(t,"box").attribute.height,i=sW(t,"box").attribute.y;B=i,E=i+e}return k(w)?w:k(B)&&k(E)?(B+E)/2:k(T)&&k(C)?(T+C)/2:k(C)?C:k(T)?T:NaN},rW=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=sW(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=sW(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=sW(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=sW(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=sW(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=sW(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=sW(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=sW(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=sW(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=sW(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class aW extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return eW(nW)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class oW extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return iW(nW)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class lW extends aW{computeAttribute(){return eW(rW)(this.target,this.params,this.params.options)}}class hW extends oW{computeAttribute(){return iW(rW)(this.target,this.params,this.params.options)}}class cW extends kz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class dW extends Tz{constructor(){super(...arguments),this.type=LO.boxPlot,this.transformerConstructor=cW,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(dW.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(dW.mark.outlier,{key:$I,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var t,e,i,s,n,r;const a=this._boxPlotMark;if(a){const i={lineWidth:this._lineWidth,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"!==this._shaftShape?"#000":this.getColorAttribute()};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const s="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return lI(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return lI(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return lI(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return lI(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return lI(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return lI(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return lI(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return lI(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(a,i,BD.STATE_NORMAL,TD.Series),this.setMarkStyle(a,s,BD.STATE_NORMAL,TD.Built_In)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this._boxFillColor)&&void 0!==n?n:this.getColorAttribute(),stroke:this.getColorAttribute(),size:x(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10},BD.STATE_NORMAL,TD.Series)}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>ZO(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>ZO(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>ZO(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>ZO(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>ZO(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},BD.STATE_NORMAL,TD.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:e=>ZO(t(this.getDatumPositionValues(e,GN),{bandPosition:this._bandPosition}),i)}:{x:t=>this._getPosition(this.direction,t),y:e=>ZO(t(this.getDatumPositionValues(e,GN),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,BD.STATE_NORMAL,TD.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;YL(this._dataSet,"foldOutlierData",XN),YL(this._dataSet,"addVChartProperty",NF);const t=new Ba(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${UI}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:sz.bind(this),call:nz}},!1),this._outlierData=new tF(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return u(this._spec.boxWidth)&&(r=lI(this._spec.boxWidth,n)),u(this._spec.boxMinWidth)&&(r=Math.max(r,lI(this._spec.boxMinWidth,n))),u(this._spec.boxMaxWidth)&&(r=Math.min(r,lI(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),p=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,p-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(p>1&&u(this._spec.boxGapInGroup)){const t=this._groups.fields,i=G(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=lI(null!==(a=i[o-1])&&void 0!==a?a:Y(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=uB(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=wz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=bI.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(mz("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(fz(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(fz(null===(a=bI.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new $N(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}dW.type=LO.boxPlot,dW.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},dW.mark=tW,dW.transformerConstructor=cW;const uW=()=>{qN(),ZA(),sM(),bI.registerGraphicComponent("line",(t=>Eg(t))),bI.registerGraphicComponent("rect",(t=>Ig(t))),bI.registerMark(QN.type,QN),Qz(),_F(),lH(),nH(),kT.registerBuiltInAnimate("boxplotScaleIn",aW),kT.registerBuiltInAnimate("boxplotScaleOut",oW),kT.registerBuiltInAnimate("barBoxplotScaleIn",lW),kT.registerBuiltInAnimate("barBoxplotScaleOut",hW),bI.registerSeries(dW.type,dW)};class pW extends rF{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=pW.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Kg(t):Ag(t)}}pW.type="text";const gW=()=>{bI.registerMark(pW.type,pW),oM(),dM(),rM(),bI.registerGraphicComponent("text",Ag),bI.registerGraphicComponent("richtext",Kg)};class fW extends KF{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const mW=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),vW={type:"fadeIn"},_W=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function yW(t,e){return"fadeIn"===e?vW:mW(t)}const bW=Object.assign(Object.assign({},OV),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class xW extends DV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class SW extends FV{constructor(){super(...arguments),this.type=LO.rangeColumn,this._barMarkType="rect",this._barName=LO.bar,this.transformerConstructor=xW}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(SW.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yz(this._spec,SW.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(SW.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(SW.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",TD.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=wz(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(fz(null===(i=bI.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),mz("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(fz(null===(s=bI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),mz("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(fz(null===(n=bI.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),mz("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new fW(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}SW.type=LO.rangeColumn,SW.mark=bW,SW.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},SW.transformerConstructor=xW;const kW=()=>{RV(),gW(),bI.registerAnimation("rangeColumn",((t,e)=>({appear:yW(t,e),enter:mW(t),exit:_W(t),disappear:{duration:fF.disappear.duration}}))),yF(),lH(),nH(),bI.registerSeries(SW.type,SW)};var AW,MW;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(AW||(AW={})),function(t){t.middle="middle",t.start="start",t.end="end"}(MW||(MW={}));class wW extends KF{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const TW=Object.assign({},yV);class CW extends SV{constructor(){super(...arguments),this.type=LO.rangeArea}initMark(){this._areaMark=this._createMark(CW.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",TD.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",TD.Series),this.setMarkStyle(t,{stroke:!1},"normal",TD.Series))}initTooltip(){this._tooltipHelper=new wW(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}CW.type=LO.rangeArea,CW.mark=TW;class BW extends Az{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Cj,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};uB(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:[]};uB(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(jL.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&Mz(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function EW(t){return ab(t)?Number.parseFloat(t):0}const PW=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&RW(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=pe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let k=p,A=S,M=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[_j],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,m.forEach((e=>{const i=e[r]===f?f:e[_j]*t;v(e,k,i),k+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},RW=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===EW(t[e])))||!i&&0===t.reduce(((t,i)=>t+EW(i[e])),0)));function OW(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const IW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:OW(t,!0,rD.appear)}),LW={type:"fadeIn"},DW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:OW(t,!0,rD.enter)}),FW=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:OW(t,!0,rD.exit)});function zW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return LW;case"growRadius":return IW(Object.assign(Object.assign({},t),{growField:"radius"}));default:return IW(Object.assign(Object.assign({},t),{growField:"angle"}))}}class jW extends rF{constructor(t,e){super(t,e),this.type=HW.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>le({x:0,y:0},this.getAttribute("centerOffset",e,i),e[kj])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class HW extends jW{constructor(){super(...arguments),this.type=HW.type}}HW.type="arc";const VW=()=>{oM(),jA(),YE("arc",sP),kT.registerBuiltInAnimate("growRadiusIn",RC),kT.registerBuiltInAnimate("growRadiusOut",OC),kT.registerBuiltInAnimate("growAngleIn",pC),kT.registerBuiltInAnimate("growAngleOut",gC),bI.registerGraphicComponent("arc",rf),bI.registerMark(HW.type,HW)},NW=Object.assign(Object.assign({},oz),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class WW extends kz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=yI({},this._theme,i,t);const n=(t,e)=>yI({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const UW=`${UI}_LABEL_VISIBLE`;class GW extends BW{constructor(){super(...arguments),this.transformerConstructor=WW,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:sI(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:sI(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=wj,this._endAngle=Tj,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[kj];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return le(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=u(t),r=u(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(u(this._spec.startAngle)?re(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?re(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?re(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;YL(this._dataSet,"pie",PW),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?re(this._spec.minAngle):0,asStartAngle:bj,asEndAngle:xj,asRatio:yj,asMiddleAngle:kj,asRadian:Mj,asQuadrant:Aj,asK:Sj,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Ba(this._dataSet,{name:`${UI}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new tF(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},GW.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:KI,groupKey:this._seriesField,isSeriesMark:!0},{morph:yz(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return RO(bj)(t)}endAngleScale(t){return RO(xj)(t)}_computeLayoutRadius(){return Bj((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:QO(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:QO(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",TD.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",TD.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,TD.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",TD.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:RO(UW).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(jL.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[kj];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return le(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===rD.appear)return this._startAngle;if(i===rD.disappear)return this._endAngle;const r=[rD.disappear,rD.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[$I];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[$I]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[$I])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[$I])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[kj]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[kj]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[kj]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[kj]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=fz(null===(i=bI.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}GW.transformerConstructor=WW,GW.mark=NW,GW.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class YW extends GW{constructor(){super(...arguments),this.type=LO.pie}}YW.type=LO.pie;const XW=()=>{VW(),bI.registerAnimation("pie",((t,e)=>({appear:zW(t,e),enter:DW(t),exit:FW(t),disappear:{duration:fF.disappear.duration}}))),bI.registerAnimation("emptyCircle",((t,e)=>({appear:zW(t,e)}))),bI.registerSeries(YW.type,YW)};function $W(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const KW=t=>({type:$W(t.growField),options:{overall:!0}}),qW={type:"fadeIn"},ZW=t=>({type:$W(t.growField)}),JW=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function QW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return qW;case"growAngle":return KW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return KW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class tU extends BW{getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(tL),this.setInnerRadiusField(QI)}setValueFieldToPercent(){this.setRadiusField(iL),this.setInnerRadiusField(eL)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const eU=Object.assign(Object.assign({},oz),{rose:{name:"rose",type:"arc"}});class iU extends kz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class sU extends Hj{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=bI.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=MD.Axis,this._tick=void 0,this._center=null,this._startAngle=wj,this._endAngle=Tj,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),BO(this._regions,(t=>{"radius"===this.getOrient()?mj(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):mj(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:sI(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:sI(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=re(this._spec.startAngle),this._endAngle=re(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:dj(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){BO(this._regions,(t=>{"radius"===this.getOrient()?mj(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):mj(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return uB(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:uB(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return le(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return he(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>fj(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ne.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return Bj((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=Cj,e=0;const i=this.getChart().getSpec();return BO(this.getRegions(),(s=>{const n=s;if(r=n.type,[LO.rose,LO.radar,LO.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(yI({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(yI({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}sU.type=n.polarAxis,sU.specKey="axes";const nU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},rU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class aU extends sU{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new iE}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YL(this._option.dataSet,t,dE),t}}aU.type=n.polarLinearAxis,aU.specKey="axes",aU.builtInTheme={axis:iH,axisLinear:Qj,axisAngle:rU,axisRadius:nU},U(aU,Jj);const oU=()=>{bI.registerGraphicComponent(Lj.lineAxis,((t,e)=>new QC(t,e))),bI.registerGraphicComponent(Dj.lineAxisGrid,((t,e)=>new hP(t,e))),bI.registerGraphicComponent(Lj.circleAxis,((t,e)=>new rB(t,e))),bI.registerGraphicComponent(Dj.circleAxisGrid,((t,e)=>new gP(t,e))),Vj(),bI.registerComponent(aU.type,aU)};class lU extends sU{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new LB}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}registerTicksTransform(){const t=`${this.type}-ticks`;return YL(this._option.dataSet,t,yE),t}transformScaleDomain(){}}lU.type=n.polarBandAxis,lU.specKey="axes",lU.builtInTheme={axis:iH,axisBand:aH,axisAngle:rU,axisRadius:nU},U(lU,rH);const hU=()=>{bI.registerGraphicComponent(Lj.lineAxis,((t,e)=>new QC(t,e))),bI.registerGraphicComponent(Dj.lineAxisGrid,((t,e)=>new hP(t,e))),bI.registerGraphicComponent(Lj.circleAxis,((t,e)=>new rB(t,e))),bI.registerGraphicComponent(Dj.circleAxisGrid,((t,e)=>new gP(t,e))),Vj(),bI.registerComponent(lU.type,lU)};class cU extends tU{constructor(){super(...arguments),this.type=LO.rose,this.transformerConstructor=iU,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(cU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yz(this._spec,cU.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>ZO(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=ZO(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(fz(null===(i=bI.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),mz("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}cU.type=LO.rose,cU.mark=eU,cU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},cU.transformerConstructor=iU;const dU=()=>{bI.registerSeries(cU.type,cU),VW(),bI.registerAnimation("rose",((t,e)=>({appear:QW(t,e),enter:ZW(t),exit:JW(t),disappear:{duration:fF.disappear.duration}}))),hU(),oU()};class uU extends IT{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:le(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=he(this.from,this._prevCenter),{angle:i,radius:s}=he(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,bO(this._fromAngle,this._toAngle)&&bO(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=le({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class pU extends nC{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!CO(t)&&!CO(e))return e;const s=he(t,this._prevCenter),n=he(e,this._center);let r=de(s.angle),a=de(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return le({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new se(s,n,r,a);return o.defined=e.defined,o}}const gU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function fU(t,e,i){return"fadeIn"===e?gU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function mU(t,e,i){return"fadeIn"===e?gU(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const vU=(t,e)=>({custom:iC,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),_U=Object.assign(Object.assign(Object.assign({},oz),Uz),{area:{name:"area",type:"area"}});class yU extends tU{constructor(){super(...arguments),this.type=LO.radar,this.transformerConstructor=tj,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(yU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:IF,closePath:!0},"normal",TD.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",TD.Series),this.event.on(jL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:u(this._spec.startAngle)?re(this._spec.startAngle):wj},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(fz(null===(s=bI.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),mz("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=bI.getAnimationInKey(e);t.setAnimationConfig(fz(null==i?void 0:i(n,r),mz(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&_(a)?a[0]:a}}}yU.type=LO.radar,yU.mark=_U,yU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},yU.transformerConstructor=tj,U(yU,Gz);const bU=()=>{bI.registerSeries(yU.type,yU),vV(),Zz(),Qz(),bI.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:fU(t,e,"in"),enter:fU(t,e,"in"),exit:fU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:fF.disappear.duration},update:[{channel:["points","center"],custom:pU,customParameters:t,duration:fF.update.duration,easing:fF.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),bI.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:mU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:fF.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:uU,customParameters:t,duration:fF.update.duration,easing:fF.update.easing}]}))),bI.registerAnimation("radarGroup",((t,e)=>({appear:vU(t,"in"),disappear:{duration:fF.disappear.duration}}))),jA(),hU(),oU()};class xU extends KF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>gi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const SU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(UI)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[$I]:r,[KI]:`${s}_${e}`})),r++}))})),n},kU={fill:"#bbb",fillOpacity:.2},AU=Object.assign(Object.assign({},oz),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}});class MU extends Tz{constructor(){super(...arguments),this.type=LO.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),YL(this._option.dataSet,"objFlat",SU),YL(this._option.dataSet,"copyDataView",tD),XL(this._option.dataSet,"dataview",Ma),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:nD.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(yI(kU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(MU.mark.group),this._containerMark=this._createMark(MU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(MU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(MU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(MU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(MU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(MU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(MU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-(null!==(t=this._spec.leftAppendPadding)&&void 0!==t?t:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",TD.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",TD.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",TD.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",TD.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",TD.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",TD.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",TD.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",TD.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",TD.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:qI}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new $O).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:qI}}initTooltip(){this._tooltipHelper=new xU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}MU.type=LO.dot,MU.mark=AU,MU.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class wU extends KF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>gi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const TU=Object.assign(Object.assign({},oz),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),CU=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class BU extends Tz{constructor(){super(...arguments),this.type=LO.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),YL(this._option.dataSet,"linkDotInfo",CU),null===(t=this.getViewData())||void 0===t||t.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:nD.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(BU.mark.group),this._containerMark=this._createMark(BU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(BU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(BU.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",TD.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",TD.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",TD.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",TD.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:qI}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new wU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}BU.type=LO.link,BU.mark=TU,BU.builtInTheme={link:{arrow:{style:{size:10}}}};const EU=Object.assign(Object.assign({},oz),{group:{name:"group",type:"group"}});class PU extends BW{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?QI:pL],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(i.offsetAngle);let o;if(u(s)){const t=ot(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return d(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?tL:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(i.offsetAngle),o=ot(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=u(n)?re(n):wj;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?re(r):Tj,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||u(null==s?void 0:s.startAngle)||u(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=ZO(this.angleAxisHelper.dataToPosition([t[QI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=ZO(this.angleAxisHelper.dataToPosition([t[tL]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?ZO(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(PU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",TD.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+re(a),o=re(r)/2;return rf(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Ig({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const LU=()=>{bI.registerAnimation("circularProgress",((t,e)=>({appear:IU(t,e),enter:{type:"growAngleIn"},disappear:{duration:fF.disappear.duration}})))};class DU extends kz{constructor(){super(...arguments),this._supportStack=!0}}class FU extends PU{constructor(){super(...arguments),this.type=LO.circularProgress,this.transformerConstructor=DU,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(FU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:yz(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",TD.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(FU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?QI:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?tL:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",TD.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(fz(null===(i=bI.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),mz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(fz(null===(s=bI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),mz("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}FU.type=LO.circularProgress,FU.mark=RU,FU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},FU.transformerConstructor=DU;const zU=()=>{bI.registerSeries(FU.type,FU),VW(),LU(),yF(),hU(),oU()};function jU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const HU={type:"fadeIn"};function VU(t,e="grow"){return!1===e?{}:"fadeIn"===e?HU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:jU(t)}))(t)}class NU extends KF{enableByType(t){return"dimension"!==t}}const WU=Object.assign(Object.assign({},oz),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class UU extends Tz{constructor(){super(...arguments),this.type=LO.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=u(e.width)?e.width:e.x1-e.x,o=u(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(UU.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return ZO(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return ZO(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?ZO(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",TD.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return ZO(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return ZO(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?ZO(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",TD.Series)}}_initTrackMark(){return this._trackMark=this._createMark(UU.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return ZO(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",TD.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return ZO(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",TD.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(fz(null===(i=bI.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),mz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(fz(null===(s=bI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),mz("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new NU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}UU.type=LO.linearProgress,UU.mark=WU,UU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const GU=()=>{RV(),bI.registerAnimation("linearProgress",((t,e)=>({appear:VU(t,e),enter:VU(t),disappear:{duration:fF.disappear.duration}}))),yF(),bI.registerSeries(UU.type,UU)},YU=[0],XU=[20,40],$U=[200,500],KU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},qU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class ZU{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const JU=`${UI}_WORD_CLOUD_TEXT`,QU=Object.assign(Object.assign({},oz),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),tG={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class eG extends Az{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=XU}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:$U,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:YU,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?JU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:KU},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||eb(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:YU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!qU.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new ZU(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var t;this._wordMark=this._createMark(eG.mark.word,{key:KI,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(eG.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:MD.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",TD.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",TD.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",TD.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(fz(bI.getAnimationInKey("wordCloud")(n,s),mz("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new $O).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:qI])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new iE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new iE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[$I])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,jL.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:KI,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:O_.createCanvas.bind(O_),getTextBounds:gf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Ng,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}eG.mark=QU,eG.builtInTheme={wordCloud:tG};function iG(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||fF.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=sG(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,At(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=At(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},nG=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=nG(t.children,e,t,n))})),s},rG=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=rG(t.children,e,t,n)),n=e(t,s,i,n)})),n},aG=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):aG(t.children,e,i)))})),e};function oG(t,e){let i,s;if(cG(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function cG(t,e){for(let i=0;i1e-6?(T+Math.sqrt(T*T-4*w*C))/(2*w):C/T);return{x:s+S+k*B,y:n+A+M*B,radius:B}}function gG(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function fG(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function mG(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function vG(t){return{_:t,next:null,prev:null}}function _G(t,e){const i=(t=G(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];gG(n,s,r);let a,o,l,h,c,d,u,p=vG(s),g=vG(n),f=vG(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=sG(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:SG.defaultOpionts.nodeSort;nG([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)nG([o],yG(h)),rG([o],bG(this._getPadding,.5,a)),nG([o],xG(1,this._maxDepth));else{const t=Math.min(s.width,s.height);nG([o],yG(SG.defaultOpionts.setRadius)),rG([o],bG(Pt,1,a)),d&&rG([o],bG(this._getPadding,o.radius/t,a)),nG([o],xG(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}SG.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const kG=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=kG(t.children):t.value=0),e+=Math.abs(t.value)})),e};function AG(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){kG(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=d(t.value)?0:At(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=At(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function MG(t){return t.depth}function wG(t,e){return e-1-t.endDepth}const TG=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),CG=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},BG={left:MG,right:wG,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:MG,end:wG},EG=_t(0,1);class PG{constructor(t){this._ascendingSourceBreadth=(t,e)=>TG(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>TG(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},PG.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Bt(e):null;this._getNodeKey=i,this._logger=rt.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):BG[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return AG(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!d(r.source),l=!d(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&d(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[CG(s[t.source]),CG(s[t.target],!0)].filter((t=>!d(t)));e.length&&(t.value=$(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=At(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=At(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(v(e)){const t=mt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*EG(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}d(this.options.nodeSortBy)&&n.sort(TG),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(TG),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];RG(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),OG);const s=_(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},IG.defaultOpionts,t):Object.assign({},IG.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Bt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Et(this.options.center[0],t.width),s=t.y0+Et(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Et(t,n))):Et(r,n),h=_(a),c=this.options.gapRadius,u=h?a.map((t=>Et(t,n))):Et(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Et(r,n),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(_(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=sG(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=le({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function LG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:RG,slice:LG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?LG:RG)(t,e,i,s,n)}};class zG{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},zG.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Bt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?DG(this.options.aspectRatio):null!==(e=FG[this.options.splitType])&&void 0!==e?e:FG.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=sG(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function jG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+li?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return rt.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=jG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=wi(o.map(wi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Pi(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=HG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&rt.getInstance().error("Area "+r+" not represented on screen")}return i}function XG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Bi((function(i){return-1*$G({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},qG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=G(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!E(G(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:G(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||NG,s=e.lossFunction||VG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];hi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rne.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:KG(f),arcs:f})}))},ZG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:JG,triangle:JG,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 JG(){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 QG(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const tY=t=>ZG[t]?ZG[t]():ZG.circle(),eY=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function iY(t){return c(t)?t:function(){return t}}class sY{constructor(t){var e,i;switch(this.options=z({},sY.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=tY(this.options.shape),this.getText=null!==(e=iY(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=iY(this.options.fontWeight),this.getTextFontSize=iY(this.options.fontSize),this.getTextFontStyle=iY(this.options.fontStyle),this.getTextFontFamily=iY(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>eY(10,50);break;case"random-light":this.getTextColor=()=>eY(50,90);break;default:this.getTextColor=iY(this.options.color)}if(d(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=c(this.options.rotate)?t=>{var e;return re(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():Mt(e);return re(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!d(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class rY extends sY{constructor(t){var e;super(z({},rY.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<=rY.defaultOptions.minFontSize&&(this.options.minFontSize=rY.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=nY[this.options.spiral])&&void 0!==e?e:nY.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=iY(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=QG(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(hY(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(lY(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}hY(p,this._size)&&(p=cY(p,this._size))}else if(hY(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||oY(p,i))&&(!i||!aY(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function aY(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function oY(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,hY=(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 cY(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},uY=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>le(t,e,i+r*n)))},pY=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},gY=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=QG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=tY("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return le(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)pY(n,uY({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)pY(n,uY({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)pY(n,uY({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)pY(n,uY({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)pY(n,uY({x:l,y:h},o,0,3));else if("star"===t.shape){const t=uY({x:l,y:h},o,-Math.PI/2,5),e=uY({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);pY(n,i)}else n.fillRect(0,0,i,s)}; +function t(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(n||(n={}));var a={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var y=t=>Array.isArray?Array.isArray(t):l(t,"Array");var _=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var A=t=>x(t)&&Number.isFinite(t);var k=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var C=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const M=Object.prototype;var T=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||M)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(_(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(T(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var P=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!u(n[a])||"object"!=typeof n[a]||s&&y(t[a])?F(t,a,n[a]):L(t,e,a,i,s)}}}}function L(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(_(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function j(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(j(t)!==j(e))return!1;if(c(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=N(t),n=N(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function et(t){return Number(t)}function it(t,e,i=et){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&x(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(t=rt.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):nt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=rt.Warn&&nt(this._method||"warn","WARN",t),this}info(...t){return this._level>=rt.Info&&nt(this._method||"log","INFO",t),this}debug(...t){return this._level>=rt.Debug&&nt(this._method||"log","DEBUG",t),this}}function ot(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(Q)),it(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e,i=ut,s=dt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function ft(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var vt=function(t,e,i){return ti?i:t};var yt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function _t(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function _(t){return o=void 0,u&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(A(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function St(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xt(t,e,{leading:s,trailing:n,maxWait:e})}function At(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Ct(t){if(A(t))return t;const e=+t;return A(e)?e:0}function wt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}bt=!1;const Mt=4294967296;const Tt=t=>e=>P(e,t),Bt=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||Tt)(i)},Et=(t,e={})=>{if(y(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Pt=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Ot=t=>0,Rt=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Lt(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!d(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:u,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)u+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!d(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!d(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:u,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=It(f.min,f);for(let r=0;r=1?Ht:t<=-1?-Ht:Math.asin(t)}function Zt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Jt(t,e){return t[0]*e[1]-t[1]*e[0]}function Qt(t,e){let i=0;for(let s=0;s0?i:0}function ie(t,e){return te(t+e,10**Math.max(ee(t),ee(e)))}function se(t,e){return te(t-e,10**Math.max(ee(t),ee(e)))}class ne{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ne(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class re{static distancePP(t,e){return Kt($t(t.x-e.x,2)+$t(t.y-e.y,2))}static distanceNN(t,e,i,s){return Kt($t(t-i,2)+$t(e-s,2))}static distancePN(t,e,i){return Kt($t(e-t.x,2)+$t(i-t.y,2))}static pointAtPP(t,e,i){return new ne((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ae(t){return t*(Math.PI/180)}function oe(t){return 180*t/Math.PI}const le=(t=0)=>{if(t<0)for(;t<-jt;)t+=jt;else if(t>0)for(;t>jt;)t-=jt;return t};function he(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function ce(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function de(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ue(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function pe(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ue(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function ge(t){return(t=ue(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function fe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function me(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ye(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var _e;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(_e||(_e={}));const be=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function xe(t,e,i){if(!t||!e)return _e.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Ce({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function we(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Me(t,e){const i=e?ae(t.angle):t.angle,s=we(t);return[Ce({x:t.x1,y:t.y1},i,s),Ce({x:t.x2,y:t.y1},i,s),Ce({x:t.x2,y:t.y2},i,s),Ce({x:t.x1,y:t.y2},i,s)]}function Te(t,e,i=!1){const s=Me(t,i),n=Me(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(we(t),we(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ae(t.angle):t.angle;let u=i?ae(90-t.angle):t.angle+Ht;const p=i?ae(e.angle):e.angle;let g=i?ae(90-e.angle):e.angle+Ht;u>Nt&&(u-=Nt),g>Nt&&(g-=Nt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Ee(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Le{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(v(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(d(t))return{width:0,height:0};if(d(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(d(this._numberCharSize)){const t=this._standardMethod(Le.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Le.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Le.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Le.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Le.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Le.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Le.NUMBERS_CHAR_SET="0123456789",Le.FULL_SIZE_CHAR="字";const Fe=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}},ze=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),He=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return je(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ne{}class We extends Ne{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Ce({x:this.x1,y:this.y1},this.angle,t),Ce({x:this.x2,y:this.y1},this.angle,t),Ce({x:this.x1,y:this.y2},this.angle,t),Ce({x:this.x2,y:this.y2},this.angle,t)]}}class Ue{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ue,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ue;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ue(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=oe(r.rotateDeg),r}}class Ge{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Ye(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Xe(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Ke=/^#([0-9a-f]{3,8})$/,$e={transparent:4294967040},qe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ze(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Je(t){return x(t)?new si(t>>16,t>>8&255,255&t,1):y(t)?new si(t[0],t[1],t[2]):new si(255,255,255)}function Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ei=(t,e)=>{const i=Ke.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new si((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Je(t):8===e?new si(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ii{static Brighter(t,e=1){return 1===e?t:new ii(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ii(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ii?t:new ii(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u($e[t]))return function(t){return x(t)?new si(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new si(t[0],t[1],t[2],t[3]):new si(255,255,255,1)}($e[t]);if(u(qe[t]))return Je(qe[t]);const e=`${t}`.trim().toLowerCase(),i=ei(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new si(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new si(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ii.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new si(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Xe(this.color.r,this.color.g,this.color.b),r=Ye(d(t)?n.h:vt(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new si(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ei(e,!0);return null!=i?i:this}setColorName(t){const e=qe[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ii(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class si{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Ze(this.r)+Ze(this.g)+Ze(this.b)+(1===this.opacity?"":Ze(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Xe(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ni(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new si(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Xe});function ai(t){if(A(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(p(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function oi(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const li=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function hi(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function ci(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const di=1e-10;function ui(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+di)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=mi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=re.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=pi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-di,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function pi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function gi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return pi(t,t-(i*i-e*e+t*t)/(2*i))+pi(e,s)}function fi(t,e){const i=re.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function mi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let _i;function bi(t,e){const i=yi(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class xi{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Si=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ai(t){let e;if(e=Si.exec(t))return new xi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const ki=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ci{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return Ci.instance||(Ci.instance=new Ci),Ci.instance}newFormat(t){const e=Ai(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):wi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=wi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:y,group:_,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?m:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?ki[8+_i/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?y+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=_(k,1/0));let C=S.length+k.length+A.length,w=C>1)+S+k+A+w.slice(C);break;default:k=w+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Ai(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=yi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=ki[8+n/3];return function(t){return s(r*t)+a}}}const wi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>bi(100*t,e),r:bi,s:function(t,e){const i=yi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(_i=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+yi(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function Mi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Pi(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Pi(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Qt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Ii(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ei(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},es=Math.sqrt,is=Math.tan;function ss(t){return t>1?0:t<-1?ji:Math.acos(t)}function ns(t){return t>1?Ni:t<-1?-Ni:Math.asin(t)}function rs(){}function as(t,e){t&&ls.hasOwnProperty(t.type)&&ls[t.type](t,e)}var os={Feature:function(t,e){as(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sji?t+Math.round(-t/Wi)*Wi:t,e]}function xs(t,e,i){return(t%=Wi)?e||i?_s(As(t),ks(e,i)):As(t):e||i?ks(e,i):bs}function Ss(t){return function(e,i){return[(e+=t)>ji?e-Wi:e<-ji?e+Wi:e,i]}}function As(t){var e=Ss(t);return e.invert=Ss(-t),e}function ks(t,e){var i=$i(t),s=Qi(t),n=$i(e),r=Qi(e);function a(t,e){var a=$i(e),o=$i(t)*a,l=Qi(t)*a,h=Qi(e),c=h*i+o*s;return[Ki(l*n-c*r,o*i-h*s),ns(c*n+l*r)]}return a.invert=function(t,e){var a=$i(e),o=$i(t)*a,l=Qi(t)*a,h=Qi(e),c=h*n-l*r;return[Ki(l*n+h*r,o*i+c*s),ns(c*i-o*s)]},a}function Cs(t,e){(e=ps(e))[0]-=t,ys(e);var i=ss(-e[1]);return((-e[2]<0?-i:i)+Wi-Hi)%Wi}function ws(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:rs,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ms(t,e){return Yi(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function Es(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Ls(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function Fs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ws(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Ls(a);var t=function(t,e){var i=Is(e),s=e[1],n=Qi(s),r=[Qi(i),-$i(i),0],a=0,o=0;Rs.reset(),1===n?s=Ni+Hi:-1===n&&(s=-Ni-Hi);for(var l=0,h=t.length;l=0?1:-1,C=k*A,w=C>ji,M=f*x;if(Rs.add(Ki(M*k*Qi(C),m*S+M*$i(C))),a+=w?A+k*Wi:A,w^p>=i^_>=i){var T=fs(ps(u),ps(y));ys(T);var B=fs(r,T);ys(B);var E=(w^A>=0?-1:1)*ns(B[2]);(s>E||s===E&&(T[0]||T[1]))&&(o+=w^A>=0?1:-1)}}return(a<-Hi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(zs))}return u}}function zs(t){return t.length>1}function Hs(t,e){return((t=t.x)[0]<0?t[1]-Ni-Hi:Ni-t[1])-((e=e.x)[0]<0?e[1]-Ni-Hi:Ni-e[1])}1===(Ps=Ds).length&&(Os=Ps,Ps=function(t,e){return Ds(Os(t),e)});var js=Fs((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?ji:-ji,l=Yi(r-i);Yi(l-ji)0?Ni:-Ni),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=ji&&(Yi(i-n)Hi?Xi((Qi(e)*(r=$i(s))*Qi(i)-Qi(s)*(n=$i(e))*Qi(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*Ni,s.point(-ji,n),s.point(0,n),s.point(ji,n),s.point(ji,0),s.point(ji,-n),s.point(0,-n),s.point(-ji,-n),s.point(-ji,0),s.point(-ji,n);else if(Yi(t[0]-e[0])>Hi){var r=t[0]0,n=Yi(e)>Hi;function r(t,i){return $i(t)*$i(i)>e}function a(t,i,s){var n=[1,0,0],r=fs(ps(t),ps(i)),a=gs(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=fs(n,r),u=vs(n,h);ms(u,vs(r,c));var p=d,g=gs(u,p),f=gs(p,p),m=g*g-f*(gs(u,u)-1);if(!(m<0)){var v=es(m),y=vs(p,(-g-v)/f);if(ms(y,u),y=us(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Yi(y[0]-b)ji^(b<=y[0]&&y[0]<=x)){var w=vs(p,(-g+v)/f);return ms(w,u),[y,us(w)]}}}function o(e,i){var n=s?t:ji-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Fs(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?ji:-ji),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ms(e,p)||Ms(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&Ms(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=$i(e),o=Qi(e),l=s*i;null==n?(n=e+s*Wi,r=e-l/2):(n=Cs(a,n),r=Cs(a,r),(s>0?nr)&&(n+=s*Wi));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Yi(s[0]-t)0?0:3:Yi(s[0]-i)0?2:1:Yi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,y,_=a,b=ws(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&_.lineEnd()},polygonStart:function(){_=b,l=[],h=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=y&&e,n=(l=Ls(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Bs(l,o,e,r,a),a.polygonEnd());_=a,l=h=c=null}};function S(t,e){n(t,e)&&_.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(_.lineStart(),_.point(r,a));else if(o&&m)_.point(r,a);else{var l=[g=Math.max(Ws,Math.min(Vs,g)),f=Math.max(Ws,Math.min(Vs,f))],b=[r=Math.max(Ws,Math.min(Vs,r)),a=Math.max(Ws,Math.min(Vs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(_.lineStart(),_.point(r,a),y=!1):(m||(_.lineStart(),_.point(l[0],l[1])),_.point(b[0],b[1]),o||_.lineEnd(),y=!1)}g=r,f=a,m=o}return x}}function Gs(t){return t}var Ys,Xs,Ks,$s,qs=Di(),Zs=Di(),Js={point:rs,lineStart:rs,lineEnd:rs,polygonStart:function(){Js.lineStart=Qs,Js.lineEnd=sn},polygonEnd:function(){Js.lineStart=Js.lineEnd=Js.point=rs,qs.add(Yi(Zs)),Zs.reset()},result:function(){var t=qs/2;return qs.reset(),t}};function Qs(){Js.point=tn}function tn(t,e){Js.point=en,Ys=Ks=t,Xs=$s=e}function en(t,e){Zs.add($s*t-Ks*e),Ks=t,$s=e}function sn(){en(Ys,Xs)}var nn=Js,rn=1/0,an=rn,on=-rn,ln=on;var hn,cn,dn,un,pn={point:function(t,e){ton&&(on=t);eln&&(ln=e)},lineStart:rs,lineEnd:rs,polygonStart:rs,polygonEnd:rs,result:function(){var t=[[rn,an],[on,ln]];return on=ln=-(an=rn=1/0),t}},gn=0,fn=0,mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An={point:kn,lineStart:Cn,lineEnd:Tn,polygonStart:function(){An.lineStart=Bn,An.lineEnd=En},polygonEnd:function(){An.point=kn,An.lineStart=Cn,An.lineEnd=Tn},result:function(){var t=Sn?[bn/Sn,xn/Sn]:_n?[vn/_n,yn/_n]:mn?[gn/mn,fn/mn]:[NaN,NaN];return gn=fn=mn=vn=yn=_n=bn=xn=Sn=0,t}};function kn(t,e){gn+=t,fn+=e,++mn}function Cn(){An.point=wn}function wn(t,e){An.point=Mn,kn(dn=t,un=e)}function Mn(t,e){var i=t-dn,s=e-un,n=es(i*i+s*s);vn+=n*(dn+t)/2,yn+=n*(un+e)/2,_n+=n,kn(dn=t,un=e)}function Tn(){An.point=kn}function Bn(){An.point=Pn}function En(){On(hn,cn)}function Pn(t,e){An.point=On,kn(hn=dn=t,cn=un=e)}function On(t,e){var i=t-dn,s=e-un,n=es(i*i+s*s);vn+=n*(dn+t)/2,yn+=n*(un+e)/2,_n+=n,bn+=(n=un*t-dn*e)*(dn+t),xn+=n*(un+e),Sn+=3*n,kn(dn=t,un=e)}var Rn=An;function In(t){this._context=t}In.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,Wi)}},result:rs};var Dn,Ln,Fn,zn,Hn,jn=Di(),Nn={point:rs,lineStart:function(){Nn.point=Vn},lineEnd:function(){Dn&&Wn(Ln,Fn),Nn.point=rs},polygonStart:function(){Dn=!0},polygonEnd:function(){Dn=null},result:function(){var t=+jn;return jn.reset(),t}};function Vn(t,e){Nn.point=Wn,Ln=zn=t,Fn=Hn=e}function Wn(t,e){zn-=t,Hn-=e,jn.add(es(zn*zn+Hn*Hn)),zn=t,Hn=e}var Un=Nn;function Gn(){this._string=[]}function Yn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Xn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ds(t,i(s))),s.result()}return r.area=function(t){return ds(t,i(nn)),nn.result()},r.measure=function(t){return ds(t,i(Un)),Un.result()},r.bounds=function(t){return ds(t,i(pn)),pn.result()},r.centroid=function(t){return ds(t,i(Rn)),Rn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Gs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Gn):new In(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Kn(t){return function(e){var i=new $n;for(var s in t)i[s]=t[s];return i.stream=e,i}}function $n(){}function qn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ds(i,t.stream(pn)),e(pn.result()),null!=s&&t.clipExtent(s),t}function Zn(t,e,i){return qn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Jn(t,e,i){return Zn(t,[[0,0],e],i)}function Qn(t,e,i){return qn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function tr(t,e,i){return qn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Gn.prototype={_radius:4.5,_circle:Yn(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=Yn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},$n.prototype={constructor:$n,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var er=16,ir=$i(30*Gi);function sr(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,y=c-n,_=v*v+y*y;if(_>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=es(b*b+x*x+S*S),k=ns(S/=A),C=Yi(Yi(S)-1)e||Yi((v*B+y*E)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Gi:0,B()):[m*Ui,v*Ui,y*Ui]},M.angle=function(t){return arguments.length?(_=t%360*Gi,B()):_*Ui},M.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},M.precision=function(t){return arguments.length?(a=sr(o,w=t*t),E()):es(w)},M.fitExtent=function(t,e){return Zn(M,t,e)},M.fitSize=function(t,e){return Jn(M,t,e)},M.fitWidth=function(t,e){return Qn(M,t,e)},M.fitHeight=function(t,e){return tr(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&T,B()}}function hr(t){var e=0,i=ji/3,s=lr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Gi,i=t[1]*Gi):[e*Ui,i*Ui]},n}function cr(t,e){var i=Qi(t),s=(i+Qi(e))/2;if(Yi(s)2?t[2]*Gi:0),e.invert=function(e){return(e=t.invert(e[0]*Gi,e[1]*Gi))[0]*=Ui,e[1]*=Ui,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===vr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function _r(t){return is((Ni+t)/2)}function br(t,e){var i=$i(t),s=t===e?Qi(t):Zi(i/$i(e))/Zi(_r(e)/_r(t)),n=i*Ji(_r(t),s)/s;if(!s)return vr;function r(t,e){n>0?e<-Ni+Hi&&(e=-Ni+Hi):e>Ni-Hi&&(e=Ni-Hi);var i=n/Ji(_r(e),s);return[i*Qi(s*t),n-i*$i(s*t)]}return r.invert=function(t,e){var i=n-e,r=ts(s)*es(t*t+i*i),a=Ki(t,Yi(i))*ts(i);return i*s<0&&(a-=ji*ts(t)*ts(i)),[a/s,2*Xi(Ji(n/r,1/s))-Ni]},r}function xr(t,e){return[t,e]}function Sr(t,e){var i=$i(t),s=t===e?Qi(t):(i-$i(e))/(e-t),n=i/s+t;if(Yi(s)Hi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Pr.invert=gr(ns),Or.invert=gr((function(t){return 2*Xi(t)})),Rr.invert=function(t,e){return[-e,2*Xi(qi(t))-Ni]};var Lr={exports:{}},Fr=function(t,e){this.p1=t,this.p2=e};Fr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Fr.prototype.run=function(){return this.p2[0]-this.p1[0]},Fr.prototype.slope=function(){return this.rise()/this.run()},Fr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Fr.prototype.isVertical=function(){return!isFinite(this.slope())},Fr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Fr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Fr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Fr.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)},Fr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var zr=Fr,Hr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new zr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Hr(t.slice(0,s),e),o=Hr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},jr=Hr;!function(t){var e=jr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Vr(Gr,e),{tolerance:s}=i;return Nr(t,s)};var Xr;!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"}(Xr||(Xr={}));const Kr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(A(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let C=0;const w=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/C:0,w.push(_[t])}return w},qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(u=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==u?u:"percentage",w=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],T=M.length?M:void 0,B=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:T});if(!w.length)return $r(t,B);const E={};return t.forEach((t=>{const e=w.map((e=>null==t?void 0:t[e])).join("-&&-");E[e]?E[e].push(t):E[e]=[t]})),Object.values(E).map((t=>{const e=[...M,...w];return $r(t,Object.assign(Object.assign({},B),{groupField:e.length?e:void 0,n:t.length}))})).flat()},Zr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",w=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",T=null!==(l=k.q1)&&void 0!==l?l:"q1",B=null!==(h=k.median)&&void 0!==h?h:"median",E=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(u=k.iqr)&&void 0!==u?u:"iqr",O=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",D=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",L=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),y(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}y(S)&&(S=[vt(Math.min.apply(null,S),0,1),vt(Math.max.apply(null,S),0,1)]);const V=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[w]=s,f[M]=o,f[T]=l,f[B]=h,f[E]=c,f[P]=d,f[O]=n,f[R]=r,f[I]=u,f[D]=p,f[L]=g,A&&(f[F]=H.get(t)||[]),V.push(f)}return V};var Jr={},Qr={};function ta(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ea(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ia(t,e){var i=t+"",s=i.length;return s9999?"+"+ia(e,6):ia(e,4))+"-"+ia(t.getUTCMonth()+1,2)+"-"+ia(t.getUTCDate(),2)+(r?"T"+ia(i,2)+":"+ia(s,2)+":"+ia(n,2)+"."+ia(r,3)+"Z":n?"T"+ia(i,2)+":"+ia(s,2)+":"+ia(n,2)+"Z":s||i?"T"+ia(i,2)+":"+ia(s,2)+"Z":"")}function na(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Qr;if(h)return h=!1,Jr;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a0}function fa(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=la(t));var r=[];switch(t.type){case"GeometryCollection":return ma(t,(function(t){ya(t,s)})),t;case"FeatureCollection":return fa(t,(function(t){fa(ya(t,s),(function(t){r.push(t)}))})),ci(r)}return ya(t,s)}function ya(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ma(t,(function(t){ya(t,e)})),t;case"LineString":return _a(pa(t),e),t;case"Polygon":return ba(pa(t),e),t;case"MultiLineString":return pa(t).forEach((function(t){_a(t,e)})),t;case"MultiPolygon":return pa(t).forEach((function(t){ba(t,e)})),t;case"Point":case"MultiPoint":return t}}function _a(t,e){ga(t)===e&&t.reverse()}function ba(t,e){ga(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=xa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Ca=(t,e={},i)=>{i.type=Xr.GEO;const s=Vr(Aa,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ka(t))})):e.push(ka(t))})),e})(t);let l=t.features;return o&&(l=va(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=Sa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=Sa.bounds(t);t.bbox=e}})),t.features=l,t},wa={},Ma=(t,e,i)=>{i.type=Xr.GEO;const s=Vr(Aa,wa,e),{object:n}=s;if(!v(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Dr(a,t)}))}:Dr(a,o));var a,o;return Ca(r,s,i)},Ta=(t,e,i)=>{const s=!h(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Ba=0;function Ea(t="dataset"){return Ba>1e8&&(Ba=0),t+"_"+Ba++}class Pa{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:Ea("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Oa{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ea("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Oa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Kr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Xn();const Ra={},Ia={albers:ur,albersusa:function(){var t,e,i,s,n,r,a=ur(),o=dr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=dr().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}},Da=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function La(t,e){return function i(){const s=e();return s.type=t,s.path=Xn().projection(s),s.copy=s.copy||function(){const t=i();return Da.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Fa{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class za extends Fa{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}class Ha{static GenAutoIncrementId(){return Ha.auto_increment_id++}}Ha.auto_increment_id=0;class ja{}const Na=new ja;let Va=0;class Wa{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Na.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Va,t),this.tryRunAnimationFrameNextFrame(),Va}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class Ua{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Ga=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ya extends Ua{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Ha.GenAutoIncrementId(),this.hooks={onSetEnv:new za(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Wa);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Wa),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Ga(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}var Xa=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ka extends o{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=Ha.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Xa(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Za))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(eo(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof Za))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=eo(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof Za))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=eo(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Za))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=eo(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Za))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=to.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(eo(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(eo(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,eo(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Za))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):eo(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof Ja))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=to.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new io(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Za,this.rootWheelEvent=new Ja,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&v(t)&&!R(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const ao=jt-1e-8;class oo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>ao)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=jt)<0&&(s+=jt),(n%=jt)<0&&(n+=jt),nn;++o,a-=Ht)g(a);else for(a=s-s%Ht+Ht,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ho=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,co={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},uo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let po,go,fo,mo,vo,yo;function _o(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tyo){let t,e=fo;for(let s=1,r=i.length;s1&&(g=Math.sqrt(g),i*=g,s*=g);const f=d/i,m=c/i,v=-c/s,y=d/s,_=f*o+m*l,b=v*o+y*l,x=f*t+m*e,S=v*t+y*e;let A=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const C=.5*(_+x)-k*(S-b),w=.5*(b+S)+k*(x-_),M=Math.atan2(b-w,_-C);let T=Math.atan2(S-w,x-C)-M;T<0&&1===r?T+=jt:T>0&&0===r&&(T-=jt);const B=Math.ceil(Math.abs(T/(Ht+.001))),E=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Po(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=jo(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Vo(t,e){const{p0:i,p1:s}=t,n=re.pointAtPP(i,s,e);return[new Wo(i,n),new Wo(n,s)]}class Wo extends Oo{constructor(t,e){super(),this.type=ko.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return re.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?re.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Ao.ROW?Vt(this.p0.x-this.p1.x):t===Ao.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class Uo{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new No(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new Wo(new ne(this._lastX,this._lastY),new ne(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Ao.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===Ao.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Go extends Uo{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Yo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Xo(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?Ao.ROW:Ao.COLUMN;return"monotoneY"===t?new Go(t,s):new Uo(t,s)}class Ko{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 $o(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Xo("linear",i,t);return qo(new Ko(n,s),t),n}function qo(t,e){return Yo(t,e,1)}function Zo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Jo{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&&Zo(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:Zo(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 Qo(t,e){return Yo(t,e,2)}function tl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return $o(t,e);const n=Xo("basis",i,t);return Qo(new Jo(n,s),t),n}function el(t){return t<0?-1:1}function il(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(el(r)+el(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function sl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function nl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class rl{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:nl(this,this._t0,sl(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,nl(this,sl(this,e=il(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:nl(this,this._t0,e=il(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class al extends rl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ol(t,e){return Yo(t,e,2)}function ll(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return $o(t,e);const n=Xo("monotoneX",i,t);return ol(new rl(n,s),t),n}function hl(t,e){return Yo(t,e,2)}function cl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return $o(t,e);const n=Xo("monotoneY",i,t);return hl(new al(n,s),t),n}let dl=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class ul extends dl{lineEnd(){this.context.closePath()}}function pl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Uo("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ao.ROW:Ao.COLUMN);return gl(new dl(r,e,n),t),r}function gl(t,e){return Yo(t,e,1)}function fl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Uo("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ao.ROW:Ao.COLUMN);return gl(new ul(r,e,n),t),r}class ml extends Ko{lineEnd(){this.context.closePath()}}function vl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Xo("linear",i,t);return yl(new ml(n,s),t),n}function yl(t,e){return Yo(t,e,1)}function _l(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ft){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ft){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function bl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return $o(i,n);const o=Xo(t,r,i);return Yo(new e(o,s,a),i,2),o}}const xl=bl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:_l(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Sl=bl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:_l(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Al extends Oo{constructor(t,e,i){super(),this.type=ko.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return zo(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Ho(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===Ao.ROW?Vt(this.p0.x-this.p2.x):t===Ao.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=zo(i,s,n,e),a=re.pointAtPP(i,s,e),o=re.pointAtPP(s,n,e);return[new Al(i,a,r),new Al(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class kl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Wo(new ne(this._lastX,this._lastY),new ne(t,e))}quadraticCurveTo(t,e,i,s){const n=new Al(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new No(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Cl(t,e,i){var s,n;switch(e){case"linear":default:return $o(t,i);case"basis":return tl(t,i);case"monotoneX":return ll(t,i);case"monotoneY":return cl(t,i);case"step":return pl(t,.5,i);case"stepClosed":return fl(t,.5,i);case"stepBefore":return pl(t,0,i);case"stepAfter":return pl(t,1,i);case"catmullRom":return xl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Sl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return vl(t,i)}}class wl extends lo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new oo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([uo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([uo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([uo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([uo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([uo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([uo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([uo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([uo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([uo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new kl(this);Po(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[uo.M]=t=>`M${t[1]} ${t[2]}`,t[uo.L]=t=>`L${t[1]} ${t[2]}`,t[uo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[uo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[uo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];Bo(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[uo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=_o(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=Cl(e,i);"x"===s?this.direction=Ao.ROW:"y"===s?this.direction=Ao.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[uo.M]=this.moveToTransform,t[uo.L]=this.lineToTransform,t[uo.Q]=this.quadraticCurveToTransform,t[uo.C]=this.bezierCurveToTransform,t[uo.AT]=this.arcToTransform,t[uo.E]=this.ellipseTransform,t[uo.R]=this.rectTransform,t[uo.A]=this.arcTransform,t[uo.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Po(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Ao.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===Ao.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{at.getInstance().warn("空函数")}}),Jl=Object.assign(Object.assign({},Ul),{points:[],cornerRadius:0,closePath:!0}),Ql=Object.assign(Object.assign({},Ul),{width:100,height:100,spikes:5,thickness:.5}),th=Object.assign(Object.assign({},Ul),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),eh=Object.assign(Object.assign({},Ul),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),ih=Object.assign(Object.assign({},Ul),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),sh=Object.assign(Object.assign(Object.assign({},Ul),Hl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),nh=Object.assign(Object.assign(Object.assign({},Ul),Hl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),rh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Ul),{fill:!0,cornerRadius:0,cornerType:"round"}),ah=Object.assign(Object.assign({},rh),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});class oh{static GetImage(t,e){var i;const s=oh.cache.get(t);s?"fail"===s.loadState?Na.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):oh.loadImage(t,e)}static GetSvg(t,e){var i;let s=oh.cache.get(t);s?"fail"===s.loadState?Na.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},oh.cache.set(t,s),s.dataPromise=Na.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=oh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},oh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Na.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Na.global.loadBlob(t):"json"===e&&(i.dataPromise=Na.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!oh.isLoading&&oh.toLoadAueue.length){oh.isLoading=!0;const t=oh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(oh.cache.set(i,n),n.dataPromise=Na.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{oh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),oh.loading()})).catch((t=>{console.error(t),oh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),oh.loading()}))}}),0)}static loadImage(t,e){const i=lh(t,oh.toLoadAueue);if(-1!==i)return oh.toLoadAueue[i].marks.push(e),void oh.loading();oh.toLoadAueue.push({url:t,marks:[e]}),oh.loading()}static improveImageLoading(t){const e=lh(t,oh.toLoadAueue);if(-1!==e){const t=oh.toLoadAueue.splice(e,1);oh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function lh(t,e){for(let i=0;i{var e;let i=!0;if(h(t,!0)){for(let s=0;s<4;s++)ch[s]=t,i&&(i=!(null!==(e=ch[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)ch[e]=!!t[e],i&&(i=!!ch[e]);else ch[0]=!1,ch[1]=!1,ch[2]=!1,ch[3]=!1;return{isFullStroke:i,stroke:ch}},uh=[0,0,0,0],ph=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(uh[0]=t[0],uh[2]=t[0],uh[1]=t[1],uh[3]=t[1],uh):t:t:0,gh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],fh=[1,2,3,0,1,2,3,0];function mh(t,e,i,s){for(;t>=Nt;)t-=Nt;for(;t<0;)t+=Nt;for(;t>e;)e+=Nt;gh[0].x=i,gh[1].y=i,gh[2].x=-i,gh[3].y=-i;const n=Math.ceil(t/Ht)%4,r=Math.ceil(e/Ht)%4;if(s.add(Ut(t)*i,Xt(t)*i),s.add(Ut(e)*i,Xt(e)*i),n!==r||e-t>zt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}xh.TimeOut=1e3/60;const Sh=new xh,Ah=(t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,kh=(t,e)=>{const i=Ah(t,e);return isNaN(i)?i:Math.max(e,i)};class Ch{bounds(t,e){if(x(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}}function wh(t,e,i,s,n){return n?t.arc(i,s,e,0,jt,!1,n):t.arc(i,s,e,0,jt),!1}var Mh=new class extends Ch{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return wh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return wh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Th=new class extends Ch{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Eh=new class extends Ch{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Ph(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Ch{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Ph(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ph(t,this.parseSize(e)/2+n,i,s)}};function Rh(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Ih extends Ch{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Ih;var Lh=new class extends Ih{constructor(){super(...arguments),this.type="triangle"}};const Fh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),zh=Math.sin(jt/10)*Fh,Hh=-Math.cos(jt/10)*Fh;function jh(t,e,i,s){const n=zh*e,r=Hh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=jt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Nh=new class extends Ch{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return jh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return jh(t,this.parseSize(e)/2+n,i,s)}};const Vh=Kt(3);function Wh(t,e,i,s){const n=e,r=n/Vh,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Uh=new class extends Ch{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Gh(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Yh=new class extends Ch{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Gh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Gh(t,this.parseSize(e)/2+n,i,s)}};function Xh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Kh=new class extends Ch{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Xh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Xh(t,this.parseSize(e)/2+n,i,s)}};const $h=-.5,qh=Kt(3)/2,Zh=1/Kt(12);function Jh(t,e,i,s){const n=e/2,r=e*Zh,a=n,o=e*Zh+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo($h*n-qh*r+i,qh*n+$h*r+s),t.lineTo($h*a-qh*o+i,qh*a+$h*o+s),t.lineTo($h*l-qh*h+i,qh*l+$h*h+s),t.lineTo($h*n+qh*r+i,$h*r-qh*n+s),t.lineTo($h*a+qh*o+i,$h*o-qh*a+s),t.lineTo($h*l+qh*h+i,$h*h-qh*l+s),t.closePath(),!1}var Qh=new class extends Ch{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Jh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Jh(t,this.parseSize(e)/2+n,i,s)}};function tc(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ec=new class extends Ch{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return tc(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return tc(t,this.parseSize(e)/2,i,s,n)}};function ic(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var sc=new class extends Ch{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return ic(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ic(t,this.parseSize(e)/2,i,s,n)}};function nc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var rc=new class extends Ch{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return nc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return nc(t,this.parseSize(e)/2,i,s,n)}};const ac=Kt(3);function oc(t,e,i,s){const n=e*ac;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var lc=new class extends Ch{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return oc(t,this.parseSize(e)/2/ac,i,s)}drawOffset(t,e,i,s,n){return oc(t,this.parseSize(e)/2/ac+n,i,s)}};function hc(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var cc=new class extends Ch{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return hc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return hc(t,this.parseSize(e)/4+n,i,s)}};function dc(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var uc=new class extends Ch{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return dc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return dc(t,this.parseSize(e)/4+n,i,s)}};function pc(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var gc=new class extends Ch{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return pc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return pc(t,this.parseSize(e)/4+n,i,s)}};function fc(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var mc=new class extends Ch{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return fc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return fc(t,this.parseSize(e)/4+n,i,s)}};function vc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var yc=new class extends Ch{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return vc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return vc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function _c(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var bc=new class extends Ch{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return _c(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return _c(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function xc(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var Sc=new class extends Ch{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return xc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return xc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function Ac(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function kc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Cc=new class extends Ch{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return x(e)?kc(t,e,i,s):Ac(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?kc(t,e+2*n,i,s):Ac(t,[e[0]+2*n,e[1]+2*n],i,s)}};const wc=new Ve;class Mc{constructor(t,e,i=!1){this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Po(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Po(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{wc.x1=i.bounds.x1*t,wc.y1=i.bounds.y1*t,wc.x2=i.bounds.x2*t,wc.y2=i.bounds.y2*t,e.union(wc)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const Tc=[Mh,Th,Eh,Oh,lc,Lh,Nh,Uh,Yh,Kh,Qh,ec,sc,Dh,rc,cc,uc,gc,mc,Cc,yc,bc,Sc],Bc={};Tc.forEach((t=>{Bc[t.type]=t}));const Ec={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Pc{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Rc(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Rc(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Rc(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Pc(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Pc(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function Lc(t,e){return Fc(t)}function Fc(t,e){const i={};for(let e=0;e{Na.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)}))}function Gc(t,e,i,s=0){return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let Yc=0;function Xc(){return Yc++}var Kc;function $c(t){const e=[];let i=0,s="";for(let n=0;nqc.set(t,!0)));const Zc=new Map;function Jc(t){if(qc.has(t))return!0;if(Zc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Qc(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Zc.set(t,!0)));const td=Xc(),ed=Xc(),id=Xc(),sd=Xc(),nd=Xc(),rd=Xc(),ad=Xc(),od=Xc(),ld=Xc(),hd=Xc(),cd=Xc(),dd=Xc(),ud=Xc(),pd=Xc(),gd=Xc(),fd=Xc(),md=Xc(),vd=Symbol.for("GraphicService"),yd=Symbol.for("GraphicCreator"),_d={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},bd=Object.keys(_d),xd={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Sd=Object.keys(xd),Ad={duration:200,easing:"cubicOut"},kd=Symbol.for("CanvasFactory"),Cd=Symbol.for("Context2dFactory");function wd(t){return function(){var t,e;const i=null===(t=Na.global)||void 0===t?void 0:t.env,s=i?null===(e=Na.canvasFactory)||void 0===e?void 0:e.call(Na,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const Md=1e-4,Td=Math.sqrt(3),Bd=1/3;function Ed(t){return t>-Ud&&tUd||t<-Ud}function Od(t){return"number"==typeof t&&Number.isFinite(t)}const Rd=[0,0],Id=[0,0],Dd=[0,0];function Ld(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Fd(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function zd(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function Hd(t){return(t%=Nt)<0&&(t+=Nt),t}function jd(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Nt);let d=Math.atan2(l,o);return d<0&&(d+=Nt),d>=s&&d<=n||d+Nt>=s&&d+Nt<=n}function Wd(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(Ed(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Yd=[-1,-1,-1],Xd=[-1,-1];function Kd(){const t=Xd[0];Xd[0]=Xd[1],Xd[1]=t}function $d(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Ed(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Bd):Math.pow(i,Bd),s=s<0?-Math.pow(-s,Bd):Math.pow(s,Bd);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+Td*Math.sin(e)))/(3*a),h=(-o+i*(s-Td*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Yd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Kd(),p=zd(e,s,r,o,Xd[0]),u>1&&(g=zd(e,s,r,o,Xd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Ed(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Yd);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=Fd(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Yd[0]=-l,Yd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Nt-1e-4){s=0,n=Nt;const e=r?1:-1;return a>=Yd[0]+t&&a<=Yd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Nt,n+=Nt);let c=0;for(let e=0;e<2;e++){const i=Yd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Nt+t),(t>=s&&t<=n||t+Nt>=s&&t+Nt<=n)&&(t>zt/2&&t<1.5*zt&&(e=-e),c+=e)}}return c}function Jd(t){return Math.round(t/zt*1e8)/1e8%2*zt}function Qd(t,e){let i=Jd(t[0]);i<0&&(i+=Nt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Nt?n=i+Nt:e&&i-n>=Nt?n=i-Nt:!e&&i>n?n=i+(Nt-Jd(i-n)):e&&i1&&(i||(h+=Oe(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,A=b;tu[0]=S,tu[1]=A,Qd(tu,Boolean(a[6])),S=tu[0],A=tu[1];const k=S,C=A-S,w=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case uo.M:u=m,p=v,c=u,d=p;break;case uo.L:if(i){if(Wd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case uo.C:if(i){if(Nd(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=$d(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case uo.Q:if(i){if(jd(c,d,m,v,y,_,e,s,n))return!0}else h+=qd(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case uo.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Vd(m,v,y,k,k+C,w,e,M,n))return!0}else h+=Zd(m,v,y,k,k+C,w,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case uo.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Wd(u,p,o,p,e,s,n)||Wd(o,p,o,l,e,s,n)||Wd(o,l,u,l,e,s,n)||Wd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case uo.Z:if(i){if(Wd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class su{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(su.IsGradientStr(t))try{const e=iu(t)[0];if(e){if("linear"===e.type)return su.ParseLinear(e);if("radial"===e.type)return su.ParseRadial(e);if("conic"===e.type)return su.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2,n=parseFloat(e.value)/180*zt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Nt,stops:su.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:su.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2;let n="angular"===e.type?parseFloat(e.value)/180*zt:0;for(;n<0;)n+=Nt;for(;n>=Nt;)n-=Nt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function au(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ou(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s,t}function lu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n,t}function hu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s,t}function cu(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function du(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function uu(t,e,i){const s=i[0],n=i[1],r=i[2];return t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function pu(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function gu(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],v=s[0],y=s[1],_=s[2],b=i[0],x=i[1],S=i[2];return Math.abs(g-b)0&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Cu),function(t,e,i){return eu(t,0,!1,e,i)}(this.path.commandList,Cu.x,Cu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Cu);const i=nu(this,this.lineWidth,this.dpr);return function(t,e,i,s){return eu(t,e,!0,i,s)}(this.path.commandList,i,Cu.x,Cu.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(ku,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}const Mu={WIDTH:500,HEIGHT:500,DPR:1};class Tu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=Mu.WIDTH,height:n=Mu.HEIGHT,dpr:r=Mu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Bu;Tu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Bu||(Bu={}));class Eu{static Get(t,e=Bu.Color1,i=[0,0,0,1]){if(e===Bu.Color1){const e=Eu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ii.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Eu.store1[t]=e,Eu.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Eu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ii.parseColorString(t);return n&&(Eu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Eu.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Bu.Color1){if(Eu.store1[t])return;Eu.store1[t]=i,Eu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Eu.store255[t])return;Eu.store255[t]=i,Eu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Pu(t,e=!1){return Array.isArray(t)&&x(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Ou(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Ru(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Ru(t,e,i,s,n)}function Ru(t,e,i,s,n){if(!t||!e)return t&&Pu(t)||e&&Pu(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Eu.Get(t,Bu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Eu.Get(e,Bu.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:Pu(a)})))});return o?Ou(r,l,i,s,n):Ou(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return Iu(s,n,i);if("radial"===s.gradient)return Du(s,n,i);if("conical"===s.gradient)return Lu(s,n,i)}return!1}return n&&n(r,a),Pu(Fu(r,a,i),s)}function Iu(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Lu(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Fu(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]}function zu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Eu.store255={},Eu.store1={};const Hu=[0,0,0,0],ju=[0,0,0,0];function Nu(t,e,i){return Eu.Get(t,Bu.Color255,Hu),Eu.Get(e,Bu.Color255,ju),`rgba(${Math.round(Hu[0]+(ju[0]-Hu[0])*i)},${Math.round(Hu[1]+(ju[1]-Hu[1])*i)},${Math.round(Hu[2]+(ju[2]-Hu[2])*i)},${Hu[3]+(ju[3]-Hu[3])*i})`}class Vu{static GetCanvas(){try{return Vu.canvas||(Vu.canvas=Na.global.createCanvas({})),Vu.canvas}catch(t){return null}}static GetCtx(){if(!Vu.ctx){const t=Vu.GetCanvas();Vu.ctx=t.getContext("2d")}return Vu.ctx}}class Wu extends Ge{static getInstance(){return Wu._instance||(Wu._instance=new Wu),Wu._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Vu.GetCanvas(),s=Vu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Wu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Uu{static GetSize(t){for(let e=0;e=t)return Uu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Uu.GenKey(t,e,i,s,n),l=Uu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=Uu.GenKey(t,e,i,s,n);Uu.cache[l]?Uu.cache[l].push({width:a,height:o,pattern:r}):Uu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Gu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Nt;for(;i>Nt;)i-=Nt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),Ou(o.color,l.color,h,!1)}function Yu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Vu.GetCanvas(),d=Vu.GetCtx();if(!d)return null;const u=Uu.GetSize(o),p=Uu.GetSize(l);let g=Uu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Wu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);t++){const e=y.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Uu.Set(e,i,s,r,a,g,u,p),g}Uu.cache={},Uu.ImageSize=[20,40,80,160,320,640,1280,2560];const Xu=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Ku(t){return null==t?void 0:t}class $u{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Ku(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Xu.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:Ku(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function qu(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Zu(t){if(!qu(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Zu(t[i])})),e}function Ju(t,e){var i;const s=null!==(i=Zu(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];qu(n)&&qu(i)?s[t]=Ju(n,i):s[t]=Zu(i)})),s}class Qu{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Zu(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];qu(r)&&qu(n)?t[i]=Ju(r,n):!qu(r)&&qu(a)&&qu(n)?t[i]=Ju(a,n):t[i]=Zu(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?tp.PAINT|tp.BOUNDS|tp.PICK:tp.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?tp.PAINT|tp.BOUNDS:tp.PAINT}};class sp{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:Ad;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:So.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:So.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:So.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const np=new $u;function rp(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,ap(t),!0)}function ap(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=np.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function op(t){if(t)return t.parentScope&&op(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&ap(t),t}function lp(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function hp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function cp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,hp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),lp(null!=e?e:t.ownerStage))}const dp=new Ve,up=new Ue,pp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],gp=["x","y"],fp=["scaleX","scaleY"],mp=["angle"],vp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),yp=new ne,_p=[],bp=tp.PAINT|tp.SHAPE|tp.BOUNDS|tp.TRANSFORM|tp.LAYOUT;function xp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Sp(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Sp(s):s})),i}function Ap(t,e){return t===e||!!(xp(t)||xp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function kp(t,e){var i;const s=null!==(i=Sp(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];xp(n)&&xp(i)?s[t]=kp(n,i):s[t]=Sp(i)})),s}const Cp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class wp extends Ka{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,hp(this.stage,this),lp(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&op(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:So.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(op(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new $u).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Sp(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&xp(n)&&xp(s)?e[t]=kp(n,s):e[t]=Sp(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:Sp(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e){const i=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((s=>{const n=Object.prototype.hasOwnProperty.call(e,s),r=t[s];if(!n)return void(Object.prototype.hasOwnProperty.call(t,s)&&(i.set(s,{prev:r,next:void 0}),delete t[s]));const a=e[s];Ap(r,a)||(i.set(s,{prev:r,next:a}),t[s]=Sp(a))})),i}_syncAttribute(){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const t=this.buildStaticAttributeSnapshot(),e=this.syncObjectToSnapshot(this.attribute,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,e}_syncFinalAttributeFromStaticTruth(){const t=this.finalAttribute;if(!t)return;const e=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(t,e)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=ip[t];return n?n(e,i):null!==(s=ep[t])&&void 0!==s?s:tp.PAINT}(e,i,s):null!==(n=ep[e])&&void 0!==n?n:tp.PAINT;return r&tp.PICK&&(r|=tp.BOUNDS),r===tp.PAINT&&this.needUpdateTag(e)&&(r=tp.SHAPE|tp.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&bp)!==bp?(t&tp.SHAPE?this.addUpdateShapeAndBoundsTag():t&tp.BOUNDS&&this.addUpdateBoundTag(),t&tp.PAINT&&this.addUpdatePaintTag(),t&tp.TRANSFORM&&this.addUpdatePositionTag(),t&tp.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=tp.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&bo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=wp.userSymbolMap[t],e)return e;if(!0===jc(t=Ec[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=y(i.path)?i.path:[i.path];dp.clear();const n=[];s.forEach((t=>{const e=(new wl).fromString(t.d),i={};Sd.forEach((e=>{t[e]&&(i[xd[e]]=t[e])})),n.push({path:e,attribute:i}),dp.union(e.bounds)}));const r=dp.width(),a=dp.height(),o=1/Gt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new Mc(t,n,!0);return wp.userSymbolMap[t]=l,l}const i=(new wl).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Gt(s,n);i.transform(0,0,r,r);const a=new Mc(t,i);return wp.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=ph(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new oo(t);return Po(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&bo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&bo.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&bo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=bo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===xo.GLOBAL){const i=new ne(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===So.STATE||null!=i&&i>=So.ANIMATE_BIND&&i<=So.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===So.STATE||null!=o&&o>=So.ANIMATE_BIND&&o<=So.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!Ap(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:_p,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:So.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:So.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Ad}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:_p,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Sp(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:So.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:So.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:_p,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:_p,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:So.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:So.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:So.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Dl.x,y:e=Dl.y,scaleX:i=Dl.scaleX,scaleY:s=Dl.scaleY,angle:n=Dl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Ut(a),f=Xt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const y=m-i,_=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*y-S*_,t.f=p+h*m+d*v-x*y-A*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),Na.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Dl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=up.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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:Na.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:So.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:So.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=Na.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return v(t,!0)?this.pathProxy=(new wl).fromString(t):this.pathProxy=new wl,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:Na.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new Qa(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):Ka.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:So.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:So.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Na.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new wu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}function Mp(t){return!!t&&("string"==typeof t?!vp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Op=Ep();class Rp{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Bp.forEach((t=>{this._defaultTheme[t]=Object.create(Op[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Bp.forEach((s=>{const n=Object.create(Op[s]);t&&t[s]&&Pp(n,t[s]),i[s]&&Pp(n,i[s]),e[s]&&Pp(n,e[s]),this.combinedTheme[s]=n})),e.common&&Bp.forEach((t=>{Pp(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Ip=new Rp;function Dp(t,e){return t.glyphHost?Dp(t.glyphHost):e?(t.isContainer,e):Lp(t)||t.attachedThemeGraphic&&Dp(t.attachedThemeGraphic)||Ip.getTheme()}function Lp(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)):Ip.getTheme()}return null}const Fp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},zp=["radius","startAngle","endAngle",...pp];class Hp extends wp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=sd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Dp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Na.graphicService.updateTempAABBBounds(i);return Fp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Na.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Nt-Ft?i.set(-r,-r,r,r):mh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,zp)}needUpdateTag(t){return super.needUpdateTag(t,zp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new wl,s.arc(0,0,r,a,o),s}clone(){return new Hp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Hp.NOWORK_ANIMATE_ATTR}}function jp(t){return new Hp(t)}function Np(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Vp(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Wp(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[li(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=li(s);d(t[s])||(e[n]=i(t[s]))})),u(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&v(t.fill)&&(e.color=t.fill),e}Hp.NOWORK_ANIMATE_ATTR=Cp;class Up{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Bl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=md}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Dp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Yp({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Ce(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Na.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Gc(n,o/Math.abs(r+a),!0,l),i.union(n)}return Na.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Na.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,je(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=Na.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Up(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=Na.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),w={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new Up(a,w,C),T=y(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=T.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const t=Np(y,a),e=this.cache.verticalList.length*v,i=Vp(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>$c(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Kc.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const S=Np(y,a),A=x.verticalList.length*v,k=Vp(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=kh(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Gp){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Gp){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Yp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Yp.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Yp.baselineMapAlign}getAlignMapBaseline(){return Yp.alignMapBaseline}}function Xp(t){return new Yp(t)}Yp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Cp),Yp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Yp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Kp=["heightLimit","lineClamp"];class $p extends Yp{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=kh(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=Na.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new Up(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),w=[],M=[0,0];let T=1/0;if(y>0&&(T=Math.max(Math.floor(y/x),1)),b&&(T=Math.min(T,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Gc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Na.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Zp)}needUpdateTag(t){return super.needUpdateTag(t,Zp)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new wl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new wl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Qp(t){return new Jp(t)}Jp.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Cp);const tg=["segments","points","curveType","curveTension",...pp];let eg=class t extends wp{constructor(t={}){super(t),this.type="line",this.numberType=od}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=_h(i,s,e))}getGraphicTheme(){return Dp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Na.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Na.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,tg)}needUpdateTag(t){return super.needUpdateTag(t,tg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new wl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function ig(t){return new eg(t)}eg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const sg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},ng=["width","x1","y1","height","cornerRadius",...pp];class rg extends wp{constructor(t){super(t),this.type="rect",this.numberType=dd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Dp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Na.graphicService.updateTempAABBBounds(i);return Fp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Na.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,ng)}needUpdateTag(t){return super.needUpdateTag(t,ng)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=sg(e);return t=new wl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new rg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rg.NOWORK_ANIMATE_ATTR}}function ag(t){return new rg(t)}rg.NOWORK_ANIMATE_ATTR=Cp;const og=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class lg extends rg{constructor(t){super(t),this.type="rect3d",this.numberType=ud}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Yt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;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,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Dp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new cg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return cg.NOWORK_ANIMATE_ATTR}}function dg(t){return new cg(t)}cg.NOWORK_ANIMATE_ATTR=Cp;const ug=Symbol.for("EnvContribution"),pg=Symbol.for("VGlobal"),gg="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",fg={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"}},mg=!0,vg=!1,yg=/\w|\(|\)|-/,_g=/[.?!,;:/,。?!、;:]/,bg=/\S/,xg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Sg(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Na.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Ag(t,a)),a}function Ag(t,e,i=!1){let s=e;for(;yg.test(t[s-1])&&yg.test(t[s])||_g.test(t[s]);)if(s--,s<=0)return i?kg(t,e):e;return s}function kg(t,e){let i=e;for(;yg.test(t[i+1])&&yg.test(t[i])||_g.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Cg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Na.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class wg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=fg[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Mg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Tg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=kh(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Cg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Cg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Sg(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Cg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Mg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Sg(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Cg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Mg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Mg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Mg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Mg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Sg(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Cg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Bg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...pp];class Eg extends wp{constructor(t){super(t),this.type="image",this.numberType=ad,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Dp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Na.graphicService.updateTempAABBBounds(i);return Fp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Na.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return rh[t]}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}clone(){return new Eg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Eg.NOWORK_ANIMATE_ATTR}}function Pg(t){return new Eg(t)}Eg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Cp);class Og extends Eg{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=ph(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=ph(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=rh.width,height:e=rh.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Rg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Og?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=fg[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Tg){const e=bg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Og)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Cg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||vg;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,xg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||mg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?ru(t,s,{AABBBounds:i}):s,xg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Og)break;const{width:n}=Cg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Og?t.width:t.getWidthWithEllips(this.direction)})),i}}class Ig{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=fg[this.direction]}store(t){if(t instanceof Og){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 Rg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Og?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Sg(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Tg(i,t.newLine,t.character,t.ascentDescentMode),new Tg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Dg=!1;try{Dg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Dg=!1}const Lg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...pp];class Fg extends wp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=pd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:nh.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:nh.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:nh.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:nh.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:nh.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:nh.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:nh.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:nh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Dp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&Fg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&Fg.splitText(t.text).length>1)))}static splitText(t){if(Dg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Fg.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Na.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Na.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Na.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Lg)}needUpdateTag(t){return super.needUpdateTag(t,Lg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!Fg.AllSingleCharacter(y)&&(y=Fg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),w=new wg(0,0,(k?n:S?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&S,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Ig(w);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&w.lines[w.lines.length-1].paragraphs.push(s)):M.deal(s,!0),w.lines.length!==t&&(t=w.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,w.lines[w.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===w.layoutDirection?k:C)){const t=w.getActualSizeWidthEllipsis();let e="horizontal"===w.layoutDirection?t.width:t.height;("horizontal"===w.layoutDirection?S:A)&&(e=Math.min(e,"horizontal"===w.layoutDirection?i:s)),w.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&w.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new Fg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Fg.NOWORK_ANIMATE_ATTR}}function zg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Cp);const Hg=["path","customPath",...pp];class jg extends wp{constructor(t){super(t),this.type="path",this.numberType=ld}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof wl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof wl?this.cache:t.path)}getGraphicTheme(){return Dp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Na.graphicService.updateTempAABBBounds(i);Fp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Na.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new wl).fromString(t.path):t.customPath&&(this.cache=new wl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}toCustomPath(){return(new wl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new jg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return jg.NOWORK_ANIMATE_ATTR}}function Ng(t){return new jg(t)}jg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Cp);const Vg=["segments","points","curveType","curveTension",...pp];class Wg extends wp{constructor(t){super(t),this.type="area",this.numberType=id}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Dp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Na.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Na.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=_h(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new wl;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Wg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wg.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const Gg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...pp];class Yg extends wp{constructor(t){super(t),this.type="arc",this.numberType=td}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(x(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=le(e),i=e+a,s&&Vt(a)>Ft&&Vt(a)Ft&&o>Ft)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=Kt(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Ft&&l>Ft){const i=e>t?1:-1;let s=qt(Number(l)/o*Xt(g)),n=qt(Number(l)/a*Xt(g));return(f-=2*s)>Ft?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Ft?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Dp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Na.graphicService.updateTempAABBBounds(i);Fp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Na.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Ft?i.set(0,0,0,0):Math.abs(o-l)>Nt-Ft?i.set(-s,-s,s,s):(mh(l,o,s,i),mh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Gg)}needUpdateTag(t){return super.needUpdateTag(t,Gg)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Nt-Ft)n.moveTo(0+h*Ut(a),0+h*Xt(a)),n.arc(0,0,h,a,o,!d),l>Ft&&(n.moveTo(0+l*Ut(o),0+l*Xt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Ut(a),e=h*Xt(a),i=l*Ut(o),s=l*Xt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Yg.NOWORK_ANIMATE_ATTR}}function Xg(t){return new Yg(t)}Yg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);const Kg=["width","height","spikes","thickness",...pp];class $g extends wp{constructor(t){super(t),this.type="star",this._cachedPoints=[],this.numberType=gd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e,spikes:i}=this.attribute;return(null==t||t>0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return Dp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=Na.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Na.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new wl,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new $g(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return $g.NOWORK_ANIMATE_ATTR}}function qg(t){return new $g(t)}$g.NOWORK_ANIMATE_ATTR=Cp;class Zg extends Yg{constructor(t){super(t),this.type="arc3d",this.numberType=ed}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),Na.graphicService.updateTempAABBBounds(i),Na.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}var Qg;Zg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Qg||(Qg={}));let tf=class t extends wp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=rd,this._childUpdateTag=bo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(rp(this.sharedStateScope,t),cp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Rp),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Rp)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===xo.GLOBAL){const i=new ne(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&bo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Dl.x,y:e=Dl.y,dx:i=Dl.dx,dy:s=Dl.dy,scaleX:n=Dl.scaleX,scaleY:r=Dl.scaleY,angle:a=Dl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Dp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Na.graphicService.updateTempAABBBounds(i),Na.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=bo.CLEAR_BOUNDS,this._childUpdateTag&=bo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&bo.UPDATE_BOUNDS||(this._childUpdateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:Na.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&bo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Na.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&rp(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return ap({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function ef(t){return new tf(t)}tf.NOWORK_ANIMATE_ATTR=Cp;const sf=["points","cornerRadius",...pp];class nf extends wp{constructor(t){super(t),this.type="polygon",this.numberType=hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Dp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Na.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Na.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=_h(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,sf)}needUpdateTag(t){return super.needUpdateTag(t,sf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new wl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new nf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nf.NOWORK_ANIMATE_ATTR}}function rf(t){return new nf(t)}nf.NOWORK_ANIMATE_ATTR=Cp;class af extends nf{constructor(t){super(t),this.type="pyramid3d",this.numberType=cd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),Na.graphicService.updateTempAABBBounds(i),Na.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,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}getNoWorkAnimateAttr(){return af.NOWORK_ANIMATE_ATTR}}function of(t){return new af(t)}af.NOWORK_ANIMATE_ATTR=Cp;class lf extends tf{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function hf(t){return new lf(t)}class cf{constructor(){this.registry=new Map}create(t,e){const i=this.registry.get(t);if(!i)throw new Error(`GraphicFactory has no creator registered for type "${t}"`);return new i(e)}register(t,e){if(!t)throw new Error("GraphicFactory requires a non-empty graphic type");this.registry.set(t,e)}}const df=new cf;const uf=new class{constructor(){this.store=new Map}registerStore(t,e){this.store.set(t,e),this[t]=e}RegisterGraphicCreator(t,e){pf(t,e)}CreateGraphic(t,e){return this.store.has(t)?gf(t,e):null}};function pf(t,e){if(!t)throw new Error("Graphic registration requires a non-empty graphic type");uf.registerStore(t,e),df.register(t,function(t){return class{constructor(e){try{return new t(e)}catch(i){return t(e)}}}}(e))}function gf(t,e){return df.create(t,e)}function ff(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=m[1];y[2]=null!==(s=m[2])&&void 0!==s?s:0}if(au(t),cu(t,t,[n+o,r+l,a+h]),cu(t,t,[y[0],y[1],y[2]]),ou(t,t,g),lu(t,t,p),cu(t,t,[-y[0],-y[1],y[2]]),uu(t,t,[c,d,u]),f){const i=Au.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}cu(i,i,[s[0],s[1],0]),hu(i,i,f),cu(i,i,[-s[0],-s[1],0]),pu(t,t,i)}}function mf(t){const{alpha:e,beta:i}=t.attribute;return e||i}class vf{constructor(t=uf){this.creator=t,this.hooks={onAttributeUpdate:new za(["graphic"]),onSetStage:new za(["graphic","stage"]),onRemove:new za(["graphic"]),onRelease:new za(["graphic"]),onAddIncremental:new za(["graphic","group","stage"]),onClearIncremental:new za(["graphic","group","stage"]),beforeUpdateAABBBounds:new za(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new za(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new za(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Vp(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Np(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Gc(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Gc(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&je(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}let yf,_f;function bf(t){return yf||(yf=gf("text",{})),yf.initAttributes(t),yf.AABBBounds}function xf(t){return _f||(_f=gf("richtext",{})),_f.setAttributes(t),_f.AABBBounds}const Sf=Symbol.for("TransformUtil"),Af=Symbol.for("GraphicUtil"),kf=Symbol.for("LayerService"),Cf=Symbol.for("StaticLayerHandlerContribution"),wf=Symbol.for("DynamicLayerHandlerContribution"),Mf=Symbol.for("VirtualLayerHandlerContribution"),Tf=Symbol.for("RenderService"),Bf=Symbol.for("BeforeRenderConstribution"),Ef=Symbol.for("AutoEnablePlugins"),Pf=Symbol.for("PluginService"),Of=Symbol.for("GraphicPicker"),Rf=Symbol.for("PickerService"),If=Symbol.for("BoundsPicker"),Df=Symbol.for("GlobalPickerService"),Lf=Symbol.for("PickItemInterceptor"),Ff=Symbol.for("PickServiceInterceptor"),zf=Symbol.for("IncrementalDrawContribution"),Hf=Symbol.for("ArcRender"),jf=Symbol.for("Arc3dRender"),Nf=Symbol.for("AreaRender"),Vf=Symbol.for("CircleRender"),Wf=Symbol.for("GraphicRender"),Uf=Symbol.for("GroupRender"),Gf=Symbol.for("LineRender"),Yf=Symbol.for("PathRender"),Xf=Symbol.for("PolygonRender"),Kf=Symbol.for("RectRender"),$f=Symbol.for("Rect3DRender"),qf=Symbol.for("SymbolRender"),Zf=Symbol.for("TextRender"),Jf=Symbol.for("RichTextRender"),Qf=Symbol.for("Pyramid3dRender"),tm=Symbol.for("GlyphRender"),em=Symbol.for("ImageRender"),im=Symbol.for("RenderSelector"),sm=Symbol.for("DrawContribution"),nm=Symbol.for("StarRender"),rm=Symbol.for("VWindow"),am=Symbol.for("WindowHandlerContribution");function om(t){const e=Na.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class lm extends Ua{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=Na.global,e=om){super(),this.handlerFactory=e,this.hooks={onChange:new za(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=Ha.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&pt(this.width,t.width())&&pt(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class hm{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=wd(Object.assign({nativeCanvas:Na.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=wd(Object.assign({nativeCanvas:Na.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const cm=new hm;class dm{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Na.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=cm.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Hl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Le(Object.assign({defaultFontParams:{fontFamily:Hl.fontFamily,fontSize:Hl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=Na.windowFactory)||void 0===s?void 0:s.call(Na))&&void 0!==n?n:new lm(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var um;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(um||(um={}));const pm=new Ue;class gm{constructor(){this.matrix=new Ue}init(t){return this.mode=um.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=um.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(pm.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(pm.a,pm.b,pm.c,pm.d,pm.e,pm.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(pm.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(pm.a,pm.b,pm.c,pm.d,pm.e,pm.f),this}scale(t,e,i){return this.mode===um.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===um.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return pm.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(pm.a,pm.b,pm.c,pm.d,pm.e,pm.f),this}translate(t,e){return this.mode===um.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===um.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}class fm{constructor(){this.global=Na.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ue(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new ne(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var mm=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function vm(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function ym(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=vm(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=vm(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const xm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Sm{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(Cm(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Dp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){Rm(t,e,i,s)}}const Am=new Sm,km=new Set(["top","center","bottom"]);function Cm(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function wm({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Mm={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Tm({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Mm[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:wm({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Bm(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Em(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:km.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Bm(s,e,"left","center","right"),y:Bm(n,i,"top","center","bottom")}}function Pm(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Om(t){if(!t)return null;const e=Pm(t.naturalWidth,t.videoWidth,t.width),i=Pm(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Rm(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Om(e),{backgroundRepeatMode:m,backgroundSizing:v}=Tm({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Em(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=cm.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),cm.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class Im{constructor(t){this.subRenderContribitions=t,this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}}class Dm{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const Lm=new Dm;class Fm{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const zm=new Fm,Hm={getContributions:()=>[]};class jm{constructor(t=[],e=Hm,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):ym(e,Ul.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ne,this.backupDirtyBounds=new Ne,this.global=null!==(s=i.global)&&void 0!==s?s:Na.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:Na.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:Hm,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Ul.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Ul.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Su.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=bm(e,i,Ul.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Se(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=xm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Su.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),xm.free(n),Su.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||function(){const t=Na.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class Vm{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class Wm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Um{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Gm{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const Ym={getContributions:()=>[]};class Xm{constructor(t=Ym,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new Um}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class Km{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class $m{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Na.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Na.global.getRequestAnimationFrame();this.rafId=t((()=>{Na.global.devicePixelRatio!==this.dpr&&(this.dpr=Na.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Na.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class qm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Na.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Zm=new Ve;class Jm{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&bo.UPDATE_PAINT)||s._updateTag&bo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(Zm.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(Zm,t.parent&&t.parent.globalTransMatrix)))})),t.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let Qm;function tv(){if(null==Qm)try{const t=document.createElement("canvas"),e=t.getContext("2d");Qm=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),Qm&&(Qm=!!document.createElement)}catch(t){Qm=!1}}function ev(){tv();const t=Na.global&&Na.global.env;return t?"browser"===t:Qm}const iv="white";class sv extends tf{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:iv}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,y,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Rp,this.hooks={beforeRender:new za(["stage"]),afterRender:new za(["stage"]),afterClearScreen:new za(["stage"]),afterClearRect:new za(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:Na.global,!this.global.env&&ev()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:Na.windowFactory)&&void 0!==n?n:()=>new lm(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=Na.pickerServiceFactory)&&void 0!==a?a:()=>new fm,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=Na.renderServiceFactory)||void 0===h?void 0:h.call(Na))&&void 0!==c?c:Na.renderService)&&void 0!==d?d:new Nm,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=Na.pluginServiceFactory)||void 0===p?void 0:p.call(Na))&&void 0!==g?g:Na.pluginService)&&void 0!==f?f:new Xm,this.layerService=null!==(y=null!==(m=e.layerService)&&void 0!==m?m:Na.layerService)&&void 0!==y?y:new hv(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:Na.graphicService)&&void 0!==b?b:new vf,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:iv,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,ap(s)),cp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&v(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new ro(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[y,_,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,A=Math.cos(d)*Math.cos(u)*1);const k=ov.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=ov.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=ov.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new Km))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new $m))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new qm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ne;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Jm,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=ov.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=ov.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=ov.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return ap({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new ne(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class nv{constructor(t=sv,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class rv extends tf{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Rp,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Na.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Na.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}class av{constructor(t=rv){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let ov=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function lv(t){const e=Na.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}ov._pluginClasses={};class hv{static GenerateLayerId(){return`${hv.idprefix}_${hv.prefix_count++}`}constructor(t=Na.global,e=new av,i=lv){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:hv.GenerateLayerId(),layerHandler:n})}),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}}hv.idprefix="visactor_layer",hv.prefix_count=0;const cv=Symbol("ContributionProvider");class dv{constructor(t,e){this.serviceIdentifier=t,this.container=e,fv.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function uv(t,e){return new dv(t,e)}function pv(t,e){t(cv).toDynamicValue((({container:t})=>uv(e,t))).inSingletonScope().whenTargetNamed(e)}function gv(t,e){t(cv).toDynamicValue((({container:t})=>uv(e,t))).whenTargetNamed(e)}class fv{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}fv.store=new Map;class mv{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=sh.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Ag(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){at.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Ag(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}}const vv=Symbol.for("TextMeasureContribution");class yv extends mv{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function _v({bind:t}){t(pg).toDynamicValue((({container:t})=>new Ya(uv(ug,t)))).inSingletonScope(),t(rm).to(lm),t(Af).toDynamicValue((({container:t})=>new dm(uv(vv,t)))).inSingletonScope(),t(Sf).to(gm).inSingletonScope(),t(kf).to(hv).inSingletonScope()}function bv({bind:t}){t(Tf).to(Nm)}const xv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===ed,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Nt;for(;o<0;)o+=Nt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};class Sv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class Av{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Dp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Su.allocateByObj(a),u=new ne(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class kv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ne(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class Cv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=xv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function wv({bind:t,isBound:e}){e(Rf)||(t(Df).toSelf(),t(Rf).toService(Df)),t(Cv).toSelf().inSingletonScope(),t(Lf).toService(Cv),t(Av).toSelf().inSingletonScope(),t(Lf).toService(Av),t(kv).toSelf().inSingletonScope(),t(Lf).toService(kv),pv(t,Lf),t(Sv).toSelf().inSingletonScope(),t(Ff).toService(Sv),pv(t,Ff)}function Mv({bind:t}){t(vd).to(vf),t(yd).toConstantValue(uf)}class Tv{constructor(){this.type="static",this.offscreen=!1,this.global=Na.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=wd({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}}function Bv(t){(function({bind:t}){pv(t,ug)})({bind:t.bind}),function({bind:t}){t(vv).to(yv).inSingletonScope(),pv(t,vv)}({bind:t.bind}),function({bind:t}){t(Tv).toSelf(),t(Cf).toService(Tv)}({bind:t.bind})}const Ev=zt/2;function Pv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!$(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Ev,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!$(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Ev,!1)}if(o&&o[2]?o[2](_[0],_[1],S[0],S[1]):t.lineTo(S[0],S[1]),!$(S,A)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Ev,zt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!$(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],zt,zt+Ev,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function Ov(t,e){return!(!t&&!e)}function Rv(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Iv(t,e,i){return i&&t*e>0}function Dv(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Lv(t,e){return t*e>0}function Fv(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function zv(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uE*E+P*P&&(k=w,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function jv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Ut(c),k=n*Xt(c),C=s*Ut(u),w=s*Xt(u);let M,T,B,E;if((b>Ft||_>Ft)&&(M=n*Ut(d),T=n*Xt(d),B=s*Ut(p),E=s*Xt(p),r1?0:P<-1?zt:Math.acos(P))/2),l=Kt(t[0]*t[0]+t[1]*t[1]);S=Yt(b,(s-l)/(o-1)),x=Yt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:B,yirs:E,xore:M,yore:T,xire:C,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Nv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Nt-Ft)e.moveTo(i+n*Ut(o),s+n*Xt(o)),e.arc(i,s,n,o,l,!c),r>Ft&&(e.moveTo(i+r*Ut(l),s+r*Xt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:w,innerDeltaAngle:M,innerEndAngle:T,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:P,maxInnerCornerRadius:O}=jv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Ft){const t=Yt(v,m),r=Yt(y,m),o=Hv(g,f,u,p,n,t,Number(c)),l=Hv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Ut(Wt(l.y01,l.x01)),s+o.cy+m*Xt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ut(Wt(l.y01,l.x01)),s+l.cy+r*Xt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Xt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Ut(C),s+n*Xt(C));if(!(r>Ft)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(w>Ft){const t=Yt(E,w),n=Yt(P,w),o=Hv(S,A,b,x,r,-n,Number(c)),l=Hv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ut(Wt(l.y01,l.x01)),s+l.cy+t*Xt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,T,B,c):e.moveTo(i+r*Ut(B),s+r*Xt(B))}return a?a[3]&&e.lineTo(i+n*Ut(o),s+n*Xt(o)):e.closePath(),d}const Vv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Wv{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=cm.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),cm.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Nt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=cm.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=Qp({}));const C=h.columns?v/h.columns:b,w=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,w-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:Vv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=cm.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),cm.free(l),c}cm.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const Uv=new Wv;class Gv{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{innerPadding:m=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,w-=m;const T=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:nu(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:w-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Nv(t,e,i,s,M+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&T(u,"outerBorder"),f&&T(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:w,startAngle:y,endAngle:_})}}const Yv=new Gv,Xv=Uv,Kv=Am;class $v{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const qv=new $v,Zv=Uv,Jv=Am;class Qv extends Sm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Cm(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const ty=new Qv;class ey{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:M,height:T}=t.attribute;M=(null!=M?M:k-i)||0,T=(null!=T?T:C-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:nu(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,T-o*g)):(e.beginPath(),Pv(e,u,p,M-o*g,T-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}class iy{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}}class sy{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return Pv(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ny=new ey,ry=Uv,ay=Am;class oy extends ey{constructor(){super(...arguments),this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}}const ly=new oy,hy=Am;class cy{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class dy{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const uy=new cy,py=new dy,gy=Uv,fy=Am,my=Uv,vy=Am;class yy extends Wv{constructor(){super(...arguments),this.time=Co.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:bh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:bh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:bh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:bh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class _y{constructor(t){this.groupRenderContribitions=t,this.numberType=rd}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ty)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Dp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:w=l.y}=t.attribute,M=Dv(p,m,g,f,c),T=Fv(p,v,g,f),B=Ov(c,u),E=Rv(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(M||T||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Pv(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ty));const P={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Co.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,M,T,l,n,a,o,P)})),h&&e.clip();const O=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,w-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):T&&(e.setStrokeStyle(t,t.attribute,C-i,w-s,l),e.stroke()))};A?(R(),O()):(O(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Co.afterFillStroke&&r.drawShape(t,e,i,s,B,E,M,T,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Na.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Dp(t,null==s?void 0:s.theme).group,i=Au.allocate(),n=Au.allocate();ff(n,t,e),pu(i,p||i,n),a.modelMatrix=i,Au.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Au.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var by,xy=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(by||(by={}));class Sy extends jm{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=by.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new za([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return xy(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Ul.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Ul.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return xy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return xy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>xy(this,void 0,void 0,(function*(){if(2!==t.count)yield _m(t,Ul.zIndex,((i,s)=>{if(this.status===by.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return xy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return xy(this,void 0,void 0,(function*(){this.rendering&&(this.status=by.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=by.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 xy(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:()=>xy(this,void 0,void 0,(function*(){yield _m(t,Ul.zIndex,(t=>xy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const Ay=Symbol.for("DrawItemInterceptor"),ky=new Ve,Cy=new Ve;class wy{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){ky.copy(s.dirtyBounds),Cy.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Su.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(ky),s.backupDirtyBounds.copy(Cy)),!0}}class My{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}class Ty{constructor(){this.order=1,this.interceptors=[new wy,new Ey,new By,new My]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Au.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const Py=Symbol.for("ArcRenderContribution"),Oy=Symbol.for("AreaRenderContribution"),Ry=Symbol.for("CircleRenderContribution"),Iy=Symbol.for("GroupRenderContribution"),Dy=Symbol.for("ImageRenderContribution"),Ly=Symbol.for("PathRenderContribution"),Fy=Symbol.for("PolygonRenderContribution"),zy=Symbol.for("RectRenderContribution"),Hy=Symbol.for("SymbolRenderContribution"),jy=Symbol.for("TextRenderContribution"),Ny=Symbol.for("StarRenderContribution"),Vy=Symbol.for("CommonRenderContribution"),Wy=Symbol.for("InteractiveSubRenderContribution");function Uy(t){!function({bind:t}){t(Sm).toSelf().inSingletonScope(),t(Wv).toSelf().inSingletonScope(),t(sm).to(jm),t(zf).to(Sy),t(Uf).toDynamicValue((({container:t})=>new _y(uv(Iy,t)))).inSingletonScope(),t(Wf).toService(Uf),pv(t,Iy),pv(t,Wy),t(Im).toDynamicValue((({container:t})=>new Im(uv(Wy,t)))).inSingletonScope(),pv(t,Wf),t(Ty).toSelf().inSingletonScope(),t(Ay).toService(Ty),pv(t,Ay)}({bind:t.bind})}class Gy{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class Yy{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new Gy(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function Xy(){return new Yy}const Ky=Xy();function $y(){$y.__loaded||($y.__loaded=!0,_v({bind:Ky.bind}),Mv({bind:Ky.bind}),bv({bind:Ky.bind}),wv({bind:Ky.bind,isBound:Ky.isBound}),function({bind:t}){t(Pf).to(Xm),gv(t,Ef)}({bind:Ky.bind}),Bv(Ky),Uy(Ky))}function qy(){return Ky}function Zy(t){$y();const[e]=Ky.getAll(t);return e}function Jy(t,e){return $y(),Ky.getNamed(t,e)}function Qy(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}$y.__loaded=!1;const t_=Qy((()=>Zy(pg)));Na.global=t_;const e_=qy(),i_=Qy((()=>Zy(Af))),s_=Qy((()=>Zy(Sf))),n_=Qy((()=>Zy(vd))),r_=Qy((()=>Zy(kf)));function a_(){Na.global=t_,Na.graphicUtil=i_,Na.transformUtil=s_,Na.graphicService=n_,Na.layerService=r_,Na.canvasFactory=t=>Jy(kd,t),Na.context2dFactory=t=>Jy(Cd,t),Na.windowFactory=()=>new lm(Na.global),Na.windowHandlerFactory=t=>function(t){const e=Jy(am,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),Na.renderServiceFactory=()=>Zy(Tf),Na.renderService=Qy((()=>Zy(Tf))),Na.pluginServiceFactory=()=>Zy(Pf),Na.pluginService=Qy((()=>Zy(Pf))),Na.pickerServiceFactory=()=>Zy(Rf),Na.layerHandlerFactory=t=>Zy("static"===t?Cf:"dynamic"===t?wf:Mf),Na.incrementalDrawContributionFactory=()=>Zy(zf)}a_();const o_={x:0,y:0,z:0,lastModelMatrix:null};class l_{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(Lm),e(zm),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Dp(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,y=Iv(d,u,h),_=Lv(d,g),b=Ov(h),x=Rv(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Po(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Iv(o,l,n),p=Lv(o,c),g=Ov(n,r),f=Rv(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;o_.x=n,o_.y=r,o_.z=a,o_.lastModelMatrix=d;const p=u&&(s||mf(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Au.allocate(),n=Au.allocate();ff(n,t,e),pu(s,d||s,n),o_.x=0,o_.y=0,o_.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Au.free(n)}if(g&&!d){const s=t.getOffsetXY(e);o_.x+=s.x,o_.y+=s.y,o_.z=a,i.setTransformForCurrent()}else if(p)o_.x=0,o_.y=0,o_.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);o_.x+=s.x,o_.y+=s.y,this.transformWithoutTranslate(i,o_.x,o_.y,o_.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),o_.x=0,o_.y=0,o_.z=0;return o_}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,f,m,v,y,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Au.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class h_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=td,this.builtinContributions=[Yv,Kv,Xv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nFt){const t=Yt(b,_),r=Yt(x,_),a=Hv(v,y,f,m,n,t,Number(u)),o=Hv(A,k,C,w,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Ft)||T<.001)e.lineTo(i+C,s+w),p=!0;else if(M>Ft){const t=Yt(E,M),n=Yt(P,M),a=Hv(C,w,A,k,r,-n,Number(u)),o=Hv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Ut(B),s+r*Xt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Dp(t,null==r?void 0:r.theme).arc;const{fill:c=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let w=0;const M=(h(S)&&S||S[0])&&"conical"===c.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Nt-Ft){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),T||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Gu(0,0,h,n);a||Iv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}class c_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=sd,this.builtinContributions=[qv,Jv,Zv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}function d_(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=jo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function u_(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function p_(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=u_(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),d_(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Ao.ROW:"y"===s?u=Ao.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function f_(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}class m_ extends l_{constructor(){super(...arguments),this.numberType=od}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();p_(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Cl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Yt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}function v_(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Ao.ROW:Ao.COLUMN,Number.isFinite(c)||(o=Ao.COLUMN),Number.isFinite(d)||(o=Ao.ROW);const u=i*(o===Ao.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),d_(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),d_(t,l,1,s),o=!1):o=!0}t.closePath()}const __=new yy,b_=Am;class x_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=id,this.builtinContributions=[__,b_],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Dp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:w,points:M,segments:T}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===C&&!T&&!M.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,_,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Cl(E(t.points,x),B,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=T[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Cl(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Cl(e,B,{curveTension:b}),n=Cl(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Yt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Ao.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Vt(_.x-b.x),A=Vt(_.y-b.y);x=null==_.x1?Ao.ROW:null==_.y1?Ao.COLUMN:Number.isFinite(S+A)?S>A?Ao.ROW:Ao.COLUMN:Ao.ROW,v_(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),p_(t,i[0]?e.top:e.bottom,l,x===Ao.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const S_=Uv,A_=Am;class k_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ld,this.builtinContributions=[A_,S_],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Dp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)Po(t.pathShape.commandList,e,i,s,1,1,f);else{Po((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}class C_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=dd,this.builtinContributions=[ny,ay,ry],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Dp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:M}=t.attribute;w=(null!=w?w:b-S)||0,M=(null!=M?M:x-A)||0;const T=Dv(g,f,w,M,h),B=Fv(g,v,w,M,C),E=Ov(h,c),P=Rv(d,m);if(!t.valid||!_)return;if(!E&&!P)return;if(!(T||B||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,M)):(e.beginPath(),Pv(e,i,s,w,M,u,"bevel"!==p));const O={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,P,T,B,l,n,a,o,O),k?(this._runStroke(t,e,i,s,l,O,B,S,A,o),this._runFill(t,e,i,s,l,O,T,S,A,a)):(this._runFill(t,e,i,s,l,O,T,S,A,a),this._runStroke(t,e,i,s,l,O,B,S,A,o)),this.afterRenderStep(t,e,i,s,E,P,T,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}class w_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[uy,fy,gy,py],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Dp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,M=s,T=C;const B=e.camera;if(k&&B&&e.project){const t=e.project(i,s,C);e.camera=null,y(c)&&(c[0],c[1]),w=t.x,M=t.y,T=void 0}!1===A.draw(e,c,w,M,T,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const M_=new class extends Sm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:w=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:T=l.backgroundScale,backgroundOffsetX:B=l.backgroundOffsetX,backgroundOffsetY:E=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:O=l.backgroundClip,backgroundCornerRadius:R=l.backgroundCornerRadius}=t.attribute;let I,{background:D}=t.attribute;if(!D)return;const L=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=p(D)&&D.background?D:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(g=z.dx)&&void 0!==g?g:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=xm.allocate(i,s,i+n,s+r),D=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=bf(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const i=t.resources.get(D);if(!i||"success"!==i.state||!i.data)return void L();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,O&&(e.beginPath(),R?Pv(e,F.x1,F.y1,F.width(),F.height(),R,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:w,backgroundKeepAspectRatio:M,backgroundScale:T,backgroundOffsetX:B,backgroundOffsetY:E,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=D,R?(Pv(e,F.x1,F.y1,F.width(),F.height(),R,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&xm.free(F),L()}};class T_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=md,this.builtinContributions=[M_],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Dp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=kh(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:w}=S,M=!f,T=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,w,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,T,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Su.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Su.free(t)}w&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,T))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,T))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,T),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,T)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,T),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,T,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,T,e),this.afterRenderStep(t,e,i,s,C,w,A,k,d,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!d(c),_=y?c.width:i.clipedWidth,b=y?0:Np(u,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}function B_(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?B_(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void B_(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,y=v/m;const _=E_(d,u),b=E_(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=P_(h,y,_,d,u),A=P_(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,w=E_(k,C),M=P_(h,E_(y,v),w,k,C);let T=Math.atan2(S.y-M.y,S.x-M.x);const B=Math.atan2(A.y-M.y,A.x-M.x);let E=B-T;E<0&&(T=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const D_=["","repeat-x","repeat-y","repeat"];function L_(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?D_[i]:"no-repeat"}function F_({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=L_(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const z_={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function H_(t){return{backgroundMode:z_[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function j_({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=F_({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function N_(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=F_({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?H_(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Rm(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class V_ extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ad,this.builtinContributions=[ly,hy],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:_=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:w,doStroke:M}=A;if(!S||!t.resources)return;const T=t.resources.get(S);if("success"!==T.state)return;const B=t.width,E=t.height;e.beginPath();let P=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,B,E):(Pv(e,i,s,B,E,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const O=()=>{w&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),N_(e,T.data,i,s,B,E,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x})))},R=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=j_({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x}),D=P||I;g?(R(),D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,k,!1,l,n,a),O(),D&&e.restore()):(D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,k,!1,l,n,a),O(),D&&e.restore(),R()),this.afterRenderStep(t,e,i,s,w,!1,k,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&v(s))return void oh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Dp(t).image;this._draw(t,a,!1,i)}}var W_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class U_{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return W_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class G_{constructor(){this._uid=Ha.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class Y_{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Eu.Get(e,Bu.Color1),this.ambient=i;const s=Kt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Yt(Gt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=v(e)?Eu.Get(e,Bu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const X_=()=>{ov.registerPlugin("DirectionalLight",Y_)};class K_{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=Au.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Au.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return gu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return fu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return mu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;mu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const $_=()=>{ov.registerPlugin("OrthoCamera",K_)},q_={getContributions:()=>[]},Z_={getContributions:()=>[]};class J_{constructor(t=q_,e=Z_,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:Na.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:q_,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:Z_,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ue(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ne(e.x,e.y),a=Dp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new ne(e.x,e.y);l.transformPoint(a,a);const o=Dp(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&Au.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Su.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class Q_{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new Vm,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new Wm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new Gm,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new Um},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new nv(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new av,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new cf}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new Nm(new jm([],(t=this.registry.contribution,e=Ay,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class tb{constructor(t={}){this.context=new Q_(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function eb(t={}){return new tb(t)}class ib extends tb{}class sb extends tb{}class nb extends x_{constructor(){super(...arguments),this.numberType=id}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Dp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Iv(u,d,c),f=Ov(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=Dp(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=Iv(u,p,c),y=Lv(u,g),_=Ov(c),b=Rv(d,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||a||o))return;const{context:x}=n;for(let n=e;n{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function gb(t,e){let i=hb.get(t);i||(i=new Map,hb.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function fb(t,e,i){const s=gb(t,e);i&&s.forEach((t=>i(t))),s.clear()}function mb(){return db(),ab}function vb(){fv.refreshAllContributions()}function yb(){return db(),null!=ob||(ob=new Ya(uv(ug,ab))),ob}function _b(t){const e=mb(),i=yb();Na.global=i,Na.canvasFactory=t=>e.getNamed(kd,t),Na.context2dFactory=t=>e.getNamed(Cd,t),Na.windowHandlerFactory=t=>ub(am,t),Na.windowFactory=()=>new lm(i,(t=>ub(am,t))),Na.pluginServiceFactory=()=>new Xm(uv(Ef,e),{pluginRegistry:t.context.registry.plugin}),Na.incrementalDrawContributionFactory=()=>new Sy([],new rb,new nb(uv(Oy,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,Ay))}function bb(t){var e;const i=mb();vb();const s=i.getAll(Wf),n=gb(t.registry.renderer,"vrender:runtime-renderer");fb(t.registry.renderer,"vrender:runtime-renderer",null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),pb(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,"vrender:runtime-renderer")}function xb(t){var e;const i=mb();vb();const s=i.getAll(Ay),n=null!==(e=cb.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,Ay,e)})),n.clear(),cb.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(Ay));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(Ay,e),r.add(e)),n.add(e)}))}function Sb(t,e){var i;const s=mb();vb();const n=s.getAll(e),r=gb(t.registry.picker,"vrender:runtime-picker");fb(t.registry.picker,"vrender:runtime-picker",null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),pb(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,"vrender:runtime-picker")}function Ab(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function kb(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function Cb(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function wb(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function Ib(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=sg(t.attribute),n=Lb(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=Lb(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=Lb(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{const i=t.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;n{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return Yb(l,e,h),h},Vb=(t,e)=>{const i=t.attribute,s=i.points;if(s)return jb(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return jb(t,e)}return[]};const Wb=t=>t.map((t=>({x:t.x,y:t.y}))),Ub=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},Gb=t=>{const e=new Ne;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return Ub(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return Ub(t,{x:e.x1,y:n},{x:e.x2,y:n})},Yb=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=Gb(t);Yb(n[0],s,i),Yb(n[1],e-s,i)}},Xb=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:Wb(i)}];const s=[];return Yb(i,e,s),s},Kb=(t,e)=>{const i=Rb(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;rObject.assign({},t))):[]}function qb(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:$b(t.touches),configurable:!0},changedTouches:{value:$b(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function Zb(t,e){try{return t[e]}catch(t){return}}function Jb(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=qb(t),l=Zb(t,"target"),h=Zb(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var Qb=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function ix(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class sx{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:ex(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},tx(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},tx(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=Qb(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=ex(i,this.selectionStartCursorIdx),a=ex(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=tx(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=ix(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),Na.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),Na.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class nx{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=ex(i,Math.ceil(t)),n=ex(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=ex(i.attribute.textConfig,a),h=ex(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(rx,[this.formatTextCommandCb]),this.commandCbs.set(ax,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):p(t)&&e.forEach((e=>z(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new sx,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),Na.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(Na.global.isMacOS()&&t.metaKey&&"c"===t.key||!Na.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return Na.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(Na.global.isMacOS()&&t.metaKey&&"a"===t.key||!Na.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},tx(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=zg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:xf(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||ag({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},tx(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),Na.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=ef({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,ox.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=ig({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=ef({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=xf(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=xf(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(ag({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(ag({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(ag({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=xf(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=xf(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:xf(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Mx=new Cx;function Tx(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Bx=new WeakSet;function Ex({bind:t}){Tx(Bx,t)||(t(h_).toDynamicValue((({container:t})=>new h_(uv(Py,t)))).inSingletonScope(),t(Hf).toService(h_),t(Wf).toService(Hf),t(Py).toService(Im),pv(t,Py))}const Px=Ex,Ox=new WeakSet;function Rx({bind:t}){Tx(Ox,t)||(t(C_).toDynamicValue((({container:t})=>new C_(uv(zy,t)))).inSingletonScope(),t(Kf).toService(C_),t(Wf).toService(Kf),t(sy).toSelf(),t(iy).toSelf(),t(zy).toService(sy),t(zy).toService(iy),t(zy).toService(Im),pv(t,zy))}const Ix=Rx,Dx=new WeakSet;function Lx({bind:t}){Tx(Dx,t)||(t(m_).toDynamicValue((()=>new m_)).inSingletonScope(),t(Gf).toService(m_),t(Wf).toService(Gf))}const Fx=Lx,zx=new WeakSet;function Hx({bind:t}){Tx(zx,t)||(t(x_).toDynamicValue((({container:t})=>new x_(uv(Oy,t)))).inSingletonScope(),t(Nf).toService(x_),t(Wf).toService(Nf),t(Oy).toService(Im),pv(t,Oy))}const jx=Hx,Nx=new WeakSet;function Vx({bind:t}){Tx(Nx,t)||(t(w_).toDynamicValue((({container:t})=>new w_(uv(Hy,t)))).inSingletonScope(),t(qf).toService(w_),t(Wf).toService(qf),t(Hy).toService(Im),pv(t,Hy))}const Wx=Vx,Ux=new WeakSet;function Gx({bind:t}){Tx(Ux,t)||(t(c_).toDynamicValue((({container:t})=>new c_(uv(Ry,t)))).inSingletonScope(),t(Vf).toService(c_),t(Wf).toService(Vf),t(Ry).toService(Im),pv(t,Ry))}const Yx=Gx,Xx=new WeakSet;function Kx({bind:t}){Tx(Xx,t)||(t(Zf).toDynamicValue((({container:t})=>new T_(uv(jy,t)))).inSingletonScope(),t(Wf).toService(Zf),t(jy).toService(Im),pv(t,jy))}const $x=Kx,qx=new WeakSet;function Zx({bind:t}){Tx(qx,t)||(t(k_).toDynamicValue((({container:t})=>new k_(uv(Ly,t)))).inSingletonScope(),t(Yf).toService(k_),t(Wf).toService(Yf),t(Ly).toService(Im),pv(t,Ly))}const Jx=Zx,Qx=new WeakSet;function tS({bind:t}){Tx(Qx,t)||(t(Xf).toDynamicValue((({container:t})=>new I_(uv(Fy,t)))).inSingletonScope(),t(Wf).toService(Xf),t(Fy).toService(Im),pv(t,Fy))}const eS=tS;class iS extends l_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=gd,this.builtinContributions=[vy,my],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const sS=new WeakSet;function nS({bind:t}){Tx(sS,t)||(t(iS).toDynamicValue((({container:t})=>new iS(uv(Ny,t)))).inSingletonScope(),t(nm).toService(iS),t(Wf).toService(nm),pv(t,Ny))}const rS=nS;class aS{constructor(){this.numberType=nd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Dp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const oS=new WeakSet;function lS({bind:t}){Tx(oS,t)||(t(aS).toDynamicValue((()=>new aS)).inSingletonScope(),t(tm).toService(aS),t(Wf).toService(tm))}const hS=lS;class cS extends l_{constructor(){super(),this.numberType=pd,this.builtinContributions=[M_],this.init()}drawShape(t,e,i,s,n){const r=Dp(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Iv(o,l,!0),d=Iv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Dp(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,y)):(e.beginPath(),Pv(e,i-t,s-n,v,y,f,!0)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,s,o,l))}draw(t,e,i){const s=Dp(t).richtext;this._draw(t,s,!1,i)}}const dS=new WeakSet;function uS({bind:t}){Tx(dS,t)||(t(cS).toDynamicValue((()=>new cS)).inSingletonScope(),t(Jf).toService(cS),t(Wf).toService(Jf))}const pS=uS,gS=new WeakSet;function fS({bind:t}){Tx(gS,t)||(t(em).toDynamicValue((({container:t})=>new V_(uv(Dy,t)))).inSingletonScope(),t(Wf).toService(em),t(Dy).toService(Im),pv(t,Dy))}const mS=fS;class vS extends l_{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Eu.Get(r,Bu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[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+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class yS extends vS{constructor(){super(...arguments),this.type="rect3d",this.numberType=ud}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=Dp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,w=Dv(v,y,A,k,d),M=Fv(v,b,A,k,S),T=Ov(d),B=Rv(u,_);if(!t.valid||!x)return;if(!T&&!B)return;if(!(w||M||a||o))return;const{light:E}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,E,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=Dp(t).rect;this._draw(t,s,!1,i)}}const _S=new WeakSet;function bS({bind:t}){Tx(_S,t)||(t(yS).toDynamicValue((()=>new yS)).inSingletonScope(),t($f).toService(yS),t(Wf).toService($f))}const xS=bS;class SS extends l_{constructor(){super(...arguments),this.numberType=ed}drawShape(t,e,i,s,n,r,a,o){var l;const h=Dp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Eu.Get(c,Bu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},w={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Nt-Ft)e.moveTo(i+r*Ut(o),s+r*Xt(o),n),e.arc(i,s,r,o,l,!c,n),a>Ft&&(e.moveTo(i+a*Ut(l),s+a*Xt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Ut(p),y=r*Xt(p),_=a*Ut(f),b=a*Xt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>Ft)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(w[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Nt,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=Ft)e.moveTo(i,s,n);else if(c>=Nt-Ft)e.moveTo(i+a*Ut(l),s+a*Xt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Ut(h),s+a*Xt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Ut(c),f=a*Xt(c),m=a*Ut(p),v=a*Xt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(w[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const AS=new WeakSet;function kS({bind:t}){Tx(AS,t)||(t(SS).toDynamicValue((()=>new SS)).inSingletonScope(),t(jf).toService(SS),t(Wf).toService(jf))}const CS=kS;class wS extends vS{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=cd}drawShape(t,e,i,s,n,r,a,o){var l;const h=Dp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=Dp(t).polygon;this._draw(t,s,!1,i)}}const MS=new WeakSet;function TS({bind:t}){Tx(MS,t)||(t(wS).toDynamicValue((()=>new wS)).inSingletonScope(),t(Qf).toService(wS),t(Wf).toService(Qf))}const BS=TS;function ES(){pf("arc",Xg)}function PS(){pf("arc3d",Jg)}function OS(){pf("area",Ug)}function RS(){pf("circle",jp)}function IS(){pf("glyph",dg)}function DS(){pf("group",ef)}function LS(){pf("image",Pg)}function FS(){pf("line",ig)}function zS(){pf("path",Ng)}function HS(){pf("polygon",rf)}function jS(){pf("star",qg)}function NS(){pf("pyramid3d",of)}function VS(){pf("rect",ag)}function WS(){pf("rect3d",hg)}function US(){pf("richtext",zg)}function GS(){pf("symbol",Qp)}function YS(){pf("text",Xp)}function XS(){pf("shadowRoot",hf)}function KS(){pf("wrapText",qp)}class $S{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?Na.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Na.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Wp("text"===t.type&&t.attribute?t.attribute:Dp(t).text)}getTransformOfText(t){const e=Dp(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const u=t.globalAABBBounds;let g=n.anchorType;if(d(g)&&(g="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===g&&(g="top-left"),"position"===g||u.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=Fe(u,g);l=t.x,h=t.y}const f=Na.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),y=e.viewBox,_=l+m.left-f.left+y.x1,b=h+m.top-f.top+y.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===g&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),c(n.style)){const e=n.style({top:b,left:_,width:u.width(),height:u.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else p(n.style)?o=Object.assign(Object.assign({},o),n.style):v(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));Na.global.updateDom(i,{width:n.width,height:n.height,style:o})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===Na.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Ul.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Ul.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&Na.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=d(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===Na.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const qS=()=>{ov.registerPlugin("HtmlAttributePlugin",$S)};class ZS extends $S{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?Na.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&Na.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=d(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const JS=()=>{ov.registerPlugin("ReactAttributePlugin",ZS)};class QS{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/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,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}const tA=()=>{ov.registerPlugin("ViewTransform3dPlugin",QS)},eA=new Ve;class iA{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Ha.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Dp(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},f=g.main,m=g.cross;"column"!==r&&"column-reverse"!==r||(f.len=d,m.len=c,f.field="y",m.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,y=0;const _=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===f.field?e.width():e.height(),s="x"===m.field?e.width():e.height();_.push({mainLen:i,crossLen:s}),v+=i,y=Math.max(y,s)}));const b=[];if(v>f.len&&"wrap"===a){let t=0,e=0;_.forEach((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),b.push({idx:_.length-1,mainLen:t,crossLen:e})}else b.push({idx:_.length-1,mainLen:v,crossLen:y});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,f,_,x,t),x=t.idx+1})),y=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":m.len,center:m.len/2};this.layoutCross(p,o,m,t,_,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(m.len-y)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",m,s,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(m.len-y)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(m.len-y)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&eA.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(eA.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const sA=()=>{ov.registerPlugin("FlexLayoutPlugin",iA)};var nA=Object.freeze({__proto__:null,ARC3D_NUMBER_TYPE:ed,ARC_NUMBER_TYPE:td,AREA_NUMBER_TYPE:id,AbstractGraphicRender:class{},get AnimateMode(){return El},get AnimateStatus(){return Rl},get AnimateStepType(){return Ol},AppContext:Q_,Application:ja,Arc:Yg,Arc3d:Zg,Arc3dRender:jf,ArcRender:Hf,ArcRenderContribution:Py,Area:Wg,AreaRender:Nf,AreaRenderContribution:Oy,get AttributeUpdateType(){return So},AutoEnablePlugins:Ef,BaseCanvas:Tu,BaseEnvContribution:U_,BaseRender:l_,get BaseRenderContributionTime(){return Co},BaseWindowHandlerContribution:G_,Basis:Jo,BeforeRenderConstribution:Bf,BoundsContext:oo,BoundsPicker:If,BrowserEntry:tb,CIRCLE_NUMBER_TYPE:sd,Canvas3DDrawItemInterceptor:Ey,Canvas3DPickItemInterceptor:Cv,CanvasFactory:kd,CanvasTextLayout:Up,Circle:Hp,CircleRender:Vf,CircleRenderContribution:Ry,ColorInterpolate:Wu,ColorStore:Eu,get ColorType(){return Bu},CommonDrawItemInterceptorContribution:Ty,CommonRenderContribution:Vy,Context2dFactory:Cd,ContributionProvider:cv,ContributionRegistry:Gm,ContributionStore:fv,CubicBezierCurve:No,CurveContext:kl,get CurveTypeEnum(){return ko},CustomEvent:Qa,CustomPath2D:wl,CustomSymbolClass:Mc,DEFAULT_TEXT_FONT_FAMILY:gg,DebugDrawItemInterceptorContribution:My,DefaultArcAllocate:dx,DefaultArcAttribute:Gl,DefaultArcRenderContribution:Gv,DefaultAreaAllocate:px,DefaultAreaAttribute:Yl,DefaultAreaTextureRenderContribution:yy,DefaultAttribute:Ul,DefaultBaseBackgroundRenderContribution:Sm,DefaultBaseClipRenderAfterContribution:Fm,DefaultBaseClipRenderBeforeContribution:Dm,DefaultBaseInteractiveRenderContribution:Im,DefaultBaseTextureRenderContribution:Wv,DefaultCanvasAllocate:hm,DefaultCanvasArcRender:h_,DefaultCanvasAreaRender:x_,DefaultCanvasCircleRender:c_,DefaultCanvasGroupRender:_y,DefaultCanvasImageRender:V_,DefaultCanvasLineRender:m_,DefaultCanvasPathRender:k_,DefaultCanvasPolygonRender:I_,DefaultCanvasRectRender:C_,DefaultCanvasSymbolRender:w_,DefaultCanvasTextRender:T_,DefaultCircleAllocate:fx,DefaultCircleAttribute:Xl,DefaultCircleRenderContribution:$v,DefaultConnectAttribute:Vl,DefaultDebugAttribute:Wl,DefaultFillStyle:Ll,DefaultGlobal:Ya,DefaultGlobalPickerService:fm,DefaultGlyphAttribute:$l,DefaultGraphicAllocate:lx,DefaultGraphicMemoryManager:Cx,DefaultGraphicService:vf,DefaultGraphicUtil:dm,DefaultGroupAttribute:Kl,DefaultGroupBackgroundRenderContribution:Qv,DefaultImageAttribute:rh,DefaultImageRenderContribution:oy,DefaultLayerService:hv,DefaultLayout:Il,DefaultLineAllocate:vx,DefaultLineAttribute:ql,DefaultMat4Allocate:xu,DefaultMatrixAllocate:bu,DefaultPathAllocate:_x,DefaultPathAttribute:Zl,DefaultPickService:J_,DefaultPickStyle:jl,DefaultPolygonAttribute:Jl,DefaultRect3dAttribute:eh,DefaultRectAllocate:hx,DefaultRectAttribute:th,DefaultRectRenderContribution:ey,DefaultRenderService:Nm,DefaultRichTextAttribute:nh,DefaultRichTextIconAttribute:ah,DefaultStarAttribute:Ql,DefaultStrokeStyle:zl,DefaultStyle:Nl,DefaultSymbolAllocate:xx,DefaultSymbolAttribute:ih,DefaultSymbolClipRangeStrokeRenderContribution:dy,DefaultSymbolRenderContribution:cy,DefaultTextAllocate:Ax,DefaultTextAttribute:sh,DefaultTextMeasureContribution:yv,DefaultTextStyle:Hl,DefaultTransform:Dl,DefaultTransformUtil:gm,DefaultWindow:lm,get Direction(){return Ao},DirectionalLight:Y_,DrawContribution:sm,DrawItemInterceptor:Ay,DynamicLayerHandlerContribution:wf,get Edge(){return hh},EditModule:sx,EmptyContext2d:wu,EnvContribution:ug,EventManager:io,EventSystem:ro,EventTarget:so,FORMAT_ALL_TEXT_COMMAND:ax,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:rx,Factory:ov,FederatedEvent:$a,FederatedMouseEvent:qa,FederatedPointerEvent:Za,FederatedWheelEvent:Ja,FlexLayoutPlugin:iA,GLYPH_NUMBER_TYPE:nd,GRAPHIC_UPDATE_TAG_KEY:pp,GROUP_NUMBER_TYPE:rd,Generator:Ha,GlobalPickerService:Df,Glyph:cg,GlyphRender:tm,GradientParser:su,Graphic:wp,GraphicCreator:yd,GraphicFactory:cf,GraphicPicker:Of,GraphicRender:Wf,GraphicService:vd,GraphicUtil:Af,Group:tf,GroupRender:Uf,GroupRenderContribution:Iy,get GroupUpdateAABBBoundsMode(){return Qg},HtmlAttributePlugin:$S,get IContainPointMode(){return xo},IMAGE_NUMBER_TYPE:ad,Image:Eg,ImageRender:em,ImageRenderContribution:Dy,IncrementalDrawContribution:zf,InteractiveDrawItemInterceptorContribution:By,InteractivePickItemInterceptorContribution:kv,InteractiveSubRenderContribution:Wy,LINE_NUMBER_TYPE:od,Layer:rv,LayerFactory:av,LayerService:kf,Line:eg,LineRender:Gf,Linear:Ko,LinearClosed:ml,Mat4Allocate:yu,MatrixAllocate:vu,get MeasureModeEnum(){return Bl},MiniappEntry:sb,MonotoneX:rl,MonotoneY:al,NOWORK_ANIMATE_ATTR:Cp,Node:Ka,NodeEntry:ib,OrthoCamera:K_,PATH_NUMBER_TYPE:ld,POLYGON_NUMBER_TYPE:hd,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:cd,Path:jg,PathRender:Yf,PathRenderContribution:Ly,PerformanceRAF:Wa,PickItemInterceptor:Lf,PickServiceInterceptor:Ff,PickerRegistry:Wm,PickerService:Rf,PluginRegistry:Um,PluginService:Pf,Polygon:nf,PolygonRender:Xf,PolygonRenderContribution:Fy,Pyramid3d:af,Pyramid3dRender:Qf,RECT3D_NUMBER_TYPE:ud,RECT_NUMBER_TYPE:dd,RICHTEXT_NUMBER_TYPE:pd,RafBasedSTO:xh,ReactAttributePlugin:ZS,Rect:rg,Rect3DRender:$f,Rect3d:lg,RectRender:Kf,RectRenderContribution:zy,ReflectSegContext:Go,RenderSelector:im,RenderService:Tf,RendererRegistry:Vm,ResourceLoader:oh,RichText:Fg,RichTextEditPlugin:ox,RichTextRender:Jf,STAR_NUMBER_TYPE:gd,get STATUS(){return Pl},SVG_ATTRIBUTE_MAP:_d,SVG_ATTRIBUTE_MAP_KEYS:bd,SVG_PARSE_ATTRIBUTE_MAP:xd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Sd,SYMBOL_NUMBER_TYPE:fd,SegContext:Uo,ShadowPickServiceInterceptorContribution:Sv,ShadowRoot:lf,ShadowRootDrawItemInterceptorContribution:wy,ShadowRootPickItemInterceptorContribution:Av,SplitRectAfterRenderContribution:sy,SplitRectBeforeRenderContribution:iy,Stage:sv,StageFactory:nv,Star:$g,StarRender:nm,StarRenderContribution:Ny,StateDefinitionCompiler:$u,StateEngine:Qu,StaticLayerHandlerContribution:Cf,Step:dl,StepClosed:ul,Symbol:Jp,SymbolRender:qf,SymbolRenderContribution:Hy,TEXT_NUMBER_TYPE:md,Text:Yp,get TextDirection(){return Kc},TextMeasureContribution:vv,TextRender:Zf,TextRenderContribution:jy,Theme:Rp,TransformUtil:Sf,get UpdateTag(){return bo},VGlobal:pg,VWindow:rm,ViewTransform3dPlugin:QS,VirtualLayerHandlerContribution:Mf,WILDCARD:"*",WindowHandlerContribution:am,WrapText:$p,XMLParser:Vc,_calculateLineHeight:Ah,_interpolateColor:Ru,addArcToBezierPath:Bo,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:Ob,alignSubpath:wb,application:Na,applyTransformOnBezierCurves:Ib,arc3dModule:CS,arcModule:Px,areaModule:jx,bezier:Mo,bezierCurversToPath:Db,binarySplitPolygon:Gb,bindArc3dRenderModule:kS,bindArcRenderModule:Ex,bindAreaRenderModule:Hx,bindCircleRenderModule:Gx,bindContributionProvider:pv,bindContributionProviderNoSingletonScope:gv,bindGlyphRenderModule:lS,bindImageRenderModule:fS,bindLineRenderModule:Lx,bindPathRenderModule:Zx,bindPolygonRenderModule:tS,bindPyramid3dRenderModule:TS,bindRect3dRenderModule:bS,bindRectRenderModule:Rx,bindRichtextRenderModule:uS,bindStarRenderModule:nS,bindSymbolRenderModule:Vx,bindTextRenderModule:Kx,boundStroke:Gc,builtInSymbolStrMap:Ec,builtinSymbols:Tc,builtinSymbolsMap:Bc,calcLineCache:Cl,calculateArcCornerRadius:jv,calculateLineHeight:kh,canvasAllocate:cm,centroidOfSubpath:Bb,circleBounds:mh,circleModule:Yx,clock:to,colorEqual:function(t,e){const i=ii.parseColorString(t),s=ii.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:Nu,configureRuntimeApplicationForApp:_b,container:e_,cornerTangents:Hv,createApp:eb,createArc:Xg,createArc3d:Jg,createArea:Ug,createBrowserApp:eb,createCanvasEventTransformer:function(t,e,i,s){return Jb(t.parentElement,e,i,s)},createCircle:jp,createColor:ru,createConicalGradient:Yu,createContributionProvider:uv,createEventTransformer:Jb,createGlyph:dg,createGraphic:gf,createGroup:ef,createImage:Pg,createLine:ig,createMat4:_u,createMiniappApp:function(t={}){return new sb(t)},createNodeApp:function(t={}){return new ib(t)},createPath:Ng,createPolygon:rf,createPyramid3d:of,createRect:ag,createRect3d:hg,createRectPath:Pv,createRichText:zg,createShadowRoot:hf,createStage:function(t){return a_(),(new nv).create(t)},createStar:qg,createSymbol:Qp,createText:Xp,createWrapText:qp,cubicCalc:Do,cubicLength:Io,cubicPointAt:Lo,cubicSubdivide:Cb,defaultArcAllocate:ux,defaultArcBackgroundRenderContribution:Kv,defaultArcRenderContribution:Yv,defaultArcTextureRenderContribution:Xv,defaultAreaAllocate:gx,defaultBaseBackgroundRenderContribution:Am,defaultBaseClipRenderAfterContribution:zm,defaultBaseClipRenderBeforeContribution:Lm,defaultBaseTextureRenderContribution:Uv,defaultCircleAllocate:mx,defaultCircleBackgroundRenderContribution:Jv,defaultCircleRenderContribution:qv,defaultCircleTextureRenderContribution:Zv,defaultGraphicMemoryManager:Mx,defaultGroupBackgroundRenderContribution:ty,defaultImageBackgroundRenderContribution:hy,defaultImageRenderContribution:ly,defaultLineAllocate:yx,defaultPathAllocate:bx,defaultRectAllocate:cx,defaultRectBackgroundRenderContribution:ay,defaultRectRenderContribution:ny,defaultRectTextureRenderContribution:ry,defaultStarBackgroundRenderContribution:vy,defaultStarTextureRenderContribution:my,defaultSymbolAllocate:Sx,defaultSymbolBackgroundRenderContribution:fy,defaultSymbolClipRangeStrokeRenderContribution:py,defaultSymbolRenderContribution:uy,defaultSymbolTextureRenderContribution:gy,defaultTextAllocate:kx,diff:kb,divideCubic:jo,drawArc:To,drawArcPath:Nv,drawAreaSegments:v_,drawBackgroundImage:Rm,drawImageWithLayout:N_,drawIncrementalAreaSegments:f_,drawIncrementalSegments:g_,drawSegments:p_,enumCommandMap:uo,fillVisible:Iv,findBestMorphingRotation:Pb,findConfigIndexByCursorIdx:ex,findCursorIdxByConfigIndex:ix,findNextGraphic:bm,flatten_simplify:Ab,foreach:ym,foreachAsync:_m,genBasisSegments:tl,genBasisTypeSegments:Qo,genLinearClosedSegments:vl,genLinearClosedTypeSegments:yl,genLinearSegments:$o,genLinearTypeSegments:qo,genMonotoneXSegments:ll,genMonotoneXTypeSegments:ol,genMonotoneYSegments:cl,genMonotoneYTypeSegments:hl,genNumberType:Xc,genStepClosedSegments:fl,genStepSegments:pl,genStepTypeSegments:gl,getAttributeFromDefaultAttrList:bh,getBackgroundImage:Cm,getConicGradientAt:Gu,getCurrentEnv:function(){return ev()?"browser":"node"},getDefaultCharacterConfig:tx,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Np(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Au.allocate();return cu(o,o,[a[0],a[1],0]),n&&ou(o,o,n),s&&lu(o,o,s),cu(o,o,[-a[0],-a[1],0]),o},getLegacyBindingContext:qy,getModelMatrix:ff,getRichTextBounds:xf,getRuntimeInstallerBindingContext:mb,getRuntimeInstallerGlobal:yb,getScaledStroke:nu,getTextBounds:bf,getTheme:Dp,getThemeFromGroup:Lp,globalTheme:Ip,glyphModule:hS,graphicCreator:uf,graphicService:n_,graphicUtil:i_,identityMat4:au,imageModule:mS,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeDrawContributionsToApp:xb,installRuntimeGraphicRenderersToApp:bb,installRuntimePickersToApp:Sb,interpolateColor:Ou,interpolateGradientConicalColor:Lu,interpolateGradientLinearColor:Iu,interpolateGradientRadialColor:Du,interpolatePureColorArray:Fu,interpolatePureColorArrayToStr:zu,intersect:zv,isBrowserEnv:ev,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){tv();const t=Na.global&&Na.global.env;return t?"node"===t:!Qm},isSvg:jc,isXML:Nc,layerService:r_,lineModule:Fx,lookAt:gu,mapToCanvasPointForCanvas:function(t){var e;if(Od(t._canvasX)&&Od(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:du,mat4Allocate:Au,matrixAllocate:Su,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i.c,b=i.d,x=0,S=0,t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=0,b=0,x=1,S=0,t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i.e,b=i.f,x=0,S=1,t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t},multiplyMat4Mat4:pu,newThemeObj:Ep,ortho:fu,parsePadding:ph,parseStroke:dh,parseSvgPath:_o,pathModule:Jx,pathToBezierCurves:Rb,point:Zo,pointEqual:vh,pointInterpolation:yh,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Zt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Zt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>vh(t,e[i]))):!Number.isNaN(t.x+t.y)&&vh(t,e))},pointsInterpolation:_h,polygonModule:eS,preLoadAllModule:$y,pyramid3dModule:BS,quadCalc:Fo,quadLength:Ho,quadPointAt:zo,rafBasedSto:Sh,rect3dModule:xS,rectFillVisible:Dv,rectModule:Ix,rectStrokeVisible:Fv,recursiveCallBinarySplit:Yb,refreshRuntimeInstallerContributions:vb,registerArc3dGraphic:PS,registerArcGraphic:ES,registerAreaGraphic:OS,registerCircleGraphic:RS,registerDirectionalLight:X_,registerFlexLayoutPlugin:sA,registerGlobalEventTransformer:function(t,e,i,s,n){const r=Jb(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:IS,registerGraphic:pf,registerGroupGraphic:DS,registerHtmlAttributePlugin:qS,registerImageGraphic:LS,registerLineGraphic:FS,registerOrthoCamera:$_,registerPathGraphic:zS,registerPolygonGraphic:HS,registerPyramid3dGraphic:NS,registerReactAttributePlugin:JS,registerRect3dGraphic:WS,registerRectGraphic:VS,registerRichtextGraphic:US,registerShadowRootGraphic:XS,registerStarGraphic:jS,registerSymbolGraphic:GS,registerTextGraphic:YS,registerViewTransform3dPlugin:tA,registerWindowEventTransformer:function(t,e,i,s,n){const r=Jb(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:KS,renderCommandList:Po,resolveBackgroundDrawMode:Tm,resolveBackgroundParamsByImageSizing:H_,resolveBackgroundPosition:Em,resolveBackgroundSizing:wm,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:F_,resolveImageRepeatMode:L_,resolveRenderableImageSize:Om,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:pS,rotateX:ou,rotateY:lu,rotateZ:hu,runFill:Ov,runStroke:Rv,scaleMat4:uu,segments:wo,shouldClipImageByLayout:j_,shouldUseMat4:mf,snapLength:Ro,splitArc:zb,splitArea:Nb,splitCircle:Hb,splitLine:Vb,splitPath:Kb,splitPolygon:Xb,splitRect:Fb,splitToGrids:Lb,starModule:rS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Lv,symbolModule:Wx,textAttributesToStyle:Wp,textDrawOffsetX:Np,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Vp,textModule:$x,transformMat4:mu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:s_,translate:cu,verticalLayout:$c,vglobal:t_,waitForAllSubLayers:Uc,wrapCanvas:wd,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=Na.global)||void 0===t?void 0:t.env,s=i?null===(e=Na.context2dFactory)||void 0===e?void 0:e.call(Na,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=y(t)?t[0]:t,i=[];if(!e)return i;if(!0===Nc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Qc(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Qc(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});function rA(t){const e=[];for(let i=0;i=0&&n>=0&&sat.getInstance().info(`[VChart log]: ${t}`,...e),lA=(t,e)=>(c(cA.warnHandler)&&cA.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),hA=(t,e,i)=>{if(!c(cA.errorHandler))throw new Error(t);cA.errorHandler.call(null,t,e)},cA={silent:!1,warnHandler:!1,errorHandler:!1},dA=ev(),uA=dA&&globalThis?globalThis.document:void 0;function pA(t){return("desktop-browser"===t||"mobile-browser"===t)&&dA}function gA(t){return fA(t)||"mobile-browser"===t}function fA(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let mA=0;function vA(){return mA>=9999999&&(mA=0),mA++}function yA(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function _A(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&y(t[0].fields))}function bA(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&bA(t,e)}))}const xA=t=>!d(t)&&!1!==t.visible;function SA(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function AA(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const CA=["#ffffff","#000000"];function wA(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ii(t).toHex(),o=new ii(e).toHex();return MA(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...CA);for(const n of a)if(t!==n&&MA(n,e,i,s,r))return n}(a,o,i,s,n,r)}function MA(t,e,i,s,n){if("lightness"===n){const i=ii.getColorBrightness(new ii(e));return ii.getColorBrightness(new ii(t))<.5?i>=.5:i<.5}return s?TA(t,e)>s:"largeText"===i?TA(t,e)>3:TA(t,e)>4.5}function TA(t,e){const i=BA(t),s=BA(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function BA(t){const e=ni(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function EA(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function PA(t,e){return[t[0]*e,t[1]*e]}function OA(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function RA(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Jt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const IA=gf,DA={arc:t=>IA("arc",t),circle:t=>IA("circle",t),group:t=>IA("group",t),image:t=>IA("image",t),line:t=>IA("line",t),path:t=>IA("path",t),polygon:t=>IA("polygon",t),rect:t=>IA("rect",t),richtext:t=>IA("richtext",t),symbol:t=>IA("symbol",t),text:t=>IA("text",t)},LA=-.5*Math.PI,FA=1.5*Math.PI,zA="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var HA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(HA||(HA={}));const jA={[HA.selectedReverse]:{},[HA.selected]:{},[HA.hover]:{},[HA.hoverReverse]:{}},NA={container:"",width:30,height:30,style:{}},VA="scrollDrag",WA=(t,e,i,s)=>new Le(Object.assign({defaultFontParams:Object.assign({fontFamily:zA,fontSize:14},s),getTextBounds:i?void 0:bf,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function UA(t,e,i={}){if(!t)return{width:0,height:0};const s=bf({text:t,fontFamily:e.fontFamily||i.fontFamily||zA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function GA(t,e="type"){var i,s;return p(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function YA(t){var e,i;return u(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function XA(t,e="type"){const i=GA(t,e);return"rich"===i?DA.richtext(YA(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),DA.text(t))}function KA(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const $A=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function qA(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function ZA(t,e){const{dx:i,dy:s}=qA(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const JA={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},QA={size:8,stroke:"#000",lineWidth:1,zIndex:1};const tk=Math.sin(Math.PI/10);function ek(t,e=tk){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function ik(t,e=tk){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function sk(t){const e={};return bA(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function nk(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function rk(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return PA(r,(s?-1:1)*(n?-1:1)*t/OA(r))}function ak(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function lk(t,e,i){var s;if(ik(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>ze(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>ze(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>He(n,r)}function hk(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:K(i)}function uk(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}function pk(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function gk(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)}));return i/s}function fk(t,e){const i=gk(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function mk(t,e){const i=vk(t),s=vk(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function vk(t,e={x:0,y:0}){return re.distancePP(t,e)}function yk(t){return A(t.x)&&A(t.y)}function _k(t,e,i){let s=!1;if(e&&c(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function bk(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const xk=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function Ak(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&Ak(t[i],e)}}var kk;!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"}(kk||(kk={}));const Ck={};function wk(t){switch(t){case kk.Linear:case kk.Log:case kk.Pow:case kk.Sqrt:case kk.Symlog:case kk.Time:return!0;default:return!1}}function Mk(t){return!!Ck[t]}function Tk(t){switch(t){case kk.Ordinal:case kk.Point:case kk.Band:return!0;default:return!1}}function Bk(t){return t}Object.values(kk).forEach((t=>{Ck[t]=!0}));const Ek=t=>-Math.log(-t),Pk=t=>-Math.exp(-t),Ok=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Rk=t=>10===t?Ok:t===Math.E?Math.exp:e=>Math.pow(t,e),Ik=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Dk=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Lk=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Fk(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 zk(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function Hk(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function jk(t,e,i,s){return 1===i&&(i=0),Hk(t,i,s)*(e/(1-i))}function Nk(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Vk(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class Uk{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=Nk(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Gk=Symbol("implicit");class Yk extends Uk{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=kk.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Gk}clone(){const t=(new Yk).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==Gk)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return Xk(t,e,r,n)}class $k extends Yk{constructor(t){super(),this.type=kk.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=jk(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[et(t[0]),et(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[et(t[0]),et(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:Kk(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return Kk(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=_t(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&x(this._userBandwidth)}clone(){var t,e,i;return new $k(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:qk}=ri;function Zk(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=ii.parseColorString(e)){const e=qk(ii.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof si?qk(t,e):e instanceof ii?qk(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):At(Number(t),Number(e))}class Jk extends Uk{constructor(t=Bk,e=Bk){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Bk,this._piecewise=zk,this._interpolate=Zk}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),At)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,et);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=_t(i[0],i[r-1])),this._piecewise=r>2?Vk:zk,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Bk),this.rescale(i)):this._clamp!==Bk}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const Qk=Math.sqrt(50),tC=Math.sqrt(10),eC=Math.sqrt(2),iC=[1,2,5,10],sC=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=oC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),J(0,e).map((t=>n+t*s))):t>0?rC(0,-(e-1)/s,s):rC((e-1)/s,0,s)},nC=mt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return sC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return sC(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=rC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=rC(t,e,l);return n&&r.reverse(),r})),oC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=iC[0];return i>=Qk?s=iC[3]:i>=tC?s=iC[2]:i>=eC&&(s=iC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function lC(t,e,i){const s=(e-t)/Math.max(0,i);return oC(s)}function hC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=lC(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function dC(t,e){const i=x(e.forceMin),s=x(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const uC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),pC=mt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),gC=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=aC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?uC(t,e,n):uC(t,e,Wk(n)),h=uC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),fC=mt(((t,e,i,s,n)=>hC(s(t),s(e),i).map((t=>Wk(n(t))))));class mC extends Jk{constructor(){super(...arguments),this.type=kk.Linear}clone(){var t;const e=new mC;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return nC(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=aC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return hC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function yC(t){return e=>-t(-e)}function _C(t=Number.EPSILON){return e=>Math.max(e,t)}class bC extends Jk{constructor(){super(Ik(10),Rk(10)),this.type=kk.Log,this._limit=_C(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new bC).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=Ik(this._base),s=Rk(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=yC(i),this._pows=yC(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Ek,this.untransformer=Pk):(this._logs=i,this._pows=s,this._limit=_C(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Bk}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return pC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return gC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return fC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return fC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(bC,vC);class xC extends mC{constructor(){super(Dk(1),Lk(1)),this.type=kk.Symlog,this._const=1}clone(){return(new xC).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=Dk(t),this.untransformer=Lk(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return pC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return gC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return fC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return fC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(xC,vC);class SC{constructor(){this.type=kk.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!d(t)&&A(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new SC).domain(this._domain).range(this._range).unknown(this._unknown)}}var AC,kC,CC;function wC(t){var e,i;const{type:s}=t;return s===kC.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(AC||(AC={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(kC||(kC={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(CC||(CC={}));const MC={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},TC={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function BC(t,e){var i;if(!t)return[];const s=LC(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?IC(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>RC(i)?PC(t,i,e):i)).filter(u)}))):i.map((i=>RC(i)?PC(t,i,e):i)).filter(u):[]}return[]}function EC(t,e){var i,s;return IC(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function PC(t,e,i){var s;const n=LC(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=MC[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=TC[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new ii(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Xe(t,i,s),a=Ye(n,r,e.l),l=new ii(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const OC=(t,e)=>{if(e&&RC(t)){const i=PC(e,t);if(i)return i}return t};function RC(t){return t&&"palette"===t.type&&!!t.key}function IC(t){return!(!y(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function DC(t){return y(t)?{dataScheme:t}:t}function LC(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=wC(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class FC extends Yk{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!IC(this._range))return void super.range(this._range);const t=EC(this._range,this._domain);super.range(t)}}const zC={linear:mC,band:$k,point:class extends $k{constructor(t){super(!1),this.type=kk.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:Yk,threshold:SC,colorOrdinal:FC};function HC(t){const e=zC[t];return e?new e:null}function jC(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function NC(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function VC(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function WC(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function UC(t){return!!v(t)&&(!!t.endsWith("%")&&yA(t.substring(0,t.length-1)))}function GC(t){return!!p(t)&&("percent"in t||"offset"in t)}function YC(t,e,i,s=0){var n,r;return x(t)?t:UC(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function XC(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=YC(t[s],e.size,i)}))})),o}function KC(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function $C(t){let e={};return y(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||UC(t)||c(t)||GC(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function qC(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ZC=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},JC=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function QC(t,e){return t&&e.key in t?t[e.key]:e.default}function tw(t){return t&&"token"===t.type&&!!t.key}const ew={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},iw={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:JC,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:ew,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},sw={name:"dark",colorScheme:{default:{dataScheme:JC,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},nw=(t,e)=>t===e||!c(t)&&!c(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>nw(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>nw(t[i],e[i])))),rw=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),rw(t[s],e.slice(1),i))},aw=t=>t instanceof Oa||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(t);function ow(t,e=["data"]){return I(t,aw,e)}function lw(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=DC(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}hw._charts={},hw._series={},hw._components={},hw._graphicComponents={},hw._marks={},hw._regions={},hw._animations={},hw._implements={},hw._chartPlugin={},hw._vChartPlugin={},hw._componentPlugin={},hw.transforms={fields:Kr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},hw.dataParser={csv:(t,e={},i)=>(i.type=Xr.DSV,ra(t)),dsv:(t,e={},i)=>{i.type=Xr.DSV;const s=Vr(oa,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return na(n).parse(t)},tsv:(t,e={},i)=>(i.type=Xr.DSV,aa(t))},hw._layout={},hw._grammarTransforms={},hw._stageEventPlugins={},hw.registerStageEventPlugin=(t,e)=>{hw._stageEventPlugins[t]=e},hw.getStageEventPlugin=t=>hw._stageEventPlugins[t],hw._interactionTriggers={},hw.registerInteractionTrigger=(t,e)=>{hw._interactionTriggers[t]=e},hw._composedEventMap={},hw.registerComposedEvent=(t,e)=>{hw._composedEventMap[t]=e},hw._tooltipProcessors={},hw.registerTooltipProcessor=(t,e)=>{hw._tooltipProcessors[t]=e},hw.createTooltipProcessor=(t,e)=>{const i=hw._tooltipProcessors[t];return i?new i(e):null};const uw=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},pw=uw(),gw={[iw.name]:iw},fw=iw.name,mw=new Map(Object.keys(gw).map((t=>[t,gw[t]]))),vw=new Map,yw=new Map(Object.keys(gw).map((t=>[t,t===fw]))),_w=(t,e)=>{if(!t)return;const i=Aw(e);mw.set(t,i),yw.set(t,!0)},bw=(t=fw)=>(yw.has(t)&&!yw.get(t)&&_w(t,mw.get(t)),mw.get(t)),xw=t=>mw.delete(t)&&vw.delete(t)&&yw.delete(t),Sw=t=>!!v(t)&&mw.has(t),Aw=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:fw;return cw({},bw(i),t)};class kw{static registerInstance(t){kw.instances.set(t.id,t)}static unregisterInstance(t){kw.instances.delete(t.id)}static getInstance(t){return kw.instances.get(t)}static instanceExist(t){return kw.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return kw.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}kw.instances=new Map;class Cw{static registerTheme(t,e){_w(t,e)}static getTheme(t,e=!1){return bw(t)}static removeTheme(t){return xw(t)}static themeExist(t){return Sw(t)}static getDefaultTheme(){return Cw.themes.get(fw)}static setCurrentTheme(t){Cw.themeExist(t)&&(Cw._currentThemeName=t,kw.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return Cw.getTheme(Cw._currentThemeName,t)}static getCurrentThemeName(){return Cw._currentThemeName}}function ww(t){return v(t)?Cw.themeExist(t)?Cw.getTheme(t):{}:p(t)?t:{}}Cw.themes=mw,Cw._currentThemeName=fw;const Mw=["animationThreshold","colorScheme","name","padding"];function Tw(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];Mw.includes(n)?s[n]=r:f(r)?RC(r)?s[n]=OC(r,e):tw(r)?s[n]=QC(i,r):s[n]=Tw(r,e,i):s[n]=r})),s}function Bw(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=Bw(t[s],e)}return i}return y(t)?t.map((t=>Bw(t,e))):t}function Ew(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(v(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=Ew(t[s],e)}return i}return y(t)?t.map((t=>Ew(t,e))):t}function Pw(t,...e){return c(t)?t(...e):t}const Ow=(t,e,i,s)=>((t,e,i)=>WA(t,e,i,{fontFamily:ew.fontFamily,fontSize:ew.fontSize}))(e,i,s).measure(t),Rw="__VCHART",Iw=500,Dw=500,Lw=`${Rw}_MEASURE_CANVAS_ID`,Fw=`${Rw}_DEFAULT_DATA_INDEX`,zw=`${Rw}_DEFAULT_DATA_KEY`,Hw=`${Rw}_DEFAULT_DATA_SERIES_FIELD`,jw=`${Rw}_DEFAULT_SERIES_STYLE_NAME`,Nw=`${Rw}_STACK_KEY`,Vw=`${Rw}_STACK_START`,Ww=`${Rw}_STACK_END`,Uw=`${Rw}_STACK_START_PERCENT`,Gw=`${Rw}_STACK_END_PERCENT`,Yw=`${Rw}_STACK_START_OffsetSilhouette`,Xw=`${Rw}_STACK_END_OffsetSilhouette`,Kw=`${Rw}_STACK_TOTAL`,$w=`${Rw}_STACK_TOTAL_PERCENT`,qw=`${Rw}_STACK_TOTAL_TOP`,Zw=`${Rw}_STACK_TOTAL_BOTTOM`,Jw=`${Rw}_MOSAIC_VALUE_START_PERCENT`,Qw=`${Rw}_MOSAIC_VALUE_END_PERCENT`,tM=`${Rw}_MOSAIC_CAT_START_PERCENT`,eM=`${Rw}_MOSAIC_CAT_END_PERCENT`,iM=`${Rw}_SEGMENT_START`,sM=`${Rw}_SEGMENT_END`,nM=`${Rw}_KEY`,rM=`${Rw}_MAP_LOOK_UP_KEY`;function aM(t,e){for(let i=0;it.key===e))}function lM(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function hM(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},gM(t,a,n[o],l,e,r))})),s?cM(n):n}function cM(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):cM(t[e].nodes);return t}function dM(t,e){if("values"in t&&t.values.length){const i=pk(t.values,e),s=uk(t.values,Gw);t.values.forEach((t=>{t[Kw]=i,t[$w]=s}))}else for(const i in t.nodes)dM(t.nodes[i],e)}function uM(t){if(!t.values.length)return;const e=t.values[t.values.length-1][Ww]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)pM(t.nodes[r],e,i,s,n)}function gM(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[Ww]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),gM(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const fM=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=vM(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function yM(t){return!c(t)&&!E(t)&&Object.keys(t).some((e=>c(t[e])))}function _M(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(c(t))return AM(t(r,i,s,n));if(yM(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{c(e[t])&&(e[t]=e[t](r,i,s,n))})),AM(e)}return AM(t)}function bM(t={}){const e=Object.assign({},t);if(c(t.style)||yM(t.style)?e.style=(e,i,s,n)=>_M(t.style,e,i,s,n):E(t.style)||(e.style=AM(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])||yM(t.state[e])?i[e]=(i,s,n,r)=>_M(t.state[e],i,s,n,r):E(t.state[e])||(i[e]=AM(t.state[e]))})),e.state=i}return e}function xM(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>AM(t[i](e,s,n,r)):E(t[i])||(e[i]=AM(t[i]))})),e}function SM(t,e){if(E(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),AM(i)}function AM(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ae(t.angle)}):t}const kM=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},CM=t=>"line"===t||"area"===t,wM=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return CM(i)?e:null==e?void 0:e[0]},MM=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let TM=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=hw.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(hw.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var BM;!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"}(BM||(BM={}));const EM=["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 PM,OM,RM;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleRawDomainUpdate="scaleRawDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(PM||(PM={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(OM||(OM={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(RM||(RM={}));const IM=[RM.mark,RM.model,RM.chart,RM.vchart];class DM{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(RM.vchart,[]),this._levelNodes.set(RM.chart,[]),this._levelNodes.set(RM.model,[]),this._levelNodes.set(RM.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const LM={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class FM{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=P(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>wM(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||OM.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||OM.chart);o.get(t)||o.set(t,new DM);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||OM.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||OM.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||OM.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||OM.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?IM.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[OM.chart,OM.window,OM.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&P(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return LM[a]&&(a=LM[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?RM.model:RM.vchart:RM.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=St(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=xt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=OM.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==RM.model&&s!==RM.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=RM.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case OM.chart:return this._viewBubbles;case OM.window:return this._windowBubbles;case OM.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case OM.chart:return this._viewListeners;case OM.window:return this._windowListeners;case OM.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return EM.includes(t)||Object.values(BM).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&hw.hasInteractionTrigger(e)}}function zM(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function HM(t,e,i){t.getParser(e)||t.registerParser(e,i)}const jM=new Map;let NM;function VM(){NM||(NM=new Pa,HM(NM,"geojson",Ca),HM(NM,"topojson",Ma),zM(NM,"simplify",Yr))}function WM(t,e,i={type:"geojson",centroid:!0}){jM.has(t)&&lA(`map type of '${t}' already exists, will be overwritten.`),VM();const s=new Oa(NM),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):p(r)&&s.transform({type:"simplify",options:r}),jM.set(t,s)}function UM(t){jM.has(t)?jM.delete(t):lA(`map type of '${t}' does not exists.`)}function GM(t,e=!1){let i=e;return t.latestData instanceof Oa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const YM=(t,e)=>0===t.length?[]:1===t.length?GM(t[0],null==e?void 0:e.deep):t.map((t=>GM(t,null==e?void 0:e.deep)));function XM(t,e,i){zM(e=e instanceof Pa?e:t.dataSet,"copyDataView",YM);const s=new Oa(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:qM.copyDataView}),s}function KM(t,e,i=[]){var s;if(t instanceof Oa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Oa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return lA(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return lA(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),lA("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function $M(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var qM,ZM,JM,QM;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(qM||(qM={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(ZM||(ZM={})),function(t){t.data="data",t.mark="mark"}(JM||(JM={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(QM||(QM={}));const tT=["line","area","trail"];function eT(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(nM,i?t.slice().sort(i):t.slice()),{keys:[nM],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const iT=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function sT(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{sT(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function rT(t,e,i,s){const n=eT(t,(t=>i(t))),r=eT(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const aT=`${Rw}_BuiltIn_CallBack_Disappear`;var oT;!function(t){t.render="render",t.disappear="disappear"}(oT||(oT={}));const lT=[0,0,0];class hT{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Ll),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},zl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Hl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this._clearMatrix=new Ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Su.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&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Nt;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=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Hl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Hl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(mu(lT,[e,i,s],this.modelMatrix),e=lT[0],i=lT[1],s=lT[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=ru(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:nu(this,a,this.dpr),r.strokeStyle=ru(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}hT.env="browser";class cT extends Tu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Na.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new hT(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}}function dT(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,kd,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Cd,e.env));r||i.bind(kd).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(Cd).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}cT.env="browser";const uT=dT(cT,hT);class pT extends hT{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}pT.env="feishu";class gT extends Tu{constructor(t){super(t)}init(){this._context=new pT(this,this._dpr)}release(...t){}}gT.env="feishu";const fT=dT(gT,pT);class mT extends hT{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=Na.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Na.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}mT.env="harmony";class vT extends Tu{constructor(t){super(t)}init(){this._context=new mT(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}vT.env="harmony";const yT=dT(vT,mT);class _T extends hT{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=Na.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Na.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}_T.env="lynx";class bT extends Tu{constructor(t){super(t)}init(){this._context=new _T(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}bT.env="lynx";const xT=dT(bT,_T);class ST extends hT{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}ST.env="node";class AT extends Tu{constructor(t){super(t)}init(){this._context=new ST(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}}AT.env="node";const kT=dT(AT,ST);class CT extends hT{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,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(ru(this,l,t,i,s)))}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:nu(this,l,this.dpr)),r.setStrokeStyle(ru(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}CT.env="taro";class wT extends Tu{constructor(t){super(t)}init(){this._context=new CT(this,this._dpr)}release(...t){}}wT.env="taro";const MT=dT(wT,CT);class TT extends pT{}TT.env="tt";class BT extends Tu{constructor(t){super(t)}init(){this._context=new TT(this,this._dpr)}release(...t){}}BT.env="tt";const ET=dT(BT,TT);class PT extends hT{draw(){}createPattern(t,e){return null}}PT.env="wx";class OT extends Tu{constructor(t){super(t)}init(){this._context=new PT(this,this._dpr)}release(...t){}}OT.env="wx";const RT=dT(OT,PT);function IT(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function DT(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}class LT extends J_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=cm.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:nu(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class _B extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let bB=!1;function xB(t){bB||(bB=!0,t.bind(qT).toDynamicValue((()=>new _B(IT(t,Hf)))).inSingletonScope(),t.bind(fB).toService(qT))}class SB extends l_{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class AB extends SB{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=ed,this.themeType="arc"}}let kB=!1;function CB(t){var e;kB||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,jf))&&(kB=!0,t.bind(ZT).toDynamicValue((()=>new AB(IT(t,jf)))).inSingletonScope(),t.bind(fB).toService(ZT))}class wB extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let MB=!1;function TB(t){MB||(MB=!0,t.bind(JT).toDynamicValue((()=>new wB(IT(t,Nf)))).inSingletonScope(),t.bind(fB).toService(JT))}class BB extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=sd}}let EB=!1;function PB(t){EB||(EB=!0,t.bind(QT).toDynamicValue((()=>new BB(IT(t,Vf)))).inSingletonScope(),t.bind(fB).toService(QT))}class OB{constructor(){this.type="glyph",this.numberType=nd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}class RB extends OB{constructor(t){super(),this.canvasRenderer=t}}let IB=!1;function DB(t){IB||(IB=!0,t.bind(uB).toDynamicValue((()=>new RB(IT(t,tm)))).inSingletonScope(),t.bind(fB).toService(uB))}class LB extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=ad}}let FB=!1;function zB(t){FB||(FB=!0,t.bind(tB).toDynamicValue((()=>new LB(IT(t,em)))).inSingletonScope(),t.bind(fB).toService(tB))}class HB extends l_{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class jB extends HB{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let NB=!1;function VB(t){NB||(NB=!0,t.bind(iB).toDynamicValue((()=>new jB(IT(t,Gf)))).inSingletonScope(),t.bind(fB).toService(iB))}const WB=new Ve;class UB{constructor(){this.type="rect",this.numberType=dd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||x(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:nu(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;WB.setValue(i.x1,i.y1,i.x2,i.y2),WB.expand(-r/2),h=!WB.containsPoint(e)}}return s.highPerformanceRestore(),h}}class GB extends UB{constructor(t){super(),this.canvasRenderer=t}}let YB=!1;class XB extends HB{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let KB=!1;function $B(t){KB||(KB=!0,t.bind(nB).toDynamicValue((()=>new XB(IT(t,Yf)))).inSingletonScope(),t.bind(fB).toService(nB))}class qB extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let ZB=!1;function JB(t){ZB||(ZB=!0,t.bind(hB).toDynamicValue((()=>new qB(IT(t,Xf)))).inSingletonScope(),t.bind(fB).toService(hB))}class QB extends SB{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=cd,this.themeType="polygon"}}let tE=!1;function eE(t){var e;tE||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Qf))&&(tE=!0,t.bind(cB).toDynamicValue((()=>new QB(IT(t,Qf)))).inSingletonScope(),t.bind(fB).toService(cB))}class iE extends UB{constructor(t){super(),this.canvasRenderer=t}}let sE=!1;function nE(t){sE||(sE=!0,t.bind(rB).toDynamicValue((()=>new iE(IT(t,Kf)))).inSingletonScope(),t.bind(fB).toService(rB))}class rE extends SB{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=ud,this.themeType="rect"}}let aE=!1;function oE(t){var e;aE||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,$f))&&(aE=!0,t.bind(aB).toDynamicValue((()=>new rE(IT(t,$f)))).inSingletonScope(),t.bind(fB).toService(aB))}class lE{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let hE=!1;function cE(t){hE||(hE=!0,t.bind(dB).toDynamicValue((()=>new lE(IT(t,Jf)))).inSingletonScope(),t.bind(fB).toService(dB))}class dE extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=gd}}let uE=!1;function pE(t){var e;uE||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,nm))&&(uE=!0,t.bind(gB).toDynamicValue((()=>new dE(IT(t,nm)))).inSingletonScope(),t.bind(fB).toService(gB))}class gE extends SB{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Au.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let fE=!1;function mE(t){fE||(fE=!0,t.bind(oB).toDynamicValue((()=>new gE(IT(t,qf)))).inSingletonScope(),t.bind(fB).toService(oB))}class vE extends SB{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=md}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Vp(a,u,n),v=Np(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&Au.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let yE=!1;function _E(t){yE||(yE=!0,t.bind(lB).toDynamicValue((()=>new vE(IT(t,Zf)))).inSingletonScope(),t.bind(fB).toService(lB))}const bE=Xc();Xc();class xE{constructor(){this.type="gif-image",this.numberType=bE}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let SE=!1;function AE(t){SE||(SE=!0,t.bind(eB).toDynamicValue((()=>new xE)).inSingletonScope(),t.bind(fB).toService(eB))}function kE(t){t.isBound(LT)||t.bind(LT).toDynamicValue((()=>new LT(DT(fB,t),IT(t,sm),DT(Lf,t),DT(Ff,t)))).inSingletonScope(),t.isBound(Rf)?t.rebind(Rf).toService(LT):t.bind(Rf).toService(LT)}function CE(t){(function(t){vB||(vB=!0,t.bind(pB).toDynamicValue((()=>new mB)).inSingletonScope(),t.bind(fB).toService(pB),pv(t.bind.bind(t),fB))})(t),xB(t),CB(t),TB(t),PB(t),DB(t),zB(t),VB(t),function(t){YB||(YB=!0,t.bind(sB).toDynamicValue((()=>new GB(IT(t,Kf)))).inSingletonScope(),t.bind(fB).toService(sB))}(t),$B(t),JB(t),eE(t),nE(t),oE(t),cE(t),pE(t),mE(t),_E(t),AE(t),kE(t)}class wE extends G_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${wE.idprefix}_${wE.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Na.global,this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:wE.GenerateCanvasId(),canvasControled:!0};this.canvas=new cT(s)}createWindowByCanvas(t){var e,i;let s;if("string"==typeof t.canvas){if(s=this.global.getElementById(t.canvas),s||"undefined"==typeof document||(s=document.getElementById(t.canvas)),!s)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else s=t.canvas;if(!s)throw new Error("发生错误,传入的canvas不正确");let n=t.width,r=t.height;if(null==n||null==r||!t.canvasControled){const t=s.getBoundingClientRect();n=t.width,r=t.height}let a=t.dpr;null==a&&(a=null!==(e=s.getContext("2d").pixelRatio)&&void 0!==e?e:s.width/n),this.canvas=new cT({width:n,height:r,dpr:a,nativeCanvas:s,canvasControled:null!==(i=t.canvasControled)&&void 0!==i&&i})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}}function ME(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,wE))||t.bind(wE).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,wE.env))||t.bind(am).toService(wE).whenTargetNamed(wE.env)}wE.env="browser",wE.idprefix="visactor_window",wE.prefix_count=0;var TE=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class BE{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function EE(t,e=!1){const i=document.createElement("img");if(Na.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class PE extends U_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new BE(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return EE(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return EE(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:Ha.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return TE(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function OE(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,PE))||(t.bind(PE).toSelf().inSingletonScope(),t.bind(ug).toService(PE))}function RE(t=qy(),e=!0){RE.__loaded||(RE.__loaded=!0,OE(t),uT(t),ME(t),e&&CE(t))}RE.__loaded=!1;class IE extends G_{get container(){return null}constructor(t=Na.global){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:Ha.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new gT(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new gT({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function DE(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,IE))||t.bind(IE).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,IE.env))||t.bind(am).toService(IE).whenTargetNamed(IE.env)}IE.env="feishu";class LE extends J_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new wu(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}}let FE=!1;class zE extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let HE=!1;function jE(t){HE||(HE=!0,t.bind(zT).toDynamicValue((()=>new zE(IT(t,Hf)))).inSingletonScope(),t.bind(FT).toService(zT))}class NE extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let VE=!1;function WE(t){VE||(VE=!0,t.bind(HT).toDynamicValue((()=>new NE(IT(t,Nf)))).inSingletonScope(),t.bind(FT).toService(HT))}class UE extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=sd}}let GE=!1;function YE(t){GE||(GE=!0,t.bind(jT).toDynamicValue((()=>new UE(IT(t,Vf)))).inSingletonScope(),t.bind(FT).toService(jT))}class XE extends OB{constructor(t){super(),this.canvasRenderer=t}}let KE=!1;function $E(t){KE||(KE=!0,t.bind(KT).toDynamicValue((()=>new XE(IT(t,tm)))).inSingletonScope(),t.bind(FT).toService(KT))}class qE{constructor(){this.type="image",this.numberType=ad}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let ZE=!1;function JE(t){ZE||(ZE=!0,t.bind(NT).toDynamicValue((()=>new qE)).inSingletonScope(),t.bind(FT).toService(NT))}class QE extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let tP=!1;function eP(t){tP||(tP=!0,t.bind(VT).toDynamicValue((()=>new QE(IT(t,Gf)))).inSingletonScope(),t.bind(FT).toService(VT))}class iP extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let sP=!1;function nP(t){sP||(sP=!0,t.bind(XT).toDynamicValue((()=>new iP(IT(t,Xf)))).inSingletonScope(),t.bind(FT).toService(XT))}class rP extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let aP=!1;function oP(t){aP||(aP=!0,t.bind(WT).toDynamicValue((()=>new rP(IT(t,Yf)))).inSingletonScope(),t.bind(FT).toService(WT))}class lP extends UB{constructor(t){super(),this.canvasRenderer=t}}let hP=!1;function cP(t){hP||(hP=!0,t.bind(UT).toDynamicValue((()=>new lP(IT(t,Kf)))).inSingletonScope(),t.bind(FT).toService(UT))}class dP{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let uP=!1;function pP(t){uP||(uP=!0,t.bind($T).toDynamicValue((()=>new dP(IT(t,Jf)))).inSingletonScope(),t.bind(FT).toService($T))}class gP extends yB{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}}let fP=!1;function mP(t){fP||(fP=!0,t.bind(GT).toDynamicValue((()=>new gP(IT(t,qf)))).inSingletonScope(),t.bind(FT).toService(GT))}class vP{constructor(){this.type="text",this.numberType=md}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let yP=!1;function _P(t){yP||(yP=!0,t.bind(YT).toDynamicValue((()=>new vP)).inSingletonScope(),t.bind(FT).toService(YT))}function bP(t){(function(t){FE||(FE=!0,pv(t.bind.bind(t),FT))})(t),function(t){t.isBound(LE)||t.bind(LE).toDynamicValue((()=>new LE(DT(FT,t),DT(Lf,t),DT(Ff,t)))).inSingletonScope(),t.isBound(Rf)?t.rebind(Rf).toService(LE):t.bind(Rf).toService(LE)}(t),jE(t),WE(t),YE(t),$E(t),JE(t),eP(t),nP(t),oP(t),cP(t),pP(t),mP(t),_P(t)}class xP{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class SP{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function AP(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function kP(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new xP(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function CP(t,e,i,s){const n=AP(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new SP(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function wP(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function MP(t,e=wP(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class TP extends U_{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},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 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=wP(i),n=null!==(e=t.dpr)&&void 0!==e?e:MP(i,s),r=CP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=kP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return MP(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function BP(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,TP))||(t.bind(TP).toSelf().inSingletonScope(),t.bind(ug).toService(TP))}function EP(t=qy(),e=!0){EP.__loaded||(EP.__loaded=!0,BP(t),fT(t),DE(t),e&&bP(t))}EP.__loaded=!1;function PP(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function OP(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Ha.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new vT(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new vT({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return PP(t,"target",s),PP(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=OP(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=OP(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&RP(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),RP(t,"x",_),RP(t,"y",b),RP(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),RP(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),RP(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),RP(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),RP(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),RP(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function DP(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,IP))||t.bind(IP).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,IP.env))||t.bind(am).toService(IP).whenTargetNamed(IP.env)}IP.env="harmony";const LP="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function FP(t){return"number"==typeof t&&Number.isFinite(t)}function zP(...t){for(let e=0;e({width:i,height:s})),new SP(t,l,n,i,s,e)}function WP(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=NP(e*s,i*s);if(t)return t}throw new Error(LP)}class UP extends U_{constructor(){super(),this.type="harmony",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,this.rafSTO=new xh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=HP(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=HP(s),r=null!==(i=t.dpr)&&void 0!==i?i:jP(s),a=function(t,e){if(!FP(t)||!FP(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=VP(WP(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=VP(WP(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return jP(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=zP(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=zP(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function GP(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,UP))||(t.bind(UP).toSelf().inSingletonScope(),t.bind(ug).toService(UP))}function YP(t=qy(),e=!0){YP.__loaded||(YP.__loaded=!0,GP(t),yT(t),DP(t),e&&bP(t))}YP.__loaded=!1;function XP(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function KP(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Ha.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new bT(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new bT({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return XP(t,"target",s),XP(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=KP(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=KP(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&$P(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),$P(t,"x",_),$P(t,"y",b),$P(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),$P(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),$P(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),$P(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),$P(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),$P(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function ZP(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,qP))||t.bind(qP).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,qP.env))||t.bind(am).toService(qP).whenTargetNamed(qP.env)}qP.env="lynx";function JP(t){return"number"==typeof t&&Number.isFinite(t)}function QP(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=eO(r),o=null!==(i=t.dpr)&&void 0!==i?i:iO(r,a),l=nO(t.width,t.height),h=rO(aO(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=eO(a),l=null!==(n=t.dpr)&&void 0!==n?n:iO(a,o),h=nO(t.width,t.height),c=Math.random().toString(),d=rO(aO(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return iO(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=QP(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=QP(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function lO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,oO))||(t.bind(oO).toSelf().inSingletonScope(),t.bind(ug).toService(oO))}function hO(t=qy(),e=!0){hO.__loaded||(hO.__loaded=!0,lO(t),xT(t),ZP(t),e&&bP(t))}hO.__loaded=!1;class cO extends G_{get container(){return null}constructor(t=Na.global){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:Ha.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new AT(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new AT({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function dO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,cO))||t.bind(cO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,cO.env))||t.bind(am).toService(cO).whenTargetNamed(cO.env)}cO.env="node";class uO extends U_{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function pO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,uO))||(t.bind(uO).toSelf().inSingletonScope(),t.bind(ug).toService(uO))}function gO(t=qy(),e=!0){gO.__loaded||(gO.__loaded=!0,pO(t),kT(t),dO(t))}gO.__loaded=!1;class fO extends G_{get container(){return null}constructor(t=Na.global){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:Ha.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new wT(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new wT({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.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){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function mO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,fO))||t.bind(fO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,fO.env))||t.bind(am).toService(fO).whenTargetNamed(fO.env)}fO.env="taro";class vO extends U_{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},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 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=CP(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=AP(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=kP(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}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(...t){}}function yO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,vO))||(t.bind(vO).toSelf().inSingletonScope(),t.bind(ug).toService(vO))}function _O(t=qy(),e=!0){_O.__loaded||(_O.__loaded=!0,yO(t),MT(t),mO(t),e&&bP(t))}_O.__loaded=!1;class bO extends G_{get container(){return null}constructor(t=Na.global){super(),this.global=t,this.type="tt",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:Ha.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new BT(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new BT({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function xO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,bO))||t.bind(bO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,bO.env))||t.bind(am).toService(bO).whenTargetNamed(bO.env)}bO.env="tt";function SO(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function AO(t,e=SO(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class kO extends U_{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=SO(i),n=null!==(e=t.dpr)&&void 0!==e?e:AO(i,s),r=CP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=kP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return AO(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function CO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,kO))||(t.bind(kO).toSelf().inSingletonScope(),t.bind(ug).toService(kO))}function wO(t=qy(),e=!0){wO.__loaded||(wO.__loaded=!0,CO(t),ET(t),xO(t),e&&bP(t))}wO.__loaded=!1;class MO{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={}}}function TO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class BO extends G_{get container(){return null}constructor(t=Na.global){super(),this.global=t,this.type="wx",this.eventManager=new MO}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:Ha.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new OT(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new OT({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,s,n,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return TO(t,"target",o),TO(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s: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!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function EO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,BO))||t.bind(BO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,am,BO.env))||t.bind(am).toService(BO).whenTargetNamed(BO.env)}BO.env="wx";function PO(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function OO(t,e=PO(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class RO extends U_{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=PO(i),n=null!==(e=t.dpr)&&void 0!==e?e:OO(i,s),r=CP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=kP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return OO(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function IO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,RO))||(t.bind(RO).toSelf().inSingletonScope(),t.bind(ug).toService(RO))}function DO(t=qy(),e=!0){DO.__loaded||(DO.__loaded=!0,IO(t),RT(t),EO(t),e&&bP(t))}DO.__loaded=!1;var LO={},FO={},zO={};Object.defineProperty(zO,"__esModule",{value:!0}),zO.loop=zO.conditional=zO.parse=void 0;zO.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};zO.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};zO.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var HO={};Object.defineProperty(HO,"__esModule",{value:!0}),HO.readBits=HO.readArray=HO.readUnsigned=HO.readString=HO.peekBytes=HO.readBytes=HO.peekByte=HO.readByte=HO.buildStream=void 0;HO.buildStream=function(t){return{data:t,pos:0}};var jO=function(){return function(t){return t.data[t.pos++]}};HO.readByte=jO;HO.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var NO=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};HO.readBytes=NO;HO.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};HO.readString=function(t){return function(e){return Array.from(NO(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};HO.readUnsigned=function(t){return function(e){var i=NO(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};HO.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=NO(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=ZO(t),i=GO(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=ZO(this.attribute.gifImage),e=GO(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=Na.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=Na.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function tR(t){return new QO(t)}class eR extends V_{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=bE,this._renderContribitions=void 0,this.builtinContributions=[iR],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=Dp(t).image;this._draw(t,n,!1,i)}}const iR=new class extends ey{constructor(){super(...arguments),this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let sR=!1;function nR(t){sR||(sR=!0,t.bind(eR).toDynamicValue((()=>new eR(DT(Dy,t)))).inSingletonScope(),t.bind(Wf).toService(eR))}function rR(){uf.RegisterGraphicCreator("gif",tR)}function aR(){if(aR.__loaded)return;aR.__loaded=!0;const t=qy();rR(),nR(t),AE(t)}aR.__loaded=!1;const oR=aR,lR=[{register:ES,bindModule:Px},{register:PS,bindModule:CS},{register:OS,bindModule:jx},{register:RS,bindModule:Yx},{register:IS,bindModule:hS},{register:DS},{register:LS,bindModule:mS},{register:FS,bindModule:Fx},{register:zS,bindModule:Jx},{register:HS,bindModule:eS},{register:NS,bindModule:BS},{register:VS,bindModule:Ix},{register:WS,bindModule:xS},{register:US,bindModule:pS},{register:XS},{register:jS,bindModule:rS},{register:GS,bindModule:Wx},{register:YS,bindModule:$x},{register:KS},{register:rR}];let hR=!1;const cR=[xB,CB,TB,PB,DB,zB,VB,$B,JB,eE,nE,oE,cE,pE,mE,_E,AE];function dR(t){return{getContributions:t}}function uR(t,{envParams:e,force:i=!1}={}){yb().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function pR(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){_b(t);const a=mb();i(a),s(a),n(a),vb(),uR(e,{envParams:r,force:!0})}function gR(t,e){pR(t,"browser",{bindEnv:OE,bindCanvasModules:uT,bindWindowContribution:ME},e)}function fR(t,e){pR(t,"node",{bindEnv:pO,bindCanvasModules:kT,bindWindowContribution:dO},e)}function mR(t){_b(t),function(){if(hR)return;const t=mb();hR=!0,lR.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),nR(t),vb()}(),xb(t),bb(t)}function vR(t){_b(t);const e=mb();cR.forEach((t=>t(e))),kE(e),Sb(t,fB),function(t){const e=mb(),i=dR((()=>t.registry.picker.getAll())),s=dR((()=>e.isBound(Lf)?e.getAll(Lf):[])),n=dR((()=>e.isBound(Ff)?e.getAll(Ff):[])),r=yb();Na.pickerServiceFactory=()=>new LT(i,{},s,n),Na.global=r}(t)}function yR(t){_b(t);bP(mb()),Sb(t,FT),function(t){const e=mb(),i=dR((()=>t.registry.picker.getAll())),s=dR((()=>e.isBound(Lf)?e.getAll(Lf):[])),n=dR((()=>e.isBound(Ff)?e.getAll(Ff):[]));Na.pickerServiceFactory=()=>new LE(i,s,n)}(t)}const _R=ev();function bR(){if(bR.__loaded)return;bR.__loaded=!0;const t=qy();ES(),Px({bind:t.bind}),_R?xB(t):jE(t)}bR.__loaded=!1;const xR=bR;function SR(){if(SR.__loaded)return;SR.__loaded=!0;const t=qy();PS(),X_(),$_(),CS({bind:t.bind}),CB(t)}SR.__loaded=!1;const AR=SR;function kR(){if(kR.__loaded)return;kR.__loaded=!0;const t=qy();OS(),jx({bind:t.bind}),_R?TB(t):WE(t)}kR.__loaded=!1;const CR=kR;function wR(){if(wR.__loaded)return;wR.__loaded=!0;const t=qy();RS(),Yx({bind:t.bind}),_R?PB(t):YE(t)}wR.__loaded=!1;const MR=wR;function TR(){if(TR.__loaded)return;TR.__loaded=!0;const t=qy();IS(),hS({bind:t.bind}),_R?DB(t):$E(t)}TR.__loaded=!1;const BR=TR;function ER(){ER.__loaded||(ER.__loaded=!0,DS())}ER.__loaded=!1;const PR=ER;function OR(){if(OR.__loaded)return;OR.__loaded=!0;const t=qy();LS(),mS({bind:t.bind}),_R?zB(t):JE(t)}OR.__loaded=!1;const RR=OR;function IR(){if(IR.__loaded)return;IR.__loaded=!0;const t=qy();FS(),Fx({bind:t.bind}),_R?VB(t):eP(t)}IR.__loaded=!1;const DR=IR;function LR(){if(LR.__loaded)return;LR.__loaded=!0;const t=qy();zS(),Jx({bind:t.bind}),_R?$B(t):oP(t)}LR.__loaded=!1;const FR=LR;function zR(){if(zR.__loaded)return;zR.__loaded=!0;const t=qy();HS(),eS({bind:t.bind}),_R?JB(t):nP(t)}zR.__loaded=!1;const HR=zR;function jR(){if(jR.__loaded)return;jR.__loaded=!0;const t=qy();NS(),X_(),$_(),BS({bind:t.bind}),eE(t)}jR.__loaded=!1;const NR=jR;function VR(){if(VR.__loaded)return;VR.__loaded=!0;const t=qy();VS(),Ix({bind:t.bind}),_R?nE(t):cP(t)}VR.__loaded=!1;const WR=VR;function UR(){if(UR.__loaded)return;UR.__loaded=!0;const t=qy();WS(),xS({bind:t.bind}),oE(t)}UR.__loaded=!1;const GR=UR;function YR(){if(YR.__loaded)return;YR.__loaded=!0;const t=qy();US(),pS({bind:t.bind}),_R?cE(t):pP(t)}YR.__loaded=!1;const XR=YR;function KR(){KR.__loaded||(KR.__loaded=!0,XS())}KR.__loaded=!1;const $R=KR;function qR(){if(qR.__loaded)return;qR.__loaded=!0;const t=qy();jS(),rS({bind:t.bind}),pE(t)}qR.__loaded=!1;const ZR=qR;function JR(){if(JR.__loaded)return;JR.__loaded=!0;const t=qy();GS(),Wx({bind:t.bind}),_R?mE(t):mP(t)}JR.__loaded=!1;const QR=JR;function tI(){if(tI.__loaded)return;tI.__loaded=!0;const t=qy();YS(),$x({bind:t.bind}),_R?_E(t):_P(t)}tI.__loaded=!1;const eI=tI;function iI(){iI.__loaded||(iI.__loaded=!0,KS())}iI.__loaded=!1;const sI=iI;function nI(t){if(!t||!c(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}class rI{static registerBuiltInAnimate(t,e){rI.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._activeConfigList=null,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:rI.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=nI(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:rI.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=nI(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=A(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:w,customType:M,controlOptions:T}=t,B=e.animate();B.priority=k;const E=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],O=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&O&&(i=null!==(h=P[O])&&void 0!==h?h:i),B.startAt(b);const R=i*x+E;R>0&&B.wait(R);let I=null,D=t.to,L=t.from;const F=this.shouldCommitAttrOutChannel(p);D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.props),L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,w,M,L,D,_,m,f,T,C,p,e);let z=0;x&&(z=x*(s-i-1));const H=c(y)?y(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&B.wait(z),S&&S>0&&B.loop(S),A&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,y,_,b;if(e&&i){i=nI(e);let d=this.resolveValue(o,u);"function"==typeof d&&(d=d(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),d=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},d);const x=c(h)?h.call(null,null!==(y=d&&(null===(v=d.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,d):h;d.options=x,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:rI.builtInAnimateMap[r],m=t.custom?t.customType:nI(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Rl.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}rI.builtInAnimateMap={};class aI{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-aI.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*aI.bounceIn(2*t):.5*aI.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Nt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Nt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Nt/e)*.5+1}}static registerFunc(t,e){aI[t]=e}}function oI(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}aI.quadIn=aI.getPowIn(2),aI.quadOut=aI.getPowOut(2),aI.quadInOut=aI.getPowInOut(2),aI.cubicIn=aI.getPowIn(3),aI.cubicOut=aI.getPowOut(3),aI.cubicInOut=aI.getPowInOut(3),aI.quartIn=aI.getPowIn(4),aI.quartOut=aI.getPowOut(4),aI.quartInOut=aI.getPowInOut(4),aI.quintIn=aI.getPowIn(5),aI.quintOut=aI.getPowOut(5),aI.quintInOut=aI.getPowInOut(5),aI.backIn=aI.getBackIn(1.7),aI.backOut=aI.getBackOut(1.7),aI.backInOut=aI.getBackInOut(1.7),aI.elasticIn=aI.getElasticIn(1,.3),aI.elasticOut=aI.getElasticOut(1,.3),aI.elasticInOut=aI.getElasticInOut(1,.3*1.5),aI.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),aI.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},aI.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)aI[`flicker${t}`]=e=>oI(e,t);for(let t=2;t<10;t++)aI[`aIn${t}`]=e=>t*e*e+(1-t)*e;function lI(t,e,i){return t+(e-t)*i}const hI=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=lI(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=lI(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=lI(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=lI(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=lI(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=lI(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=lI(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=lI(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=lI(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Ou(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?zu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Ou(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?zu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=lI(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=lI(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=lI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=lI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=lI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=lI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=lI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=lI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=lI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=lI(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=lI(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=lI(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=lI(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=lI(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=lI(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=lI(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=_h(e,i,s),r.addUpdateBoundTag()}}};function cI(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:So.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=aI[s])&&void 0!==n?n:aI.linear:aI.linear,"wait"===t&&(this.onUpdate=bI),this.id=Ha.GenAutoIncrementId(),this.syncAttributeUpdate=bI}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=Eu.Get(i,Bu.Color255),r=Eu.Get(s,Bu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(hI["fill"===e?"fillPure":"strokePure"])}else hI[e]?t.push(hI[e]):t.push(cI)}else hI[e]?t.push(hI[e]):t.push(cI)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class AI extends SI{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();yI(this.target,t,So.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class kI extends SI{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class CI extends kI{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class wI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Rl.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class MI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&_I(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class TI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,yI(this.target,i,So.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class BI extends MI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class EI extends TI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class PI extends MI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class OI extends TI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}class RI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){yI(this.target,this.from,So.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const II=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class DI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){mI(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){mI(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class LI extends DI{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=II(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&_I(this.target,r),this.determineUpdateFunction()}}class FI extends DI{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class zI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&_I(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class HI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const jI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class NI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=jI(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&_I(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){vI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class VI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){vI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const WI=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class UI extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(mI(this.target,{points:r.map(((t,i)=>yh(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class GI extends UI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:WI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&_I(this.target,e)}else this.valid=!1}}class YI extends UI{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:WI(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const XI=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class KI extends UI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:XI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&_I(this.target,e)}else this.valid=!1}}class $I extends UI{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:XI(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const qI=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class ZI extends UI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:qI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&_I(this.target,e)}else this.valid=!1}}class JI extends UI{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:qI(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const QI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class tD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class eD extends tD{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=QI(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&_I(this.target,r)}}class iD extends tD{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const sD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class nD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=sD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&_I(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){vI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){vI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class oD extends aD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&A(m.x)?m.x:g,b=u.includes("y")?y:m&&A(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&_I(this.target,e)}}class lD extends aD{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,y=v&&A(v.x)?v.x:f,_=v&&A(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class hD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,yI(this.target,{text:n})}}class cD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class dD extends cD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=pt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&_I(this.target,e)}}class uD extends cD{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=pt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class pD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),w=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,T=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,B=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,E=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(T){case"x":A={scaleX:null!==(g=null!=B?B:w.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=E?E:w.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=B?B:w.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=E?E:w.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&_I(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),mI(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class gD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),mI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class fD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function mD(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;tvD[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&mD(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(mI(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class bD{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new rI(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function xD(t){return new bD(t)}class SD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;yI(this.target,{text:o})}}class AD extends CI{onBind(){super.onBind();const t=xD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(_I(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),_I(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),_I(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),_I(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;_I(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:SD});const i=s._titleBottom.attribute.text;_I(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:SD})}else _I(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),_I(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;_I(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());_I(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class kD extends CI{onBind(){super.onBind();const t=xD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class CD extends CI{onBind(){super.onBind();const t=xD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if(_I(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:SD}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:SD}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class wD extends CI{onBind(){super.onBind();const t=xD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class MD extends wI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=t_.createCanvas({width:t.width,height:t.height,dpr:t_.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=t_.createCanvas({width:t.width,height:t.height,dpr:t_.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==MD.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class TD extends MD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class BD extends MD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==BD.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==BD.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class ED{static createTempCanvas(t,e,i){return t_.createCanvas({width:t,height:e,dpr:i||t_.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=ED.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(ED.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(ED.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(ED.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(ED.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(ED.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(ED.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(ED.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class RD extends BD{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class FD extends BD{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=ED.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class zD extends MD{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=t_.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=t_.createCanvas({width:i,height:s,dpr:t_.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class HD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?Fg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Fg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}yI(this.target,{textConfig:o})}}class jD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Fg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Fg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),yI(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),yI(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class ND extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Fg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Fg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),yI(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?Fg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Fg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),yI(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function GD(t,e){mI(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class YD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,_I(this.target,m)}onUpdate(t,e,i){GD(this.target,UD(this.propKeys,this.from,this.to,e))}}class XD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,_I(this.target,d)}onUpdate(t,e,i){GD(this.target,UD(this.propKeys,this.from,this.to,e))}}class KD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,_I(this.target,p)}onUpdate(t,e,i){GD(this.target,UD(this.propKeys,this.from,this.to,e))}}class $D extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,_I(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),yI(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class qD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,_I(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),yI(this.target,n)}}class ZD extends kI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new rI(this.target);a.execute({type:"custom",custom:YD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:XD,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class JD extends kI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new rI(this.target);a.execute({type:"custom",custom:YD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:KD,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class QD extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){GD(this.target,UD(this.propKeys,this.from,this.to,e))}}class tL extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){GD(this.target,UD(this.propKeys,this.from,this.to,e))}}class eL extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){GD(this.target,UD(this.propKeys,this.from,this.to,e))}}class iL extends kI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new rI(this.target);n.execute({type:"custom",custom:tL,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:QD,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class sL extends kI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new rI(this.target);n.execute({type:"custom",custom:eL,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:QD,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class nL extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),mI(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Ou(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Ou(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class rL extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Na.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new wl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Na.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:So.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:So.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=jo(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=jo(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}aL.getInstance();const oL="appear",lL="disappear",hL="update",cL="highlight",dL="unhighlight";class uL{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class pL{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new rI(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new rI(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([oL],[{name:oL,animation:t}],e)}applyDisappearState(t,e){this.applyState([lL],[{name:lL,animation:t}],e)}applyUpdateState(t,e){this.applyState([hL],[{name:hL,animation:t}],e)}applyHighlightState(t,e){this.applyState([cL],[{name:cL,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([dL],[{name:dL,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class gL{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new pL(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new uL(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class fL extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Ha.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Rl.END?this.removeAnimate(t,!0):t.status!==Rl.RUNNING&&t.status!==Rl.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const mL=new fL;function vL(t,e){for(let i=0;i{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new SI(Ol.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new AI(Ol.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new RI(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Rl.RUNNING&&(this.status=Rl.PAUSED)}resume(){this.status===Rl.PAUSED&&(this.status=Rl.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Rl.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Rl.END,this.target.restoreStaticAttribute(),void(this.__skipRestoreStaticAttributeOnRemove=!0);this.status=Rl.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&yI(this.target,this._startProps,So.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const bL=new Wa;class xL{constructor(){this.released=!1}tick(t,e){bL.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class SL extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Pl.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Pl.INITIAL,Na.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Na.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new xL;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Pl.INITIAL&&(this.status=Pl.PAUSE,!0)}resume(){return this.status!==Pl.INITIAL&&(this.status=Pl.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Pl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Pl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Pl.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Pl.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Pl.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Pl.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Na.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function kL(){U(wp,gL),U(wp,AL)}const CL=Symbol.for("vrender.bootstrap.state"),wL=new WeakMap;function ML(t,e){var i;const s=null!==(i=t[CL])&&void 0!==i?i:new Set;return t[CL]=s,!s.has(e)&&(s.add(e),!0)}function TL(t,e){var i,s,n,r;const a=null!==(i=null==t?void 0:t.type)&&void 0!==i?i:"unknown",o=null!==(s=null==t?void 0:t.numberType)&&void 0!==s?s:"unknown",l=null!==(r=null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)&&void 0!==r?r:"anonymous";return`${e}:${String(o)}:${String(a)}:${l}`}function BL(t,e){let i=wL.get(t);i||(i=new Map,wL.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function EL(t,e,i){const s=BL(t,e);i&&s.forEach((t=>i(t))),s.clear()}function PL(t){var e,i;const s=null!==(e=qy().getAll(Wf))&&void 0!==e?e:[],n=BL(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;EL(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=TL(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function OL(t,e){var i,s;const n=null!==(i=qy().getAll(e))&&void 0!==i?i:[],r=BL(t.registry.picker,"vrender:legacy-picker"),a=new Set;EL(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=TL(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const RL=gR,IL=fR,DL={taro:{installEnv:function(t,e){pR(t,"taro",{bindEnv:yO,bindCanvasModules:MT,bindWindowContribution:mO},e)},loadEnv:_O},feishu:{installEnv:function(t,e){pR(t,"feishu",{bindEnv:BP,bindCanvasModules:fT,bindWindowContribution:DE},e)},loadEnv:EP},tt:{installEnv:function(t,e){pR(t,"tt",{bindEnv:CO,bindCanvasModules:ET,bindWindowContribution:xO},e)},loadEnv:wO},wx:{installEnv:function(t,e){pR(t,"wx",{bindEnv:IO,bindCanvasModules:RT,bindWindowContribution:EO},e)},loadEnv:DO},lynx:{installEnv:function(t,e){pR(t,"lynx",{bindEnv:lO,bindCanvasModules:xT,bindWindowContribution:ZP},e)},loadEnv:hO},harmony:{installEnv:function(t,e){pR(t,"harmony",{bindEnv:GP,bindCanvasModules:yT,bindWindowContribution:DP},e)},loadEnv:YP}},LL=[sA,tA,qS,JS,X_,$_],FL=[()=>{rI.registerBuiltInAnimate("increaseCount",hD),rI.registerBuiltInAnimate("fromTo",RI),rI.registerBuiltInAnimate("scaleIn",pD),rI.registerBuiltInAnimate("scaleOut",gD),rI.registerBuiltInAnimate("growHeightIn",NI),rI.registerBuiltInAnimate("growHeightOut",VI),rI.registerBuiltInAnimate("growWidthIn",nD),rI.registerBuiltInAnimate("growWidthOut",rD),rI.registerBuiltInAnimate("growCenterIn",zI),rI.registerBuiltInAnimate("growCenterOut",HI),rI.registerBuiltInAnimate("clipIn",BI),rI.registerBuiltInAnimate("clipOut",EI),rI.registerBuiltInAnimate("fadeIn",PI),rI.registerBuiltInAnimate("fadeOut",OI),rI.registerBuiltInAnimate("growPointsIn",GI),rI.registerBuiltInAnimate("growPointsOut",YI),rI.registerBuiltInAnimate("growPointsXIn",KI),rI.registerBuiltInAnimate("growPointsXOut",$I),rI.registerBuiltInAnimate("growPointsYIn",ZI),rI.registerBuiltInAnimate("growPointsYOut",JI),rI.registerBuiltInAnimate("growAngleIn",LI),rI.registerBuiltInAnimate("growAngleOut",FI),rI.registerBuiltInAnimate("growRadiusIn",eD),rI.registerBuiltInAnimate("growRadiusOut",iD),rI.registerBuiltInAnimate("moveIn",oD),rI.registerBuiltInAnimate("moveOut",lD),rI.registerBuiltInAnimate("rotateIn",dD),rI.registerBuiltInAnimate("rotateOut",uD),rI.registerBuiltInAnimate("update",_D),rI.registerBuiltInAnimate("state",fD),rI.registerBuiltInAnimate("labelItemAppear",AD),rI.registerBuiltInAnimate("labelItemDisappear",kD),rI.registerBuiltInAnimate("poptipAppear",CD),rI.registerBuiltInAnimate("poptipDisappear",wD),rI.registerBuiltInAnimate("inputText",SD),rI.registerBuiltInAnimate("inputRichText",HD),rI.registerBuiltInAnimate("outputRichText",jD),rI.registerBuiltInAnimate("slideRichText",VD),rI.registerBuiltInAnimate("slideOutRichText",ND),rI.registerBuiltInAnimate("slideIn",YD),rI.registerBuiltInAnimate("growIn",XD),rI.registerBuiltInAnimate("spinIn",KD),rI.registerBuiltInAnimate("moveScaleIn",ZD),rI.registerBuiltInAnimate("moveRotateIn",JD),rI.registerBuiltInAnimate("strokeIn",$D),rI.registerBuiltInAnimate("slideOut",QD),rI.registerBuiltInAnimate("growOut",tL),rI.registerBuiltInAnimate("spinOut",eL),rI.registerBuiltInAnimate("moveScaleOut",iL),rI.registerBuiltInAnimate("moveRotateOut",sL),rI.registerBuiltInAnimate("strokeOut",qD),rI.registerBuiltInAnimate("pulse",nL),rI.registerBuiltInAnimate("MotionPath",WD),rI.registerBuiltInAnimate("streamLight",rL),rI.registerBuiltInAnimate("dissolve",OD),rI.registerBuiltInAnimate("grayscale",LD),rI.registerBuiltInAnimate("distortion",RD),rI.registerBuiltInAnimate("particle",FD),rI.registerBuiltInAnimate("glitch",DD),rI.registerBuiltInAnimate("gaussianBlur",ID),rI.registerBuiltInAnimate("pixelation",zD)},kL],zL=[xR,AR,CR,MR,BR,oR,PR,RR,DR,FR,HR,NR,WR,GR,XR,$R,QR,eI,sI,ZR];function HL(){LL.forEach((t=>t())),FL.forEach((t=>t()))}function jL(t,e){if(!ML(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==t_?void 0:t_.env)?t_.envParams:void 0}(e);return void 0===i?fR(t):IL(t,i),mR(t),yR(t),gO(),zL.forEach((t=>t())),PL(t),OL(t,FT),HL(),t}function NL(t,e,i){if(!ML(t,e))return t;const s=DL[e];return s.installEnv(t,i),mR(t),function(t){yR(t)}(t),s.loadEnv(),zL.forEach((t=>t())),PL(t),OL(t,FT),HL(),t}var VL=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt())),PL(t),OL(t,fB),HL(),t):t}(eb(VL(t,["envParams"])),e)}var UL=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nJL(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=ZL(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&JL(t,i,s))}}}(t,s,r,o)}function tF(t){const{env:e}=t,i=Object.assign({},t);return delete i.env,delete i.key,"browser"===e?WL(i):"node"===e?function(t={}){const{envParams:e}=t,i=XL(t,["envParams"]);return jL(KL(i),e)}(i):"taro"===e?function(t={}){return YL("taro",t)}(i):"feishu"===e?function(t={}){return YL("feishu",t)}(i):"tt"===e?function(t={}){return YL("tt",t)}(i):"wx"===e?function(t={}){return YL("wx",t)}(i):"lynx"===e?function(t={}){return YL("lynx",t)}(i):function(t={}){return YL("harmony",t)}(i)}const eF=t=>{switch(t){case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony";case s.lynx:return"lynx";default:return"browser"}},iF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},sF=(t,e)=>{const i=eF(t),s=iF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},nF=(t,e)=>{const i=QL((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,tF,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}};class rF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(t,e){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(PM.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(PM.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(PM.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var t,e,i,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:g,background:f}=this._option,m=sF(o,l);t_.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(o),null!=m?m:{});const v=this._option.stage;if(this._isExternalStage=!!v,this._releaseVRenderAppRef=void 0,this._stage=v,!this._stage){const s=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=eF(i.mode),n=sF(i.mode,i.modeParams);return nF(s,n)})({app:this._option.app,mode:o,modeParams:l});this._releaseVRenderAppRef=s.releaseAppRef;try{this._stage=(y=s.app,_=Object.assign({background:f,width:this._width,height:this._height,container:null!==(t=this._container.dom)&&void 0!==t?t:null,canvas:null!==(e=this._container.canvas)&&void 0!==e?e:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:g},ReactDOM:this._option.ReactDOM,autoRefresh:u(r)?r:!u(a)},null!==(i=this._option.renderHooks)&&void 0!==i?i:{}),y.createStage(_))}catch(t){throw null===(n=this._releaseVRenderAppRef)||void 0===n||n.call(this),this._releaseVRenderAppRef=void 0,t}}var y,_;this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const b=ef({x:0,y:0,width:this._width,height:this._height});b.name="root",this._stage.defaultLayer.appendChild(b),this._rootGroup=b;const x=(u(h)?h:gA(o))&&!1!==c&&hw.getStageEventPlugin("gesture");x&&(this._gestureController=new x(this._stage,p(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=QM.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!y(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!pA(this._option.mode))return!1;return!1===(u(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:t_.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(t_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=t_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>sT(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>sT(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{sT(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===QM.before;(e||i)&&(oA(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=QM.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=QM.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),oA(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=nT(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=rT(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=rT(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=eT(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=eT(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:aT,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{sT(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===ZM.appear))?ZM.appear:e.every((t=>t===ZM.disappear))?ZM.disappear:ZM.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===OM.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=kM(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=kM(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:wM(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===OM.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===OM.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===OM.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===OM.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===OM.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{sT(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=nT(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return pA(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&Uc(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{sT(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=t_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){t_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function aF(t,i){var s;return e(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==i?void 0:i.onError)&&void 0!==s?s:hA)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const oF={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}},lF={poptip:z({},oF)};function hF(t){t.crosshair=G(t.crosshair||{}).map((e=>lw({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function cF(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=oi(l,i.width,i.height);a=t,o=e}else if(h&&pA(e.mode)){let t;t=v(h)?t_.getElementById(h):h;const{width:e,height:s}=oi(t,i.width,i.height);a=e,o=s}else if(fA(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}const dF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function uF(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function pF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function gF(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;dF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function fF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}const mF=9,vF=0,yF=-1;var _F,bF,xF,SF,AF,kF;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(_F||(_F={})),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"}(bF||(bF={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(xF||(xF={}));class CF{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},CF.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=G(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}CF.defaultMarkInfo={};class wF{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class MF{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>lw({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class TF extends wF{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=MF,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new CF,this._lastLayoutRect=null,this.id=vA(),this.userId=t.id,this._spec=t,this.effect={},this.event=new TM(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${Rw}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=hw.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!d(e))return P(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class BF{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=bF.Region,this._willLayoutTag=!0,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=XC($C(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:YC(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:YC(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:YC(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:YC(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:YC(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:YC(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=YC(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=YC(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=YC(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(KC(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class EF extends TF{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new BF(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class PF extends MF{_initTheme(t,e){return{spec:t,theme:this._theme}}}class OF extends EF{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=PF,this.modelType="region",this.specKey="region",this.type=OF.type,this._series=[],this.layoutType="region",this.layoutZIndex=_F.Region,this.seriesDataFilterOver=()=>{this.event.emit(PM.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",_F.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",xF.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:_F.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:_F.Mark+1}))}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",xF.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",xF.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",xF.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",xF.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",xF.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||G(t.userId).includes(e.userId))&&(!u(t.specIndex)||G(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function RF(t){const e=[],i=[],s=[];return t.forEach((t=>{d(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function IF(t,e,i){e?t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function DF(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function LF(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=jF(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),DF(d,!0,p,l),s&&IF(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function FF(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=jF(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=jF(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),DF(d,!1,p,o),s&&IF(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function HF(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=jF(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=jF(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=RF(t);n.length&&LF(n,e,i,!1,"left",s),r.length&&LF(r,e,i,!0,"left",s),a.length&&FF(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=RF(t);n.length&&zF(n,e,i,!1,"top",s),r.length&&zF(r,e,i,!0,"top",s),a.length&&HF(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=RF(t);n.length&&LF(n,e,i,!1,"right",s),r.length&&LF(r,e,i,!0,"right",s),a.length&&FF(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=RF(t);n.length&&zF(n,e,i,!1,"bottom",s),r.length&&zF(r,e,i,!0,"bottom",s),a.length&&HF(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=jF(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=jF(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:hA)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}NF.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(SF||(SF={})),function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(AF||(AF={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(kF||(kF={}));const VF=["linear","radial","conical"],WF={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const UF={};Object.values(AF).forEach((t=>{UF[t]=!0})),AF.STATE_HOVER,AF.STATE_HOVER_REVERSE,AF.STATE_SELECTED,AF.STATE_SELECTED_REVERSE,AF.STATE_DIMENSION_HOVER,AF.STATE_DIMENSION_HOVER_REVERSE;class GF extends wF{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class YF extends GF{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];u(s.domain)&&(n.domain=s.domain),u(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,tT.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!UF[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Rw)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(Rw))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(wk(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class XF extends wF{constructor(){super(...arguments),this.id=vA(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=hw.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class KF extends XF{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const $F=1e3,qF="quadInOut",ZF=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],JF=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=Ou(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},QF=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Rb(t):[],n=Rb(e);i&&s&&(i.fromTransform&&Ib(s,i.fromTransform.clone().getInverse()),Ib(s,i.toTransfrom));const[r,a]=Ob(s,n);return t?Pb(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},ez=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],iz=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!ez.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Eu.Get(t,Bu.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class sz extends kI{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;QF(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&JF(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):yI(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const nz=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=tz(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=iz(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new sz({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:$F,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:qF);return c.play(d),c};class rz extends kI{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;QF(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&JF(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const az=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>ZF.includes(t))(i)||(e[i]=t[i])})),e},oz=(t,e,i)=>{const s=az(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=Na.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},lz=(t,e,i)=>{const s=[],n=i?null:az(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:az(t.attribute);if("rect"===t.type)Fb(t,e).forEach((t=>{s.push(Na.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)zb(t,e).forEach((t=>{s.push(Na.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)Hb(t,e).forEach((t=>{s.push(Na.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=Vb(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Na.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?Xb(t,e).forEach((t=>{s.push(Na.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?Nb(t,e).forEach((t=>{s.push(Na.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&Kb(t,e).forEach((t=>{"path"in t?s.push(Na.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Na.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&oz(t,s,e),s},cz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,dz=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=cz(l.delay,n,a,o),d=cz(l.duration,n,a,o),u=cz(l.oneByOne,n,a,o),p=cz(l.splitPath,n,a,o),g=A(u)&&u>0?t=>x(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?lz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:hz)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);nz(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?lz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:hz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>tz(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>iz(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:So.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new sz({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:$F,null!==(l=i.easing)&&void 0!==l?l:qF))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:So.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new rz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:$F,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:qF))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):nz(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},uz=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},pz=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},gz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},fz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];gz(t,a,s)},mz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));gz(t,r,i)},vz=Symbol("statesClearedBeforeReInit");class yz extends XF{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new KF(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=ef("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:_F.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new wl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===SF.enter||t.context.diffState===SF.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&gz(t,r,e)},this.name=t,this.model=e.model,this.key=e.key,this.state=new YF(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ae)}isUserLevel(t){return[xF.User_Mark,xF.User_Series,xF.User_Chart,xF.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&lw(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Mk(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=HC(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):VF.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Mk(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",xF.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,xF.User_Mark)}else this.setStyle(i,t,xF.User_Mark)}))}_computeGradientAttr(e){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=e,d=t(e,["gradient","scale","field"]);let p=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(p=t),g||(g=e)}const f=EC(BC(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},WF[o]),d);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==p?void 0:p.scale(t[g]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=ii.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)VF.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=EC(BC(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return eT(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return hw.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[zw],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=eT(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===ZM.appear))?ZM.appear:t.every((t=>t===ZM.disappear))?ZM.disappear:t[0];return null!=e?e:ZM.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{pz(t),s.push(...t.getGraphics())})),e.forEach((t=>{pz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);dz([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=uz(e,n),r=uz(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===ZM.exit?ZM.exit:i===ZM.update?ZM.update:ZM.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===SF.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===SF.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=SF.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=SF.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=SF.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=ZM.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=ZM.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return iT(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=iT(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||c(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!c(r)&&(!VF.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!Mk(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);d(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,MM(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===AF.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=hw.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=hw.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===QM.before||(this._product||this._initProduct(),oA(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[vz],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?fz(i,t,!0,a):mz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[vz]=e:delete s[vz]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===SF.exit&&!e.isExiting)if(e.context.animationState===SF.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===SF.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:SF.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=ef({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[vz]=t.currentStates.slice())}))}}var _z;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(_z||(_z={}));class bz extends yz{constructor(){super(...arguments),this.type=bz.type,this._marks=[],this._diffState=SF.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(lA("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?(lA("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return sT(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===SF.update){const t=this.hasAnimation(),e=MM(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=SF.update}render(){this._isCommited&&(oA(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}bz.type="group";const xz={measureText:Ow};class Sz{static instance(){return Sz.instance_||(Sz.instance_=new Sz),Sz.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class Az{constructor(){this.id=vA(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?lA("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class kz extends Az{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const Cz=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},wz=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class Mz extends o{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=to.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=to.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||Cz(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=wz(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=to.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=wz(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Cz(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=to.now()-i>this.config.press.time&&wz(s[0],t){Na.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Bz extends Tz{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},y=null!==(o=v.width)&&void 0!==o?o:0,_=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const C=Na.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:y/2,y:null!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:_/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(y+_)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let w,M;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},M={startAngle:x}):(w={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?w:M,"in"===b?M:w,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class Ez extends Tz{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",y=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",_=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Na.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===y?0:f,height:"in"===v&&"y"===y?0:m,fill:!0});let x={},S={};"y"===y?"negative"===_?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===_?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Pz extends kI{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),A(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ne(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;A(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&mD(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(mI(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=yh(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));yI(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const Oz={type:"fadeIn"};function Rz(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return Oz;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}class Iz extends wI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}afterStageRender(t,e){var i,s;return null===(s=null===(i=this.params)||void 0===i?void 0:i.callBack)||void 0===s?void 0:s.call(i,t,e,this.currentAnimationRatio,this.animationTime)}}const Dz={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},Lz={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},Fz={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},zz=()=>{hw.registerAnimation("scaleInOut",(()=>Lz))},Hz=()=>{hw.registerAnimation("fadeInOut",(()=>Fz))},jz=(t,e)=>({appear:Rz(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Pz,duration:Dz.update.duration,easing:Dz.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),Nz=()=>{hw.registerAnimation("line",jz)},Vz=()=>{rI.registerBuiltInAnimate("growPointsIn",GI),rI.registerBuiltInAnimate("growPointsOut",YI),rI.registerBuiltInAnimate("growPointsXIn",KI),rI.registerBuiltInAnimate("growPointsXOut",$I),rI.registerBuiltInAnimate("growPointsYIn",ZI),rI.registerBuiltInAnimate("growPointsYOut",JI),rI.registerBuiltInAnimate("clipIn",BI),rI.registerBuiltInAnimate("clipOut",EI)},Wz=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};AF.STATE_HIGHLIGHT,AF.STATE_BLUR;class Uz{constructor(t){this._markSet=new CF,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const Gz={highlightState:AF.STATE_HIGHLIGHT,blurState:AF.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class Yz extends Uz{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},Gz,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&mz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}Yz.type="element-highlight",Yz.defaultOptions=Gz;const Xz=()=>{hw.registerInteractionTrigger(Yz.type,Yz)},Kz={state:AF.STATE_SELECTED,trigger:"click"};class $z extends Uz{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},Kz,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),fz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&mz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}$z.type="element-select",$z.defaultOptions=Kz;const qz=()=>{hw.registerInteractionTrigger($z.type,$z)};class Zz extends Az{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const Jz=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},Qz=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...Qz(t))})),s},tH=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(Jz(t,r),!1)};class eH{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>hw.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>hw.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>hw.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return hw.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>hw.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){hw.registerTransform(t,e)}static registerFunction(t,e){t&&e&&Sz.instance().registerFunction(t,e)}static unregisterFunction(t){t&&Sz.instance().unregisterFunction(t)}static getFunction(t){return t?Sz.instance().getFunction(t):null}static getFunctionList(){return Sz.instance().getFunctionNameList()}static registerMap(t,e,i){const s=hw.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=hw.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,jM.get(e);var e}static registerSVG(t,e,i){const s=hw.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=hw.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){kw.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=vA(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=oT.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=gF(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?hw.getSeriesBuiltInTheme(e):hw.getComponentBuiltInTheme(e);i=i?lw({},s,i[e]):s}s===t.length-1&&u(i)&&(i=Tw({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},Ak(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:y,stage:_,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=pA(y);if(S?RE(e_):"node"===y&&gO(e_),S&&f&&(this._container=v(f)?t_.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==y&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=Cw.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===e.type&&A.push("scrollbar");const k=new at(null!==(a=this._option.logLevel)&&void 0!==a?a:rt.Error);at.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new rF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new FM(this,this._compiler),this._event=new TM(this._eventDispatcher,y),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),kw.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=lw({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Bw(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;eH.getFunctionList()&&eH.getFunctionList().length&&(t=Ew(t,eH)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=hw.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=hw.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=hw.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(PM.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(PM.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=St(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return cF(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:Iw,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:Dw})}_initDataSet(t){this._dataSet=t instanceof Pa?t:new Pa,HM(this._dataSet,"dataview",Ta),HM(this._dataSet,"array",i),zM(this._dataSet,"copyDataView",YM);for(const t in hw.transforms)zM(this._dataSet,t,hw.transforms[t]);for(const t in hw.dataParser)HM(this._dataSet,t,hw.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),uF(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(PM.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?ZM.none:ZM.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,kw.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{Jz(t)})),this._exitingVRenderComponents.clear())}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return e(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Oa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=KM(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?lw({},t[n][e.index],i):i):t[n]=s?lw({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?lw({},t[n][r],i):i)}else t.id===e&&(t[n]=s?lw({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=lw({},t.getSpec(),e));const r=t.updateSpec(e),a=uF(r),o=pF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(PM.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=cw({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=ww(this._currentThemeName),this._currentTheme=o(a,l);else{const t=cw({},ww(p(r)&&r.type?r.type:p(n)&&n.type?n.type:this._currentThemeName),ww(n),ww(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(lF.poptip,oF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!pA(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return ww(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!Cw.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=u(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield aF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!pA(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,e):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(u(this._container))return this._container;let e;return e=v(this._canvas)?t_.getElementById(this._canvas):this._canvas,u(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?qC(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return lA("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?qC(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(lA("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return Sz.instance().getFunction(t)}registerFunction(t,e){t&&e&&Sz.instance().registerFunction(t,e)}unregisterFunction(t){t&&Sz.instance().unregisterFunction(t)}getFunctionList(){return Sz.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=hw.getChartPlugins();t.length>0&&(this._chartPlugin=new kz(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=hw.getVChartPlugins();e.length>0&&(this._vChartPlugin=new Zz(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=oT.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;this._renderState=oT.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent()}}eH.InstanceManager=kw,eH.ThemeManager=Cw,eH.globalConfig={uniqueTooltip:!0},eH.Utils=xz,eH.vglobal=t_;hw.registerRegion("region",OF),hw.registerLayout("base",NF),$R(),PR(),hw.registerMark(bz.type,bz),hw.registerStageEventPlugin("gesture",Mz),Xz(),qz(),_w(sw.name,sw);const iH="monotone",sH="linear",nH="bevel";var rH;!function(t){t.vertical="vertical",t.horizontal="horizontal"}(rH||(rH={}));class aH{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}class oH extends SL{constructor(t){super(t),this.lastFrameTime=0,this.status=Pl.RUNNING}setupTickHandler(){const t=new aH;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Pl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Pl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Pl.RUNNING,!0}}function lH(t,e){return e("component",t)}function hH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=hw.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const cH=(t,e,i,s)=>{if(d(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},dH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,c(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],p=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(c(e.set))g=function(t){const i=p.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=p.get(`${e[a]}`);if(d(i))for(let i=0;i(g(t),t)))},uH="2.1.0",pH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},gH=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?P(e,t.field):t,s){const{formatFunc:i,args:r}=hH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},fH=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const mH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function vH(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=_H(gH(h,r,a,c),p,g),o.value=_H(gH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=gH(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function yH(t,e,i,s,n,r,a){if(c(e)){vH(t,e(n,a),i,s,r,a)}else e&&vH(t,e,i,s,r,a)}const _H=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=vi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class bH{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:u(n)?G(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(u(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of G(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(u(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{yH(a,t,e,i,s,n,r)})):c(t)?yH(a,t,e,i,s,n,r):t&&vH(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=c(e)?e(s,n):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:gH(r.visible,t,n),value:_H(gH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:gH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=gH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&mH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const xH={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},SH=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=aM([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return AH(a,n,o)},AH=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{yA(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{yA(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=xH[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},kH=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{yA(t[e])||(t[e]=0)}))})),t},CH=`${Rw}_HIERARCHY_DEPTH`,wH=`${Rw}_HIERARCHY_ROOT`,MH=`${Rw}_HIERARCHY_ROOT_INDEX`;function TH(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function BH(t,e,i){t&&(i.needDefaultSeriesField&&(t[Hw]=i.defaultSeriesField),t[Fw]=e,t[zw]=i.getKey(t,e,i))}function EH(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function PH(t,e,i,s=0,n,r){void 0===r&&(r=e),BH(t,e,i),t[CH]=s,t[wH]=n||t[i.categoryField],t[MH]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>PH(e,s,i,t[CH]+1,t[wH],r)))}const OH={label:{name:"label",type:"text"}},RH=`${Rw}_rect_x`,IH=`${Rw}_rect_x1`,DH=`${Rw}_rect_y`,LH=`${Rw}_rect_y1`,FH={data:!0},zH={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},HH=[...Object.keys(Dz),"normal"];function jH(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return GH(n)&&delete n.type,n.oneByOne&&(n=VH(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:WH,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=lw({},o[e],a);return GH(n)&&delete n.type,n.oneByOne&&(n=VH(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:WH,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function NH(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),YH(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function VH(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=c(n)?n(t,i,a):A(n)?n:0,h=c(r)?r(t,i,a):A(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):A(n)?n:0,d=c(a)?a(t,r,o):A(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function WH(t,e){var i;return null!==(i=null==t?void 0:t[Fw])&&void 0!==i?i:e.context.graphicIndex}function UH(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function GH(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function YH(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),YH(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),YH(t[s],e,i))}function XH(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class KH extends MF{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=wC(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=hw.getSeriesMarkMap(o)?function(t,e,i){const s=hw.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=lw({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return lw({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=lw({},i,s,t),n=i.label;return n&&p(n)&&y(e.label)&&(e.label=e.label.map((t=>lw({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const $H=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(zH[e]||(t[e]=!0),t)),{}),qH={compileOnlyKeys:zH,dataRelatedKeys:$H,seriesOnlyKeys:{tooltip:!0}},ZH={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},JH=t=>(t=>p(t)&&!y(t)&&!c(t))(t)?t:d(t)?{}:null,QH=(t,e,i)=>{const s=JH(t),n=JH(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function tj(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class ej extends TF{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){u(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${Rw}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=KH,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=_F.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(PM.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=XH(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(PM.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return d(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),u(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(zM(this._rawData.dataSet,"invalidTravel",kH),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=KM(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=XM(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=XM(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new KF(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=AH(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){zM(this._dataSet,"dimensionStatistics",SH);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Oa(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&aM(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){zM(this._dataSet,"dimensionStatistics",SH);const s=new Oa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=aM(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&aM(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Oa(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return d(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:v(t)?e=>e[t]:y(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(zM(this._rawData.dataSet,"addVChartProperty",pH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:TH.bind(this),call:BH}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(PM.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(PM.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(PM.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(PM.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=jH({},NH(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:gA(i)||fA(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=lw(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=lw(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=Wz(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=Wz(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:AF.STATE_HOVER_REVERSE,highlightState:AF.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:AF.STATE_SELECTED_REVERSE,state:AF.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=Wz(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:Hw;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:jw,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,jw,xF.User_SeriesStyle)}))}afterInitMark(){this.event.emit(PM.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",xF.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(hw.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new bH(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,tj(i))}_getSpecUpdatePolicy(){return qH}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},FH),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(G(t.label),G(e.label),l),!l.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>QH(t[i],e[i],ZH)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&QH(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?tj(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&tj(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Oa||$M(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();XH(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:Hw,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new FC).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return BC(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:Hw}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),d(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),d(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,u=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${u}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,lw({},p,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:zw}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${d(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==Ww&&t!==Gw&&t!==Vw&&t!==Uw||(t=this.getStackValueField()),null!==(e=lM(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>yA(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:Hw]}}function ij(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();wk(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function sj(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}ej.mark=OH,ej.transformerConstructor=KH;class nj extends ej{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);wk(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${Rw}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(Ww),this.setFieldX2(Vw)):(this.setFieldY(Ww),this.setFieldY2(Vw))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(Gw),this.setFieldX2(Uw)):(this.setFieldY(Gw),this.setFieldY2(Uw))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(Xw),this.setFieldX2(Yw)):(this.setFieldY(Xw),this.setFieldY2(Yw))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=G(this._spec.xField),this._specYField=G(this._spec.yField),u(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(G(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(G(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(PM.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(ij("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function rj(t){return"bottom"===t||"top"===t}function aj(t){return"left"===t||"right"===t}function oj(t){return"z"===t}function lj(t,e){return WC(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function hj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function cj(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?rj(t)?"linear":"band":rj(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const dj=(t,e,i)=>{var s;const n=null!==(s="band"===e?lH("axisBand",i):["linear","log","symlog"].includes(e)?lH("axisLinear",i):{})&&void 0!==s?s:{},r=rj(t)?lH("axisX",i):aj(t)?lH("axisY",i):lH("axisZ",i);return lw({},lH("axis",i),n,r)};class uj{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:hA)("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:hA)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>Tk(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return rj(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class pj extends uj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:OM.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const gj=(t,e)=>{var i,s;return t===e||!d(t)&&!d(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},fj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return A(s)?[-s,s]:s},mj=(t,e,i,s)=>{var n;const r=e.getScale(),a=Tk(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:vj(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,yj=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(G(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class _j extends uj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!gj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:OM.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:OM.canvas}),callback:this.onMouseOut}),gA(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:OM.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),gA(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var bj;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(bj||(bj={}));const xj={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},Sj={sampling:!0,samplingFactor:!0};class Aj{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(xj.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",xF.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",xF.Series),this.event.on(PM.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:nH,curveType:sH,closePath:!0},"normal",xF.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===iH?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",xF.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",xF.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(xj.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:UH(this._spec,xj.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Oa(this._option.dataSet,{name:`${Rw}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(bj.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:xF.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:AF.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",xF.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",xF.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[xj.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(bj.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,lw({},this._spec[xj.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:AF.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",xF.Series),this.event.on(PM.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",xF.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",xF.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const kj=Object.assign(Object.assign({},OH),xj),Cj=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>Cj(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},wj=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class Mj extends yz{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return wj}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(Mk(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?Cj(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:SF.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[zw]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const Tj=new Uint32Array(33),Bj=new Uint32Array(33);Bj[0]=0,Tj[0]=~Bj[0];for(let t=1;t<=32;++t)Bj[t]=Bj[t-1]<<1|1,Tj[t]=~Bj[t];function Ej(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&Tj[31&o]&Bj[1+(31&l)])return!0}else{if(i[h]&Tj[31&o])return!0;if(i[c]&Bj[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,Tj[31&o]&Bj[1+(31&l)]);else for(s(h,Tj[31&o]),s(c,Bj[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,Bj[31&a]|Tj[1+(31&o)]);else for(n(l,Bj[31&a]),n(h,Tj[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function Pj(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=vt(i,-o,t.width+l),d=vt(s,-o,t.width+l),u=vt(n,-a,t.height+h),p=vt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function Oj(t,e,i=!1){return i?Pj(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function Rj(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=Oj(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=Pj(t,r)),e.getRange(r)))}function Ij(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>u(t))),p=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return Ij(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return Ij(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return Ij(t,e,n,s,h,d)}return!1}const Lj=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],Fj=["top","inside-top","inside"];function zj(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const Hj={mode:"same-time",duration:300,easing:"linear"};function jj(t){return 3===t||4===t}function Nj(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const Vj=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function Wj(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}class Uj extends CI{onBind(){const t=xD(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class Gj extends CI{onBind(){const t=xD(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const Yj=(t,e)=>Math.ceil(t)>Math.floor(e),Xj=([t,e],[i,s])=>s>t&&e>i;function Kj(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const $j=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class qj extends tf{constructor(t,e){super(t),this._skipRenderAttributes=$j,(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){d(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{Qj(t,e,i)})),e}function tN(t,e){e&&(null==t||t.onComplete.push(e))}function eN(t){t.forEach((t=>{t()}))}function iN(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var sN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(HA.hover,!0),bA(this,(t=>{t===e||E(t.states)||t.addState(HA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(bA(this,(t=>{E(t.states)||(t.removeState(HA.hoverReverse),t.removeState(HA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void bA(this,(t=>{E(t.states)||(t.removeState(HA.selectedReverse),t.removeState(HA.selected))}));E(e.states)||(e.addState(HA.selected,!0),bA(this,(t=>{t===e||E(t.states)||t.addState(HA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===So.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===So.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Se(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[Wj(g,f,c,d,a,o),Wj(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=DA.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new wl)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),eN(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,tN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(Hj),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=Qj(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=Qj(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},iN(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(c(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}let a=this._initText(r);a=c(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(a);const o=[],l=a;if(!h(t)&&c(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}c(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return XA(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=c(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&Yj(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&Yj(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(pt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(Kj([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!Xj([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(Oj(i,e,!0))}))),h.length>0&&h.forEach((t=>{v(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(Oj(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(Oj(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;Jj(i,null==n?void 0:n.attribute),Jj(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{rN[t]=e};var oN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};lN.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const hN=()=>{aN("line",lN),aN("area",lN)};var cN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}dN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const uN=()=>{aN("symbol",dN),aN("line-data",dN)};class pN extends Mj{constructor(){super(...arguments),this.type=pN.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)===kC.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}pN.type="line";const gN=()=>{hw.registerMark(pN.type,pN),$R(),DR(),hN(),uN(),Vz(),hw.registerGraphicComponent("line",ig)};class fN extends yz{constructor(){super(...arguments),this.type=fN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}fN.type="symbol";const mN=()=>{hw.registerMark(fN.type,fN),$R(),QR(),uN(),hw.registerGraphicComponent("symbol",Qp)};class vN extends KH{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function yN(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function _N(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function bN(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function xN(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function SN(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function AN(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const kN=t=>t.map(((t,e)=>({index:e,value:t}))),CN=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},wN=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ae(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=WA(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=se(t,e),a=Math.max(ee(i),ee(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return kN(v)};class BN{constructor(t){this.id=vA(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class EN extends BN{constructor(){super(EN.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!wk(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(PM.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&yN(c)&&yN(d)))return;const u=_N(t,c),p=_N(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=u,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!xN(u,p))return}else if(0===_&&0===b){if(!xN(p,u))return}else if(y||A)if(y&&!A){if(!bN(u,p))return}else if(A&&!y){if(!bN(p,u))return}else{if(f===b)return;if(f>b){if(!SN(u,p))return}else if(!SN(p,u))return}else{if(0===f&&0===_){if(!AN(u,p))return}else if(0===b&&0===g&&!AN(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){zM(e.getOption().dataSet,"tickAlign",TN);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}EN.pluginType="component",EN.type="AxisSyncPlugin";const PN={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function ON(t){let e=0;return P(t,"tick.visible")&&(e+=P(t,"tick.tickSize")),P(t,"label.visible")&&(e+=P(t,"label.space")),e}function RN(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function IN(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const DN=t=>"band"===t||"ordinal"===t||"point"===t;function LN(t,e){return{id:t,label:t,value:e,rawValue:t}}function FN(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class zN extends Az{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const HN=`${Rw}_ARC_TRANSFORM_VALUE`,jN=`${Rw}_ARC_RATIO`,NN=`${Rw}_ARC_START_ANGLE`,VN=`${Rw}_ARC_END_ANGLE`,WN=`${Rw}_ARC_K`,UN=`${Rw}_ARC_MIDDLE_ANGLE`,GN=`${Rw}_ARC_QUADRANT`,YN=`${Rw}_ARC_RADIAN`,XN=-Math.PI/2,KN=3*Math.PI/2,$N=.6,qN=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return pe(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},ZN=(t,e,i)=>{var s;const n=null!==(s="band"===e?lH("axisBand",i):"linear"===e?lH("axisLinear",i):{})&&void 0!==s?s:{},r=lH("angle"===t?"axisAngle":"axisRadius",i);return lw({},lH("axis",i),n,r)};function JN(t,e,i,s){switch(t){case n.cartesianBandAxis:return dj(lj(i,["z"]),"band",e);case n.cartesianLinearAxis:return dj(lj(i,["z"]),"linear",e);case n.cartesianLogAxis:return dj(lj(i,["z"]),"log",e);case n.cartesianSymlogAxis:return dj(lj(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return dj(lj(i),void 0,e);case n.polarBandAxis:return ZN(i.orient,"band",e);case n.polarLinearAxis:return ZN(i.orient,"linear",e);case n.polarAxis:return ZN(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=lH(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>rj(t.orient)));let g;g=u(p)?lw({},DN(p.type)?a:o,l):l;const f=r.find((t=>aj(t.orient)));let m;return m=u(f)?lw({},Tk(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=lH(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?lw({},DN(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?lw({},Tk(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return QN(i,lH(t,e));default:return lH(t,e)}}const QN=(t,e)=>{var i;const s=lw({},e,e[hj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class tV extends MF{getTheme(t,e){return JN(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},$C(e)),{[s]:0}))}}class eV extends EF{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=tV,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Qa||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:OM.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new zN(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;Jz(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=Qz(t),s=tH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}Jz(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var iV,sV;eV.transformerConstructor=tV,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(iV||(iV={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(sV||(sV={}));class nV extends yz{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=tH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?Jz(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(Jz(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=hw.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(BM.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}nV.type="component";const rV=()=>{hw.registerMark(nV.type,nV)};var aV,oV;!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.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(aV||(aV={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(oV||(oV={}));const lV={[oV.selectedReverse]:{},[oV.selected]:{},[oV.hover]:{},[oV.hoverReverse]:{}},hV=t=>t,cV={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class dV extends eV{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?iV.circleAxis:iV.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?sV.circleAxisGrid:sV.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:_F.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(this._syncComponentVisibility(),(null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=jH(null===(l=hw.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:P(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:P(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:P(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:P(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:P(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:P(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==_?_:P(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new KF(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&_k(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=y(a)?wk(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!wk(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return _k(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(s)&&(this._regionIndex=G(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(PM.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=bk(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),_k(this._regions,(t=>{t.event.on(PM.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(PM.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):_k(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(_k(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;tV(null==e?void 0:e[i],null==t?void 0:t[i])||cV[i]))}_getAxisAttributes(){const e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=bM(s=e.domainLine)).startSymbol=bM(s.startSymbol),s.endSymbol=bM(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=H(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return AM(lw({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:AM(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>AM(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=AM(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return AM(lw({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:AM(e.tick.style)),e.tick.state&&(i.tick.state=xM(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return AM(lw({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:AM(e.subTick.style)),e.subTick.state&&(i.subTick.state=xM(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=PN[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ae(p):null,textStyle:lw({},u,AM(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:AM(h.style)}),h.state&&(i.title.state.shape=xM(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:AM(o.style)}),o.state&&(i.title.state.background=xM(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=xM(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=AM(e.background.style)),e.background.state&&(i.panel.state=xM(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:Pw(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:c(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return AM(lw({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:AM(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:Pw(t.subGrid.alternateColor),style:AM(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=hH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){HM(this._option.dataSet,"scale",hV);const i=this.registerTicksTransform();return new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===aV.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}dV.specKey="axes";const uV=()=>{rV(),hw.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},pV=[EN];class gV extends dV{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=_F.Axis,this.layoutLevel=bF.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),_k(this._regions,(t=>{const e=this.getOrient();rj(e)?FN(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):aj(e)?FN(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):oj(e)&&FN(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=lw({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(lw({x:e.x,y:e.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=rj(this.getOrient()),n=t=>{var e;return(s?!rj(t.getOrient()):rj(t.getOrient()))&&wk(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&Y(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=lj(e,["z"]),oj(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!IN(e))return null;const{axisType:t,componentName:s}=cj(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>aj(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!IN(t))return;const{axisType:s,componentName:n}=cj(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=hw.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return rj(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):oj(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(pV.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){rj(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!rj(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!oj(this.getOrient())&&this._spec.innerOffset){const t=this._spec;aj(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=YC(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=YC(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=rj(this.getOrient())?t.fieldX:oj(this.getOrient())?t.fieldZ:t.fieldY,wk(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:wk(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(BM.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(rj(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=rj(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return _k(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:rj(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:oj(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();_k(this._regions,(e=>{rj(t)?FN(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):aj(t)?FN(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):oj(t)&&FN(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=rj(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=rj(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=lw(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ne).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=rj(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?vt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):vt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return LN(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:wk(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(PM.layoutEnd,this._updateAxisLayout),this.event.on(PM.layoutEnd,this._fixAxisOnZero),this.event.on(PM.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}gV.type=n.cartesianAxis,gV.specKey="axes";class fV{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new KF(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(PM.scaleDomainUpdate,{model:this}),this.event.emit(PM.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=G(e).concat(i);if(n.push(r),o){const e=LN(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>LN(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}this.event.emit(PM.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const mV=(t,e,i,s)=>{const n=MN(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},vV=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,yV=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?kN([s[s.length-1]]):kN([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(g),a=X(g);if(s.length<=f/n){const i=mV(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=bV(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=mV(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!vV(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?yV(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function SV(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=ok(t,!!n),o=ok(r,!!n);const h=re.distancePP(s,l),c=re.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=xV(e,t,!1,!!n),o=xV(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=ok(t,!!n),o=ok(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class AV extends qj{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&sk(this._innerView),this.removeAllChild(!0),this._innerView=DA.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return nk(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${aV.grid}-sub`:`${aV.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=ok(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=xV(t,o,!1,!!a)}const u=DA.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:AV.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=ok(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=DA.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*zt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:AV.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!pt(a.value,0)&&!pt(l.value,0),d=!pt(a.value,1)&&!pt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}AV.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class kV{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=OA(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return PA([n[1],-1*n[0]],t*(e?1:-1)*s)}}class CV extends CI{onBind(){var t;const e=xD(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;Jj(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class wV extends CI{onBind(){const t=xD(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;Jj(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function MV(){PR(),DR(),XR(),eI(),rI.registerBuiltInAnimate("axisEnter",CV),rI.registerBuiltInAnimate("axisUpdate",wV)}PR(),FR();class TV extends AV{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},AV.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=LA,endAngle:r=FA}=this.attribute;i=ak(t,s,re.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function BV(){PR(),DR(),HR(),QR()}function EV(){PR(),DR(),xR(),QR()}U(TV,kV),BV();class PV extends qj{getStartAngle(){return ue(this._startAngle)}getEndAngle(){return ue(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PV.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(Z(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=DA.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),E(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=DA.line;G(i)[0].cornerRadius&&(t=DA.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=DA.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:Z(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}PV.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}}},EV();class OV extends PV{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PV.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=DA.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),E(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function RV(){PR(),WR(),QR(),XR(),eI()}var IV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nc&&(w=c,R.setAttribute("maxLineWidth",c-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=w,A&&A.setAttribute("x",(A.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):j>0&&S.setAttribute("x",b[3]):(k-=w/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const N="right"===_||"end"===_,V="left"===_||"start"===_,W=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:G(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=w-b[1]-b[3],e=I+B,i=1===j?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),A){const t=i-I/2-B+F/2;A.setAttributes({x:t})}}if(V&&1!==j){const t=w-b[1]-b[3],e=0===j?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=w-b[1]-b[3],e=0===j?t/2+B/2:t;if(W(e,"right"),A){const t=e-I-B+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-D/2),S.setAttribute("y",-b[2])):"top"===H&&(S.setAttribute("y",b[0]),A&&A.setAttribute("y",D/2)),E(null==m?void 0:m.text)||(R.states=m.text);const{visible:U}=a,Y=IV(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:M,x:k,y:C}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new wl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},DV.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}DV.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const LV=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!E(s.states)?(s.addState(HA.hover,!0),bA(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(HA.hoverReverse,!0)})),s):i},FV=(t,e,i)=>i?(bA(e,(t=>{t.name&&!E(t.states)&&(t.removeState(HA.hoverReverse),t.removeState(HA.hover))})),null):i,zV=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(HA.selected)?(bA(e,(t=>{t.name&&!E(t.states)&&(t.removeState(HA.selectedReverse),t.removeState(HA.selected))})),null):s.name&&!E(s.states)?(s.addState(HA.selected,!0),bA(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(HA.selectedReverse,!0)})),s):i},HV={type:"default",duration:300,easing:"linear"};class jV extends Zj{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=LV(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=FV(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=zV(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=DA.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),eN(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,tN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(bA(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=Qj(this),{delay:a=0,duration:o=HV.duration,easing:l=HV.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};Jj(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=Qj(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},iN(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&sk(this._innerView),this.removeAllChild(!0),this._innerView=DA.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(HV)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=DA.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=aV.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=DA.group({x:0,y:0,pickable:!1});t.name=aV.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=DA.group({x:0,y:0,pickable:!1});i.name=aV.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=DA.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=aV.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=jA;else{const t=this.data[s],e=z({},jA,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=DA.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=aV.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=jA;else{const i=z({},jA,s.state);Object.keys(i).forEach((s=>{c(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=DA.group({x:0,y:0,pickable:!1});return r.name=`${aV.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=XA(this._getLabelAttribute(t,e,n,i));if(a.name=aV.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=jA;else{const s=z({},jA,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new DV(Object.assign({},e));i.name=aV.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return nk(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&c(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=zt/2*(l.x>e.x?1:-1):h=zt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+P(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+P(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=c(y)?z({},JA.label.style,y(t,e,i,s)):y;y=z(this.getLabelAlign(m,o,y.angle),y),c(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return c(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=d?d:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},bA(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=I(r.attribute),a=I(e.attribute),o=kb(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},Jj(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const NV={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&lk(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function VV(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function WV(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=c(n)?n:NV[n]||NV.parity;if(s.length>=3&&hk(s,r)){do{s=a(s,r)}while(s.length>=3&&hk(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);lk(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),WV(l,s,n,(t=>lk(t,l,r))),WV(h,s,o,(t=>lk(t,h,r)||!(!n||t===l)&&lk(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function GV(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},KV(t,e.attribute.angle)),{angle:XV(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({},$V(t,e.attribute.angle)),{angle:XV(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Ce({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function XV(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function KV(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=XV(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function $V(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=XV(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function qV(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(E(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=ik(h),m=ek(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function ZV(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var JV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=DA.group({zIndex:999});e.name=aV.axisBreak,e.id=this._getNodeId(`${aV.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},QA,s),a=null!==(e=r.size)&&void 0!==e?e:QA.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=DA.symbol(Object.assign({x:s.x,y:s.y},o));l.name=aV.axisBreakSymbol;const h=DA.symbol(Object.assign({x:n.x,y:n.y},o));h.name=aV.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=DA.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=aV.background,n.id=this._getNodeId("background"),n.states=z({},lV,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new DV(Object.assign({},t));e.name=aV.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=JV(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:z({},lV,l),symbol:z({},lV,l)});const d=new PV(c);d.name=aV.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=s,p=JV(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+P(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),k=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let w,M,{angle:T}=p;if(w="start"===n?"start":"end"===n?"end":"center",d(T)&&o){T=RA(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else w=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let B=u;if(d(B)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(T!==Math.PI/2){const t=Math.abs(Math.cos(null!=T?T:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=s-S;else if(T&&0!==T){const t=Math.abs(Math.sin(T));B=t<1e-6?1/0:this.attribute.end.y/t}else B=s-S}const E=Object.assign(Object.assign(Object.assign({},k),p),{maxWidth:B,textStyle:Object.assign({textAlign:w,textBaseline:M},a),state:{text:z({},lV,c.text),shape:z({},lV,c.shape),panel:z({},lV,c.background)}});return E.angle=T,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=s,p=JV(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(d(b)&&a){b=RA(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=u,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return KV(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return $V(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=Y(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(E(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=ae(e)})),YV(i,t),!GV(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!A(i))return;const a=t[0].attribute.angle,o=ik(a),l=ek(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=ZV(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Yt(c,i))}}else{if(l){const i=ZV(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Yt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);qV(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&UV(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=DA.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=aV.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=UA(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ai(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}QV.defaultAttributes=JA,U(QV,kV);const tW={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},eW={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},iW={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},sW={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}};class nW extends gV{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new $k}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return zM(this._option.dataSet,t,_V),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=jk(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),p=e=>{const i=t===n?a:0;if(d(r)||t{hw.registerGraphicComponent(iV.lineAxis,((t,e)=>new QV(t,e))),hw.registerGraphicComponent(sV.lineAxisGrid,((t,e)=>new TV(t,e))),uV(),hw.registerComponent(nW.type,nW,!1)},aW=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function oW(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,hW=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function cW(t,e,i="count"){const s=hW(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const dW=Math.sqrt(50),uW=Math.sqrt(10),pW=Math.sqrt(2);class gW{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=RN(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=rj(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!c(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(Y(e)-e[0]);i<=1||A(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(lW),e.sort(lW),{domain:oW(t,e),scope:cW(t,e,i)}}(r,rA(t),this._spec.breaks[0].scopeType);e=rA(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=RN(this._spec);if(u(e)||u(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=dW?10:n>=uW?5:n>=pW?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(PM.scaleDomainUpdate,{model:this}),this.event.emit(PM.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const t=this.collectData(0,!0),e=this.computeLinearDomain(t);this._rawDomain=e,this.event.emit(PM.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function fW(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function mW(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!wk(t.type))return kN(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return kN([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(u(h))m=fW(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=fW(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=fW(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=MN(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=MN(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?yW.greedy:yW.parity;for(;l.length>=3&&hk(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;lk(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),mW(t,l,a,(e=>lk(e,t,i))),mW(n,l,o,(e=>lk(e,n,i)||!(!a||e===t)&&lk(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return kN(m)},yW={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&lk(i,t,e)||(i=t,0))))}},_W={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class bW extends gV{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new mC}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!oj(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=rj(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=UC(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=rA(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return zM(this._option.dataSet,t,vW),t}}bW.type=n.cartesianLinearAxis,bW.specKey="axes",bW.builtInTheme={axis:eW,axisLinear:_W,axisX:iW,axisY:sW},U(bW,gW);const xW=()=>{hw.registerGraphicComponent(iV.lineAxis,((t,e)=>new QV(t,e))),hw.registerGraphicComponent(sV.lineAxisGrid,((t,e)=>new TV(t,e))),uV(),hw.registerComponent(bW.type,bW)},SW=`${Rw}_hide_`;function AW(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const kW=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[SW]&&(AW(t,!0),t[SW]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[SW]=!0,AW(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},CW=()=>{hw.registerGrammarTransform("symbolOverlap",{transform:kW,runType:"afterEncode"})},wW={min:K,max:X,average:gk,sum:pk};function MW(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function TW(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function BW(t,e,i,s){return TW(t,e,i,"min",s)}function EW(t,e,i,s){return TW(t,e,i,"max",s)}function PW(t,e,i,s){return TW(t,e,i,"average",s)}function OW(t,e,i,s){return TW(t,e,i,"sum",s)}const RW=(t,e)=>{let i=c(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=MW;if("min"===n?l=BW:"max"===n?l=EW:"average"===n?l=PW:"sum"===n&&(l=OW),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},IW=()=>{hw.registerGrammarTransform("dataSampling",{transform:RW})};class DW extends nj{constructor(){super(...arguments),this.type=kC.line,this.transformerConstructor=vN,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Sj)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(jH(null===(i=hw.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),NH("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=sj(this);this._symbolMark.setAnimationConfig(jH(null===(s=hw.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),NH("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}DW.type=kC.line,DW.mark=kj,DW.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},DW.transformerConstructor=vN,U(DW,Aj);class LW{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{$M(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Oa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];lA(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];lA(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class FW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{_A(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{aM(e,[{key:t,operations:wk(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&aM(e,[{key:i.field,operations:wk(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?HC("colorOrdinal"):HC(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(_A(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),_A(s.domain)?e.reRender=!0:V(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!_A(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=wk(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=wk(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;wk(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(wk(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=wk(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!E(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));wk(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class zW{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");fz(t,s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");mz(t,s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");mz(t,s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");fz(t,s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&fz(t,i,!0,l):a&&fz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&fz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{mz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&mz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const HW={[n.markPoint]:!0,[n.markLine]:!0,[n.markArea]:!0},jW={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class NW extends wF{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=vA(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:Iw,height:Dw},this._viewRect={width:Iw,height:Dw},this._viewBox={x1:0,y1:0,x2:Iw,y2:Dw},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>G(t).some((t=>u(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(jW).some((t=>!d(e[t])))},this._paddingSpec=$C(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new TM(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new LW(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new zW;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=hw.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(jH({},NH("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=hw.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:_F.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=hw.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(PM.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(PM.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(PM.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof TF)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof yz))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof yz)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&$M(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=cF(this._spec,this._option,{width:Iw,height:Dw})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=BC(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new FW(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){gF(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=BC(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=$C(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{gF(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},r={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===n.label||l.type===n.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));r[l.type]&&(r[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(y(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);pF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),gF(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);pF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),gF(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(r).forEach((e=>{if(r[e]){const i=this._spec[e];(y(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(HW[t]&&y(e)&&y(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return HW[t]&&y(e)&&e.length>0&&y(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!HW[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;HW[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];gF(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=XC(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(PM.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(AF.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(AF.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(AF.STATE_SELECTED)}clearHovered(){this.clearState(AF.STATE_HOVER)}_initEvent(){[PM.dataZoomChange,PM.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(BM.AFTER_MARK_RENDER_END,e)};this._event.on(BM.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:wM;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(CM(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===bj.dimensionHover||s===bj.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>Tk(t.axis.getScale().type)&&d(t.index))),o=a||r.every((t=>Tk(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(n.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(n.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),r=[];s.forEach((e=>{const i=t(e);!1!==i&&r.push({axis:e,value:i})})),i.showCrosshair(r)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const VW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)},WW={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class UW{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},WW),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):rw(t,a,c.spec),rw(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=VW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=VW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(hw.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(hw.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=hw.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=hw.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=hw.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):cH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=cH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class GW extends UW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{d(i[t])&&(i[t]=n[t])})),P(i,"trimPadding")&&lw(i,fF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class YW extends GW{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),hF(t)}}const XW=(t,e)=>{const i={nodes:{}},{fields:s}=c(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=hM(t,!0);for(const e in o)for(const i in o[e].nodes)pM(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)uM(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&dM(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(PM.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class $W{_beforeInit(){this._dataSet&&zM(this._dataSet,"stackSplit",XW)}_initStack(){this._stack=new KW(this),this._stack.init()}}const qW={state:AF.STATE_DIMENSION_HOVER,reverseState:AF.STATE_DIMENSION_HOVER_REVERSE,trigger:bj.dimensionHover};class ZW extends Uz{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},qW,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=wM(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}ZW.type="dimension-hover",ZW.defaultOptions=qW;const JW=()=>{hw.registerInteractionTrigger(ZW.type,ZW)},QW=()=>{hw.registerComposedEvent(bj.dimensionHover,_j),hw.registerComposedEvent(bj.dimensionClick,pj)},tU=t=>t.fieldX[0],eU=t=>t.fieldY[0],iU=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},sU=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},nU=(t,e)=>t?e?tU:iU:e?eU:sU,rU=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=yj(t,(t=>rj(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=yj(t,(t=>aj(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Tk(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=aU(t,i,nU(e,Tk(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=aU(t,i,nU(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},aU=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:oU(t,s,i)},oU=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=mj(e,t,"cartesian",null!=i?i:rj(t.getOrient())?tU:eU);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},lU=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(Tk(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(wk(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=ON(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};cU(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&hU(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),hU=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=hH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},cU=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},dU=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=uU(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},uU=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},pU=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return lU(c,r,e),c.xField.cacheInfo?dU(c.xField):c.yField.cacheInfo?dU(c.yField):void 0},gU=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],fU=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&gU.forEach((e=>{u(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(mU(s).every((t=>{var e;return!mH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},mU=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},vU={dom:`${Rw}_TOOLTIP_HANDLER_DOM`,canvas:`${Rw}_TOOLTIP_HANDLER_CANVAS`},yU={key:"其他",value:"..."};var _U;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(_U||(_U={}));class bU{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(PM.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=fU(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},yU),t):yU;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!d(e)&&mH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class xU extends bU{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Tk(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(u(s))break}return u(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const SU=()=>{hw.registerTooltipProcessor("dimension",xU)};class AU extends bU{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,xo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(wM(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const kU=()=>{hw.registerTooltipProcessor("mark",AU)};class CU extends bU{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const wU=()=>{hw.registerTooltipProcessor("group",CU)};class MU extends NW{constructor(){super(...arguments),this.transformerConstructor=YW,this.type="line",this.seriesType=kC.line}_setModelOption(){this._modelOption.getDimensionInfo=rU,this._modelOption.getDimensionInfoByValue=oU,this._modelOption.getRectByDimensionData=pU}}MU.type="line",MU.seriesType=kC.line,MU.transformerConstructor=YW,U(MU,$W);const TU=[...wj,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class BU extends Mj{constructor(){super(...arguments),this.type=BU.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return TU}_getIgnoreAttributes(){return[]}}BU.type="area";const EU=()=>{hw.registerMark(BU.type,BU),$R(),CR(),hN(),uN(),Vz(),hw.registerGraphicComponent("area",Ug)};class PU extends bH{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),u(e))return e}return i}}}const OU=Object.assign(Object.assign(Object.assign({},OH),xj),{area:{name:"area",type:"area"}}),RU=()=>{hw.registerAnimation("area",jz),Nz(),zz()};class IU extends vN{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||p&&!d)&&(g=h,f=l),l.style=lw({},f.style,g.style),l.state=lw({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function DU(){PR(),WR()}function LU(){return"browser"===t_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const FU={debounce:xt,throttle:St};DU();let zU=class t extends qj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=LU(),a="browser"===t_.env?t_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=vt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:FU[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:yt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=yt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(VA,{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",FU[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===t_.env?t_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(yt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ai(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ai(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=vt(t[0],0,1),c=vt(t[1],0,1),d=vt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=yt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?yt([a+i*n,a+s*n],a,n-l):yt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=LU(),e="browser"===t_.env?t_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===t_.env?t_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};zU.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class HU{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ne).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=HU.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(VA,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new zU(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),D.setAttribute("x",D.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),D.setAttribute("y",D.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:zt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:zt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:zt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}KU.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class $U{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,KU.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new KU(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,z(e,lF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class qU{constructor(){this.activeEvent="onRegister",this._uid=Ha.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class ZU extends qU{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class JU extends qU{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function QU(t){t.isBound($U)||(t.bind($U).toSelf().inSingletonScope(),t.bind(Wy).toService($U)),t.isBound(ZU)||(t.bind(ZU).toSelf(),t.bind(Ef).toService(ZU)),t.isBound(JU)||(t.bind(JU).toSelf(),t.bind(Ef).toService(JU))}class tG extends qj{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}PR(),DR();class eG extends tG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eG.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}eG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},PR(),WR();class iG extends tG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},iG.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}iG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},PR(),xR();class sG extends tG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},sG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=re.distancePP(t,e);this.setAttribute("radius",i)}}sG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},PR(),xR();class nG extends tG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},nG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=LA,endAngle:s=FA}=this.attribute,n=s-i,r=oe(de(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}nG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},PR(),FR();class rG extends tG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},rG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=he(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=re.distancePP(t,e);this.setAttribute("radius",i)}}rG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class aG{isInValidValue(t){const{startAngle:e=LA,endAngle:i=FA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=LA,endAngle:i=FA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return he(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return rk(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function oG(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=oG(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var cG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),A(l)&&l>=3){const t=ak(n,l,c,e,i);h=DA.path(Object.assign(Object.assign({},a.style),{path:ok(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=DA.circle(t)}h.name=aV.line,h.id=this._getNodeId("line"),E(a.state)||(h.states=z({},lV,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:u={}}=a,p=cG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=P(this.attribute.label,"style.fontSize",12)+P(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;d(_)&&(_=0===r?"end":"middle"),"start"===_?(y="bottom",g={x:s.x,y:s.y-v}):"end"===_&&(y="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:y,textAlign:"center"},l),state:{text:z({},lV,u.text),shape:z({},lV,u.shape),panel:z({},lV,u.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(pt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=oG(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&lG(e,c,i)}else e.AABBBounds.width()>r&&lG(e,r,i)}else o>a.x&&h.x2>n.x2?(lG(e,n.x2-o,i),r&&hG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return pt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}dG.defaultAttributes=JA,U(dG,aG);const uG=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=WA(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=he({x:0,y:0},i,t),a=nk(r,rk(s,r,e,n));return o=a,l=rk(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(pt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return kN(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=uG(t,i,e),r=K(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=gG(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return kN(d)},gG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&CN(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var fG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=ge(h.endAngle-d/2),g=he(c,h.outerRadius,o),f=he(c,a+e.line.line1MinLength,o),m=new yG(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=he(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):jj(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=he(t.circleCenter,v,t.middleAngle),t.labelLimit=f,gt(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=jj(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=jj(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(ft(t.pointB.x,this._line2MinLength+h)||gt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=jj(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?d(h)||"auto"===h?"edge"===c?jj(t.quadrant)?"left":"right":jj(t.quadrant)?"right":"left":h:d(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(jj(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(pt(l/2,u))g=0,f=1,m=-p;else if(pt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&ft(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&ft(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),eN(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,tN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}xG.defaultAttributes={pickable:!1};var SG,AG,kG,CG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(wG,aG),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(SG||(SG={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(AG||(AG={})),function(t){t.dataZoomChange="dataZoomChange"}(kG||(kG={}));const MG="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",TG={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:MG,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:MG,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},BG={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}},EG=0,PG=1,OG=2,RG=3,IG=4,DG=5,LG=5,FG=999,zG=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var HG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:OG},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:OG},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:EG},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,w;const{orient:M,middleHandlerStyle:T={},startHandlerStyle:B={},endHandlerStyle:E={},zoomLock:P}=this.attribute,{start:O,end:R}=this._getState(),{position:I,width:D,height:L}=this._getLayoutAttrFromConfig(),F=null!==(t=B.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=E.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(T.visible){const t=(null===(i=T.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+O*D,y:I.y-t,width:(R-O)*D,height:t,zIndex:DG},null===(s=T.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=T.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(O+R)/2*D,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=T.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:DG},T.icon),{pickable:!P&&(null===(h=T.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*D,y:I.y+L/2,size:L,symbolType:null!==(c=B.symbolType)&&void 0!==c?c:"square"},BG.horizontal),{zIndex:DG}),B),{pickable:!P&&(null===(d=B.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*D,y:I.y+L/2,size:L,symbolType:null!==(u=E.symbolType)&&void 0!==u?u:"square"},BG.horizontal),{zIndex:DG}),E),{pickable:!P&&(null===(p=E.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+O*D-t/2,y:I.y+L/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:FG},BG.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+R*D-g/2,y:I.y+L/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:FG},BG.horizontal),{pickable:!P}),"rect")}else{if(T.visible){const t=(null===(g=T.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+D,y:I.y+O*L,width:t,height:(R-O)*L,zIndex:DG},null===(f=T.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=T.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+D+t/2,y:I.y+(O+R)/2*L,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=T.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:DG},T.icon),{pickable:!P&&(null===(S=null===(x=T.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+D/2,y:I.y+O*L,size:D,symbolType:null!==(A=B.symbolType)&&void 0!==A?A:"square"},BG.vertical),{zIndex:DG}),B),{pickable:!P&&(null===(k=B.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+D/2,y:I.y+R*L,size:D,symbolType:null!==(C=E.symbolType)&&void 0!==C?C:"square",zIndex:DG},BG.vertical),E),{pickable:!P&&(null===(w=E.pickable)||void 0===w||w)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+D/2+t/2,y:I.y+O*L-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:FG},BG.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+D/2+i/2,y:I.y+R*L-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:FG},BG.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:RG},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:RG},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:PG},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:IG},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return Ab(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ne).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=HG(c,["formatMethod"]),{formatMethod:g}=d,f=HG(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,w,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},w={textAlign:zG(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:zG(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:zG(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:zG(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),z({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:LG}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),z({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:LG}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new DV(e),s.name=i,t.add(s)),s}}const NG={debounce:xt,throttle:St};class VG extends o{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=SG.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=SG.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=SG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=SG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=SG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===t_.env?t_:this.stage,s=LU();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===SG.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===SG.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===SG.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===SG.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(AG.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(AG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(AG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===SG.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(AG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(AG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:NG[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===t_.env?t_:this.stage,e=LU();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===t_.env?t_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===t_.env?t_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:vt(e+t,0,1),end:vt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=SG.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}RV(),WR(),QR(),CR(),DR();let WG=class t extends qj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,y;h.visible?this._isHorizontal?(m=p,v=g-f,y={x:a.x,y:a.y+f}):(m=p-f,v=g,y={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,y=a);const _=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(_+b)/2,y={x:y.x+_/2,y:y.y}):(v-=(_+b)/2,y={x:y.x,y:y.y+_/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new jG(this._getRendererAttrs()),this._interaction=new VG(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(AG.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(AG.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(kG.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(AG.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;u(t)&&u(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(kG.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...G(a))}setPreviewPointsX(t){c(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._renderer.statePointToData=t)}};var UG,GG,YG,XG;function KG(){PR(),RV(),kL()}WG.defaultAttributes=TG,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(UG||(UG={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(GG||(GG={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(YG||(YG={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(XG||(XG={}));class $G extends qj{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=LV(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=FV(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=zV(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=DA.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=DA.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=DA.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),eN(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,tN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=Qj(this);this.markerAnimate("exit");const n=Qj(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},iN(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function qG(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function ZG(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;Jj(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function JG(t,e,i,s){t&&(ZG(t.startSymbol,e,i,s),qG(t).forEach((t=>ZG(t,e,i,s))),ZG(t.endSymbol,e,i,s))}function QG(t,e,i,s){t&&(ZG(t.getTextShape(),e,i,s),ZG(t.getBgRect(),e,i,s))}function tY(t,e,i,s){var n,r,a,o;t&&(Jj(t,{fillOpacity:0,strokeOpacity:0},{fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function eY(t,e,i,s){t&&(tY(t.startSymbol,e,i,s),qG(t).forEach((t=>tY(t,e,i,s))),tY(t.endSymbol,e,i,s))}function iY(t,e,i,s){t&&(tY(t.getTextShape(),e,i,s),tY(t.getBgRect(),e,i,s))}function sY(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;ZG(t.startSymbol,s,r,n);const h=qG(t);h.forEach((t=>Jj(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),ZG(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;ZG(t.getTextShape(),e,l,n),ZG(t.getBgRect(),e,l,n)}))}function nY(t,e,i,s,n){JG(t,s,i,n),G(e).forEach((t=>{QG(t,s,i,n)}))}function rY(t,e,i,s,n){ZG(t,s,i,n),G(e).forEach((t=>{QG(t,s,i,n)}))}function aY(t,e,i,s,n){ZG(t,s,i,n),G(e).forEach((t=>{QG(t,s,i,n)}))}function oY(t,e,i,s,n,r){var a;JG(t,n,s,r),ZG(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?QG(i,n,s,r):ZG(i,n,s,r)}function lY(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;ZG(t.startSymbol,n,o,r);const u=qG(t);u.forEach((t=>Jj(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),ZG(e,n+o+l,h,r),ZG(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(ZG(i.getTextShape(),n+o+l+h+c,d,r),ZG(i.getBgRect(),n+o+l+c,d,r)):ZG(i,n+o+l+c,d,r)}function hY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?sY(t,e,s,r,a):"fadeIn"===i&&nY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?sY(t,e,s,n,a):"fadeIn"===i&&nY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){eY(t,s,i,n),G(e).forEach((t=>{iY(t,s,i,n)}))}(t,e,i,s,n)}}function cY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&rY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&rY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){tY(t,s,i,n),G(e).forEach((t=>{iY(t,s,i,n)}))}(t,e,i,s,n)}}function dY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&aY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&aY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){tY(t,s,i,n),G(e).forEach((t=>{iY(t,s,i,n)}))}(t,e,i,s,n)}}function uY(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?oY(n,r,e,i,s,o):"callIn"===t&&lY(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?oY(n,r,e,i,s,a):"callIn"===t&&lY(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;eY(t,n,s,r),tY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?iY(i,n,s,r):tY(i,n,s,r)}(n,r,e,t,i,s)}}const pY={type:"clipIn",duration:500,easing:"linear",delay:0},gY={type:"fadeIn",duration:500,easing:"linear",delay:0},fY={type:"callIn",duration:500,easing:"linear",delay:0},mY={type:"fadeOut",duration:500,easing:"linear",delay:0};class vY{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new DV(Object.assign(Object.assign({},h),{state:{panel:z({},jA,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},jA,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},jA,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},jA,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class yY extends $G{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=pY,this.defaultExitAnimation=mY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;ZA(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U(yY,vY);const _Y=.001,bY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:UG.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]}},xY={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},SY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:YG.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},AY={interactive:!0,label:{position:GG.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}},kY={interactive:!0,label:{autoRotate:!0,position:YG.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},CY={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},wY={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},MY={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function TY(){BY._animate=hY}KG(),BV(),kL();class BY extends yY{markerAnimate(t){BY._animate&&this._animationConfig&&BY._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},BY.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(SA(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return AA(Math.abs(e),Math.PI/2,_Y)||AA(Math.abs(e),3*Math.PI/2,_Y)?kA(i,e,t):SA(e)?xY.postiveXAxis[t]:xY.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new PV({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},jA,null==a?void 0:a.line),startSymbol:z({},jA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},jA,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},jA,null==a?void 0:a.line),startSymbol:z({},jA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},jA,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)}));else if(!A(t.x)||!A(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",BY.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(BY.defaultAttributes.label)}}function EY(){PY._animate=cY}BY.defaultAttributes=bY,KG(),HR(),kL();class PY extends $G{markerAnimate(t){PY._animate&&this._animationConfig&&PY._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PY.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=gY,this.defaultExitAnimation=mY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},wY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;ZA(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=DA.polygon(Object.assign({points:e},i));n.states=z({},jA,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",PY.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},jA,null==i?void 0:i.area)),this._updateMarkLabels(PY.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)})),e}}PY.defaultAttributes=AY,U(PY,vY),KG(),EV(),kL();class OY extends yY{markerAnimate(t){OY._animate&&this._animationConfig&&OY._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OY.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case YG.arcInnerStart:l=n;case YG.arcOuterStart:l=n;break;case YG.arcInnerEnd:l=r;case YG.arcOuterEnd:l=r;break;case YG.center:case YG.arcInnerMiddle:case YG.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return CY[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new OV({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},jA,null==o?void 0:o.line),startSymbol:z({},jA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},jA,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},jA,null==o?void 0:o.line),startSymbol:z({},jA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},jA,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",OY.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(OY.defaultAttributes.label)}}OY.defaultAttributes=SY,KG(),xR(),kL();class RY extends $G{markerAnimate(t){RY._animate&&this._animationConfig&&RY._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},RY.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=gY,this.defaultExitAnimation=mY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case YG.center:h=(s+n)/2,c=(r+a)/2;break;case YG.arcInnerStart:h=s,c=r;break;case YG.arcOuterStart:h=n,c=r;break;case YG.arcInnerEnd:h=s,c=a;break;case YG.arcOuterEnd:h=n,c=a;break;case YG.arcInnerMiddle:h=s,c=(r+a)/2;break;case YG.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},CY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;ZA(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=DA.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},jA,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",RY.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},jA,null==o?void 0:o.area)),this._updateMarkLabels(RY.defaultAttributes.label)}isValidPoints(){return!0}}function IY(){DY._animate=uY}RY.defaultAttributes=kY,U(RY,vY),KG(),BV(),EV(),QR(),RR(),DR(),kL();class DY extends $G{markerAnimate(t){DY._animate&&this._animationConfig&&DY._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},DY.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=fY,this.defaultExitAnimation=mY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return AA(Math.abs(s),Math.PI/2,_Y)||AA(Math.abs(s),3*Math.PI/2,_Y)?kA(t,s,n):SA(s)?MY.postiveXAxis[n]:MY.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=XG.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},jA,null==p?void 0:p.textBackground),text:z({},jA,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},jA,null==p?void 0:p.itemContent));const v=SA(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=DA.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},jA,null==s?void 0:s.itemContent)):"text"===n?o=new DV(Object.assign(Object.assign({},i),{state:{panel:z({},jA,null==s?void 0:s.textBackground),text:z({},jA,null==s?void 0:s.itemContent)}})):"richText"===n?(o=DA.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},jA,null==s?void 0:s.itemContent)):"image"===n?(o=DA.image(Object.assign(Object.assign({},i),r)),o.states=z({},jA,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},jA,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=AA(c,0,_Y)||AA(d,0,_Y),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=$A(e-u,t-d),o=$A(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(UY.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(UY.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===UY.focus||"focus"===o){const s=a.hasState(VY.focus);a.toggleState(VY.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[VY.unSelected,VY.unSelectedHover,VY.focus],t),this._setLegendItemState(e,VY.selected,t)})):(this._setLegendItemState(a,VY.selected,t),this._removeLegendItemState(a,[VY.unSelected,VY.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[VY.selected,VY.selectedHover,VY.focus],t),this._setLegendItemState(e,VY.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(VY.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(VY.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(WY.legendItemClick,a,t);i?(this._removeLegendItemState(a,[VY.selected,VY.selectedHover],t),this._setLegendItemState(a,VY.unSelected,t)):(this._setLegendItemState(a,VY.selected,t),this._removeLegendItemState(a,[VY.unSelected,VY.unSelectedHover],t))}else this._setLegendItemState(a,VY.selected,t),this._removeLegendItemState(a,[VY.unSelected,VY.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[VY.selected,VY.selectedHover],t),this._setLegendItemState(e,VY.unSelected,t))}))}this._dispatchLegendEvent(WY.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,VY.selected),this._removeLegendItemState(e,[VY.unSelected,VY.unSelectedHover])):(this._removeLegendItemState(e,[VY.selected,VY.selectedHover]),this._setLegendItemState(e,VY.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=HY,spaceRow:l=jY,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,w=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=w+l,w=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,w=Math.max(w,m),M.push(i)):(u(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=DA.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=K(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";p(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";p(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:p,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),C=this._handleStyle(x,t,e,i,s),w=ai(c);let M;!1===x.visible?(M=DA.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,UY.item,t,M)):(M=DA.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,UY.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?VY.selected:VY.unSelected);const T=DA.group({x:0,y:0,pickable:!1});M.add(T);let B,E=0,O=0,R=0;if(v&&!1!==v.visible){const i=P(S,"style.size",10);O=y(i)?i[0]||0:i,R=P(v,"space",8);const s=DA.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,UY.itemShape,t,M,S.state),s.addState(e?VY.selected:VY.unSelected),T.add(s)}let I=0;if(p){const e=P(g,"size",10);B=DA.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,UY.focus,t,M),I=e}const D=_.formatMethod?_.formatMethod(o,t,i):o,L=XA(Object.assign(Object.assign({x:O/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:D,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(L,UY.itemLabel,t,M,A.state),L.addState(e?VY.selected:VY.unSelected),T.add(L);const F=P(_,"space",8);if(u(l)){const s=P(b,"space",p?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=XA(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,UY.itemValue,t,M,k.state),r.addState(e?VY.selected:VY.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-O-R-F-I-s;this._autoEllipsis(m,t,L,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-O/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2))}else r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),T.add(r)}else this._itemWidthByUser?(L.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-O-R-I),E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2)):E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2);B&&(B.setAttribute("x",E),T.add(B));const z=T.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;T.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const j=z.height(),N=u(this.attribute.item.width)?this.attribute.item.width:H+w[1]+w[3],V=this._itemHeightByUser||j+w[0]+w[2];return M.setAttributes({width:N,height:V}),B&&B.setAttribute("visible",!1),T.translateTo(-z.x1+w[3],-z.y1+w[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new zY(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new zY(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new zU(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new zU(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",St(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=HY,spaceRow:o=jY}=n,l=this._itemsContainer,{space:h=NY,defaultCurrent:c=1}=r,d=KY(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=DA.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=HY,spaceRow:a=jY}=s,o=this._itemsContainer,{space:l=NY,defaultCurrent:h=1}=n,c=KY(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=DA.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=DA.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];pt(vt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),pt(vt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(VY.selected)?this._setLegendItemState(t,VY.selectedHover,e):this._setLegendItemState(t,VY.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===UY.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(WY.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(VY.unSelectedHover)||t.hasState(VY.selectedHover))&&(i=!0),t.removeState(VY.unSelectedHover),t.removeState(VY.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(VY.unSelectedHover)&&!t.hasState(VY.selectedHover)||(i=!0),t.removeState(VY.unSelectedHover),t.removeState(VY.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===UY.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(WY.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(WY.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==UY.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(WY.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==UY.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(WY.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(VY.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},$Y,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(VY.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(c(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var ZY;function JY(t){return y(t)?t:[t,t]}function QY(t){return t?"ew-resize":"ns-resize"}qY.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:HY,spaceRow:jY,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:NY,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"}(ZY||(ZY={})),YY();class tX extends qj{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},tX.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=LU(),n="browser"===t_.env?t_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=LU(),n="browser"===t_.env?t_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(u(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=G(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:JY(p)[0],endValue:JY(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=DA.group({x:0,y:0});f.name=ZY.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=DA.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=ZY.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=DA.group({x:g?v:0,y:g?0:v});f.add(y);const _=DA.group({x:0,y:0});let b;if(_.name=ZY.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=DA.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=ZY.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=DA.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=ZY.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=JY(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":QY(p)},r));if(v.name=ZY.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=ZY.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":QY(p)},r));if(i.name=ZY.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=ZY.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=yt(h,i,s);c=t[0],u=t[1]}else c=i,u=vt(h,i,s);const g=this._isHorizontal;e||(c=i);const f=DA.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=ZY.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":QY(g);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(u,e?"end":"start"),b=DA.rect(Object.assign({x:g?Math.min(y,_):0,y:g?0:Math.min(y,_),width:g?Math.abs(_-y):r,height:g?n:Math.abs(_-y),cursor:v},a));b.name=ZY.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return DA.symbol(t)}_renderHandlerText(t,e){return DA.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return c(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":QY(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=DA.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=DA.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===t_.env?t_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=LU(),e="browser"===t_.env?t_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===ZY.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===ZY.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===ZY.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===ZY.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===t_.env?t_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}tX.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},XY(),YY();class eX extends GY{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eX.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip:y,inverse:_,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function iX(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}eX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},XY(),YY(),FR();class sX extends GY{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},sX.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,sizeBackground:y,disableTriggerEvent:_,inverse:b}=this.attribute,x=DA.group({x:0,y:0});this._innerView.add(x);const S=new tX({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:iX(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:_,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const C=DA.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);const w=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}sX.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)"}},PR(),eI(),XR();let nX=class t extends qj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:w,subtextStyle:M={},width:T,height:B,minWidth:E,maxWidth:P,minHeight:O,maxHeight:R,align:I,verticalAlign:D,padding:L=0}=this.attribute,F=ai(L),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||u(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:T)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},NA),C),x:h,y:c,width:null!==(s=null!=t?t:T)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:T,heightLimit:null!==(a=C.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,R-j);if("rich"===k||u(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:T)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:w},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:w},NA),M),x:n,y:r,width:null!==(c=null!=t?t:T)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(w)?w:[w],whiteSpace:"normal"},M),{maxLineWidth:null!==(p=M.maxLineWidth)&&void 0!==p?p:T,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const V=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(N,W),G=j+(null!==(f=M.height)&&void 0!==f?f:V);if(u(T)&&(U=T),u(B)&&(G=B),u(E)&&UP&&(U=P),u(O)&&GR&&(G=R),z.setAttributes({width:U,height:G,boundsPadding:F}),this._mainTitle){if(u(I)||u(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:U;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:D,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(_=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==_?_:U;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:D,e=this._mainTitle?u(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};nX.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 rX={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"}}};PR(),eI(),XR();let aX=class extends qj{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},P(rX,n),e.style,{visible:e.visible});a.lineHeight=u(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=XA(a);return o.name=r,t.appendChild(o),e.autoFit&&A(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&A(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const p=UA(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",u(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;A(_)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",u(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class oX extends Jp{constructor(t){super(t)}}var lX,hX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(lX||(lX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(hX||(hX={}));class cX extends qj{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},cX.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"},cX.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"},cX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},cX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},cX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{d(this._playController)&&(this._playController=new oX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new oX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new oX(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(lX.OnPlay)},this.pause=()=>{this._dispatchEvent(lX.OnPause)},this.forward=()=>{this._dispatchEvent(lX.OnForward)},this.backward=()=>{this._dispatchEvent(lX.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}cX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},cX.defaultAttributes={[hX.Start]:{},[hX.Pause]:{},[hX.Backward]:{},[hX.Forward]:{}};const dX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},uX=[200,10];var pX,gX;!function(t){t.Default="default",t.Reverse="reverse"}(pX||(pX={})),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"}(gX||(gX={}));const fX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===pX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===pX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),mX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===pX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===pX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),vX=t=>"top"===t||"bottom"===t;class yX extends qj{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yX.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;A(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Gt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:A(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(vX(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:uX[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:uX[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new tX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=vX(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new cX(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=vX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:uX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Gt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(vX(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:vX(this._orient)?t+s:(this._size.width-r)/2,y:vX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:vX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:vX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:vX(this._orient)?t+s:(this._size.width-r)/2,y:vX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function _X(){YY(),PR(),QR()}yX.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({},dX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},dX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},dX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},dX),{key:"backward",position:"start"})}},_X();class bX extends yX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:pX.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(lX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(lX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(lX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(lX.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(gX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(fX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||mX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===pX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(gX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=t_.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(gX.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(gX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=t_.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(),t_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(gX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,t_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(gX.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(gX.change),this.dispatchCustomEvent(gX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var xX,SX=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};_X();class AX extends yX{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(lX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(lX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(lX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(lX.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(gX.change))},this.play=()=>SX(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(gX.play),this._rafId=t_.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=t_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,t_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(gX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,t_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(gX.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(gX.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(gX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}(xX||(xX={}));const kX={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},CX=5;const wX={debounce:xt,throttle:St};PR(),HR();let MX=class t extends qj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=kX.updateTrigger,endTrigger:i=kX.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(G(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:wX[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(xX.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=kX.trigger,resetTrigger:i=kX.resetTrigger}=this.attribute;G(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),G(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(xX.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(xX.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=CX}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(xX.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(xX.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent(xX.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=CX}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(xX.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(xX.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),G(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=kX.updateTrigger,endTrigger:s=kX.endTrigger}=this.attribute;G(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),G(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=DA.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Pe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};MX.defaultAttributes=kX;const TX=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},BX=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:G(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},EX={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:zA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:zA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:zA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},PX=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];PR(),WR(),QR(),eI(),XR();let OX=class t extends qj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ai(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:xA(p)&&xA(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:xA(p)&&xA(p.value)},BX(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:xA(p)&&xA(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:xA(p)&&xA(p.value)},BX(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},NA),p.value),visible:xA(p)&&xA(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=xA(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const y=xA(p)?p.height+p.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!xA(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let p="right"===c?(o?d:0)+(xA(n.key)?r+n.key.spacing:0)+(xA(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(KA(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:xA(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),KA(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(xA(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=kh(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(xA(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},BX(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},BX(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},NA),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(xA(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},BX(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},BX(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>PX.includes(t)))?(this._mergeAttributes(e,s),d(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&xA(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=xA(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=WA(d),y=WA(u);let _=0;if(xA(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(xA(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return TX({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return TX({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};OX.defaultAttributes=EX;class RX extends bW{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),_k(this._regions,(t=>{rj(this.getOrient())?FN(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):FN(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=lw({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new KF(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=vi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>LN(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>LN(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return zM(this._option.dataSet,t,vW),t}transformScaleDomain(){}}RX.type=n.cartesianTimeAxis,RX.specKey="axes",RX.builtInTheme={axis:eW,axisX:iW,axisY:sW};class IX extends bW{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new bC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return zM(this._option.dataSet,t,vW),t}transformScaleDomain(){}}IX.type=n.cartesianLogAxis,IX.specKey="axes",IX.builtInTheme={axis:eW,axisLinear:_W,axisX:iW,axisY:sW},U(IX,gW);class DX extends bW{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new xC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return zM(this._option.dataSet,t,vW),t}transformScaleDomain(){}}DX.type=n.cartesianSymlogAxis,DX.specKey="axes",DX.builtInTheme={axis:eW,axisLinear:_W,axisX:iW,axisY:sW},U(DX,gW);class LX extends nj{constructor(){super(...arguments),this.type=kC.area,this.transformerConstructor=IU,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Sj)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(LX.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===iH?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return jC(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",xF.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return jC(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",xF.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",xF.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",xF.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[Ww]},"normal",xF.Series),this.setMarkStyle(o,{curveType:a},"normal",xF.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(jH(null===(e=hw.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),NH("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(jH(null===(i=hw.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),NH("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=sj(this);this._symbolMark.setAnimationConfig(jH(null===(s=hw.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),NH("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new PU(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}LX.type=kC.area,LX.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},LX.mark=OU,LX.transformerConstructor=IU,U(LX,Aj);class FX extends GW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),hF(t)}}class zX extends NW{constructor(){super(...arguments),this.transformerConstructor=FX,this.type="area",this.seriesType=kC.area}_setModelOption(){this._modelOption.getDimensionInfo=rU,this._modelOption.getDimensionInfoByValue=oU,this._modelOption.getRectByDimensionData=pU}}zX.type="area",zX.seriesType=kC.area,zX.transformerConstructor=FX,U(zX,$W);function HX(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const jX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:HX(t,e)}),NX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:HX(t,e)}),VX={type:"fadeIn"},WX={type:"growCenterIn"};function UX(t,e){if(!1===e)return{};switch(e){case"fadeIn":return VX;case"scaleIn":return WX;default:return jX(t)}}class GX extends yz{constructor(){super(...arguments),this.type=GX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}GX.type="rect";const YX=()=>{$R(),WR(),aN("rect",mG),hw.registerMark(GX.type,GX),rI.registerBuiltInAnimate("growHeightIn",NI),rI.registerBuiltInAnimate("growHeightOut",VI),rI.registerBuiltInAnimate("growWidthIn",nD),rI.registerBuiltInAnimate("growWidthOut",rD),rI.registerBuiltInAnimate("growCenterIn",zI),rI.registerBuiltInAnimate("growCenterOut",HI),hw.registerGraphicComponent("rect",ag)},XX=Object.assign(Object.assign({},OH),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function KX(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=ZC(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[RH]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):jC(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[IH]):jC(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=jC(this._dataToPosX(t),e,i),n=jC(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[DH]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):jC(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[LH]):jC(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=jC(this._dataToPosY(t),e,i),n=jC(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),ZX)})}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},JX.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:UH(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(JX.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",xF.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===n.cartesianBandAxis));let r;if(zM(this._option.dataSet,"addVChartProperty",pH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};zM(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Oa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:TH.bind(this),call:BH}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new KF(this._option,r)}init(t){super.init(t),this.initRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=LH,s=DH,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=IH,s=RH,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=hM(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)KX(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=jC(this[r](t),l,i),u=jC(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!NC(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",xF.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",xF.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&d(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,d=!1,p=1/0,g=-1/0;i.values.forEach((e=>{const i=e[Vw],n=e[Ww],r=e[Uw],c=e[Gw];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?DH:RH],i=e[a?LH:IH];l=Math.min(l,t,i),h=Math.max(h,t,i)}u(r)&&u(c)&&(d=!0,p=Math.min(p,r,c),g=Math.max(g,r,c))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[Vw]:s,[Ww]:o}),d?{[Uw]:p,[Gw]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(ag(Object.assign(Object.assign({},m),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>jC(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",xF.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",xF.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>jC(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",xF.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",xF.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=d(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",xF.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",xF.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=sj(this);this._barMark.setAnimationConfig(jH(null===(e=hw.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),NH(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=u(this._spec.barWidth)&&r===n,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=a;return o&&(c=ZC(this._spec.barWidth,a)),l&&(c=Math.max(c,ZC(this._spec.barMinWidth,a))),h&&(c=Math.min(c,ZC(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,p;"horizontal"===t?(h=this.getYAxisHelper(),c="height",p="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",p="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&u(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=ZC(null!==(l=i[r-1])&&void 0!==l?l:Y(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*y+(u-1)*p,n+=g*(y+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const _=wk(g.type||"band");return p(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}JX.type=kC.bar,JX.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},JX.mark=XX,JX.transformerConstructor=qX;const QX=()=>{IW(),YX(),hw.registerAnimation("bar",((t,e)=>({appear:UX(t,e),enter:jX(t,!1),exit:NX(t,!1),disappear:{duration:Dz.disappear.duration}}))),rW(),xW(),hw.registerSeries(JX.type,JX)};class tK extends GW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),hF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=p(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class eK extends NW{constructor(){super(...arguments),this.transformerConstructor=tK,this.type="bar",this.seriesType=kC.bar}_setModelOption(){this._modelOption.getDimensionInfo=rU,this._modelOption.getDimensionInfoByValue=oU,this._modelOption.getRectByDimensionData=pU}}eK.type="bar",eK.seriesType=kC.bar,eK.transformerConstructor=tK,U(eK,$W);const iK=[10,20],sK=kk.Linear,nK="circle",rK=kk.Ordinal,aK=["circle","square","triangle","diamond","star"],oK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},lK=Object.assign(Object.assign({},OH),{point:{name:"point",type:"symbol"}});class hK extends KH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const cK={sizeField:!0};class dK extends nj{constructor(){super(...arguments),this.type=kC.scatter,this.transformerConstructor=hK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),cK)})}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(c(e))return e;if(y(e)){if(d(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${Rw}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${Rw}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:sK,defaultRange:iK},"size")}getShapeAttribute(t,e){return d(e)?nK:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:rK,defaultRange:aK},"shape")}initMark(){this._symbolMark=this._createMark(dK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:UH(this._spec,dK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=sj(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(jH(null===(i=hw.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),NH("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:nK},AF.STATE_NORMAL,xF.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},AF.STATE_NORMAL,xF.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},AF.STATE_NORMAL,xF.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",xF.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",xF.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},AF.STATE_NORMAL,xF.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},AF.STATE_NORMAL,xF.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ue});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}dK.type=kC.scatter,dK.mark=lK,dK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},dK.transformerConstructor=hK;const uK=()=>{mN(),hw.registerAnimation("scatter",((t,e)=>Object.assign({appear:oK(0,e)},Lz))),rW(),xW(),hw.registerSeries(dK.type,dK)};class pK extends GW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class gK extends NW{constructor(){super(...arguments),this.transformerConstructor=pK,this.type="scatter",this.seriesType=kC.scatter}_setModelOption(){this._modelOption.getDimensionInfo=rU,this._modelOption.getDimensionInfoByValue=oU,this._modelOption.getRectByDimensionData=pU}}gK.type="scatter",gK.seriesType=kC.scatter,gK.transformerConstructor=pK,U(gK,$W);class fK extends ej{constructor(){super(...arguments),this.type=kC.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return d(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${Rw}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const mK=(t,e)=>{const i=c(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[Fw]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[rM]=a||r})),s};class vK extends bH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class yK extends yz{constructor(){super(...arguments),this.type=yK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}yK.type="path";const _K=()=>{hw.registerMark(yK.type,yK),$R(),FR(),hw.registerGraphicComponent("path",Ng)},bK=Object.assign(Object.assign({},OH),{area:{name:"area",type:"path"}});class xK{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?La(i,e):Ia[i]?(Ra[i]||(Ra[i]=La(i,Ia[i])),Ra[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class SK{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class AK{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function kK(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:SK}:gA(t)||fA(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:AK}:null}const CK={debounce:xt,throttle:St};class wK{constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=gA(this._renderMode)||fA(this._renderMode),kK(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return kK(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!Ae({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:RM.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:RM.chart,consume:!1}];l.on(...c,CK[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,CK[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||kK(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||kK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return d(r)&&d(a)?s:Ae({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:RM.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:RM.chart,consume:!1}];l.on(...c,CK[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,CK[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){kK(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||kK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:RM.chart},(t=>{if(!t.event)return;const{event:n}=t;Ae({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:RM.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||kK(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:RM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||kK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:RM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:RM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:RM.chart,source:OM.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:RM.chart,source:OM.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=CK[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=CK[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:RM.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:RM.chart,source:OM.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:RM.chart,source:OM.chart},this._handleDragMouseUp)}))}}class MK extends eV{constructor(){var t,e;super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=_F.Mark,this._projectionSpec={name:(t=this.type,e=this.id,`${Rw}_${e}_${t}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=u(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(d(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:n.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=lw(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var t,e,i;this.event.on(PM.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new xK(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===kC.map||e.type===kC.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),_k(this._regions,(t=>{var e;if(t.type===kC.map||t.type===kC.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==kC.map&&e.type!==kC.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[rM],s=t.getDatumCenter(e);i&&u(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}MK.type=n.geoCoordinate,U(MK,wK);const TK=()=>{hw.registerComponent(MK.type,MK)};class BK extends KH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class EK extends fK{constructor(){super(...arguments),this.type=kC.map,this.transformerConstructor=BK,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),jM.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),zM(this._dataSet,"copyDataView",YM),zM(this._dataSet,"map",mK),zM(this._dataSet,"lookup",dH);const i=jM.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new Oa(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:qM.copyDataView}).transform({type:"map",options:()=>({nameMap:this._nameMap,nameProperty:this._nameProperty})}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:rM,fields:()=>this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new KF(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(EK.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:UH(this._spec,EK.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:Hw])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:Hw]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",xF.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",xF.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(jH(null===(t=hw.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),NH("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new vK(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[Fw]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[Fw],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ue}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ue}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:A(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return Fw}getActiveMarks(){return[this._pathMark]}}EK.type=kC.map,EK.mark=bK,EK.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},EK.transformerConstructor=BK;const PK=`${Rw}_waterfall_default_seriesField`,OK=(t,e)=>{if(!t||0===t.length)return t;const i=c(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let d=Array.from(l[s]);"decrease"===a&&(d=d.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return d.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[qw]=!0:delete t[qw]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===d.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=RK([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const f=g[0];let{start:m,end:v}=IK(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>se(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=ie(y,e)):(t[c]=+_,_=ie(_,e)),t[d]=ie(t[c],e),m=ie(m,e),b=se(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,d,e,i,a),void o.push(s)}u=RK(r,t,s,o,u,d,e,i),o.push(s)})),o};function RK(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=IK(t,i,s,n,u);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=ie(i.positive,e)):(t[h]=+i.negative,i.negative=ie(i.negative,e)),t[c]=ie(t[h],e),i.end=ie(i.end,e)}i.isTotal=e,(d(p)||p===PK)&&(t[PK]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function IK(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!d(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?lA("total.collectCountField error"):n=e[a].start;o<0?lA("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=ie(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const DK=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=c(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ie(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},LK={type:"fadeIn"},FK={type:"growCenterIn"};function zK(t,e){switch(e){case"fadeIn":return LK;case"scaleIn":return FK;default:return jX(t,!1)}}class HK extends yz{constructor(){super(...arguments),this.type=HK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return ig(t)}}HK.type="rule";const jK=()=>{hw.registerMark(HK.type,HK),$R(),DR(),hw.registerGraphicComponent("line",ig)},NK=Object.assign(Object.assign({},XX),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),VK=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:WK(t.map((t=>t.latestData)).flat(),e.fields,i)}};function WK(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>WK(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class UK{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new Oa(e instanceof Pa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),zM(e,"dimensionTree",VK),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class GK extends qX{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const YK={rect:JK,symbol:qK,arc:t$,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=qK(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:e$,line:i$,area:i$,rect3d:JK,arc3d:t$,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function XK(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=YK[t])&&void 0!==i?i:YK.point;return e.series.type===kC.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=$K(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:s$(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function KK(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==kC.sankey){const{formatFunc:t,args:n}=hH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function $K(t){return c(t)?e=>t(e.data):t}function qK(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=$K(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:ZK(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function ZK(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function JK(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=$K(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:QK(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function QK(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function t$(t){var e;const{labelSpec:i}=t,s=null!==(e=$K(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function e$(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=KK(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Xp(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function i$(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[Hw]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function s$(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const n$={calculationMode:!0};class r$ extends JX{constructor(){super(...arguments),this.type=kC.waterfall,this.transformerConstructor=GK,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&dM(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),n$)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new UK(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],d(this._seriesField)&&(this._seriesField=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(),zM(this._dataSet,"waterfallFillTotal",DK),zM(this._dataSet,"waterfall",OK),(d(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=XM(this.getViewData(),this._dataSet,{name:`${Rw}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new KF(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:Vw,endAs:Ww,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=sj(this);this._barMark.setAnimationConfig(jH(null===(i=hw.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),NH("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(jH(null===(s=hw.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),NH("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(r$.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:se(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:se(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return e$(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?jC(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):jC(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const t="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:e=>e.lastIndex?this.totalPositionY(e,"lastIndex",this._getLeaderLineCategoryPos(!0,t)):0,y1:e=>this.totalPositionY(e,"index",this._getLeaderLineCategoryPos(!1,t))},"normal",xF.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:e=>e.lastIndex?this.totalPositionX(e,"lastIndex",this._getLeaderLineCategoryPos(!0,t)):0,x1:e=>this.totalPositionX(e,"index",this._getLeaderLineCategoryPos(!1,t)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",xF.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&NC([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}r$.type=kC.waterfall,r$.mark=NK,r$.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},r$.transformerConstructor=GK;const a$=()=>{jK(),YX(),hw.registerAnimation("waterfall",((t,e)=>({appear:zK(t,e),enter:jX(t,!1),exit:NX(t,!1),disappear:{duration:Dz.disappear.duration}}))),Hz(),rW(),xW(),hw.registerSeries(r$.type,r$)},o$=`${Rw}_BOX_PLOT_OUTLIER_VALUE`;var l$;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(l$||(l$={}));const h$=(t,e)=>{const i=[],s=c(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=y(e)?e:[e];i.push(...s.map((e=>{const i={[o$]:e};return r.forEach((e=>{i[e]=t[e]})),u(a)&&(i[a]=t[a]),i})))})),i};class c$ extends bH{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===l$.OUTLIER)return this.series.getOutliersField();if(t===l$.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case l$.MIN:return this.series.getMinField();case l$.MAX:return this.series.getMaxField();case l$.MEDIAN:return this.series.getMedianField();case l$.Q1:return this.series.getQ1Field();case l$.Q3:return this.series.getQ3Field();case l$.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===l$.OUTLIER)return e[o$];if(t===l$.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case l$.MIN:return e[this.series.getMinField()];case l$.MAX:return e[this.series.getMaxField()];case l$.MEDIAN:return e[this.series.getMedianField()];case l$.Q1:return e[this.series.getQ1Field()];case l$.Q3:return e[this.series.getQ3Field()];case l$.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[o$])}getDefaultContentList(t){return[{key:this.getContentKey(l$.OUTLIER),value:this.getContentValue(l$.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(l$.MAX),value:this.getContentValue(l$.MAX)},{key:this.getContentKey(l$.Q3),value:this.getContentValue(l$.Q3)},{key:this.getContentKey(l$.MEDIAN),value:this.getContentValue(l$.MEDIAN)},{key:this.getContentKey(l$.Q1),value:this.getContentValue(l$.Q1)},{key:this.getContentKey(l$.MIN),value:this.getContentValue(l$.MIN)},{key:this.getContentKey(l$.SERIES_FIELD),value:this.getContentValue(l$.SERIES_FIELD)}]}}const d$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class u$ extends yz{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.context.diffState!==SF.enter&&t.context.diffState!==SF.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{d$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?z(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=dg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e),e.addEventListener("afterAttributeUpdate",(t=>{var i;2===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.type)&&this._syncInheritedStyleAttrs(e,e.attribute)}));const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=hw.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const p$=()=>{hw.registerGraphicComponent("glyph",dg),$R(),BR()},g$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],f$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class m$ extends u${constructor(){super(...arguments),this.type=m$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=g$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),A(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=f$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),A(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}m$.type="boxPlot";const v$=Object.assign(Object.assign({},OH),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),y$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!A(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return A(c)&&(f.from.min=o,f.to.min=c),A(d)&&(f.from.max=o,f.to.max=d),A(u)&&(f.from.q1=o,f.to.q1=u),A(p)&&(f.from.q3=o,f.to.q3=p),A(g)&&(f.from.median=o,f.to.median=g),f},_$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!A(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return A(c)&&(f.to.min=o,f.from.min=c),A(d)&&(f.to.max=o,f.from.max=d),A(u)&&(f.to.q1=o,f.from.q1=u),A(p)&&(f.to.q3=o,f.from.q3=p),A(g)&&(f.to.median=o,f.from.median=g),f},b$=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),x$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,k,C;if(i&&A(i.center))return i.center;let w,M,T,B,E;if("horizontal"===e){w=null===(r=null===(n=(null===(s=b$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=b$(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,T=null===(p=null===(u=null===(d=null===(c=b$(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=b$(t,"box").attribute.width,i=b$(t,"box").attribute.x;B=i,E=i+e}else{w=null===(m=null===(f=(null===(g=b$(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=b$(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,T=null===(C=null===(k=null===(S=null===(x=b$(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===k?void 0:k[0])||void 0===C?void 0:C.y;const e=b$(t,"box").attribute.height,i=b$(t,"box").attribute.y;B=i,E=i+e}return A(w)?w:A(B)&&A(E)?(B+E)/2:A(M)&&A(T)?(M+T)/2:A(T)?T:A(M)?M:NaN},S$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(A(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=b$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=b$(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=b$(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=b$(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=b$(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=b$(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=b$(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=b$(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=b$(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=b$(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return A(v)?v:A(b)&&A(x)?(b+x)/2:A(y)&&A(_)?(y+_)/2:A(_)?_:A(y)?y:NaN};class A$ extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return y$(x$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class k$ extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return _$(x$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class C$ extends A${computeAttribute(){return y$(S$)(this.target,this.params,this.params.options)}}class w$ extends k${computeAttribute(){return _$(S$)(this.target,this.params,this.params.options)}}class M$ extends KH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const T$={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class B$ extends nj{constructor(){super(...arguments),this.type=kC.boxPlot,this.transformerConstructor=M$,this._bandPosition=0}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}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),T$)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(B$.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(B$.mark.outlier,{key:Fw,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var t,e,i,s,n,r;const a=this._boxPlotMark;if(a){const i={lineWidth:this._lineWidth,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"!==this._shaftShape?"#000":this.getColorAttribute()};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const s="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return ZC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return ZC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return ZC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return ZC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return ZC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return ZC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return ZC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return ZC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(a,i,AF.STATE_NORMAL,xF.Series),this.setMarkStyle(a,s,AF.STATE_NORMAL,xF.Built_In)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this._boxFillColor)&&void 0!==n?n:this.getColorAttribute(),stroke:this.getColorAttribute(),size:x(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10},AF.STATE_NORMAL,xF.Series),this.initBoxPlotMarkStyle()}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>jC(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>jC(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>jC(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>jC(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>jC(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},AF.STATE_NORMAL,xF.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:e=>jC(t(this.getDatumPositionValues(e,o$),{bandPosition:this._bandPosition}),i)}:{x:t=>this._getPosition(this.direction,t),y:e=>jC(t(this.getDatumPositionValues(e,o$),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,AF.STATE_NORMAL,xF.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;zM(this._dataSet,"foldOutlierData",h$),zM(this._dataSet,"addVChartProperty",pH);const t=new Oa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Rw}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:TH.bind(this),call:BH}},!1),this._outlierData=new KF(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return u(this._spec.boxWidth)&&(r=ZC(this._spec.boxWidth,n)),u(this._spec.boxMinWidth)&&(r=Math.max(r,ZC(this._spec.boxMinWidth,n))),u(this._spec.boxMaxWidth)&&(r=Math.min(r,ZC(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),p=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,p-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(p>1&&u(this._spec.boxGapInGroup)){const t=this._groups.fields,i=G(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=ZC(null!==(a=i[o-1])&&void 0!==a?a:Y(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=wk(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=sj(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=hw.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(NH("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(jH(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(jH(null===(a=hw.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new c$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}B$.type=kC.boxPlot,B$.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},B$.mark=v$,B$.transformerConstructor=M$;const E$=()=>{p$(),DR(),WR(),hw.registerGraphicComponent("line",(t=>ig(t))),hw.registerGraphicComponent("rect",(t=>ag(t))),hw.registerMark(m$.type,m$),mN(),zz(),rW(),xW(),rI.registerBuiltInAnimate("boxplotScaleIn",A$),rI.registerBuiltInAnimate("boxplotScaleOut",k$),rI.registerBuiltInAnimate("barBoxplotScaleIn",C$),rI.registerBuiltInAnimate("barBoxplotScaleOut",w$),hw.registerSeries(B$.type,B$)};class P$ extends yz{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=P$.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?zg(t):Xp(t)}}P$.type="text";const O$=()=>{hw.registerMark(P$.type,P$),$R(),eI(),XR(),hw.registerGraphicComponent("text",Xp),hw.registerGraphicComponent("richtext",zg)};class R$ extends bH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const I$=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),D$={type:"fadeIn"},L$=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function F$(t,e){return"fadeIn"===e?D$:I$(t)}const z$=Object.assign(Object.assign({},XX),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class H$ extends qX{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class j$ extends JX{constructor(){super(...arguments),this.type=kC.rangeColumn,this._barMarkType="rect",this._barName=kC.bar,this.transformerConstructor=H$}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(j$.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:UH(this._spec,j$.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(j$.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(j$.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",xF.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=sj(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(jH(null===(i=hw.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),NH("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(jH(null===(s=hw.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),NH("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(jH(null===(n=hw.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),NH("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new R$(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}j$.type=kC.rangeColumn,j$.mark=z$,j$.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},j$.transformerConstructor=H$;const N$=()=>{YX(),O$(),hw.registerAnimation("rangeColumn",((t,e)=>({appear:F$(t,e),enter:I$(t),exit:L$(t),disappear:{duration:Dz.disappear.duration}}))),Hz(),rW(),xW(),hw.registerSeries(j$.type,j$)};var V$,W$;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(V$||(V$={})),function(t){t.middle="middle",t.start="start",t.end="end"}(W$||(W$={}));class U$ extends bH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const G$=Object.assign({},OU);class Y$ extends LX{constructor(){super(...arguments),this.type=kC.rangeArea}initMark(){this._areaMark=this._createMark(Y$.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",xF.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",xF.Series),this.setMarkStyle(t,{stroke:!1},"normal",xF.Series))}initTooltip(){this._tooltipHelper=new U$(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}Y$.type=kC.rangeArea,Y$.mark=G$;class X$ extends ej{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=$N,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};wk(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:[]};wk(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(PM.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&ij(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function K$(t){return yA(t)?Number.parseFloat(t):0}const $$=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&q$(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ge(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[HN],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[HN]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},q$=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===K$(t[e])))||!i&&0===t.reduce(((t,i)=>t+K$(i[e])),0)));function Z$(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const J$=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Z$(t,!0,ZM.appear)}),Q$={type:"fadeIn"},tq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Z$(t,!0,ZM.enter)}),eq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Z$(t,!0,ZM.exit)});function iq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Q$;case"growRadius":return J$(Object.assign(Object.assign({},t),{growField:"radius"}));default:return J$(Object.assign(Object.assign({},t),{growField:"angle"}))}}class sq extends yz{constructor(t,e){super(t,e),this.type=nq.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>he({x:0,y:0},this.getAttribute("centerOffset",e,i),e[UN])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class nq extends sq{constructor(){super(...arguments),this.type=nq.type}}nq.type="arc";const rq=()=>{$R(),xR(),aN("arc",_G),rI.registerBuiltInAnimate("growRadiusIn",eD),rI.registerBuiltInAnimate("growRadiusOut",iD),rI.registerBuiltInAnimate("growAngleIn",LI),rI.registerBuiltInAnimate("growAngleOut",FI),hw.registerGraphicComponent("arc",Xg),hw.registerMark(nq.type,nq)},aq=Object.assign(Object.assign({},OH),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class oq extends KH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=lw({},this._theme,i,t);const n=(t,e)=>lw({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const lq=`${Rw}_LABEL_VISIBLE`,hq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},cq={outerRadius:!0};class dq extends X${constructor(){super(...arguments),this.transformerConstructor=oq,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:YC(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:YC(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=XN,this._endAngle=KN,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[UN];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return he(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=u(t),r=u(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(u(this._spec.startAngle)?ae(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?ae(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?ae(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;zM(this._dataSet,"pie",$$),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?ae(this._spec.minAngle):0,asStartAngle:NN,asEndAngle:VN,asRatio:jN,asMiddleAngle:UN,asRadian:YN,asQuadrant:GN,asK:WN,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Oa(this._dataSet,{name:`${Rw}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new KF(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},dq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:zw,groupKey:this._seriesField,isSeriesMark:!0},{morph:UH(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Sk(NN)(t)}endAngleScale(t){return Sk(VN)(t)}_computeLayoutRadius(){return qN((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:VC(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:VC(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",xF.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",xF.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,xF.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",xF.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Sk(lq).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(PM.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),cq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),hq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[UN];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return he(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===ZM.appear)return this._startAngle;if(i===ZM.disappear)return this._endAngle;const r=[ZM.disappear,ZM.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[Fw];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Fw]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Fw])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Fw])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[UN]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[UN]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[UN]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[UN]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=jH(null===(i=hw.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}dq.transformerConstructor=oq,dq.mark=aq,dq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class uq extends dq{constructor(){super(...arguments),this.type=kC.pie}}uq.type=kC.pie;const pq=()=>{rq(),hw.registerAnimation("pie",((t,e)=>({appear:iq(t,e),enter:tq(t),exit:eq(t),disappear:{duration:Dz.disappear.duration}}))),hw.registerAnimation("emptyCircle",((t,e)=>({appear:iq(t,e)}))),hw.registerSeries(uq.type,uq)};function gq(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const fq=t=>({type:gq(t.growField),options:{overall:!0}}),mq={type:"fadeIn"},vq=t=>({type:gq(t.growField)}),yq=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function _q(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mq;case"growAngle":return fq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return fq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const bq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class xq extends X${_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),bq)})}getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(Ww),this.setInnerRadiusField(Vw)}setValueFieldToPercent(){this.setRadiusField(Gw),this.setInnerRadiusField(Uw)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const Sq=Object.assign(Object.assign({},OH),{rose:{name:"rose",type:"arc"}});class Aq extends KH{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class kq extends dV{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=hw.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=_F.Axis,this._tick=void 0,this._center=null,this._startAngle=XN,this._endAngle=KN,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),_k(this._regions,(t=>{"radius"===this.getOrient()?FN(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):FN(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:YC(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:YC(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:ON(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){_k(this._regions,(t=>{"radius"===this.getOrient()?FN(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):FN(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return wk(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:wk(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return he(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return ce(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>LN(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=re.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return qN((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=$N,e=0;const i=this.getChart().getSpec();return _k(this.getRegions(),(s=>{const n=s;if(r=n.type,[kC.rose,kC.radar,kC.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;A(s)&&(t=s),A(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(lw({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(lw({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}kq.type=n.polarAxis,kq.specKey="axes";const Cq={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},wq={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class Mq extends kq{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new mC}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return zM(this._option.dataSet,t,vW),t}}Mq.type=n.polarLinearAxis,Mq.specKey="axes",Mq.builtInTheme={axis:eW,axisLinear:_W,axisAngle:wq,axisRadius:Cq},U(Mq,gW);const Tq=()=>{hw.registerGraphicComponent(iV.lineAxis,((t,e)=>new QV(t,e))),hw.registerGraphicComponent(sV.lineAxisGrid,((t,e)=>new TV(t,e))),hw.registerGraphicComponent(iV.circleAxis,((t,e)=>new dG(t,e))),hw.registerGraphicComponent(sV.circleAxisGrid,((t,e)=>new wG(t,e))),uV(),hw.registerComponent(Mq.type,Mq)};class Bq extends kq{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new $k}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return zM(this._option.dataSet,t,pG),t}transformScaleDomain(){}}Bq.type=n.polarBandAxis,Bq.specKey="axes",Bq.builtInTheme={axis:eW,axisBand:tW,axisAngle:wq,axisRadius:Cq},U(Bq,fV);const Eq=()=>{hw.registerGraphicComponent(iV.lineAxis,((t,e)=>new QV(t,e))),hw.registerGraphicComponent(sV.lineAxisGrid,((t,e)=>new TV(t,e))),hw.registerGraphicComponent(iV.circleAxis,((t,e)=>new dG(t,e))),hw.registerGraphicComponent(sV.circleAxisGrid,((t,e)=>new wG(t,e))),uV(),hw.registerComponent(Bq.type,Bq)};class Pq extends xq{constructor(){super(...arguments),this.type=kC.rose,this.transformerConstructor=Aq,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(Pq.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:UH(this._spec,Pq.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>jC(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=jC(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(jH(null===(i=hw.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),NH("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}Pq.type=kC.rose,Pq.mark=Sq,Pq.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},Pq.transformerConstructor=Aq;const Oq=()=>{hw.registerSeries(Pq.type,Pq),rq(),hw.registerAnimation("rose",((t,e)=>({appear:_q(t,e),enter:vq(t),exit:yq(t),disappear:{duration:Dz.disappear.duration}}))),Eq(),Tq()};class Rq extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:he(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=ce(this.from,this._prevCenter),{angle:i,radius:s}=ce(this.to,this._center);A(i*s)||(this.valid=!1),this._fromAngle=A(t)?t:i,this._fromRadius=A(e)?e:s,this._toAngle=i,this._toRadius=s,ck(this._fromAngle,this._toAngle)&&ck(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Iq extends Pz{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!yk(t)&&!yk(e))return e;const s=ce(t,this._prevCenter),n=ce(e,this._center);let r=ue(s.angle),a=ue(n.angle);!A(r)&&A(a)&&(r=a),A(r)&&!A(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new ne(s,n,r,a);return o.defined=e.defined,o}}const Dq=t=>({type:"in"===t?"fadeIn":"fadeOut"});function Lq(t,e,i){return"fadeIn"===e?Dq(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function Fq(t,e,i){return"fadeIn"===e?Dq(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const zq=(t,e)=>({custom:Bz,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),Hq=Object.assign(Object.assign(Object.assign({},OH),xj),{area:{name:"area",type:"area"}});class jq extends xq{constructor(){super(...arguments),this.type=kC.radar,this.transformerConstructor=vN,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(jq.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:sH,closePath:!0},"normal",xF.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",xF.Series),this.event.on(PM.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:u(this._spec.startAngle)?ae(this._spec.startAngle):XN},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(jH(null===(s=hw.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),NH("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=hw.getAnimationInKey(e);t.setAnimationConfig(jH(null==i?void 0:i(n,r),NH(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}jq.type=kC.radar,jq.mark=Hq,jq.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},jq.transformerConstructor=vN,U(jq,Aj);const Nq=()=>{hw.registerSeries(jq.type,jq),EU(),gN(),mN(),hw.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:Lq(t,e,"in"),enter:Lq(t,e,"in"),exit:Lq(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:Dz.disappear.duration},update:[{channel:["points","center"],custom:Iq,customParameters:t,duration:Dz.update.duration,easing:Dz.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),hw.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:Fq(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:Dz.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:Rq,customParameters:t,duration:Dz.update.duration,easing:Dz.update.easing}]}))),hw.registerAnimation("radarGroup",((t,e)=>({appear:zq(t,"in"),disappear:{duration:Dz.disappear.duration}}))),xR(),Eq(),Tq()};class Vq extends bH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>vi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const Wq=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(Rw)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[Fw]:r,[zw]:`${s}_${e}`})),r++}))})),n},Uq={fill:"#bbb",fillOpacity:.2},Gq=Object.assign(Object.assign({},OH),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),Yq={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},Xq={grid:{background:!0}};class Kq extends nj{constructor(){super(...arguments),this.type=kC.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Yq),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),Xq)})}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),zM(this._option.dataSet,"objFlat",Wq),zM(this._option.dataSet,"copyDataView",YM),HM(this._option.dataSet,"dataview",Ta),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:qM.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(lw(Uq,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(Kq.mark.group),this._containerMark=this._createMark(Kq.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(Kq.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(Kq.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(Kq.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(Kq.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(Kq.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(Kq.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-(null!==(t=this._spec.leftAppendPadding)&&void 0!==t?t:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",xF.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",xF.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",xF.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",xF.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",xF.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",xF.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",xF.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",xF.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",xF.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:Hw}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new FC).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:Hw}}initTooltip(){this._tooltipHelper=new Vq(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}Kq.type=kC.dot,Kq.mark=Gq,Kq.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class $q extends bH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>vi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const qq=Object.assign(Object.assign({},OH),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),Zq=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class Jq extends nj{constructor(){super(...arguments),this.type=kC.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),zM(this._option.dataSet,"linkDotInfo",Zq),null===(t=this.getViewData())||void 0===t||t.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:qM.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(Jq.mark.group),this._containerMark=this._createMark(Jq.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(Jq.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(Jq.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",xF.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",xF.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",xF.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",xF.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:Hw}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new $q(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}Jq.type=kC.link,Jq.mark=qq,Jq.builtInTheme={link:{arrow:{style:{size:10}}}};const Qq=Object.assign(Object.assign({},OH),{group:{name:"group",type:"group"}}),tZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class eZ extends X${constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?Vw:iM],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(i.offsetAngle);let o;if(u(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return d(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?Ww:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),tZ)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=u(n)?ae(n):XN;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?ae(r):KN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||u(null==s?void 0:s.startAngle)||u(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=jC(this.angleAxisHelper.dataToPosition([t[Vw]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=jC(this.angleAxisHelper.dataToPosition([t[Ww]]),this.angleAxisHelper.getScale(0));if(A(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?jC(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(eZ.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",xF.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ae(a),o=ae(r)/2;return Xg(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[ag({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const rZ=()=>{hw.registerAnimation("circularProgress",((t,e)=>({appear:nZ(t,e),enter:{type:"growAngleIn"},disappear:{duration:Dz.disappear.duration}})))};class aZ extends KH{constructor(){super(...arguments),this._supportStack=!0}}const oZ={cornerRadius:!0,roundCap:!0};class lZ extends eZ{constructor(){super(...arguments),this.type=kC.circularProgress,this.transformerConstructor=aZ,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(A(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(A(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),oZ)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(lZ.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:UH(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",xF.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(lZ.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?Vw:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?Ww:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",xF.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(jH(null===(i=hw.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),NH("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(jH(null===(s=hw.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),NH("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}lZ.type=kC.circularProgress,lZ.mark=iZ,lZ.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},lZ.transformerConstructor=aZ;const hZ=()=>{hw.registerSeries(lZ.type,lZ),rq(),rZ(),Hz(),Eq(),Tq()};function cZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const dZ={type:"fadeIn"};function uZ(t,e="grow"){return!1===e?{}:"fadeIn"===e?dZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:cZ(t)}))(t)}class pZ extends bH{enableByType(t){return"dimension"!==t}}const gZ=Object.assign(Object.assign({},OH),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),fZ={bandWidth:!0,cornerRadius:!0,clamp:!0},mZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class vZ extends nj{constructor(){super(...arguments),this.type=kC.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=u(e.width)?e.width:e.x1-e.x,o=u(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),fZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),mZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(vZ.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return jC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return jC(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?jC(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",xF.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return jC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return jC(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?jC(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",xF.Series)}}_initTrackMark(){return this._trackMark=this._createMark(vZ.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return jC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",xF.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return jC(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",xF.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(jH(null===(i=hw.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),NH("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(jH(null===(s=hw.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),NH("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new pZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}vZ.type=kC.linearProgress,vZ.mark=gZ,vZ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const yZ=()=>{YX(),hw.registerAnimation("linearProgress",((t,e)=>({appear:uZ(t,e),enter:uZ(t),disappear:{duration:Dz.disappear.duration}}))),Hz(),hw.registerSeries(vZ.type,vZ)},_Z=[0],bZ=[20,40],xZ=[200,500],SZ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},AZ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class kZ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const CZ=`${Rw}_WORD_CLOUD_TEXT`,wZ=Object.assign(Object.assign({},OH),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),MZ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class TZ extends ej{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=bZ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:xZ,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:_Z,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?CZ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:SZ},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||pA(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:_Z,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!AZ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new kZ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var t;this._wordMark=this._createMark(TZ.mark.word,{key:zw,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(TZ.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:_F.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",xF.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",xF.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",xF.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(jH(hw.getAnimationInKey("wordCloud")(n,s),NH("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new FC).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:Hw])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new mC).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new mC).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[Fw])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!A(t)||!A(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,PM.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:zw,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:t_.createCanvas.bind(t_),getTextBounds:bf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Pg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}TZ.mark=wZ,TZ.builtInTheme={wordCloud:MZ};function BZ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||Dz.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=EZ(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,Ct(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Ct(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},PZ=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=PZ(t.children,e,t,n))})),s},OZ=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=OZ(t.children,e,t,n)),n=e(t,s,i,n)})),n},RZ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):RZ(t.children,e,i)))})),e};function IZ(t,e){let i,s;if(FZ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function FZ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*w*T))/(2*w):T/M);return{x:s+S+A*B,y:n+k+C*B,radius:B}}function NZ(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function VZ(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function WZ(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function UZ(t){return{_:t,next:null,prev:null}}function GZ(t,e){const i=(t=G(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];NZ(n,s,r);let a,o,l,h,c,d,u,p=UZ(s),g=UZ(n),f=UZ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=EZ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Mt)/Mt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:$Z.defaultOpionts.nodeSort;PZ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)PZ([o],YZ(h)),OZ([o],XZ(this._getPadding,.5,a)),PZ([o],KZ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);PZ([o],YZ($Z.defaultOpionts.setRadius)),OZ([o],XZ(Ot,1,a)),d&&OZ([o],XZ(this._getPadding,o.radius/t,a)),PZ([o],KZ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}$Z.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const qZ=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=qZ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function ZZ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){qZ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=d(t.value)?0:Ct(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Ct(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function JZ(t){return t.depth}function QZ(t,e){return e-1-t.endDepth}const tJ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),eJ=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},iJ={left:JZ,right:QZ,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:JZ,end:QZ},sJ=_t(0,1);class nJ{constructor(t){this._ascendingSourceBreadth=(t,e)=>tJ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>tJ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},nJ.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Et(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):iJ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return ZZ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!d(r.source),l=!d(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&d(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[eJ(s[t.source]),eJ(s[t.target],!0)].filter((t=>!d(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Ct(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Ct(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(v(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*sJ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}d(this.options.nodeSortBy)&&n.sort(tJ),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(tJ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];rJ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),aJ);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},oJ.defaultOpionts,t):Object.assign({},oJ.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Et(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Pt(this.options.center[0],t.width),s=t.y0+Pt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>Pt(t,n))):Pt(r,n),h=y(a),c=this.options.gapRadius,u=h?a.map((t=>Pt(t,n))):Pt(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Pt(r,n),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=EZ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=he({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function lJ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,y=Math.max(v/x,x/m),y>_){f-=h;break}_=y}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:rJ,slice:lJ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?lJ:rJ)(t,e,i,s,n)}};class dJ{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},dJ.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Et(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?hJ(this.options.aspectRatio):null!==(e=cJ[this.options.splitType])&&void 0!==e?e:cJ.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=EZ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function uJ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+di?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return at.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=uJ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rwt(e)));u=Ii(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=pJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&at.getInstance().error("Area "+r+" not represented on screen")}return i}function bJ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*xJ({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},AJ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=G(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!E(G(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:G(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||fJ,s=e.lossFunction||gJ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];ui(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rre.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:SJ(f),arcs:f})}))},kJ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:CJ,triangle:CJ,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 CJ(){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 wJ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const MJ=t=>kJ[t]?kJ[t]():kJ.circle(),TJ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function BJ(t){return c(t)?t:function(){return t}}class EJ{constructor(t){var e,i;switch(this.options=z({},EJ.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=MJ(this.options.shape),this.getText=null!==(e=BJ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=BJ(this.options.fontWeight),this.getTextFontSize=BJ(this.options.fontSize),this.getTextFontStyle=BJ(this.options.fontStyle),this.getTextFontFamily=BJ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>TJ(10,50);break;case"random-light":this.getTextColor=()=>TJ(50,90);break;default:this.getTextColor=BJ(this.options.color)}if(d(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=c(this.options.rotate)?t=>{var e;return ae(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():wt(e);return ae(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!d(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class OJ extends EJ{constructor(t){var e;super(z({},OJ.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<=OJ.defaultOptions.minFontSize&&(this.options.minFontSize=OJ.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=PJ[this.options.spiral])&&void 0!==e?e:PJ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=BJ(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=wJ(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,y=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;y[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(LJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(DJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}LJ(p,this._size)&&(p=FJ(p,this._size))}else if(LJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||IJ(p,i))&&(!i||!RJ(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function RJ(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function IJ(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,LJ=(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 FJ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},HJ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>he(t,e,i+r*n)))},jJ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},NJ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=wJ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=MJ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return he(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)jJ(n,HJ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)jJ(n,HJ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)jJ(n,HJ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)jJ(n,HJ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)jJ(n,HJ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=HJ({x:l,y:h},o,-Math.PI/2,5),e=HJ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);jJ(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ function t(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let fY=class t extends sY{constructor(e){super(z({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,k,A).data;if(this.exceedTime())return null;const w=[];let T,C=S;const B=[x/2,S/2,x/2,S/2],E=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),tB[1]&&(B[1]=t),eB[2]&&(B[2]=e))}};for(;C--;)for(T=x;T--;)E(C,T,w);return{datum:t,occupied:w,bounds:B,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),q(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(p(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?dY(t,o,l.width,l.height,h):"geometric"===t.type&&gY(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=QG(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};fY.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class mY extends sY{constructor(t){super(z({},mY.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}mY.defaultOptions={enlarge:!1};const _Y={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},yY=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return rt.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?bY(t.fontFamily):"sans-serif",d=t.fontStyle?bY(t.fontStyle):"normal",u=t.fontWeight?bY(t.fontWeight):"normal",p=t.rotate?bY(t.rotate):0,g=bY(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?bY(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,S=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},_Y),t.as):_Y,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?bY(t.fontSize):14;const C=t.fontSizeRange;if(C&&!x(T)){const t=T,e=SY(kY(t,l),C);T=i=>e(t(i))}let B=rY;"fast"===t.layoutType?B=mY:"grid"===t.layoutType&&(B=fY);const E=new B(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:S,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:E}:E.output()},bY=t=>v(t)||x(t)||c(t)||_(t)?t:e=>e[t.field],xY=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),SY=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=xY(t[0]),n=xY(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(xY(t)-r)/(a-r)*(e[1]-e[0])+e[0]},kY=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function AY(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{bI.registerGrammarTransform("wordcloud",{transform:yY}),gW(),bI.registerAnimation("wordCloud",((t,e)=>({appear:iG(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:fF.disappear.duration}}))),bI.registerSeries(MY.type,MY)},TY=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:f=!1,isCone:m=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(y*v)&&0!==v?y/v:0,S=k(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},CY=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},BY=`${UI}_FUNNEL_TRANSFORM_RATIO`,EY=`${UI}_FUNNEL_REACH_RATIO`,PY=`${UI}_FUNNEL_HEIGHT_RATIO`,RY=`${UI}_FUNNEL_VALUE_RATIO`,OY=`${UI}_FUNNEL_LAST_VALUE_RATIO`,IY=`${UI}_FUNNEL_NEXT_VALUE_RATIO`,LY=`${UI}_FUNNEL_LAST_VALUE`,DY=`${UI}_FUNNEL_CURRENT_VALUE`,FY=`${UI}_FUNNEL_NEXT_VALUE`,zY=`${UI}_FUNNEL_TRANSFORM_LEVEL`;class jY extends KF{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[EY])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return u(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class HY extends rF{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class VY extends HY{constructor(){super(...arguments),this.type=VY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}VY.type="polygon";const NY=()=>{bI.registerMark(VY.type,VY),oM(),eM(),kT.registerBuiltInAnimate("growPointsOut",kC),bI.registerGraphicComponent("polygon",lf)},WY=Object.assign(Object.assign({},oz),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class UY extends kz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class GY extends Az{constructor(){super(...arguments),this.type=LO.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=UY,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;YL(this._dataSet,"funnel",TY),YL(this._dataSet,"funnelTransform",CY);const t=new Ba(this._dataSet,{name:`${UI}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new tF(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:DY,asTransformRatio:BY,asReachRatio:EY,asHeightRatio:PY,asValueRatio:RY,asNextValueRatio:IY,asLastValueRatio:OY,asLastValue:LY,asNextValue:FY,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:zY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},GY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:yz(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},GY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(GY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(GY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new jY(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,s;const n=this._funnelMark;n&&this.setMarkStyle(n,{points:t=>this.getPoints(t),visible:t=>u(t[this._valueField]),fill:this.getColorAttribute()},"normal",TD.Series);const r=this._funnelTransformMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",TD.Series);const a=this._funnelOuterLabelMark.label;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",TD.Series),c(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(a,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",TD.User_Mark));const o=this._funnelOuterLabelMark.line;if(o&&a){this.setMarkStyle(o,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",TD.Series);const n=null!==(i=null===(e=null===(t=this._spec.outerLabel)||void 0===t?void 0:t.line)||void 0===e?void 0:e.visible)&&void 0!==i?i:null===(s=this._spec.outerLabel)||void 0===s?void 0:s.visible;u(n)&&o.setVisible(n)}}initLabelMarkStyle(t){var e;if(!t)return;const i=t.getTarget(),s=t.getComponent();if(i===this._funnelMark){this._labelMark=t,this.setMarkStyle(t,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",TD.Series);const i=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&$y(i,this._funnelOuterLabelMark.label,s),this._funnelOuterLabelMark.line&&$y(i,this._funnelOuterLabelMark.line,null!==(e=this._funnelOuterLabelMark.label)&&void 0!==e?e:s)}else this._funnelTransformMark&&i===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*RO(EY).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",TD.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(fz(null===(s=bI.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),mz("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(fz(bI.getAnimationInKey("fadeInOut")(),mz(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(fz(bI.getAnimationInKey("funnel")({},o),mz(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(fz(null===(a=bI.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),mz("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[OY])/2:this._getSecondaryAxisLength(t[RY])/2,n=this._getSecondaryAxisLength(t[RY])/2):(s=this._getSecondaryAxisLength(t[RY])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[IY])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[zY])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return u(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[KI]===t[KI]));if(!u(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(x(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{NY(),gW(),MN(),bI.registerSeries(GY.type,GY),bI.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},vF))),bI.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:sC,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),yF()},XY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},$Y=t=>{const e=t.filter((t=>t.context.diffState===CD.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},KY=(t,e,i)=>{if(E(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},qY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$Y(i.parent.children),a=KY(r,s,n);return XY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$Y(i.parent.children),a=KY(r,s,n);return XY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),ZY=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},JY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$Y(i.parent.children),a=ZY(r);return XY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$Y(i.parent.children),a=ZY(r);return XY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),QY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},tX=(t,e={})=>{if(!t)return[];const i=[];return aG(t,i,e),i},eX=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new IG(i).layout(t,{width:s,height:n})};class iX extends KF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var sX;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(sX||(sX={}));const nX=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(d(n))return t;if(i.type===sX.DrillDown){return G(wL(t,n,s,"children"))}if(i.type===sX.DrillUp){const e=TL(t,n,s,"children");if(e)return G(e)}return t};class rX{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=lN(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(n.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;YL(t,"drillFilter",nX),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(d(t.datum)||d(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!_(t)||E(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:sX.DrillDown},e().reRunAllTransform(),i.emit(jL.drill,{value:{path:t,type:sX.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!_(n)||E(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:sX.DrillUp},i().reRunAllTransform(),s.emit(jL.drill,{value:{path:n,type:sX.DrillUp},model:this}),n}}const aX=Object.assign(Object.assign({},oz),{sunburst:{name:"sunburst",type:"arc"}}),oX=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:tz,operations:["max","min","values"]}),t.push({key:ez,operations:["values"]}),t),lX={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class hX extends BW{constructor(){super(...arguments),this.type=LO.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:ez),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:KI},getRawData:()=>this.getRawData()}),this._startAngle=re(this._spec.startAngle),this._endAngle=re(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),YL(this._dataSet,"sunburstLayout",eX),YL(this._dataSet,"flatten",tX),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[u(this._centerX)?this._centerX:this.getLayoutRect().width/2,u(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return oX(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(YL(t.dataSet,"addVChartProperty",NF),t.transform({type:"addVChartProperty",options:{beforeCall:rz.bind(this),call:az}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(hX.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){d(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(u(this._offsetX)?this._offsetX:0),y:t=>t.y+(u(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},BD.STATE_NORMAL,TD.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(hX.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return p(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(u(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(u(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},BD.STATE_NORMAL,TD.Series)}initTooltip(){this._tooltipHelper=new iX(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(G(this.__innerRadius))[0],outerRadius:this._computeRadius(G(this.__outerRadius))[0],startAngle:G(this._startAngle)[0],endAngle:G(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(fz(null===(e=bI.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),mz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(fz(null===(e=bI.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),mz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}hX.type=LO.sunburst,hX.mark=aX,hX.builtInTheme={sunburst:lX},U(hX,rX);const cX=()=>{bI.registerSeries(hX.type,hX),VW(),gW(),yF(),bI.registerAnimation("sunburst",((t,e)=>({appear:QY(0,e),enter:qY(t),exit:JY(t),disappear:{duration:fF.disappear.duration}})))},dX=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new SG(i).layout(t,{width:s,height:n})};class uX extends KF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const pX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},gX=Object.assign(Object.assign({},oz),{circlePacking:{name:"circlePacking",type:"arc"}});class fX extends Tz{constructor(){super(...arguments),this.type=LO.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:ez),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:KI},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();d(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),YL(this._dataSet,"circlePackingLayout",dX),YL(this._dataSet,"flatten",tX),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(YL(t.dataSet,"addVChartProperty",NF),t.transform({type:"addVChartProperty",options:{beforeCall:rz.bind(this),call:az}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(fX.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){d(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},BD.STATE_NORMAL,TD.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(fX.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},BD.STATE_NORMAL,TD.Series)}getStatisticFields(){return oX(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new uX(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(fz(null===(i=bI.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),mz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(fz(null===(e=bI.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),mz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}fX.type=LO.circlePacking,fX.mark=gX,fX.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},U(fX,rX);const mX=()=>{bI.registerSeries(fX.type,fX),VW(),gW(),_F(),bI.registerAnimation("circlePacking",((t,e)=>({appear:pX(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:fF.disappear.duration}})))},vX=(t,e,i)=>{e.forEach((e=>{d(e[i])||t.add(e[i]),e.children&&e.children.length>0&&vX(t,e.children,i)}))},_X=t=>{var e;if(!t||!_(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},yX=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new PG(e),r=[];return r.push(n.layout(s,i)),r},bX=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},xX=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class SX extends KF{constructor(){super(...arguments),this._getDimensionData=t=>{if(!d(null==t?void 0:t.source)&&!d(null==t?void 0:t.target)){if(x(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const kX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),AX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:kX(t),MX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class wX extends IT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class TX extends IT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const CX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},BX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class EX extends KN{constructor(){super(...arguments),this.type=EX.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?BX:CX,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}EX.type="linkPath";const PX=Object.assign(Object.assign({},oz),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class RX extends kz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const OX=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class IX extends Tz{constructor(){super(...arguments),this.type=LO.sankey,this.transformerConstructor=RX,this._nodeLayoutZIndex=MD.Node,this._labelLayoutZIndex=MD.Label,this._viewBox=new je,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(u(a))return a;if(u(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(u(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=x(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getGraphics();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getGraphics();s&&s.length&&(i.forEach((t=>{t.removeState(BD.STATE_SANKEY_EMPHASIS),t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE)})),s.forEach((t=>{t.removeState(BD.STATE_SANKEY_EMPHASIS),t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=t=>{const e=IL(t),i=[e.key];if(this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=IL(t);n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(BD.STATE_SANKEY_EMPHASIS,!0)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(BD.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(BD.STATE_SANKEY_EMPHASIS),t.addState(BD.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=IL(t),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),OX(e,BD.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(BD.STATE_SANKEY_EMPHASIS),e.addState(BD.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=IL(t),s=this._nodeMark.getGraphics();if(!s||!s.length)return;const n=this._linkMark.getGraphics();if(!n||!n.length)return;const r=(null===(e=IL(n[0]))||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=IL(n),d=(null==c?void 0:c.parents)?"parents":"source";if(G(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;const n=IL(t);e.includes(null!==(s=n.key)&&void 0!==s?s:n.index)?(t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(BD.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(BD.STATE_SANKEY_EMPHASIS),t.addState(BD.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(G(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const a=IL(s),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return s.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),void OX(s,BD.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),void OX(s,BD.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState(BD.STATE_SANKEY_EMPHASIS),s.addState(BD.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{const e=this._nodeMark.getGraphics();if(!e||!e.length)return;const i=this._linkMark.getGraphics();if(!i||!i.length)return;if("source"===(IL(t)?"parents":"source"))this._linkMark&&i.forEach((t=>{t.removeState(BD.STATE_SANKEY_EMPHASIS),t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&e.forEach((t=>{t.removeState(BD.STATE_SANKEY_EMPHASIS),t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const s=IL(t),n=[s.source,s.target],r=[];G(s.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),i.forEach((t=>{const e=IL(t),i=e.datum;if(e.source===s.source&&e.target===s.target)return t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),void OX(t,BD.STATE_SANKEY_EMPHASIS,{ratio:1});const a=i?i.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(s.source)&&e.includes(s.target)})):null;if(a&&a.length){n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target);const i=a.filter((t=>t.parents.some(((e,i)=>{var n;return e.key===s.source&&(null===(n=t.parents[i+1])||void 0===n?void 0:n.key)===s.target})))).reduce(((t,e)=>t+e.value),0),r=i/e.value;return t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),void OX(t,BD.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===e.source&&t.target===e.target));if(o)return n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target),t.removeState(BD.STATE_SANKEY_EMPHASIS_REVERSE),void OX(t,BD.STATE_SANKEY_EMPHASIS,{ratio:o.value/e.value});t.removeState(BD.STATE_SANKEY_EMPHASIS),t.addState(BD.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(e,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){YL(this._dataSet,"sankeyLayout",yX),YL(this._dataSet,"sankeyFormat",_X),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:nD.sankeyLayout});const{dataSet:a}=this._option;YL(a,"sankeyNodes",bX),YL(a,"flatten",tX);const o=new Ba(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:sz.bind(this),call:nz}},!1),this._nodesSeriesData=o,YL(a,"sankeyLinks",xX);const l=new Ba(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:sz.bind(this),call:nz}},!1),this._linksSeriesData=l}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(IX.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(IX.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=G(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=G(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},BD.STATE_NORMAL,TD.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",TD.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(i.setGlyphConfig({direction:this.direction}),this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},BD.STATE_NORMAL,TD.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",TD.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(d(t)||d(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=zF(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(fz(null===(i=bI.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),mz("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(fz(null===(s=bI.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),mz("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:VL.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([BD.STATE_SANKEY_EMPHASIS_REVERSE,BD.STATE_SANKEY_EMPHASIS]),e.includes(IL(t).key)?t.addState(BD.STATE_SANKEY_EMPHASIS,!0):t.addState(BD.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new SX(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!d(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new $O;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{u(t[i])&&e.add(t[i]),u(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return vX(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}IX.type=LO.sankey,IX.transformerConstructor=RX,IX.mark=PX,IX.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const LX=()=>{RV(),qN(),QA(),bI.registerGraphicComponent("path",(t=>Jg(t))),bI.registerMark(EX.type,EX),gW(),bI.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:AX(t,e)},vF))),bI.registerAnimation("sankeyLinkPath",((t,e)=>({appear:MX(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:fF.disappear.duration}}))),kT.registerBuiltInAnimate("linkPathGrowOut",TX),kT.registerBuiltInAnimate("linkPathGrowIn",wX),yF(),bI.registerSeries(IX.type,IX)},DX=(t,e)=>{let i={},s=e.fields;if(c(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=tX(n);return i=ZF([{latestData:r}],e),i};class FX extends KF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const zX=Object.assign(Object.assign({},oz),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),jX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class HX extends kz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const VX=(t,e)=>{if(e.getViewBox()){const i=new zG(e).layout(t,e.getViewBox()),s=[];return aG(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[ez,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class NX extends Tz{constructor(){super(...arguments),this.type=LO.treemap,this.transformerConstructor=HX,this._categoryField="name",this._valueField="value",this._viewBox=new je,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:ez),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ne),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:KI},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),YL(this._dataSet,"treemap",VX),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YL(this._rawData.dataSet,"addVChartProperty",NF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:rz.bind(this),call:az}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=DX([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){YL(this._dataSet,"hierarchyDimensionStatistics",DX),YL(this._dataSet,"flatten",tX);const i=new Ba(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 oX(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(NX.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(NX.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},BD.STATE_NORMAL,TD.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()},BD.STATE_NORMAL,TD.Series)}_initRichStyleOfLabelMark(t){"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},BD.STATE_NORMAL,TD.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},BD.STATE_NORMAL,TD.Series),this._initRichStyleOfLabelMark(t))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},BD.STATE_NORMAL,TD.Series),this._initRichStyleOfLabelMark(t))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(fz(null===(e=bI.getAnimationInKey("treemap"))||void 0===e?void 0:e(),mz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new FX(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(FL.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(FL.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}NX.type=LO.treemap,NX.mark=zX,NX.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},NX.transformerConstructor=HX,U(NX,rX),U(NX,cN);const WX=()=>{bI.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),bI.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),RV(),gW(),bI.registerAnimation("treemap",((t,e)=>({appear:jX(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:fF.disappear.duration}}))),yF(),bI.registerSeries(NX.type,NX)},UX=Object.assign(Object.assign({},EU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),GX=Object.assign(Object.assign({},oz),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),YX={type:"fadeIn"};function XX(t,e){return"fadeIn"===e?YX:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class $X extends kz{constructor(){super(...arguments),this._supportStack=!1}}class KX extends KF{enableByType(t){return"dimension"!==t}}const qX="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",ZX={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:qX,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:qX,fill:"#ddd"}}};class JX extends PU{constructor(){super(...arguments),this.type=LO.gaugePointer,this.transformerConstructor=$X,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(JX.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},JX.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(JX.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new KX(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return u(this.radiusAxisHelper)&&u(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=$(e),n=mt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(fz(null===(i=bI.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),mz("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}JX.type=LO.gaugePointer,JX.mark=GX,JX.builtInTheme={gaugePointer:ZX},JX.transformerConstructor=$X;const QX=()=>{bI.registerSeries(JX.type,JX),sN(),RV(),bI.registerAnimation("gaugePointer",((t,e)=>{const i=XX(t,e);return{appear:i,enter:i,disappear:{duration:fF.disappear.duration}}})),hU(),oU()};class t$ extends kz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class e$ extends PU{constructor(){super(...arguments),this.type=LO.gauge,this.transformerConstructor=t$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=re(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();YL(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[gL]=t[this._angleField[0]],t[pL]=e>0?i[e-1][gL]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(e$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(e$.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t&&"segment"===t.name){const e=this.getSpec().segment;if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,TD.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?ZO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?ZO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return u(t[pL])?this.angleAxisHelper.dataToPosition([t[pL]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[gL]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(fz(null===(i=bI.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),mz("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}e$.type=LO.gauge,e$.mark=UX,e$.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},e$.transformerConstructor=t$;class i$ extends rF{constructor(){super(...arguments),this.type=i$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Tg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="rect":a.symbolType=o,a}}i$.type="cell";function s$(t){return!1===t?{}:{type:"fadeIn"}}class n$ extends KF{enableByType(t){return"dimension"!==t}}const r$=Object.assign(Object.assign({},oz),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class a$ extends kz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class o$ extends Tz{constructor(){super(...arguments),this.type=LO.heatmap,this.transformerConstructor=a$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=G(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(o$.mark.cell,{isSeriesMark:!0},{morph:yz(this._spec,o$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(o$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",TD.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=ni(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",TD.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=wz(this);this._cellMark.setAnimationConfig(fz(null===(i=bI.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),mz("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new n$(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}o$.type=LO.heatmap,o$.mark=r$,o$.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},o$.transformerConstructor=a$;const l$=()=>{gW(),bI.registerMark(i$.type,i$),bI.registerGraphicComponent("symbol",Tg),oM(),hM(),KE(),bI.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},vF),{appear:s$(e)}))),lH(),nH(),bI.registerSeries(o$.type,o$)},h$=Object.assign(Object.assign({},oz),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),c$=`${UI}_CORRELATION_X`,d$=`${UI}_CORRELATION_Y`,u$=`${UI}_CORRELATION_SIZE`,p$=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const y=e.view();if(y.x1-y.x0==0||y.y1-y.y0==0||y.x1-y.x0==-1/0||y.x1-y.x0==1/0||y.y1-y.y0==-1/0||y.y1-y.y0==1/0)return t;const b=re(null!==(i=e.startAngle)&&void 0!==i?i:-90),S=re(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((y.x1-y.x0)/2,(y.y1-y.y0)/2),A=Et(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=Et(e.outerRadius,k),w=[x(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:y.x0+Et(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",y.x1-y.x0),x(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:y.y0+Et(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",y.y1-y.y0)],T=Bt(e.field),C=t.map(T),[B,E]=Rt(C),P=B===E?t=>(A+M)/2:t=>A+(M-A)*(t-B)/(E-B),R=d(e.radiusField)?T:Bt(e.radiusField),O=null!==(p=null===(u=null==e?void 0:e.radiusRange)||void 0===u?void 0:u[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Rt(t.map(R)):[B,E],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,S),D=Math.max(b,S),F=g$(L,D,t.length),z=[],j=(D-L)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=I(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),f$({x:n,y:r,size:s},z)||n-sy.x1||r-sy.y1);t++)t<59&&(a+=j,a>D?a=L:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},f$=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!_(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[$I]:null==n?void 0:n[$I],[qI]:null==n?void 0:n[qI]}};class v$ extends KN{constructor(){super(...arguments),this.type=v$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=mt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}v$.type="ripple";const _$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class y$ extends kz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class b$ extends BW{constructor(){super(...arguments),this.type=LO.correlation,this.transformerConstructor=y$,this._viewBox=new je}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){u(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){u(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){u(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;YL(this._dataSet,"correlation",p$);const s=new Ca;XL(s,"dataview",Ma),YL(s,"correlationCenter",m$);const n=new Ba(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new tF(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const t=this._createMark(b$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:$I});t&&(t.setMarkConfig({zIndex:MD.Node}),this._nodePointMark=t);const e=this._createMark(b$.mark.ripplePoint,{key:$I,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});e&&(this._ripplePointMark=e);const i=this._createMark(b$.mark.centerPoint,{key:$I,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(i.setMarkConfig({zIndex:MD.Node}),this._centerPointMark=i)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[c$],y:t=>t[d$],size:t=>t[u$],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},BD.STATE_NORMAL,TD.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},BD.STATE_NORMAL,TD.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},BD.STATE_NORMAL,TD.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},BD.STATE_NORMAL,TD.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(fz(null===(e=bI.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),mz("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}b$.type=LO.correlation,b$.mark=h$,b$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},b$.transformerConstructor=y$;const x$=()=>{Qz(),qN(),hM(),bI.registerMark(v$.type,v$),bI.registerGraphicComponent("symbol",(t=>Tg(t))),bI.registerSeries(b$.type,b$),bI.registerAnimation("correlation",((t,e)=>Object.assign({appear:_$(0,e)},mF)))},S$=Object.assign(Object.assign({},oz),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class k$ extends KN{constructor(){super(...arguments),this.type=k$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}k$.type="liquid";const A$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class M$ extends KF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class w$ extends Az{constructor(){super(...arguments),this.type=LO.liquid,this.transformerConstructor=tj,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Ig({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Tg({x:s,y:n,size:r,symbolType:A$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){u(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=aI(this._spec.outlineMargin),this._paddingSpec=aI(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Ut(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(w$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(w$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(w$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(w$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",TD.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",TD.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",TD.Series)}initTooltip(){this._tooltipHelper=new M$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(fz(null===(i=bI.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),mz("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(fz(null===(s=bI.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),mz("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(jL.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=OM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}w$.type=LO.liquid,w$.mark=S$,w$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},w$.transformerConstructor=tj;const T$=t=>G(t).join(",");class C$ extends KF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>T$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>T$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const B$=Object.assign(Object.assign({},oz),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class E$ extends kz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const P$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?qG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class R$ extends Az{constructor(){super(...arguments),this.type=LO.venn,this.transformerConstructor=E$,this._viewBox=new je}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:KI)}initData(){var t;super.initData(),YL(this._dataSet,"venn",P$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(R$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(R$.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},BD.STATE_NORMAL,TD.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},BD.STATE_NORMAL,TD.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},BD.STATE_HOVER,TD.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>T$(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},BD.STATE_NORMAL,TD.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>T$(t.sets)},BD.STATE_NORMAL,TD.Series))}initTooltip(){this._tooltipHelper=new C$(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:T$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return T$(i)}legendSelectedFilter(t,e){if(t.type===n.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[T$(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>G(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(T$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(fz(null===(e=bI.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),mz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(fz(null===(e=bI.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),mz(t.name,this._spec,this._markAttributeContext)))}))}}R$.type=LO.venn,R$.mark=B$,R$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},R$.transformerConstructor=E$;class O$ extends FV{constructor(){super(...arguments),this.type=LO.mosaic,this.transformerConstructor=DV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(cL),this.setFieldX2(hL)),this.setFieldY(uL),this.setFieldY2(dL)):(t&&(this.setFieldY(cL),this.setFieldY2(hL)),this.setFieldX(uL),this.setFieldX2(dL)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&d(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];d(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}O$.type=LO.mosaic,O$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},O$.transformerConstructor=DV;class I$ extends PH{_isValidSeries(t){return t===LO.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class L$ extends BH{constructor(){super(...arguments),this.transformerConstructor=I$,this.type="map",this.seriesType=LO.map}}L$.type="map",L$.seriesType=LO.map,L$.transformerConstructor=I$;class D$ extends PH{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=G(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return u(r)&&n.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),u(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class F$ extends D${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),d(l.type)&&(l.type="linear"),d(o.type)&&(o.type="band");const h=uj(l,{min:0,max:1});d(l.min)&&(l.min=h.min),d(l.max)&&(l.max=h.max),s&&Object.assign(l,yI({},s,l)),n&&Object.assign(o,yI({},n,o))}}class z$ extends D${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class j$ extends D${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class H$ extends BH{constructor(){super(...arguments),this.transformerConstructor=j$}}H$.transformerConstructor=j$;class V$ extends H${constructor(){super(...arguments),this.transformerConstructor=j$,this.type="pie",this.seriesType=LO.pie}}V$.type="pie",V$.seriesType=LO.pie,V$.transformerConstructor=j$;class N$ extends z${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Cj,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Cj,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&d(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=G(t.crosshair||{}).map((t=>yI({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const W$=(t,e)=>{if(!t)return null;const i=Vz(t,(t=>"angle"===t.getOrient()),e),s=Vz(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&gB(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=wO({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=TO(u),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=jz(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&gB(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=wO({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=TO(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=jz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class U$ extends BH{constructor(){super(...arguments),this.transformerConstructor=N$,this.type="rose",this.seriesType=LO.rose}_setModelOption(){this._modelOption.getDimensionInfo=W$}}U$.type="rose",U$.seriesType=LO.rose,U$.transformerConstructor=N$,U(U$,DH);class G$ extends z${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=yI({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=G(t.crosshair||{}).map((t=>yI({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class Y$ extends BH{constructor(){super(...arguments),this.transformerConstructor=G$,this.type="radar",this.seriesType=LO.radar}_setModelOption(){this._modelOption.getDimensionInfo=W$}}Y$.type="radar",Y$.seriesType=LO.radar,Y$.transformerConstructor=G$,U(Y$,DH);class X$ extends PH{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=p(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{P(e,"trimPadding")&&yI(e,xD(this.type,t))})),this._transformAxisSpec(t)}}class $$ extends BH{constructor(){super(...arguments),this.transformerConstructor=X$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=YH(t,e,i))&&void 0!==s?s:[],...null!==(n=W$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=$H,this._modelOption.getRectByDimensionData=tV}}$$.type="common",$$.transformerConstructor=X$,U($$,DH);class K$ extends RH{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class q$ extends BH{constructor(){super(...arguments),this.transformerConstructor=K$}}q$.transformerConstructor=K$,U(q$,DH);class Z$ extends K${transformSpec(t){super.transformSpec(t),_D(t)}}class J$ extends q${constructor(){super(...arguments),this.transformerConstructor=Z$,this.type="histogram",this.seriesType=LO.bar}_setModelOption(){this._modelOption.getDimensionInfo=YH,this._modelOption.getDimensionInfoByValue=$H,this._modelOption.getRectByDimensionData=tV}}J$.type="histogram",J$.seriesType=LO.bar,J$.transformerConstructor=Z$;class Q$ extends F${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class tK extends BH{constructor(){super(...arguments),this.transformerConstructor=Q$,this.type="circularProgress",this.seriesType=LO.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=W$}}tK.type="circularProgress",tK.seriesType=LO.circularProgress,tK.transformerConstructor=Q$,U(tK,DH);class eK extends F${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=LO.circularProgress,e}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===LO.gauge||t.type===LO.circularProgress));d(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(d(a.radiusField)&&d(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),d(a.valueField)&&d(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===LO.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:MD.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),d(i.angle.type)&&(i.angle.type="linear"),d(i.radius.type)&&(i.radius.type="linear"),d(i.angle.zIndex)&&(i.angle.zIndex=MD.Region+50)}}class iK extends BH{constructor(){super(...arguments),this.transformerConstructor=eK,this.type="gauge",this.seriesType=LO.gaugePointer}}iK.type="gauge",iK.seriesType=LO.gaugePointer,iK.transformerConstructor=eK;class sK extends PH{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class nK extends BH{constructor(){super(...arguments),this.transformerConstructor=sK,this.type="wordCloud",this.seriesType=LO.wordCloud}}nK.transformerConstructor=sK;class rK extends nK{constructor(){super(...arguments),this.transformerConstructor=sK,this.type="wordCloud",this.seriesType=LO.wordCloud}}rK.type="wordCloud",rK.seriesType=LO.wordCloud,rK.transformerConstructor=sK;class aK extends PH{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class oK extends BH{constructor(){super(...arguments),this.transformerConstructor=aK,this.type="funnel",this.seriesType=LO.funnel}}oK.type="funnel",oK.seriesType=LO.funnel,oK.transformerConstructor=aK;class lK extends RH{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="band"),d(i.type)&&(i.type="linear");const n=uj(i,{min:0,max:1});d(i.min)&&(i.min=n.min),d(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="linear"),d(e.type)&&(e.type="band");const n=uj(s,{min:0,max:1});d(s.min)&&(s.min=n.min),d(s.max)&&(s.max=n.max)}}}class hK extends BH{constructor(){super(...arguments),this.transformerConstructor=lK,this.type="linearProgress",this.seriesType=LO.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=YH,this._modelOption.getDimensionInfoByValue=$H,this._modelOption.getRectByDimensionData=tV}}hK.type="linearProgress",hK.seriesType=LO.linearProgress,hK.transformerConstructor=lK,U(hK,DH);class cK extends RH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),_D(t)}}class dK extends BH{constructor(){super(...arguments),this.transformerConstructor=cK,this.type="rangeColumn",this.seriesType=LO.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=YH,this._modelOption.getDimensionInfoByValue=$H,this._modelOption.getRectByDimensionData=tV}}dK.type="rangeColumn",dK.seriesType=LO.rangeColumn,dK.transformerConstructor=cK;class uK extends PH{_getDefaultSeriesSpec(t){const e=u(t.startAngle)?t.startAngle:-90,i=u(t.endAngle)?t.endAngle:e+ae(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class pK extends BH{constructor(){super(...arguments),this.transformerConstructor=uK,this.type="sunburst",this.seriesType=LO.sunburst}}pK.type="sunburst",pK.seriesType=LO.sunburst,pK.transformerConstructor=uK;class gK extends PH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class fK extends BH{constructor(){super(...arguments),this.transformerConstructor=gK,this.type="circlePacking",this.seriesType=LO.circlePacking}}fK.type="circlePacking",fK.seriesType=LO.circlePacking,fK.transformerConstructor=gK;class mK extends PH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class vK extends BH{constructor(){super(...arguments),this.transformerConstructor=mK,this.type="treemap",this.seriesType=LO.treemap}}vK.type="treemap",vK.seriesType=LO.treemap,vK.transformerConstructor=mK;class _K extends jV{transformSpec(t){super.transformSpec(t),t.legends&&G(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),_D(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class yK extends HV{constructor(){super(...arguments),this.transformerConstructor=_K,this.type="waterfall",this.seriesType=LO.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=YH,this._modelOption.getDimensionInfoByValue=$H,this._modelOption.getRectByDimensionData=tV}}yK.type="waterfall",yK.seriesType=LO.waterfall,yK.transformerConstructor=_K;class bK extends RH{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),_D(t)}}class xK extends BH{constructor(){super(...arguments),this.transformerConstructor=bK,this.type="boxPlot",this.seriesType=LO.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=YH,this._modelOption.getDimensionInfoByValue=$H,this._modelOption.getRectByDimensionData=tV}}xK.type="boxPlot",xK.seriesType=LO.boxPlot,xK.transformerConstructor=bK;class SK extends PH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class kK extends BH{constructor(){super(...arguments),this.transformerConstructor=SK,this.type="sankey",this.seriesType=LO.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=IL(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}kK.type="sankey",kK.seriesType=LO.sankey,kK.transformerConstructor=SK;class AK extends RH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),_D(t)}}class MK extends BH{constructor(){super(...arguments),this.transformerConstructor=AK,this.type="rangeArea",this.seriesType=LO.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=YH,this._modelOption.getDimensionInfoByValue=$H,this._modelOption.getRectByDimensionData=tV}}MK.type="rangeArea",MK.seriesType=LO.rangeArea,MK.transformerConstructor=AK;class wK extends RH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class TK extends BH{constructor(){super(...arguments),this.transformerConstructor=wK,this.type="heatmap",this.seriesType=LO.heatmap}}TK.type="heatmap",TK.seriesType=LO.heatmap,TK.transformerConstructor=wK;class CK extends PH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class BK extends BH{constructor(){super(...arguments),this.transformerConstructor=CK,this.type="correlation",this.seriesType=LO.correlation}}BK.type="correlation",BK.seriesType=LO.correlation,BK.transformerConstructor=CK;function EK(t){var e,i;const s=Object.assign({},t);return E(t.style)||(s.textStyle=RL(t.style)),E(t.textStyle)||yI(s.textStyle,RL(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&RL(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&RL(s.background.style),s}const PK=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},RK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const p={};c.forEach((t=>{p[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:qI;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===p[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===p[t.source]&&!0===p[t.target])))):u(g)&&(t=t.filter((t=>!0===p[r.getSeriesFieldValue(t,g)]))),t)};class OK extends Ij{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=MD.Legend,this.layoutLevel=wD.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{BO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),BO(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=tI(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;u(s)&&(this._seriesUserId=G(s)),u(e)&&(this._regionUserId=G(e)),u(n)&&(this._seriesIndex=G(n)),u(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(N(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new tF(this._option,t),this._initSelectedData(),BO(this._regions,(t=>{t.event.on(jL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;d(t)||JSON.stringify(n)===JSON.stringify(t)||(BO(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(jL.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)N(s,this._cacheAttrs)||this._legendComponent.setAttributes(yI({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(yI({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());N(t,this._cacheAttrs)||this._legendComponent.setAttributes(yI({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(jL.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}OK.specKey="legends";class IK extends OK{constructor(){super(...arguments),this.type=n.discreteLegend,this.name=n.discreteLegend}static getSpecInfo(t){return jF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),BO(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:nD.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){YL(this._option.dataSet,"discreteLegendFilter",RK),YL(this._option.dataSet,"discreteLegendDataMake",PK);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return BO(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!ob(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return c(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=yL(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(e){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(e,i){const s=t(e,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=e;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=EK(n):l.title={visible:!1},E(r.focusIconStyle)||RL(r.focusIconStyle),r.shape&&(r.shape=BL(r.shape)),r.label&&(r.label=BL(r.label)),r.value&&(r.value=BL(r.value)),r.background&&(r.background=BL(r.background)),eI(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),eI(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),eI(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(E(a.railStyle)||RL(a.railStyle),E(a.sliderStyle)||RL(a.sliderStyle)):(E(a.textStyle)||RL(a.textStyle),a.handler&&BL(a.handler)),l.pager=a,o.visible&&!E(o.style)&&(yI(l,o.style),u(o.padding)&&(l.padding=o.padding)),l}(this._spec,e)),{maxWidth:e.width,maxHeight:e.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return FR}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(ER.legendItemClick,(e=>{const i=P(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(jL.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(ER.legendItemHover,(t=>{const e=P(t,"detail");this.event.emit(jL.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(ER.legendItemUnHover,(t=>{const e=P(t,"detail");this.event.emit(jL.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return c(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=zF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=zF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}IK.specKey="legends",IK.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},IK.type=n.discreteLegend;const LK=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},DK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!p(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!E(o)){const[e,i]=o;return a?a(t,o,l):h(t)?CL(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function FK(e){const i=yI({},e),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:d,background:p={},type:g,id:f,visible:m,orient:v,position:_,data:y,defaultSelected:b,field:x,filter:S,regionId:k,regionIndex:A,seriesIndex:M,seriesId:w,padding:T}=i,C=t(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?C.title=EK(s):C.title={visible:!1},C.showHandler=!1!==n.visible,E(n.style)||(C.handlerStyle=RL(n.style)),u(r.width)&&(C.railWidth=r.width),u(r.height)&&(C.railHeight=r.height),E(r.style)||(C.railStyle=RL(r.style)),E(a.style)||(C.trackStyle=RL(a.style)),C.startText=BL(o),C.endText=BL(l),C.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return c(i)?e.style=(t,e,s)=>RL(i(t,e,s)):E(i)||(e.style=RL(i)),e}(h),E(d)||(C.sizeBackground=RL(d)),p.visible&&!E(p.style)&&(yI(C,p.style),u(p.padding)&&(C.padding=p.padding)),C}const zK={color:NR,size:UR},jK={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},HK=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},jK),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},VK={horizontal:HK(!0),vertical:HK(!1)},NK=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},jK),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},WK={horizontal:NK(!0),vertical:NK(!1)},UK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],GK=[2,10];class YK extends OK{static getSpecInfo(t){const e=jF(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?n.colorLegend:n.sizeLegend})),e}constructor(t,e){super(t,e),this.type=n.colorLegend,this.name=n.colorLegend;const i="color"===this._spec.type?n.colorLegend:n.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),BO(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData,customFilter:this._spec.customFilter},level:nD.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){YL(this._option.dataSet,"continuousLegendFilter",DK),YL(this._option.dataSet,"continuousLegendDataMake",LK);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>EO(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=yL(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!ob(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=yL(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),E(r)&&(r="color"===this._legendType?UK:GK);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 h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},FK(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return zK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",bt((e=>{const i=P(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(jL.legendFilter,{model:this,value:i,event:e})}),30))}}}YK.specKey="legends",YK.builtInTheme={colorLegend:VK,sizeLegend:WK},YK.type=n.continuousLegend;const XK=(t,e)=>u(e)?t.map((t=>e[t])):void 0,$K=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),KK=t=>!d(t)&&(_(t)?t.length>0&&t.every(u):Object.keys(t).length>0);function qK(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),p=i.getOption(),g=p.getRegionsInUserIdOrIndex(u(c.regionId)?[c.regionId]:void 0,u(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=ZK(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=p.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>$K(i,s)(t)&&$K(n,r)(t)&&(d(a)||$K([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),k=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{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=>x(t))))&&void 0!==i?i:[]}}))}];u(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=p.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:HL.chart,event:k({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=p.globalInstance;return RF.globalConfig.uniqueTooltip&&RF.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=p.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:HL.chart,event:k(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=p.globalInstance;return RF.globalConfig.uniqueTooltip&&RF.hideTooltip(a.id),m}return"none"}const ZK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),p=e.getMeasureField(),g=e.getSeriesField(),f=u(g)?t[g]:void 0,m=u(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=XK(c,t);let _=XK(p,t);const y=KK(_),b=!y&&u(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find($K(c,v));if(!y&&(_=XK(p,i),!KK(_)))return;const n=e.type===LO.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=gB(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>d(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter($K(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=XK(p,o),!KK(_))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find($K(c,n));if(!y&&(_=XK(p,r),!KK(_)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===LO.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter($K(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=XK(p,i),!KK(_))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find($K(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=XK(p,a),h=_,!KK(_)&&!a)return;KK(_)||(_=[null])}const u=e.dataToPosition(a);d(u)||isNaN(u.x)||isNaN(u.y)||s.push({pos:u,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},JK=t=>u(t)&&!_(t),QK=t=>u(t)&&_(t),tq=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class eq extends Oj{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=yI({},...tq.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=yI({},s);tq.forEach((t=>{delete r[t]})),delete r.style;const a=yI({},r,i);return a.style=yI({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return u(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:sb(this._option.mode)||!eb(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,u(t.parentElement)?v(t.parentElement)&&(t.parentElement=O_.getElementById(t.parentElement)):eb(this._option.mode)&&(t.parentElement=null==tb?void 0:tb.body)}}const iq={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class sq extends Ij{constructor(){super(...arguments),this.layoutZIndex=1,this.type=n.tooltip,this.name=n.tooltip,this.transformerConstructor=eq,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=eb(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&JK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):u(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&RF.globalConfig.uniqueTooltip&&l&&RF.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(jL.tooltipHide,Object.assign(Object.assign({},t),{source:HL.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(null==n?void 0:n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:HL.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(jL.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(jL.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?nV.canvas:nV.dom,n=bI.getComponentPluginInType(t);n||Zy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=bI.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(ib(s)||sb(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):p(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>p(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=x(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,xt(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=qK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(QK(t)){if(JK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>Fz(t,e[i])))}if(QK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}sq.type=n.tooltip,sq.transformerConstructor=eq,sq.builtInTheme={tooltip:iq},sq.specKey="tooltip";var nq,rq;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(nq||(nq={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(rq||(rq={}));const aq={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class oq extends Ij{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=MD.CrossHair_Grid,this.labelZIndex=MD.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),x(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=xt((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(p(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{gB(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:VL.chart}:{source:HL.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:t=s["desktop-browser"]}=this._option,e=function(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:ib(t)||sb(t)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(t);if(e){const t=G(this.trigger||"hover"),i=t=>"click"===t?"none"===this.triggerOff?null:e.clickOut:e.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:e[t],out:i(t)})})),s}return null}_registerTooltipEvent(){this.event.on(jL.tooltipHide,{source:HL.chart},this._handleTooltipHideOrRelease),this.event.on(jL.tooltipShow,{source:HL.chart},this._handleTooltipShow),this.event.on(jL.tooltipRelease,{source:HL.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=P(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{aq[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||x(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(e,i){var s,n,r;const a={},{line:o={},label:l={},visible:c}=e;if(a.visible=c,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=t(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(x(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=P(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==e?void 0:e.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=e.line.style.stroke);const t=P(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const e=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=e.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:c,outerBorder:d}=n,u=t(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:e.minWidth,maxWidth:e.maxWidth,padding:e.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:P(s,"stroke")}),panel:(h(e.visible)?e.visible:e)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:c,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}oq.specKey="crosshair";const lq={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class hq extends oq{static getSpecInfo(t){return jF(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=n.cartesianCrosshair,this.name=n.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=Cz(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){Cz(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(u(t.dimType)?"y"===t.dimType:Bz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=PO(this._regions,"cartesian");e&&(KH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=JH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new vw(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new _w(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}hq.specKey="crosshair",hq.builtInTheme={crosshair:lq},hq.type=n.cartesianCrosshair;class cq extends oq{static getSpecInfo(t){return jF(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=n.polarCrosshair,this.name=n.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=PO(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&u(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=dj(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=zF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:le(d,a.getInnerRadius(),o),end:le(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ce(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=le(t,o,r),d=le(t,o,h),m=me([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=mt(ne.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new vw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new bw(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new xw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new yw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=de(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=de(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?le(e,p[1]+m.offset,u):le(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}cq.specKey="crosshair",cq.builtInTheme={crosshair:lq},cq.type=n.polarCrosshair;const dq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(d(o)||d(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},uq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(d(a)||d(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return G(r).every((i=>{t[i]>=a[0]&&t[i]<=Y(a)&&(e=!0)})),e}:t=>{let e=!1;return G(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},pq=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],p=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(d(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);u(null==t?void 0:t.max)&&u(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{d(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{G(i[e]).forEach((i=>{d(t[i])||(d(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),d(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),p.push(e)})),p},gq=(t,e,i)=>{const s=e.domain();if(uB(e.type))return i?s[0]+(Y(s)-s[0])*(1-t):s[0]+(Y(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(Y(n)-n[0])*t;return e.invert(r)},fq=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&uB(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(Y(n)-n[0])))},mq=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},vq=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},_q=(t,e,i)=>"start"===t?"percent"===e&&u(i.start)||"value"===e&&u(i.startValue):"percent"===e&&u(i.end)||"value"===e&&u(i.endValue),yq=(t,e,i)=>{if(uB(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class bq{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:u(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=mt(this.getState().start+f,0,1),_=mt(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===Rz(Pz(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,h(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}U(bq,cN);class xq extends Ij{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:fq(t,this._stateScale,this._isHorizontal),a="percent"===n?e:fq(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var t;this._dataFilterEvent.initZoomEvent(),null===(t=this._relatedAxisComponent)||void 0===t||t.event.on(jL.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=mq(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=yq(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&vq(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else BO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),BO(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=Pz(t),this._isHorizontal="horizontal"===Rz(this._orient),this._dataFilterEvent=new bq(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(uB(n.type)){const r=n.domain(),a=r[0],o=Y(r)-a,l=u(t)?a+o*t:+e,h=u(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=u(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=u(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(u(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):u(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),d(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>Rz(t._orient)===Rz(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!uB(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(u(i)&&(u(i.userId)&&(this._seriesUserId=G(i.userId)),u(i.specIndex)&&(this._seriesIndex=G(i.specIndex))),u(this._spec.seriesId)){const t=G(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(u(this._spec.seriesIndex)){const t=G(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(u(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(G(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(u(this._spec.regionId)){const t=G(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};BO(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=uB(d.getScale(0).type),p=uB(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?G(g.xField):G(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?G(g.yField):G(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else BO(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;XL(r,"dataview",Ma),YL(r,"dataFilterComputeDomain",pq);const a=new Ba(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new tF(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(YL(this._option.dataSet,"dataFilterWithNewDomain",uq),YL(this._option.dataSet,"lockStatisticsFilter",dq),BO(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>uB(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>uB(this._stateScale.type)},level:nD.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(uB(this._stateScale.type));this._stateScale.domain(a,!1),(u(this._spec.start)||u(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!N(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;_q("start",i,this._spec)&&_q("end",s,this._spec)&&(t="percent"===i?this._spec.start:fq(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:fq(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?fq(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?fq(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=gq(this._start,this._stateScale,mq(i,this._isHorizontal)),this._endValue=gq(this._end,this._stateScale,mq(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,uB(this._stateScale.type)&&this._stateScale.domain()[0]!==Y(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=yq(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&BO(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new iE:new LB,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),X(t)]:[-1/0,1/0]}return e}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:TD.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,r,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),u=vq(h);if(!this._dataUpdating&&gB(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==u?void 0:u.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(r=this._cacheRect)||void 0===r?void 0:r.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==u?void 0:u.bandSize,gB(c.type)){u&&(this._start||this._end)&&(this.type===n.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!d(t)||!d(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(xq,cN);class Sq extends Oj{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=yI({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const kq=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),Aq={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:kq(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:kq(!0)};class Mq extends xq{constructor(t,e){var i;super(t,e),this.type=n.dataZoom,this.name=n.dataZoom,this.transformerConstructor=Sq,this.specKey="dataZoom",this.layoutZIndex=MD.DataZoom,this.layoutLevel=wD.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange)if(i&&this._component)this._component.setStartAndEnd(t,e);else{const i=this._relatedAxisComponent,n=gq(t,this._stateScale,mq(i,this._isHorizontal)),r=gq(e,this._stateScale,mq(i,this._isHorizontal));if(!u(n)||!u(r))return;this._start=t,this._end=e;(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(jL.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new iE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(mq(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=mq(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),d(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),d(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const u=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=u?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new iE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(mq(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!uB(t.type)||e[0]!==Y(e))&&(!gB(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(G(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:u(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:mq(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>gq(t,this._stateScale,mq(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new PP(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>gq(t,this._stateScale,mq(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:RL(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:RL(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:RL(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:RL(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:RL(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:RL(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:RL(g.style)},selectedBackgroundStyle:RL(this._spec.selectedBackground.style),dragMaskStyle:RL(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:yI(RL(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},RL(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:yI(RL(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},RL(null===(d=m.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=zF(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(mq(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}Mq.type=n.dataZoom,Mq.transformerConstructor=Sq,Mq.builtInTheme={dataZoom:Aq},Mq.specKey="dataZoom";const wq={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class Tq extends xq{constructor(t,e){var i;super(t,e),this.type=n.scrollBar,this.name=n.scrollBar,this.specKey="scrollBar",this.layoutZIndex=MD.DataZoom,this.layoutLevel=wD.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}_handleChange(t,e,i){super._handleChange(t,e,i);const s=bO(this._start,t)&&bO(this._end,e);if(this._shouldChange&&(!s||!1===this._spec.realTime)){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this._relatedAxisComponent,n=mq(s,this._isHorizontal),r=gq(t,this._stateScale,n),a=gq(e,this._stateScale,n);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,r,a):this._handleStateChange(r,a))&&this.event.emit(jL.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:u(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new SM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return d(i)||(s.padding=i),E(null==t?void 0:t.style)||(s.railStyle=RL(t.style)),E(null==e?void 0:e.style)||(s.sliderStyle=RL(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}Tq.type=n.scrollBar,Tq.builtInTheme={scrollBar:wq},Tq.specKey="scrollBar";const Cq=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),G(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},Bq=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),Eq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:Bq("l1FontSize","primaryFontColor")},content:{visible:!0,style:Bq("l2FontSize","tertiaryFontColor")}};class Pq extends Ij{constructor(){super(...arguments),this.type=n.indicator,this.name=n.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=MD.Indicator,this.layoutLevel=wD.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return jF(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=G(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IL(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IL(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){YL(this._option.dataSet,"indicatorFilter",Cq);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new tF(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const e=this._regions[0],{width:i,height:s}=e.getLayoutRect(),{x:n,y:r}=e.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,p=t(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return G(o).forEach((t=>{const e=yI({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},PL(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?lI(l,this._computeLayoutRadius()):0,dy:h?lI(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!u(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},PL(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},p)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)N(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new XR(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":c(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}Pq.type=n.indicator,Pq.builtInTheme={indicator:Eq},Pq.specKey="indicator";const Rq=["sum","average","min","max","variance","standardDeviation","median"];function Oq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function Iq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.x)&&Oq(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=eI(t.x)?zq(t.x,n)+r.x:jq(l.getXAxisHelper(),[t.x])+r.x,h}function Lq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.y)&&Oq(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=eI(t.y)?zq(t.y,n)+r.y:jq(l.getYAxisHelper(),[t.y])+r.y,h}function Dq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.angle)&&Oq(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),jq(a.angleAxisHelper,[t.angle])}function Fq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.radius)&&Oq(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),jq(a.radiusAxisHelper,[t.radius])}function zq(t,e){return Number(t.substring(0,t.length-1))*e/100}function jq(t,e){const i=t.getScale(0);return uB(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function Hq(t){return Rq.includes(t)}function Vq(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),p={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},k={min:null,max:null};return f.forEach((t=>{const e=u(t.x),i=u(t.y);let s,r;if(e&&i)s=Iq(t,_,n,p,c,o),r=Lq(t,y,n,p,d,o),Nq(s,b,S,g.length),Nq(r,x,k,g.length),g.push([{x:s,y:r}]);else if(e){s=Iq(t,_,n,p,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);Nq(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=Lq(t,y,n,p,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);Nq(r,x,k,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,k),g}function Nq(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=u(t.angle),i=u(t.radius);if(e&&i){const e=Dq(t,l,n,r),i=Fq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=Dq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=Fq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function Uq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=_(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=eI(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=eI(i)?Number(i.substring(0,i.length-1))*f/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=G(t.x),S=G(t.y);1===b.length&&x(b[0])&&Oq(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===S.length&&x(S[0])&&Oq(y,S[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",S[0])),n.push({x:jq(d.getXAxisHelper(),b)+p.x+m,y:jq(d.getYAxisHelper(),S)+p.y+v})})),n}function Gq(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=G(t.angle),u=G(t.radius);1===d.length&&x(d[0])&&Oq(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&x(u[0])&&Oq(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:jq(l.angleAxisHelper,d),radius:jq(l.radiusAxisHelper,u)})})),s}function Yq(t,e,i){let{x:s,y:n}=t;return eI(s)&&(s=zq(s,e)),eI(n)&&(n=zq(n,i)),{x:s,y:n}}function Xq(t,e,i){let s;if(s=c(t)?G(t(e.getData().getLatestData(),e)):G(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=Yq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>Yq(t,n,r)))}function $q(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function Kq(e,i,s){const{labelBackground:n={},style:r,shape:a}=e,o=t(e,["labelBackground","style","shape"]);if(!1!==e.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},RL(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Zq(RL(n.style),i,s)),u(n.padding)&&(t.padding=ni(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Zq(RL(r),i,s)),t}return{visible:!1}}function qq(t,e,i){for(const s in t)c(t[s])&&(t[s]=t[s](e,i));return t}function Zq(t,e,i){return c(t)?t(e,i):t}function Jq(t,e){return c(t)?t(e):t}function Qq(t,e,i){return u(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function tZ(t){return{isXProcess:u(t.x),isYProcess:u(t.y),isX1Process:u(t.x1),isY1Process:u(t.y1),isAngleProcess:u(t.angle),isRadiusProcess:u(t.radius),isAngle1Process:u(t.angle1),isRadius1Process:u(t.radius1),isCoordinatesProcess:u(t.coordinates),isValidProcess:u(t.process)}}function eZ(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=tZ(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function iZ(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=tZ(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function sZ(t){return{doXYProcess:u(t.x)&&u(t.y),doPolarProcess:u(t.angle)&&u(t.radius),doGeoProcess:u(t.areaName)}}function nZ(e,i){let s;if(i.coordinates){const e=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=e,o=t(e,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(c(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=G(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;u(r)&&(c=G(i)[r]),n&&G(i).includes(n)&&(c=n);let d=s;u(l)&&(d=G(s)[l]),a&&G(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),v(t[c])&&Hq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=G(c).map((e=>t[e])),v(t[d])&&Hq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=G(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;u(r)&&(a=G(s)[r]),n&&G(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),v(t[a])&&Hq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=G(a).map((e=>t[e])),v(t[l])&&Hq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=G(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((t=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(u(t.x)){const s=t.x;_(s)?i.x=s.map((i=>aZ(i,e,t))):i.x=aZ(s,e,t)}if(u(t.y)){const s=t.y;_(s)?i.y=s.map((i=>aZ(i,e,t))):i.y=aZ(s,e,t)}if(u(t.angle)){const s=t.angle;_(s)?i.angle=s.map((i=>aZ(i,e,t))):i.angle=aZ(s,e,t)}if(u(t.radius)){const s=t.radius;_(s)?i.radius=s.map((i=>aZ(i,e,t))):i.radius=aZ(s,e,t)}if(u(t.areaName)){const s=t.areaName;i.areaName=aZ(s,e,t)}t.getRefRelativeSeries&&(i.getRefRelativeSeries=t.getRefRelativeSeries),n.push(i)})),n}const rZ={min:(t,e)=>xO(t[0].latestData,e.field),max:(t,e)=>SO(t[0].latestData,e.field),sum:function(t,e){return kO(t[0].latestData,e.field)},average:function(t,e){return AO(t[0].latestData,e.field)},variance:function(t,e){return MO(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(MO(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ht(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function aZ(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(c(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return rZ[i](e,{field:s})}return t}function oZ(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class lZ extends Ij{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return jF(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return v(e)&&Hq(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];G(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ca;return e.registerParser("array",i),new Ba(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(u(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=PO(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){d(this._spec.offsetX)||(this._layoutOffsetX=sI(this._spec.offsetX,e.width,e)),d(this._spec.offsetY)||(this._layoutOffsetY=sI(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();YL(this._option.dataSet,"markerAggregation",nZ),YL(this._option.dataSet,"markerFilter",oZ);const i=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function hZ(t,e){return function(t,e,i){const{predict:s}=Lt(t,(t=>t[e]),(t=>t[i])),n=xO(t,e),r=SO(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class cZ extends lZ{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=MD.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=eZ(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Zq(RL(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>Kq(t,this._markerData,this._markAttributeContext))),state:{line:qq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:qq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:qq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return qq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return qq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:Zq(RL(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:Zq(RL(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||G(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=$q([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=G((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=G(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=eZ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;YL(this._option.dataSet,"markerAggregation",nZ),YL(this._option.dataSet,"markerRegression",hZ),YL(this._option.dataSet,"markerFilter",oZ);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Ba(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}cZ.specKey="markLine";const dZ=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),uZ={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},pZ={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:dZ(!1),endSymbol:dZ(!0),label:uZ};class gZ extends cZ{constructor(){super(...arguments),this.type=n.markLine,this.name=n.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new mR(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=u(e.coordinates),o=u(e.process),l=o&&u(e.process.x),h=o&&u(e.process.y),c=u(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:p,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=eZ(e);let y=[];if(p||f||g||m||v||a&&l||a&&h){const t=Vq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=Uq(i,r,d,e.coordinatesOffset):c&&(y=Xq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(eI(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:p,limitRect:g}=r;if(!p||p.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(p[0],p[1],h,d);let m;m=o&&u(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(p[0],p[1],h,d));const v=G((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=G(r.label),y=G(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=eZ(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&u(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&u(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&u(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}gZ.type=n.markLine,gZ.coordinateType="cartesian",gZ.builtInTheme={markLine:pZ};class fZ extends cZ{constructor(){super(...arguments),this.type=n.polarMarkLine,this.name=n.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=eZ(this._spec);return e||i?new yR(t):new mR(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=eZ(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=Wq(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>le(f,t.radius,t.angle)))}}else u&&(p=Gq(i,r,a),g={points:p.map((t=>le(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=eZ(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}fZ.type=n.polarMarkLine,fZ.coordinateType="polar",fZ.builtInTheme={polarMarkLine:pZ};class mZ extends Ij{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=n.title,this.specKey=n.title,this.layoutType="normal",this.layoutZIndex=MD.Title,this.layoutLevel=wD.Title,this._orient="top",this._orient=tI(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return jF(t,this.specKey,n.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=sI(this._spec.width,a.width,null,a.width),l=sI(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=u(this._spec.text)&&""!==this._spec.text,d=u(this._spec.subtext)&&""!==this._spec.subtext,p=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(p.textStyle.width=h),d&&(p.subtextStyle.width=h),u(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?p.textStyle.width=t:delete p.textStyle.width,d&&(p.subtextStyle.width=t)}return p}_createOrUpdateTitleComponent(t){if(this._titleComponent)N(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new GR(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}mZ.type=n.title,mZ.specKey=n.title,mZ.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class vZ extends lZ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=MD.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=iZ(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:Zq(RL(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>Kq(t,this._markerData,this._markAttributeContext))),state:{area:qq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>qq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return qq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||G(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=$q([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=G(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=G(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=iZ(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}vZ.specKey="markArea";const _Z={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class yZ extends vZ{constructor(){super(...arguments),this.type=n.markArea,this.name=n.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new _R(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=iZ(i),d=u(i.positions),p=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=Vq(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=Vq(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=Uq(s,a,p,i.coordinatesOffset):d&&(f=Xq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=iZ(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}yZ.type=n.markArea,yZ.coordinateType="cartesian",yZ.builtInTheme={markArea:_Z};class bZ extends vZ{constructor(){super(...arguments),this.type=n.polarMarkArea,this.name=n.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=iZ(this._spec);return i||e||s?new bR(t):new _R(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=iZ(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=Wq(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=Gq(i,r,c),u={points:d.map((t=>le(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=iZ(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}bZ.type=n.polarMarkArea,bZ.coordinateType="polar",bZ.builtInTheme={polarMarkArea:_Z};const xZ=t=>RL(Object.assign({},t)),SZ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},RL(t.style))}),kZ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=xZ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=xZ(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},RL(Object.assign({},y)));var y;const b=SZ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=SZ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=SZ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=SZ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),A=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:k})});return t.visible||(A.controller.visible=!1,A.slider.visible=!1),A},AZ=t=>"left"===t||"right"===t,MZ=t=>"top"===t||"bottom"===t,wZ={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class TZ extends Ij{constructor(){super(...arguments),this.layoutZIndex=MD.Player,this.layoutLevel=wD.Player,this.specKey="player",this.type=n.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},kZ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},kZ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?N(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new oO(t):this._playerComponent=new cO(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...G(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...G(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...G(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...G(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=AZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=AZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...G(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...G(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...G(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...G(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(jL.rendered,this.autoPlayCallback),this._option.globalInstance.on(jL.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(eO.end,(()=>{var t;this.event.emit(jL.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(eO.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(eO.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(jL.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(eO.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(jL.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(eO.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(jL.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(eO.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(jL.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=AZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=MZ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return x(this._spec.width)?Math.min(t.width,Number(this._spec.width)):AZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return x(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):MZ(this._orient)?this._maxSize():t.height}_computeDx(t){return AZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return MZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];this._option.globalInstance.updateFullData(e.data),this.event.emit(jL.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}release(){this._option.globalInstance.off(jL.rendered,this.autoPlayCallback)}}TZ.builtInTheme={player:wZ},TZ.specKey="player",TZ.type=n.player;class CZ extends Ij{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.layoutType="none",this.layoutZIndex=MD.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,N(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=WO({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==CD.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),f(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}CZ.type=n.label;class BZ extends pW{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}BZ.type="text",BZ.constructorType="label";const EZ=()=>{gW(),bI.registerMark(BZ.constructorType,BZ)};class PZ extends Oj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class RZ extends CZ{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.specKey="label",this.transformerConstructor=PZ,this.layoutZIndex=MD.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,r)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:n.label,specInfoPath:["component",this.specKey,r],regionIndexes:[r]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(jL.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(FL.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(FL.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),BO(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&u(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(u(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n),c(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",TD.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=yI({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},RN(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[lL])):t=>t.filter((t=>t.data[oL]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?ON(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}RZ.type=n.label,RZ.specKey="label",RZ.transformerConstructor=PZ;class OZ extends CZ{constructor(){super(...arguments),this.type=n.totalLabel,this.name=n.totalLabel,this.specKey="totalLabel",this.layoutZIndex=MD.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var r;null===(r=t.seriesIndexes)||void 0===r||r.forEach((t=>{const{spec:r}=e.series[t],a=r[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:n.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[rL]},"normal",TD.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return yI({textStyle:{pickable:!0===this._spec.interactive},position:IZ(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[lL]:t.data[oL]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>ON({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function IZ(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}OZ.type=n.totalLabel,OZ.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},OZ.specKey="totalLabel";class LZ extends lZ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=MD.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=sZ(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w,T,C,B,E,P,R,O,I;const{itemContent:L={},itemLine:D={},targetSymbol:F={}}=this._spec,j=L,{type:H="text",text:V,symbol:N,image:W,richText:U,customMark:G,textStyle:Y,symbolStyle:X,imageStyle:$,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=j,Q=t(j,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(e=null==V?void 0:V.state)&&void 0!==e?e:J,it={dx:0,dy:0},et=Kq(Object.assign(Object.assign({},V),{style:z(it,null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==U?void 0:U.state)&&void 0!==r?r:J,it={width:100,height:100},et=Zq(z(it,null!==(o=null!==(a=null==U?void 0:U.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==N?void 0:N.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=RL(Zq(z(it,null!==(c=null!==(h=null==N?void 0:N.style)&&void 0!==h?h:X)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==W?void 0:W.state)&&void 0!==d?d:J,it={width:80,height:80},et=Zq(z(it,null!==(p=null!==(u=null==W?void 0:W.style)&&void 0!==u?u:$)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=Zq(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:Jq(L.offsetX,this._relativeSeries.getRegion()),offsetY:Jq(L.offsetX,this._relativeSeries.getRegion())},Q),{style:Zq(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(k=F.size)&&void 0!==k?k:20,style:Zq(F.style,this._markerData,this._markAttributeContext)},state:{line:qq(null!==(M=null===(A=this._spec.itemLine.line)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:qq(null!==(T=null===(w=this._spec.itemLine.startSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineEndSymbol:qq(null!==(B=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:qq(tt,this._markerData,this._markAttributeContext),textBackground:qq(null===(P=null===(E=this._spec.itemContent.text)||void 0===E?void 0:E.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:qq(null!==(O=null===(R=this._spec.targetSymbol)||void 0===R?void 0:R.state)&&void 0!==O?O:{},this._markerData,this._markAttributeContext)},animation:null!==(I=this._spec.animation)&&void 0!==I&&I,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=t(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:RL(rt.style)}):{visible:!1};return new SR(st)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=$q([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:Qq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:Qq(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=sZ(t);(u(t.coordinate)||e||i||s)&&this._initCommonDataView()}}LZ.specKey="markPoint";const DZ={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class FZ extends LZ{constructor(){super(...arguments),this.type=n.markPoint,this.name=n.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=u(s.x)&&u(s.y),o=u(s.coordinate),l=u(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=Vq(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=Uq(n,r,h,s.coordinatesOffset)[0]:l&&(c=Xq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=sZ(t),i=u(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}FZ.type=n.markPoint,FZ.coordinateType="cartesian",FZ.builtInTheme={markPoint:DZ};class zZ extends LZ{constructor(){super(...arguments),this.type=n.polarMarkPoint,this.name=n.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=Wq(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:le({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}zZ.type=n.polarMarkPoint,zZ.coordinateType="polar",zZ.builtInTheme={polarMarkPoint:DZ};class jZ extends LZ{constructor(){super(...arguments),this.type=n.geoMarkPoint,this.name=n.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{u(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}jZ.type=n.geoMarkPoint,jZ.coordinateType="geo",jZ.builtInTheme={geoMarkPoint:DZ};const HZ="inBrush",VZ="outOfBrush";class NZ extends Ij{constructor(){super(...arguments),this.layoutType="none",this.type=n.brush,this.name=n.brush,this.specKey="brush",this.layoutZIndex=MD.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return jF(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),HZ,TD.Series),i.setMarkStyle(s,Object.assign({},e),VZ,TD.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&G(t).includes(n.userId.toString())||e&&G(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){u(this._spec.regionId)||u(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(u(this._spec.brushLinkSeriesId)||u(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(G(this._spec.brushLinkSeriesId),G(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){u(this._spec.axisId)?G(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):u(this._spec.axisIndex)?G(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new gO(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:RL(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r),this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(lO.brushActive,(i=>{this._initMarkBrushState(e,VZ),this._emitEvent(jL.brushActive,t,i)})),r.addEventListener(lO.drawStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(jL.brushStart,t,e)})),r.addEventListener(lO.moveStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(jL.brushStart,t,e)})),r.addEventListener(lO.drawing,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(jL.brushChange,t,e)})),r.addEventListener(lO.moving,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(jL.brushChange,t,e)})),r.addEventListener(lO.brushClear,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0),this._initMarkBrushState(e,""),this._emitEvent(jL.brushClear,t,i)})),r.addEventListener(lO.drawEnd,(i=>{var s;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:n}=i.detail,{updateElementsState:r=!0}=this._spec;if(null===(s=this._spec)||void 0===s?void 0:s.onBrushEnd)!0===this._spec.onBrushEnd(i)?(this.clearGraphic(),this._initMarkBrushState(e,""),this._emitEvent(jL.brushClear,t,i)):(this._spec.onBrushEnd(i),this._emitEvent(jL.brushEnd,t,i));else{const e=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&e.length>0||!r)&&this._setAxisAndDataZoom(n,t),this._emitEvent(jL.brushEnd,t,i)}})),r.addEventListener(lO.moveEnd,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec,n=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&n.length>0||s)&&this._setAxisAndDataZoom(i,t),this._emitEvent(jL.brushEnd,t,e)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},RL(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(HZ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(HZ),i.addState(VZ,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(HZ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(HZ),i.addState(VZ,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Be(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(HZ),s.removeState(VZ),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=Y(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}NZ.type=n.brush,NZ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},NZ.specKey="brush";class WZ extends Ij{constructor(){super(...arguments),this.type=n.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=MD.CustomMark,this.layoutLevel=wD.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${UI}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=fz({},mz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(d(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),u(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new je).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new je;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}WZ.type=n.customMark,WZ.specKey="customMark";class UZ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:c(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&u(e.modelId)){if(u(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&u(e.modelKey)&&"modelIndex"in e&&u(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>GZ(t))),a=n.filter((t=>!GZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>GZ(t))),h=o.filter((t=>!GZ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function GZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}UZ.type="grid";const YZ="vchart-tooltip",XZ=`${YZ}-container`,$Z=`${YZ}-title`,KZ=`${YZ}-content-box`,qZ={offsetX:10,offsetY:10},ZZ="99999999999999";function JZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const QZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,tJ=t=>v(t)&&""!==(null==t?void 0:t.trim())||x(t)?JZ(t):"",eJ=(t,e)=>{let i;if(u(t))if(x(t))i=t;else if(c(t)){const s=t(e);x(s)&&(i=s)}return i},iJ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},sJ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=iJ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class nJ extends lj{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,d,g;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,S="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,w=m[y],T=UF(null==w?void 0:w.position,b,e),C=null!==(r=UF(null==w?void 0:w.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:GI,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:YI;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=eb(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),N&&!P){const t=this._getParentElement(m);j=null!==(d=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==d?d:v;const e=null!==(g=this._compiler.getCanvas())&&void 0!==g?g:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=QZ(e,F),V=QZ(t,j)}const W=V/H,U={},G={x:T,y:T},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==S?void 0:S.series)||void 0===r?void 0:r.coordinate)&&S.datum&&S.datum.length){L=!0;const t=f(S,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:E;switch(sJ(t,n)){case-2:U[e]=a-i*W-c;break;case-1.5:U[e]=a+c;break;case 0:U[e]=(a+o)/2-i*W/2;break;case-1:U[e]=(a+o)/2-i*W-c;break;case 1:U[e]=(a+o)/2+c;break;case 1.5:U[e]=o-i*W-c;break;case 2:U[e]=o+c}}},$=["x","y"];if(p(T))if(p(K=T)&&(u(K.left)||u(K.right)||u(K.top)||u(K.bottom))){const{left:t,right:e,top:i,bottom:s}=T;U.left=eJ(t,_),U.top=eJ(i,_),U.right=eJ(e,_),U.bottom=eJ(s,_)}else(t=>p(t)&&(u(t.x)||u(t.y)))(T)&&$.forEach((t=>{const e=T[t];x(e)||c(e)?U[Y[t][0]]=eJ(e,_):X(e,t)}));else u(T)&&(X({orient:T,mode:C},"x"),X({orient:T,mode:C},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?B:E,s="x"===t?O:I,n="x"===t?A:M,r=sJ(G[t],t);if(k(U[Y[t][0]]))q[t]=U[Y[t][0]];else if(k(U[Y[t][1]]))q[t]=s-i*W-U[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*W/2:e-i*W-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]u(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",aJ=(t={},e={})=>{var i,s;u(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return u(n)&&(e.color=n),u(t.fontWeight)&&(e.fontWeight=t.fontWeight),u(t.textAlign)&&(e.textAlign=t.textAlign),u(t.fontSize)&&(e.fontSize=rJ(t.fontSize)),u(t.maxWidth)&&(e.maxWidth=rJ(t.maxWidth)),t.multiLine||u(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},oJ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?sI(e,t.fontSize):0},lJ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return u(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),u(r)&&(o=ni(r),a.padding=rJ(o)),{panelStyle:a,panelPadding:o}};function hJ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const cJ=t=>{bI.registerComponentPlugin(t.type,t)};class dJ extends nJ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(dJ.type),this.type=nV.dom,this._tooltipContainer=null==tb?void 0:tb.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(tb&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=lJ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:rJ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=aJ(h),x=aJ(u),S=aJ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=rJ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=rJ(null!==(s=u.spacing)&&void 0!==s?s:26),S[A]=rJ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(oJ(p),oJ(u));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes($Z))),l=a.find((t=>t.className.includes(KZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add($Z),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(hJ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${YZ}-column`),e.classList.add(`${YZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(KZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];hJ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));hJ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${YZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=tJ(e.key),e.keyStyle&&aJ(e.keyStyle,l)):"value"===i?(o.innerHTML=tJ(e.value),e.valueStyle&&aJ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,g=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?JZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const _=()=>c?JZ(c):m,y=g,b=t=>new wg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let k,A;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;A=t.toString(),k=t.bounds}else S.isSvg&&S.svgCache&&(A=S.svgCache.map((t=>t.path.toString())).join(),k=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new je));let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const w=fh.IsGradientStr(u);if(!u||v(u)&&!w||d)return m=d?"none":u?JZ(u):"currentColor",`\n \n \n \n `;const T=w?fh.Parse(u):p(u)?u:null;if(T){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=T.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===T.gradient?t=`\n ${i}\n `:"linear"===T.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),hJ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(KZ))),h=[...o.children].find((t=>t.className.includes($Z)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(u(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes($Z)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=sI(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,hJ(l,c))}const p=l.children,g=[];if(p){for(let i=0;i{cJ(dJ)},pJ={fontFamily:uI.fontFamily,spacing:10,wordBreak:"break-word"},gJ=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},pf||(pf=df.CreateGraphic("richtext",{})),pf.setAttributes(a),pf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function fJ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:pJ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:u(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const mJ=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return u(a)&&(r.cornerRadius=[a,a,a,a]),r};class vJ extends nJ{constructor(){super(vJ.type),this.type=nV.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new yO({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:p,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ni(d.padding),b=aI(d.padding),x=fJ(Object.assign({textAlign:"right"===_?"right":"left"},p),i),S=fJ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=fJ(m,i),A={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},M={panel:mJ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:A,key:S,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:w={},content:T=[]}=t;let C=b.left+b.right,B=b.top+b.bottom,E=0;const P=!!T.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=T.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:p,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,w={height:0,spaceRow:null!=y?y:v};if(u(h)){const i=yI({},S,fJ(b,void 0,{})),{width:s,height:n,text:r}=gJ(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(u(m)){const t=yI({},k,fJ(x,void 0,{})),{width:e,height:s,text:n}=gJ(m,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};M?t.stroke=d:t.fill=d,t.stroke=null!=p?p:d,t.lineWidth=g,w.shape=t;const e=null!=f?f:A.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aW.autoWidth&&!1!==W.multiLine;if(j){W=yI({},x,fJ(V,void 0,{})),U()&&(W.multiLine=null===(r=W.multiLine)||void 0===r||r,W.maxWidth=null!==(a=W.maxWidth)&&void 0!==a?a:P?Math.ceil(E):void 0);const{text:t,width:e,height:i}=gJ(H,W);M.title.value=Object.assign(Object.assign({width:U()?Math.min(e,null!==(o=W.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},W),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return B+=z,M.title.width=D,M.title.height=F,U()?C+=E||D:C+=Math.max(D,E),P&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-L-R-S.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=B,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?u(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}vJ.type=nV.canvas;const _J=()=>{cJ(vJ)},yJ=(t="chart",e,i)=>{var s,r,a,o,l,h,c,d,u,p,g;const f={modelInfo:[]};if("chart"===t)f.isChart=!0,f.modelInfo.push({spec:e,type:"chart"});else if("region"===t)f.modelType="region",f.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(r=e.series)||void 0===r||r.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(LO).includes(t))f.modelType="series",f.specKey="series",f.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&f.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(n).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=bI.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=G(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=G(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=bI.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=G(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);G(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},bJ=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:u,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=yJ(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!d(e)||G(e).some((e=>c(e)?e(t,i,s):fI(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=yI({},i),m=c(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:yI(f,m),hasChanged:!0};const i=yI({},t,m);mI(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[u])?f[u].push(t):d(f[u])?f[u]="component"===h?t:[t]:f[u]=[f[u],t]}return{chartSpec:f,hasChanged:!0}},xJ=t=>{bI.registerChartPlugin(t.type,t)};class SJ extends lj{constructor(){super(SJ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[SJ.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[SJ.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=_I(this._option.globalInstance.getSpec(),["data",SJ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=_I(this._baseChartSpec,["data",SJ.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(u(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(u(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(u(t.minWidth)&&e.width{const n=bJ(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=_I(i,["data",SJ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}SJ.pluginType="chart",SJ.specKey="media",SJ.type="MediaQueryPlugin";const kJ=()=>{xJ(SJ)},AJ=/\{([^}]+)\}/,MJ=/\{([^}]+)\}/g,wJ=/:/;class TJ extends lj{constructor(){super(TJ.type),this.type="formatterPlugin",this._timeModeFormat={utc:gi.getInstance().timeUTCFormat,local:gi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Si.getInstance().format,this._numericSpecifier=Si.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[TJ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;c(r)?this._formatter=r:(this._formatter=this._format.bind(this),c(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),bI.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=AJ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(MJ,((t,i)=>{if(!wJ.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(yi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}TJ.pluginType="chart",TJ.specKey="formatter",TJ.type="formatterPlugin";const CJ=()=>{xJ(TJ)};class BJ extends lj{constructor(){super(BJ.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[BJ.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=lN(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom{xJ(BJ)};RF.useRegisters([()=>{OT(),kT.registerBuiltInAnimate("scaleIn",FC),kT.registerBuiltInAnimate("scaleOut",zC),kT.registerBuiltInAnimate("fadeIn",hC),kT.registerBuiltInAnimate("fadeOut",cC),kT.registerBuiltInAnimate("moveIn",NC),kT.registerBuiltInAnimate("moveOut",WC),kT.registerBuiltInAnimate("rotateIn",GC),kT.registerBuiltInAnimate("rotateOut",YC),kT.registerBuiltInAnimate("update",HC),kT.registerBuiltInAnimate("state",jC),kT.registerBuiltInAnimate("fromTo",XC),kT.registerBuiltInAnimate(gD,gF)},()=>{hV(),dV(),pV(),HH(),jH(),AH(),fH(),Zz(),Qz(),xF(),_F(),lH(),nH(),bI.registerSeries(MH.type,MH),bI.registerChart(gV.type,gV)},()=>{hV(),dV(),pV(),jH(),AH(),fH(),Zz(),vV(),Qz(),bV(),lH(),nH(),bI.registerSeries(SV.type,SV),HH(),bI.registerChart(AV.type,AV)},()=>{hV(),dV(),pV(),jH(),zV(),HH(),bI.registerChart(HV.type,HV)},()=>{hV(),dV(),HH(),jH(),qV(),bI.registerChart(JV.type,JV)},()=>{dV(),XW(),bI.registerChart(V$.type,V$)},()=>{hV(),dV(),HH(),jH(),dU(),bI.registerChart(U$.type,U$)},()=>{hV(),dV(),pV(),HH(),jH(),bU(),bI.registerChart(Y$.type,Y$)},()=>{hV(),dV(),pV(),HH(),jH(),zV(),bI.registerTransform("bin",Xr),bI.registerChart(J$.type,J$)},()=>{dV(),pN(),sN(),bI.registerSeries(fN.type,fN),bI.registerImplement("registerMap",ZL),bI.registerImplement("unregisterMap",JL),yF(),bI.registerChart(L$.type,L$)},()=>{dV(),QX(),bI.registerSeries(e$.type,e$),VW(),LU(),oU(),zU(),bI.registerChart(iK.type,iK)},()=>{dV(),wY(),bI.registerChart(rK.type,rK)},()=>{dV(),YY(),bI.registerChart(oK.type,oK)},()=>{hV(),dV(),pV(),HH(),jH(),UN(),bI.registerChart(yK.type,yK)},()=>{hV(),dV(),HH(),jH(),uW(),bI.registerTransform("boxplot",$r),bI.registerChart(xK.type,xK)},()=>{hV(),dV(),HH(),jH(),zU(),bI.registerChart(tK.type,tK)},()=>{hV(),dV(),HH(),jH(),GU(),bI.registerChart(hK.type,hK)},()=>{hV(),dV(),HH(),jH(),kW(),bI.registerChart(dK.type,dK)},()=>{hV(),dV(),pV(),HH(),jH(),vV(),lH(),nH(),bI.registerSeries(CW.type,CW),bI.registerChart(MK.type,MK)},()=>{dV(),cX(),bI.registerChart(pK.type,pK)},()=>{dV(),mX(),bI.registerChart(fK.type,fK)},()=>{dV(),WX(),bI.registerChart(vK.type,vK)},()=>{dV(),yo.load(wM),LX(),bI.registerChart(kK.type,kK)},()=>{dV(),l$(),bI.registerChart(TK.type,TK)},()=>{dV(),x$(),bI.registerChart(BK.type,BK)},()=>{hV(),dV(),pV(),HH(),bI.registerChart($$.type,$$),jH()},nH,lH,()=>{bI.registerGraphicComponent(Lj.lineAxis,((t,e)=>new QC(t,e))),bI.registerGraphicComponent(Dj.lineAxisGrid,((t,e)=>new hP(t,e))),Vj(),bI.registerComponent(hH.type,hH)},()=>{bI.registerGraphicComponent(Lj.lineAxis,((t,e)=>new QC(t,e))),bI.registerGraphicComponent(Dj.lineAxisGrid,((t,e)=>new hP(t,e))),Vj(),bI.registerComponent(cH.type,cH)},()=>{bI.registerGraphicComponent(Lj.lineAxis,((t,e)=>new QC(t,e))),bI.registerGraphicComponent(Dj.lineAxisGrid,((t,e)=>new hP(t,e))),Vj(),bI.registerComponent(dH.type,dH)},hU,oU,()=>{bI.registerComponent(IK.type,IK)},()=>{bI.registerComponent(YK.type,YK)},()=>{bI.registerComponent(sq.type,sq)},()=>{bI.registerComponent(hq.type,hq)},()=>{bI.registerComponent(cq.type,cq)},()=>{bI.registerComponent(Mq.type,Mq)},()=>{bI.registerComponent(Tq.type,Tq)},()=>{bI.registerComponent(Pq.type,Pq)},pN,()=>{bI.registerComponent(gZ.type,gZ),fR()},()=>{bI.registerComponent(yZ.type,yZ),vR()},()=>{bI.registerComponent(FZ.type,FZ),xR()},()=>{bI.registerComponent(fZ.type,fZ),yR._animate=qP,fR()},()=>{bI.registerComponent(bZ.type,bZ),bR._animate=JP,vR()},()=>{bI.registerComponent(zZ.type,zZ),xR()},()=>{bI.registerComponent(jZ.type,jZ),xR()},()=>{bI.registerComponent(mZ.type,mZ)},()=>{bI.registerComponent(TZ.type,TZ)},()=>{bI.registerGraphicComponent(RZ.type,(t=>new rP(t))),EZ(),zj(),bI.registerComponent(RZ.type,RZ,!0,1/0)},()=>{bI.registerGraphicComponent(OZ.type,(t=>new rP(t))),EZ(),zj(),bI.registerComponent(OZ.type,OZ,!0)},()=>{bI.registerComponent(NZ.type,NZ)},()=>{bI.registerComponent(WZ.type,WZ)},()=>{yo.load(fw)},()=>{bI.registerLayout(UZ.type,UZ)},_J,TF,EF]),RF.useRegisters([()=>{mk(yo)}]);export{TD as AttributeLevel,hj as AxisSyncPlugin,vJ as CanvasTooltipHandler,jL as ChartEvent,BJ as ChartResizeZoomPlugin,YI as DEFAULT_CHART_HEIGHT,GI as DEFAULT_CHART_WIDTH,LF as DEFAULT_CLOSE_STROKE_JOIN,$I as DEFAULT_DATA_INDEX,KI as DEFAULT_DATA_KEY,qI as DEFAULT_DATA_SERIES_FIELD,fL as DEFAULT_KEY,kD as DEFAULT_LAYOUT_RECT_LEVEL,AD as DEFAULT_LAYOUT_RECT_LEVEL_MIN,IF as DEFAULT_LINEAR_INTERPOLATE,mL as DEFAULT_MAP_LOOK_UP_KEY,XI as DEFAULT_MEASURE_CANVAS_ID,ZI as DEFAULT_SERIES_STYLE_NAME,OF as DEFAULT_SMOOTH_INTERPOLATE,_T as DefaultTicker,DF as Direction,dJ as DomTooltipHandler,bI as Factory,TJ as FormatterPlugin,wD as LayoutLevel,MD as LayoutZIndex,uL as MOSAIC_CAT_END_PERCENT,dL as MOSAIC_CAT_START_PERCENT,cL as MOSAIC_VALUE_END_PERCENT,hL as MOSAIC_VALUE_START_PERCENT,bT as ManualTicker,SJ as MediaQuery,UI as PREFIX,s as RenderModeEnum,gL as SEGMENT_FIELD_END,pL as SEGMENT_FIELD_START,tL as STACK_FIELD_END,nL as STACK_FIELD_END_OffsetSilhouette,iL as STACK_FIELD_END_PERCENT,JI as STACK_FIELD_KEY,QI as STACK_FIELD_START,sL as STACK_FIELD_START_OffsetSilhouette,eL as STACK_FIELD_START_PERCENT,rL as STACK_FIELD_TOTAL,lL as STACK_FIELD_TOTAL_BOTTOM,aL as STACK_FIELD_TOTAL_PERCENT,oL as STACK_FIELD_TOTAL_TOP,BD as STATE_VALUE_ENUM,$C as StreamLight,DI as ThemeManager,nD as TransformLevel,SD as USER_LAYOUT_RECT_LEVEL,RF as VChart,rI as boundsInRect,MI as builtinThemes,sI as calcLayoutNumber,nI as calcPadding,VO as computeActualDataScheme,oI as convertPoint,rf as createArc,ef as createArea,Pp as createGroup,Eg as createLine,Ig as createRect,Kg as createRichText,Tg as createSymbol,Ag as createText,gI as darkTheme,hI as dataScheme,RF as default,wI as defaultThemeName,WO as getActualColor,lI as getActualNumValue,XO as getColorSchemeBySeries,HO as getDataScheme,kI as getFunnelTheme,II as getMergedTheme,jF as getSpecInfo,PI as getTheme,BI as hasThemeMerged,UO as isColorKey,eI as isPercent,iI as isPercentOffset,GO as isProgressiveDataColorScheme,dI as isTokenKey,tI as isValidOrient,pI as lightTheme,HF as lookup,WI as measureText,aI as normalizeLayoutPaddingSpec,NO as queryColorFromColorScheme,cI as queryToken,_J as registerCanvasTooltipHandler,xJ as registerChartPlugin,EJ as registerChartResizeZoomPlugin,XL as registerDataSetInstanceParser,YL as registerDataSetInstanceTransform,uJ as registerDomTooltipHandler,CJ as registerFormatPlugin,kJ as registerMediaQuery,EI as registerTheme,RI as removeTheme,OI as themeExist,TI as themes,uI as token,YO as transformColorSchemeToStandardStruct,RL as transformToGraphic,VF as version,O_ as vglobal,qy as warn}; +let VJ=class t extends EJ{constructor(e){super(z({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),y=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=y*this.gridSize;const _=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,_,b);const C=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const w=[];let M,T=S;const B=[x/2,S/2,x/2,S/2],E=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tB[1]&&(B[1]=t),eB[2]&&(B[2]=e))}};for(;T--;)for(M=x;M--;)E(T,M,w);return{datum:t,occupied:w,bounds:B,gw:S,gh:x,fillTextOffsetX:_,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),q(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(p(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?zJ(t,o,l.width,l.height,h):"geometric"===t.type&&NJ(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(A(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=wJ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};VJ.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class WJ extends EJ{constructor(t){super(z({},WJ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}WJ.defaultOptions={enlarge:!1};const GJ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},YJ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?XJ(t.fontFamily):"sans-serif",d=t.fontStyle?XJ(t.fontStyle):"normal",u=t.fontWeight?XJ(t.fontWeight):"normal",p=t.rotate?XJ(t.rotate):0,g=XJ(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?XJ(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",y=null!==(r=t.shrink)&&void 0!==r&&r,_=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,S=t.minFontSize,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},GJ),t.as):GJ,C=t.depth_3d,w=t.postProjection;let M=t.fontSize?XJ(t.fontSize):14;const T=t.fontSizeRange;if(T&&!x(M)){const t=M,e=$J(qJ(t,l),T);M=i=>e(t(i))}let B=OJ;"fast"===t.layoutType?B=WJ:"grid"===t.layoutType&&(B=VJ);const E=new B(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:M,shrink:y,clip:b,enlarge:_,minFontSize:S,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:E}:E.output()},XJ=t=>v(t)||x(t)||c(t)||y(t)?t:e=>e[t.field],KJ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),$J=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=KJ(t[0]),n=KJ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(KJ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},qJ=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function ZJ(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{hw.registerGrammarTransform("wordcloud",{transform:YJ}),O$(),hw.registerAnimation("wordCloud",((t,e)=>({appear:BZ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:Dz.disappear.duration}}))),hw.registerSeries(JJ.type,JJ)},tQ=t=>c(t)?t():t,eQ=(t,e)=>{var i,s,n,r;const a=t.map((t=>Object.assign({},t)));if(!a||0===a.length)return a;const{asTransformRatio:o,asReachRatio:l,asHeightRatio:h,asValueRatio:c,asNextValueRatio:d,asLastValueRatio:u,asLastValue:p,asCurrentValue:g,asNextValue:f}=e,m=tQ(e.valueField),v=null!==(i=tQ(e.heightVisual))&&void 0!==i&&i,y=null===(s=tQ(e.isCone))||void 0===s||s,_=tQ(e.range),b=a.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[m])||-1/0)),-1/0),x=a.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[m])||1/0)),1/0),S=[null!==(n=null==_?void 0:_.min)&&void 0!==n?n:x,null!==(r=null==_?void 0:_.max)&&void 0!==r?r:b];return a.forEach(((t,e)=>{var i,s;const n=Number.parseFloat(t[m]),r=Number.parseFloat(null===(i=a[e-1])||void 0===i?void 0:i[m]),_=Number.parseFloat(null===(s=a[e+1])||void 0===s?void 0:s[m]),b=A(_*n)&&0!==n?_/n:0,x=A(n*r)&&0!==r?n/r:0;p&&(t[p]=r),f&&(t[f]=_),o&&(t[o]=b),l&&(t[l]=0===e?1:x),h&&(t[h]=!0===v?b:1/a.length),c&&(t[c]=n/S[1]),d&&(t[d]=e===a.length-1?y?0:t[c]:_/S[1]),u&&(t[u]=0===e?1:r/S[1]),g&&(t[g]=n)})),a},iQ=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},sQ=`${Rw}_FUNNEL_TRANSFORM_RATIO`,nQ=`${Rw}_FUNNEL_REACH_RATIO`,rQ=`${Rw}_FUNNEL_HEIGHT_RATIO`,aQ=`${Rw}_FUNNEL_VALUE_RATIO`,oQ=`${Rw}_FUNNEL_LAST_VALUE_RATIO`,lQ=`${Rw}_FUNNEL_NEXT_VALUE_RATIO`,hQ=`${Rw}_FUNNEL_LAST_VALUE`,cQ=`${Rw}_FUNNEL_CURRENT_VALUE`,dQ=`${Rw}_FUNNEL_NEXT_VALUE`,uQ=`${Rw}_FUNNEL_TRANSFORM_LEVEL`;class pQ extends bH{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[nQ])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return u(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class gQ extends yz{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class fQ extends gQ{constructor(){super(...arguments),this.type=fQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}fQ.type="polygon";const mQ=()=>{hw.registerMark(fQ.type,fQ),$R(),HR(),rI.registerBuiltInAnimate("growPointsOut",YI),hw.registerGraphicComponent("polygon",rf)},vQ=Object.assign(Object.assign({},OH),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class yQ extends KH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class _Q extends ej{constructor(){super(...arguments),this.type=kC.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=yQ,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;zM(this._dataSet,"funnel",eQ),zM(this._dataSet,"funnelTransform",iQ);const t=new Oa(this._dataSet,{name:`${Rw}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new KF(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:()=>this.getValueField(),isCone:()=>this._spec.isCone,asCurrentValue:cQ,asTransformRatio:sQ,asReachRatio:nQ,asHeightRatio:rQ,asValueRatio:aQ,asNextValueRatio:lQ,asLastValueRatio:oQ,asLastValue:hQ,asNextValue:dQ,range:()=>this._spec.range}}),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.transform({type:"funnelTransform",options:{asIsTransformLevel:uQ}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},_Q.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:UH(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},_Q.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(_Q.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(_Q.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new pQ(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,s;const n=this._funnelMark;n&&this.setMarkStyle(n,{points:t=>this.getPoints(t),visible:t=>u(t[this._valueField]),fill:this.getColorAttribute()},"normal",xF.Series);const r=this._funnelTransformMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",xF.Series);const a=this._funnelOuterLabelMark.label;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",xF.Series),c(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(a,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",xF.User_Mark));const o=this._funnelOuterLabelMark.line;if(o&&a){this.setMarkStyle(o,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",xF.Series);const n=null!==(i=null===(e=null===(t=this._spec.outerLabel)||void 0===t?void 0:t.line)||void 0===e?void 0:e.visible)&&void 0!==i?i:null===(s=this._spec.outerLabel)||void 0===s?void 0:s.visible;u(n)&&o.setVisible(n)}}initLabelMarkStyle(t){var e;if(!t)return;const i=t.getTarget(),s=t.getComponent();if(i===this._funnelMark){this._labelMark=t,this.setMarkStyle(t,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",xF.Series);const i=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&aA(i,this._funnelOuterLabelMark.label,s),this._funnelOuterLabelMark.line&&aA(i,this._funnelOuterLabelMark.line,null!==(e=this._funnelOuterLabelMark.label)&&void 0!==e?e:s)}else this._funnelTransformMark&&i===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*Sk(nQ).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",xF.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(jH(null===(s=hw.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),NH("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(jH(hw.getAnimationInKey("fadeInOut")(),NH(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(jH(hw.getAnimationInKey("funnel")({},o),NH(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(jH(null===(a=hw.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),NH("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[oQ])/2:this._getSecondaryAxisLength(t[aQ])/2,n=this._getSecondaryAxisLength(t[aQ])/2):(s=this._getSecondaryAxisLength(t[aQ])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[lQ])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[uQ])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return u(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[zw]===t[zw]));if(!u(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(x(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_{mQ(),O$(),jK(),hw.registerSeries(_Q.type,_Q),hw.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},Fz))),hw.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Ez,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),Hz()},xQ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},SQ=t=>{const e=t.filter((t=>t.context.diffState===SF.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},AQ=(t,e,i)=>{if(E(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},kQ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=SQ(i.parent.children),a=AQ(r,s,n);return xQ(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=SQ(i.parent.children),a=AQ(r,s,n);return xQ(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),CQ=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},wQ=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=SQ(i.parent.children),a=CQ(r);return xQ(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=SQ(i.parent.children),a=CQ(r);return xQ(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),MQ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},TQ=(t,e={})=>{if(!t)return[];const i=[];return RZ(t,i,e),i},BQ=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new oJ(i).layout(t,{width:s,height:n})};class EQ extends bH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var PQ;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(PQ||(PQ={}));const OQ=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(d(n))return t;if(i.type===PQ.DrillDown){return G(fM(t,n,s,"children"))}if(i.type===PQ.DrillUp){const e=mM(t,n,s,"children");if(e)return G(e)}return t};class RQ{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=kK(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(n.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;zM(t,"drillFilter",OQ),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(d(t.datum)||d(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!y(t)||E(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:PQ.DrillDown},e().reRunAllTransform(),i.emit(PM.drill,{value:{path:t,type:PQ.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!y(n)||E(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:PQ.DrillUp},i().reRunAllTransform(),s.emit(PM.drill,{value:{path:n,type:PQ.DrillUp},model:this}),n}}const IQ=Object.assign(Object.assign({},OH),{sunburst:{name:"sunburst",type:"arc"}}),DQ=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:CH,operations:["max","min","values"]}),t.push({key:wH,operations:["values"]}),t),LQ={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class FQ extends X${constructor(){super(...arguments),this.type=kC.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:wH),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:zw},getRawData:()=>this.getRawData()}),this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),zM(this._dataSet,"sunburstLayout",BQ),zM(this._dataSet,"flatten",TQ),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[u(this._centerX)?this._centerX:this.getLayoutRect().width/2,u(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return DQ(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(zM(t.dataSet,"addVChartProperty",pH),t.transform({type:"addVChartProperty",options:{beforeCall:EH.bind(this),call:PH}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(FQ.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){d(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(u(this._offsetX)?this._offsetX:0),y:t=>t.y+(u(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},AF.STATE_NORMAL,xF.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(FQ.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return p(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(u(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(u(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},AF.STATE_NORMAL,xF.Series)}initTooltip(){this._tooltipHelper=new EQ(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(G(this.__innerRadius))[0],outerRadius:this._computeRadius(G(this.__outerRadius))[0],startAngle:G(this._startAngle)[0],endAngle:G(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(jH(null===(e=hw.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),NH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(jH(null===(e=hw.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),NH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}FQ.type=kC.sunburst,FQ.mark=IQ,FQ.builtInTheme={sunburst:LQ},U(FQ,RQ);const zQ=()=>{hw.registerSeries(FQ.type,FQ),rq(),O$(),Hz(),hw.registerAnimation("sunburst",((t,e)=>({appear:MQ(0,e),enter:kQ(t),exit:wQ(t),disappear:{duration:Dz.disappear.duration}})))},HQ=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new $Z(i).layout(t,{width:s,height:n})};class jQ extends bH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const NQ=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},VQ=Object.assign(Object.assign({},OH),{circlePacking:{name:"circlePacking",type:"arc"}});class WQ extends nj{constructor(){super(...arguments),this.type=kC.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:wH),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:zw},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();d(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),zM(this._dataSet,"circlePackingLayout",HQ),zM(this._dataSet,"flatten",TQ),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(zM(t.dataSet,"addVChartProperty",pH),t.transform({type:"addVChartProperty",options:{beforeCall:EH.bind(this),call:PH}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(WQ.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){d(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},AF.STATE_NORMAL,xF.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(WQ.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},AF.STATE_NORMAL,xF.Series)}getStatisticFields(){return DQ(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new jQ(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(jH(null===(i=hw.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),NH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(jH(null===(e=hw.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),NH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}WQ.type=kC.circlePacking,WQ.mark=VQ,WQ.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},U(WQ,RQ);const UQ=()=>{hw.registerSeries(WQ.type,WQ),rq(),O$(),zz(),hw.registerAnimation("circlePacking",((t,e)=>({appear:NQ(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:Dz.disappear.duration}})))},GQ=(t,e,i)=>{e.forEach((e=>{d(e[i])||t.add(e[i]),e.children&&e.children.length>0&&GQ(t,e.children,i)}))},YQ=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},XQ=(t,e)=>{const i=c(e)?e():e;if(!t||!(null==i?void 0:i.view)||!t.length)return[];const s=i.view();if(s.x1-s.x0==0||s.y1-s.y0==0||s.x1-s.x0==-1/0||s.x1-s.x0==1/0||s.y1-s.y0==-1/0||s.y1-s.y0==1/0)return[];const n=t[0],r=KQ(n,i),a=new nJ(i),o=[];return o.push(a.layout(r,s)),o},KQ=(t,e)=>{if("source"===e.sourceField&&"target"===e.targetField&&"value"===e.valueField)return t;const i=t.links;return i?Object.assign(Object.assign({},t),{links:i.map((t=>{const i={};return Object.keys(t).forEach((s=>{s===e.sourceField?i.source=t[e.sourceField]:s===e.targetField?i.target=t[e.targetField]:s===e.valueField?i.value=t[e.valueField]:i[s]=t[s]})),i}))}):t},$Q=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},qQ=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class ZQ extends bH{constructor(){super(...arguments),this._getDimensionData=t=>{if(!d(null==t?void 0:t.source)&&!d(null==t?void 0:t.target)){if(x(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const JQ=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),QQ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:JQ(t),t0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class e0 extends kI{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class i0 extends kI{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const s0=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},n0=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class r0 extends u${constructor(){super(...arguments),this.type=r0.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?n0:s0,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}r0.type="linkPath";const a0=Object.assign(Object.assign({},OH),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class o0 extends KH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const l0=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&mz(t,e),fz(t,e,s,n)};class h0 extends nj{constructor(){super(...arguments),this.type=kC.sankey,this.transformerConstructor=o0,this._nodeLayoutZIndex=_F.Node,this._labelLayoutZIndex=_F.Label,this._viewBox=new Ne,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(u(a))return a;if(u(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(u(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=x(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getGraphics();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getGraphics();s&&s.length&&(i.forEach((t=>{mz(t,[AF.STATE_SANKEY_EMPHASIS,AF.STATE_SANKEY_EMPHASIS_REVERSE])})),s.forEach((t=>{mz(t,[AF.STATE_SANKEY_EMPHASIS,AF.STATE_SANKEY_EMPHASIS_REVERSE])})),this._needClear=!1)},this._handleNodeAdjacencyClick=t=>{const e=wM(t),i=[e.key];if(this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=wM(t);n.source===e.key?(i.includes(n.target)||i.push(n.target),mz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE),fz(t,AF.STATE_SANKEY_EMPHASIS,!0)):n.target===e.key?(i.includes(n.source)||i.push(n.source),mz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE),fz(t,AF.STATE_SANKEY_EMPHASIS,!0)):(mz(t,AF.STATE_SANKEY_EMPHASIS),fz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=wM(t),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach((e=>{e===t?(mz(e,AF.STATE_SANKEY_EMPHASIS_REVERSE),l0(e,AF.STATE_SANKEY_EMPHASIS,{ratio:1})):(mz(e,AF.STATE_SANKEY_EMPHASIS),fz(e,AF.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=wM(t),s=this._nodeMark.getGraphics();if(!s||!s.length)return;const n=this._linkMark.getGraphics();if(!n||!n.length)return;const r=(null===(e=wM(n[0]))||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=wM(n),d=(null==c?void 0:c.parents)?"parents":"source";if(G(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;const n=wM(t);e.includes(null!==(s=n.key)&&void 0!==s?s:n.index)?(mz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE),fz(t,AF.STATE_SANKEY_EMPHASIS,!0)):(mz(t,AF.STATE_SANKEY_EMPHASIS),fz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(G(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const a=wM(s),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return mz(s,AF.STATE_SANKEY_EMPHASIS_REVERSE),void l0(s,AF.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),mz(s,AF.STATE_SANKEY_EMPHASIS_REVERSE),void l0(s,AF.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});mz(s,AF.STATE_SANKEY_EMPHASIS),fz(s,AF.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{const e=this._nodeMark.getGraphics();if(!e||!e.length)return;const i=this._linkMark.getGraphics();if(!i||!i.length)return;if("source"===(wM(t)?"parents":"source"))this._linkMark&&i.forEach((t=>{mz(t,[AF.STATE_SANKEY_EMPHASIS,AF.STATE_SANKEY_EMPHASIS_REVERSE])})),this._nodeMark&&e.forEach((t=>{mz(t,[AF.STATE_SANKEY_EMPHASIS,AF.STATE_SANKEY_EMPHASIS_REVERSE])}));else{const s=wM(t),n=[s.source,s.target],r=[];G(s.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),i.forEach((t=>{const e=wM(t),i=e.datum;if(e.source===s.source&&e.target===s.target)return mz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE),void l0(t,AF.STATE_SANKEY_EMPHASIS,{ratio:1});const a=i?i.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(s.source)&&e.includes(s.target)})):null;if(a&&a.length){n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target);const i=a.filter((t=>t.parents.some(((e,i)=>{var n;return e.key===s.source&&(null===(n=t.parents[i+1])||void 0===n?void 0:n.key)===s.target})))).reduce(((t,e)=>t+e.value),0),r=i/e.value;return mz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE),void l0(t,AF.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===e.source&&t.target===e.target));if(o)return n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target),mz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE),void l0(t,AF.STATE_SANKEY_EMPHASIS,{ratio:o.value/e.value});mz(t,AF.STATE_SANKEY_EMPHASIS),fz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(e,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){super.initData();const t=this.getViewData(),e=this.getRawData();if(e&&t){zM(this._dataSet,"sankeyLayout",XQ),zM(this._dataSet,"sankeyFormat",YQ),e.transform({type:"sankeyFormat"},!1),t.transform({type:"sankeyLayout",options:()=>{var t,e,i,s;return{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse}},level:qM.sankeyLayout});const{dataSet:i}=this._option;zM(i,"sankeyNodes",$Q),zM(i,"flatten",TQ);const s=new Oa(i,{name:`sankey-node-${this.id}-data`});s.parse([this.getViewData()],{type:"dataview"}),s.transform({type:"sankeyNodes"}),s.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),s.transform({type:"addVChartProperty",options:{beforeCall:TH.bind(this),call:BH}},!1),this._nodesSeriesData=s,zM(i,"sankeyLinks",qQ);const n=new Oa(i,{name:`sankey-link-${this.id}-data`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyLinks"}),n.transform({type:"addVChartProperty",options:{beforeCall:TH.bind(this),call:BH}},!1),this._linksSeriesData=n}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(h0.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(h0.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=G(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=G(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},AF.STATE_NORMAL,xF.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",xF.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(i.setGlyphConfig({direction:this.direction}),this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},AF.STATE_NORMAL,xF.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",xF.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(d(t)||d(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=hH(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(jH(null===(i=hw.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),NH("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(jH(null===(s=hw.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),NH("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:RM.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{mz(t,[AF.STATE_SANKEY_EMPHASIS_REVERSE,AF.STATE_SANKEY_EMPHASIS]),e.includes(wM(t).key)?fz(t,AF.STATE_SANKEY_EMPHASIS,!0):fz(t,AF.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new ZQ(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!d(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new FC;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{u(t[i])&&e.add(t[i]),u(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return GQ(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}h0.type=kC.sankey,h0.transformerConstructor=o0,h0.mark=a0,h0.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const c0=()=>{YX(),p$(),FR(),hw.registerGraphicComponent("path",(t=>Ng(t))),hw.registerMark(r0.type,r0),O$(),hw.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:QQ(t,e)},Fz))),hw.registerAnimation("sankeyLinkPath",((t,e)=>({appear:t0(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:Dz.disappear.duration}}))),rI.registerBuiltInAnimate("linkPathGrowOut",i0),rI.registerBuiltInAnimate("linkPathGrowIn",e0),Hz(),hw.registerSeries(h0.type,h0)},d0=(t,e)=>{let i={},s=e.fields;if(c(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=TQ(n);return i=SH([{latestData:r}],e),i};class u0 extends bH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const p0=Object.assign(Object.assign({},OH),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),g0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class f0 extends KH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const m0=(t,e)=>{const i=c(e)?e():e,s=i.getViewBox();if(s){const e=new dJ(i).layout(t,s),n=[];return RZ(e,n,{maxDepth:null==i?void 0:i.maxDepth}),n.forEach((t=>{t&&[wH,"name"].forEach((e=>{t[e]=t.datum[t.depth][i.nameField]}))})),n}return[]};class v0 extends nj{constructor(){super(...arguments),this.type=kC.treemap,this.transformerConstructor=f0,this._categoryField="name",this._valueField="value",this._viewBox=new Ne,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:wH),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ue),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:zw},getRawData:()=>this.getRawData()}),A(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t;super.initData(),zM(this._dataSet,"treemap",m0),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:()=>{var t,e,i,s;return{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(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!==(s=this._spec.minVisibleArea)&&void 0!==s?s:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(zM(this._rawData.dataSet,"addVChartProperty",pH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:EH.bind(this),call:PH}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=d0([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){zM(this._dataSet,"hierarchyDimensionStatistics",d0),zM(this._dataSet,"flatten",TQ);const i=new Oa(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 DQ(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(v0.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(v0.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},AF.STATE_NORMAL,xF.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()},AF.STATE_NORMAL,xF.Series)}_initRichStyleOfLabelMark(t){"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},AF.STATE_NORMAL,xF.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},AF.STATE_NORMAL,xF.Series),this._initRichStyleOfLabelMark(t))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},AF.STATE_NORMAL,xF.Series),this._initRichStyleOfLabelMark(t))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(jH(null===(e=hw.getAnimationInKey("treemap"))||void 0===e?void 0:e(),NH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new u0(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(BM.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(BM.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}v0.type=kC.treemap,v0.mark=p0,v0.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},v0.transformerConstructor=f0,U(v0,RQ),U(v0,wK);const y0=()=>{hw.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),hw.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),YX(),O$(),hw.registerAnimation("treemap",((t,e)=>({appear:g0(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:Dz.disappear.duration}}))),Hz(),hw.registerSeries(v0.type,v0)},_0=Object.assign(Object.assign({},Qq),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),b0=Object.assign(Object.assign({},OH),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),x0={type:"fadeIn"};function S0(t,e){return"fadeIn"===e?x0:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class A0 extends KH{constructor(){super(...arguments),this._supportStack=!1}}class k0 extends bH{enableByType(t){return"dimension"!==t}}const C0="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",w0={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:C0,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:C0,fill:"#ddd"}}};class M0 extends eZ{constructor(){super(...arguments),this.type=kC.gaugePointer,this.transformerConstructor=A0,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(M0.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},M0.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(M0.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new k0(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return u(this.radiusAxisHelper)&&u(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=K(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(jH(null===(i=hw.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),NH("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}M0.type=kC.gaugePointer,M0.mark=b0,M0.builtInTheme={gaugePointer:w0},M0.transformerConstructor=A0;const T0=()=>{hw.registerSeries(M0.type,M0),_K(),YX(),hw.registerAnimation("gaugePointer",((t,e)=>{const i=S0(t,e);return{appear:i,enter:i,disappear:{duration:Dz.disappear.duration}}})),Eq(),Tq()};class B0 extends KH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class E0 extends eZ{constructor(){super(...arguments),this.type=kC.gauge,this.transformerConstructor=B0,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=ae(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();zM(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[sM]=t[this._angleField[0]],t[iM]=e>0?i[e-1][sM]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(E0.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(E0.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t&&"segment"===t.name){const e=this.getSpec().segment;if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,xF.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?jC(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?jC(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return u(t[iM])?this.angleAxisHelper.dataToPosition([t[iM]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[sM]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(jH(null===(i=hw.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),NH("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}E0.type=kC.gauge,E0.mark=_0,E0.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},E0.transformerConstructor=B0;class P0 extends yz{constructor(){super(...arguments),this.type=P0.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Qp(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="rect":a.symbolType=o,a}}P0.type="cell";function O0(t){return!1===t?{}:{type:"fadeIn"}}class R0 extends bH{enableByType(t){return"dimension"!==t}}const I0=Object.assign(Object.assign({},OH),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class D0 extends KH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}const L0={valueField:!0};class F0 extends nj{constructor(){super(...arguments),this.type=kC.heatmap,this.transformerConstructor=D0}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=G(t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),L0)})}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(F0.mark.cell,{isSeriesMark:!0},{morph:UH(this._spec,F0.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(F0.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",xF.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=ai(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",xF.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=sj(this);this._cellMark.setAnimationConfig(jH(null===(i=hw.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),NH("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new R0(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}F0.type=kC.heatmap,F0.mark=I0,F0.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},F0.transformerConstructor=D0;const z0=()=>{O$(),hw.registerMark(P0.type,P0),hw.registerGraphicComponent("symbol",Qp),$R(),QR(),uN(),hw.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},Fz),{appear:O0(e)}))),rW(),xW(),hw.registerSeries(F0.type,F0)},H0=Object.assign(Object.assign({},OH),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),j0=`${Rw}_CORRELATION_X`,N0=`${Rw}_CORRELATION_Y`,V0=`${Rw}_CORRELATION_SIZE`,W0=t=>c(t)?t():t,U0=(t,e)=>{var i,s,n,r,a,o,l,h;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const c=t,u=e.view();if(u.x1-u.x0==0||u.y1-u.y0==0||u.x1-u.x0==-1/0||u.x1-u.x0==1/0||u.y1-u.y0==-1/0||u.y1-u.y0==1/0)return t;const p=ae(null!==(i=W0(e.startAngle))&&void 0!==i?i:-90),g=ae(null!==(s=W0(e.endAngle))&&void 0!==s?s:270),f=Math.max((u.x1-u.x0)/2,(u.y1-u.y0)/2),m=Pt(null!==(n=W0(e.innerRadius))&&void 0!==n?n:0,f),v=Pt(W0(e.outerRadius),f),_=W0(e.center),b=[x(null==_?void 0:_[0])?_[0]:u.x0+Pt(null!==(r=null==_?void 0:_[0])&&void 0!==r?r:"50%",u.x1-u.x0),x(null==_?void 0:_[1])?_[1]:u.y0+Pt(null!==(a=null==_?void 0:_[1])&&void 0!==a?a:"50%",u.y1-u.y0)],S=Et(W0(e.field)),A=c.map(S),[k,C]=Rt(A),w=k===C?t=>(m+v)/2:t=>m+(v-m)*(t-k)/(C-k),M=W0(e.radiusField),T=W0(e.radiusRange),B=d(M)?S:Et(M),E=null!==(o=null==T?void 0:T[1])&&void 0!==o?o:5;let P=t=>E;if(B){const[t,e]=B!==S?Rt(c.map(B)):[k,C],i=null!==(l=null==T?void 0:T[0])&&void 0!==l?l:5,s=null!==(h=null==T?void 0:T[1])&&void 0!==h?h:5;t!==e&&(P=n=>i+(s-i)*(B(n)-t)/(e-t))}const O=Math.min(p,g),R=Math.max(p,g),I=G0(O,R,c.length),D=[],L=(R-O)/60;return c.forEach(((t,e)=>{const i=w(A[e]),s=P(t);let n,r,a=I[e];for(let t=0;t<60&&(n=b[0]+i*Math.cos(a),r=b[1]+i*Math.sin(a),Y0({x:n,y:r,size:s},D)||n-su.x1||r-su.y1);t++)t<59&&(a+=L,a>R?a=O:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},Y0=(t,e)=>!(!e||!e.length)&&e.some((e=>{const i=e.x,s=e.y,n=e.size;return Math.pow(t.x-i,2)+Math.pow(t.y-s,2)c(t)?t():t,K0=(t,e)=>{if(!t||!y(t))return[];const i=X0(e.keyword),s=X0(e.categoryField),n=t[0].latestData[0];return{[s]:i,[Fw]:null==n?void 0:n[Fw],[Hw]:null==n?void 0:n[Hw]}};class $0 extends u${constructor(){super(...arguments),this.type=$0.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=vt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}$0.type="ripple";const q0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class Z0 extends KH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class J0 extends X${constructor(){super(...arguments),this.type=kC.correlation,this.transformerConstructor=Z0,this._viewBox=new Ne}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){u(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){u(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){u(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){if(super.initData(),!this._data)return;zM(this._dataSet,"correlation",U0);const t=new Pa;HM(t,"dataview",Ta),zM(t,"correlationCenter",K0);const e=new Oa(t,{name:`${this.type}_${this.id}_center`});e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"correlationCenter",options:{keyword:()=>{var t,e,i;return null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:""},categoryField:()=>this._spec.categoryField}}),this._centerSeriesData=new KF(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:()=>this._spec.valueField,radiusRange:()=>this._spec.sizeRange,radiusField:()=>this._spec.sizeField,center:()=>[this._spec.centerX,this._spec.centerY],innerRadius:()=>this._spec.innerRadius,outerRadius:()=>this._spec.outerRadius,startAngle:()=>this._spec.startAngle,endAngle:()=>this._spec.endAngle}})}initMark(){const t=this._createMark(J0.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:Fw});t&&(t.setMarkConfig({zIndex:_F.Node}),this._nodePointMark=t);const e=this._createMark(J0.mark.ripplePoint,{key:Fw,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});e&&(this._ripplePointMark=e);const i=this._createMark(J0.mark.centerPoint,{key:Fw,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(i.setMarkConfig({zIndex:_F.Node}),this._centerPointMark=i)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[j0],y:t=>t[N0],size:t=>t[V0],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},AF.STATE_NORMAL,xF.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},AF.STATE_NORMAL,xF.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},AF.STATE_NORMAL,xF.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},AF.STATE_NORMAL,xF.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(jH(null===(e=hw.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),NH("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}J0.type=kC.correlation,J0.mark=H0,J0.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},J0.transformerConstructor=Z0;const Q0=()=>{mN(),p$(),QR(),hw.registerMark($0.type,$0),hw.registerGraphicComponent("symbol",(t=>Qp(t))),hw.registerSeries(J0.type,J0),hw.registerAnimation("correlation",((t,e)=>Object.assign({appear:q0(0,e)},Lz)))},t1=Object.assign(Object.assign({},OH),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class e1 extends u${constructor(){super(...arguments),this.type=e1.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}e1.type="liquid";const i1=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class s1 extends bH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class n1 extends ej{constructor(){super(...arguments),this.type=kC.liquid,this.transformerConstructor=vN,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=ag({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Qp({x:s,y:n,size:r,symbolType:i1(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){u(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=$C(this._spec.outlineMargin),this._paddingSpec=$C(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Gt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(n1.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(n1.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(n1.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(n1.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",xF.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",xF.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",xF.Series)}initTooltip(){this._tooltipHelper=new s1(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(jH(null===(i=hw.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),NH("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(jH(null===(s=hw.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),NH("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(PM.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=wA(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}n1.type=kC.liquid,n1.mark=t1,n1.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},n1.transformerConstructor=vN;const r1=t=>G(t).join(",");class a1 extends bH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>r1(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>r1(null==t?void 0:t[this.series.getDimensionField()[0]])}}const o1=Object.assign(Object.assign({},OH),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class l1 extends KH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const h1=(t,e)=>{const i=c(e)?e():e,s=i.getViewBox();return s&&(null==t?void 0:t.length)?AJ(Object.assign({setField:i.setField,valueField:i.valueField},s),t):[]};class c1 extends ej{constructor(){super(...arguments),this.type=kC.venn,this.transformerConstructor=l1,this._viewBox=new Ne}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:zw)}initData(){var t;super.initData(),zM(this._dataSet,"venn",h1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:()=>({getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField})})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(c1.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(c1.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},AF.STATE_NORMAL,xF.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},AF.STATE_NORMAL,xF.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},AF.STATE_HOVER,xF.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>r1(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},AF.STATE_NORMAL,xF.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>r1(t.sets)},AF.STATE_NORMAL,xF.Series))}initTooltip(){this._tooltipHelper=new a1(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:r1(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return r1(i)}legendSelectedFilter(t,e){if(t.type===n.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[r1(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>G(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(r1(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(jH(null===(e=hw.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),NH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(jH(null===(e=hw.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),NH(t.name,this._spec,this._markAttributeContext)))}))}}c1.type=kC.venn,c1.mark=o1,c1.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},c1.transformerConstructor=l1;class d1 extends JX{constructor(){super(...arguments),this.type=kC.mosaic,this.transformerConstructor=qX}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(Qw),this.setFieldX2(Jw)),this.setFieldY(eM),this.setFieldY2(tM)):(t&&(this.setFieldY(Qw),this.setFieldY2(Jw)),this.setFieldX(eM),this.setFieldX2(tM)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&d(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];d(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}d1.type=kC.mosaic,d1.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},d1.transformerConstructor=qX;class u1 extends UW{_isValidSeries(t){return t===kC.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class p1 extends NW{constructor(){super(...arguments),this.transformerConstructor=u1,this.type="map",this.seriesType=kC.map}}p1.type="map",p1.seriesType=kC.map,p1.transformerConstructor=u1;class g1 extends UW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=G(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return u(r)&&n.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),u(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class f1 extends g1{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY","clamp"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),d(l.type)&&(l.type="linear"),d(o.type)&&(o.type="band");const h=RN(l,{min:0,max:1});d(l.min)&&(l.min=h.min),d(l.max)&&(l.max=h.max),s&&Object.assign(l,lw({},s,l)),n&&Object.assign(o,lw({},n,o))}}class m1 extends g1{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class v1 extends g1{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class y1 extends NW{constructor(){super(...arguments),this.transformerConstructor=v1}}y1.transformerConstructor=v1;class _1 extends y1{constructor(){super(...arguments),this.transformerConstructor=v1,this.type="pie",this.seriesType=kC.pie}}_1.type="pie",_1.seriesType=kC.pie,_1.transformerConstructor=v1;class b1 extends m1{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["radius","outerRadius","innerRadius"]),n.radius=null!==(e=t.radius)&&void 0!==e?e:$N,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:$N,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&d(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=G(t.crosshair||{}).map((t=>lw({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const x1=(t,e)=>{if(!t)return null;const i=yj(t,(t=>"angle"===t.getOrient()),e),s=yj(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Tk(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=mk({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=vk(u),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=mj(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Tk(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=mk({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=vk(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=mj(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class S1 extends NW{constructor(){super(...arguments),this.transformerConstructor=b1,this.type="rose",this.seriesType=kC.rose}_setModelOption(){this._modelOption.getDimensionInfo=x1}}S1.type="rose",S1.seriesType=kC.rose,S1.transformerConstructor=b1,U(S1,$W);class A1 extends m1{_getDefaultSeriesSpec(t){var e,i,s,n;const r=super._getDefaultSeriesSpec(t),a=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e,"series","radar","area");return this._addSeriesRelatedSpecKeys(["line","point","area"]),r.line=t.line,r.point=t.point,r.stack=t.stack,r.percent=t.percent,r.area=lw({visible:null!==(s=null==a?void 0:a.visible)&&void 0!==s&&s},t.area),r.seriesMark=null!==(n=t.seriesMark)&&void 0!==n?n:"area",r.activePoint=t.activePoint,r.pointDis=t.pointDis,r.pointDisMul=t.pointDisMul,r.markOverlap=t.markOverlap,r}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=G(t.crosshair||{}).map((t=>lw({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class k1 extends NW{constructor(){super(...arguments),this.transformerConstructor=A1,this.type="radar",this.seriesType=kC.radar}_setModelOption(){this._modelOption.getDimensionInfo=x1}}k1.type="radar",k1.seriesType=kC.radar,k1.transformerConstructor=A1,U(k1,$W);class C1 extends UW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=p(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{P(e,"trimPadding")&&lw(e,fF(this.type,t))})),this._transformAxisSpec(t)}}class w1 extends NW{constructor(){super(...arguments),this.transformerConstructor=C1,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=rU(t,e,i))&&void 0!==s?s:[],...null!==(n=x1(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=oU,this._modelOption.getRectByDimensionData=pU}}w1.type="common",w1.transformerConstructor=C1,U(w1,$W);class M1 extends GW{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class T1 extends NW{constructor(){super(...arguments),this.transformerConstructor=M1}}T1.transformerConstructor=M1,U(T1,$W);class B1 extends M1{transformSpec(t){super.transformSpec(t),hF(t)}}class E1 extends T1{constructor(){super(...arguments),this.transformerConstructor=B1,this.type="histogram",this.seriesType=kC.bar}_setModelOption(){this._modelOption.getDimensionInfo=rU,this._modelOption.getDimensionInfoByValue=oU,this._modelOption.getRectByDimensionData=pU}}E1.type="histogram",E1.seriesType=kC.bar,E1.transformerConstructor=B1;class P1 extends f1{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["cornerRadius","progress","track","roundCap"]),s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class O1 extends NW{constructor(){super(...arguments),this.transformerConstructor=P1,this.type="circularProgress",this.seriesType=kC.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=x1}}O1.type="circularProgress",O1.seriesType=kC.circularProgress,O1.transformerConstructor=P1,U(O1,$W);class R1 extends f1{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["pin","pinBackground","pointer"]),e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=kC.circularProgress,e}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===kC.gauge||t.type===kC.circularProgress));d(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(d(a.radiusField)&&d(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),d(a.valueField)&&d(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===kC.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:_F.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),d(i.angle.type)&&(i.angle.type="linear"),d(i.radius.type)&&(i.radius.type="linear"),d(i.angle.zIndex)&&(i.angle.zIndex=_F.Region+50)}}class I1 extends NW{constructor(){super(...arguments),this.transformerConstructor=R1,this.type="gauge",this.seriesType=kC.gaugePointer}}I1.type="gauge",I1.seriesType=kC.gaugePointer,I1.transformerConstructor=R1;class D1 extends UW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class L1 extends NW{constructor(){super(...arguments),this.transformerConstructor=D1,this.type="wordCloud",this.seriesType=kC.wordCloud}}L1.transformerConstructor=D1;class F1 extends L1{constructor(){super(...arguments),this.transformerConstructor=D1,this.type="wordCloud",this.seriesType=kC.wordCloud}}F1.type="wordCloud",F1.seriesType=kC.wordCloud,F1.transformerConstructor=D1;class z1 extends UW{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class H1 extends NW{constructor(){super(...arguments),this.transformerConstructor=z1,this.type="funnel",this.seriesType=kC.funnel}}H1.type="funnel",H1.seriesType=kC.funnel,H1.transformerConstructor=z1;class j1 extends GW{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",this._addSeriesRelatedSpecKeys(["cornerRadius"]),s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="band"),d(i.type)&&(i.type="linear");const n=RN(i,{min:0,max:1});d(i.min)&&(i.min=n.min),d(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="linear"),d(e.type)&&(e.type="band");const n=RN(s,{min:0,max:1});d(s.min)&&(s.min=n.min),d(s.max)&&(s.max=n.max)}}}class N1 extends NW{constructor(){super(...arguments),this.transformerConstructor=j1,this.type="linearProgress",this.seriesType=kC.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=rU,this._modelOption.getDimensionInfoByValue=oU,this._modelOption.getRectByDimensionData=pU}}N1.type="linearProgress",N1.seriesType=kC.linearProgress,N1.transformerConstructor=j1,U(N1,$W);class V1 extends GW{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),hF(t)}}class W1 extends NW{constructor(){super(...arguments),this.transformerConstructor=V1,this.type="rangeColumn",this.seriesType=kC.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=rU,this._modelOption.getDimensionInfoByValue=oU,this._modelOption.getRectByDimensionData=pU}}W1.type="rangeColumn",W1.seriesType=kC.rangeColumn,W1.transformerConstructor=V1;class U1 extends UW{_getDefaultSeriesSpec(t){const e=u(t.startAngle)?t.startAngle:-90,i=u(t.endAngle)?t.endAngle:e+oe(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class G1 extends NW{constructor(){super(...arguments),this.transformerConstructor=U1,this.type="sunburst",this.seriesType=kC.sunburst}}G1.type="sunburst",G1.seriesType=kC.sunburst,G1.transformerConstructor=U1;class Y1 extends UW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class X1 extends NW{constructor(){super(...arguments),this.transformerConstructor=Y1,this.type="circlePacking",this.seriesType=kC.circlePacking}}X1.type="circlePacking",X1.seriesType=kC.circlePacking,X1.transformerConstructor=Y1;class K1 extends UW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class $1 extends NW{constructor(){super(...arguments),this.transformerConstructor=K1,this.type="treemap",this.seriesType=kC.treemap}}$1.type="treemap",$1.seriesType=kC.treemap,$1.transformerConstructor=K1;class q1 extends tK{transformSpec(t){super.transformSpec(t),t.legends&&G(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),hF(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["bar","stackLabel","leaderLine","total","calculationMode"]),e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class Z1 extends eK{constructor(){super(...arguments),this.transformerConstructor=q1,this.type="waterfall",this.seriesType=kC.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=rU,this._modelOption.getDimensionInfoByValue=oU,this._modelOption.getRectByDimensionData=pU}}Z1.type="waterfall",Z1.seriesType=kC.waterfall,Z1.transformerConstructor=q1;class J1 extends GW{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),hF(t)}}class Q1 extends NW{constructor(){super(...arguments),this.transformerConstructor=J1,this.type="boxPlot",this.seriesType=kC.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=rU,this._modelOption.getDimensionInfoByValue=oU,this._modelOption.getRectByDimensionData=pU}}Q1.type="boxPlot",Q1.seriesType=kC.boxPlot,Q1.transformerConstructor=J1;class t2 extends UW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class e2 extends NW{constructor(){super(...arguments),this.transformerConstructor=t2,this.type="sankey",this.seriesType=kC.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=wM(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}e2.type="sankey",e2.seriesType=kC.sankey,e2.transformerConstructor=t2;class i2 extends GW{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["area","point","line"]),s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),hF(t)}}class s2 extends NW{constructor(){super(...arguments),this.transformerConstructor=i2,this.type="rangeArea",this.seriesType=kC.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=rU,this._modelOption.getDimensionInfoByValue=oU,this._modelOption.getRectByDimensionData=pU}}s2.type="rangeArea",s2.seriesType=kC.rangeArea,s2.transformerConstructor=i2;class n2 extends GW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class r2 extends NW{constructor(){super(...arguments),this.transformerConstructor=n2,this.type="heatmap",this.seriesType=kC.heatmap}}r2.type="heatmap",r2.seriesType=kC.heatmap,r2.transformerConstructor=n2;class a2 extends UW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class o2 extends NW{constructor(){super(...arguments),this.transformerConstructor=a2,this.type="correlation",this.seriesType=kC.correlation}}o2.type="correlation",o2.seriesType=kC.correlation,o2.transformerConstructor=a2;function l2(t){var e,i;const s=Object.assign({},t);return E(t.style)||(s.textStyle=AM(t.style)),E(t.textStyle)||lw(s.textStyle,AM(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&AM(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&AM(s.background.style),s}function h2(t){const e=t=>function(t){return u(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:u(t.texturePadding)?t.texturePadding:1,textureSize:u(t.textureSize)?t.textureSize:4}):t}(t);if(c(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else E(t.style)||(t.style=e(t.style));return E(t.state)||Object.keys(t.state).forEach((i=>{if(c(t.state[i])){const s=t.state[i];t.state[i]=(...t)=>e(s(...t))}else E(t.state[i])||(t.state[i]=e(t.state[i]))})),t}const c2=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},d2=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const p={};c.forEach((t=>{p[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:Hw;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===p[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===p[t.source]&&!0===p[t.target])))):u(g)&&(t=t.filter((t=>!0===p[r.getSeriesFieldValue(t,g)]))),t)},u2={position:!0,item:!0,title:!0,pager:!0,background:!0};class p2 extends eV{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=_F.Legend,this.layoutLevel=bF.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{_k(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),_k(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=WC(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;u(s)&&(this._seriesUserId=G(s)),u(e)&&(this._regionUserId=G(e)),u(n)&&(this._seriesIndex=G(n)),u(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const s=!V(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):s&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(s&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,s=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>V(null==i?void 0:i[t],null==s?void 0:s[t])||u2[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new KF(this._option,t),this._initSelectedData(),_k(this._regions,(t=>{t.event.on(PM.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;d(t)||JSON.stringify(n)===JSON.stringify(t)||(_k(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(PM.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(lw({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(lw({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(lw({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(PM.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}p2.specKey="legends";class g2 extends p2{constructor(){super(...arguments),this.type=n.discreteLegend,this.name=n.discreteLegend}static getSpecInfo(t){return cH(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),_k(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:qM.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){zM(this._option.dataSet,"discreteLegendFilter",d2),zM(this._option.dataSet,"discreteLegendDataMake",c2);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return _k(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!_A(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return c(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=lM(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(e){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(e,i,s){const{title:n={},item:r={},pager:a={},background:o={},type:l,id:h,visible:d,orient:p,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=e,S=t(e,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:k={},pager:C={},background:w={}}=e;A=I(A),k=I(k),C=I(C),w=I(w);const M=S;if(c(M.maxRow)||c(M.maxCol)){const t=WC(s)?s:WC(p)?p:"left";c(M.maxRow)&&(M.maxRow=M.maxRow({rect:i,orient:t,id:h})),c(M.maxCol)&&(M.maxCol=M.maxCol({rect:i,orient:t,id:h}))}return A.visible?M.title=l2(A):M.title={visible:!1},E(k.focusIconStyle)||AM(k.focusIconStyle),k.shape&&(k.shape=h2(bM(k.shape))),k.label&&(k.label=bM(k.label)),k.value&&(k.value=bM(k.value)),k.background&&(k.background=bM(k.background)),UC(k.maxWidth)&&(k.maxWidth=Number(k.maxWidth.substring(0,k.maxWidth.length-1))*i.width/100),UC(k.width)&&(k.width=Number(k.width.substring(0,k.width.length-1))*i.width/100),UC(k.height)&&(k.height=Number(k.height.substring(0,k.height.length-1))*i.width/100),M.item=k,"scrollbar"===C.type?(E(C.railStyle)||AM(C.railStyle),E(C.sliderStyle)||AM(C.sliderStyle)):(E(C.textStyle)||AM(C.textStyle),C.handler&&bM(C.handler)),M.pager=C,w.visible&&!E(w.style)&&(lw(M,w.style),u(w.padding)&&(M.padding=w.padding)),M}(this._spec,e,this.layoutOrient)),{maxWidth:e.width,maxHeight:e.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return qY}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(WY.legendItemClick,(e=>{const i=P(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(PM.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(WY.legendItemHover,(t=>{const e=P(t,"detail");this.event.emit(PM.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(WY.legendItemUnHover,(t=>{const e=P(t,"detail");this.event.emit(PM.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,datum:t.datum,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(s)?s:1,strokeOpacity:A(n)?n:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return c(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=hH(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=hH(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}g2.specKey="legends",g2.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},g2.type=n.discreteLegend;const f2=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;A(n)&&(t=Math.min(n,t)),A(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},m2=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!p(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!E(o)){const[e,i]=o;return a?a(t,o,l):h(t)?vM(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function v2(e){const i=lw({},e),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:d,background:p={},type:g,id:f,visible:m,orient:v,position:y,data:_,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:C,seriesId:w,padding:M}=i,T=t(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?T.title=l2(s):T.title={visible:!1},T.showHandler=!1!==n.visible,E(n.style)||(T.handlerStyle=AM(n.style)),u(r.width)&&(T.railWidth=r.width),u(r.height)&&(T.railHeight=r.height),E(r.style)||(T.railStyle=AM(r.style)),E(a.style)||(T.trackStyle=AM(a.style)),T.startText=bM(o),T.endText=bM(l),T.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return c(i)?e.style=(t,e,s)=>AM(i(t,e,s)):E(i)||(e.style=AM(i)),e}(h),E(d)||(T.sizeBackground=AM(d)),p.visible&&!E(p.style)&&(lw(T,p.style),u(p.padding)&&(T.padding=p.padding)),T}const y2={color:eX,size:sX},_2={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},b2=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},_2),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},x2={horizontal:b2(!0),vertical:b2(!1)},S2=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},_2),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},A2={horizontal:S2(!0),vertical:S2(!1)},k2=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],C2=[2,10];class w2 extends p2{static getSpecInfo(t){const e=cH(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?n.colorLegend:n.sizeLegend})),e}constructor(t,e){super(t,e),this.type=n.colorLegend,this.name=n.colorLegend;const i="color"===this._spec.type?n.colorLegend:n.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),_k(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData,customFilter:this._spec.customFilter},level:qM.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){zM(this._option.dataSet,"continuousLegendFilter",m2),zM(this._option.dataSet,"continuousLegendDataMake",f2);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>bk(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=lM(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!_A(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=lM(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),E(r)&&(r="color"===this._legendType?k2:C2);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 h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},v2(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return y2[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((e=>{const i=P(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(PM.legendFilter,{model:this,value:i,event:e})}),30))}}}w2.specKey="legends",w2.builtInTheme={colorLegend:x2,sizeLegend:A2},w2.type=n.continuousLegend;const M2=(t,e)=>u(e)?t.map((t=>e[t])):void 0,T2=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),B2=t=>!d(t)&&(y(t)?t.length>0&&t.every(u):Object.keys(t).length>0);function E2(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),p=i.getOption(),g=p.getRegionsInUserIdOrIndex(u(c.regionId)?[c.regionId]:void 0,u(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=P2(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=p.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>T2(i,s)(t)&&T2(n,r)(t)&&(d(a)||T2([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{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=>x(t))))&&void 0!==i?i:[]}}))}];u(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=p.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:OM.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=p.globalInstance;return eH.globalConfig.uniqueTooltip&&eH.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=p.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:OM.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=p.globalInstance;return eH.globalConfig.uniqueTooltip&&eH.hideTooltip(a.id),m}return"none"}const P2=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),p=e.getMeasureField(),g=e.getSeriesField(),f=u(g)?t[g]:void 0,m=u(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=M2(c,t);let y=M2(p,t);const _=B2(y),b=!_&&u(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(T2(c,v));if(!_&&(y=M2(p,i),!B2(y)))return;const n=e.type===kC.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=Tk(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>d(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(T2(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=M2(p,o),!B2(y))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(T2(c,n));if(!_&&(y=M2(p,r),!B2(y)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===kC.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(T2(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=M2(p,i),!B2(y))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:y,hasMeasureData:_,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(T2(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=M2(p,a),h=y,!B2(y)&&!a)return;B2(y)||(y=[null])}const u=e.dataToPosition(a);d(u)||isNaN(u.x)||isNaN(u.y)||s.push({pos:u,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},O2=t=>u(t)&&!y(t),R2=t=>u(t)&&y(t),I2=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class D2 extends tV{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=lw({},...I2.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=lw({},s);I2.forEach((t=>{delete r[t]})),delete r.style;const a=lw({},r,i);return a.style=lw({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return u(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:fA(this._option.mode)||!pA(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,u(t.parentElement)?v(t.parentElement)&&(t.parentElement=t_.getElementById(t.parentElement)):pA(this._option.mode)&&(t.parentElement=null==uA?void 0:uA.body)}}const L2={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class F2 extends eV{constructor(){super(...arguments),this.layoutZIndex=1,this.type=n.tooltip,this.name=n.tooltip,this.transformerConstructor=D2,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=pA(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&O2(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):u(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&eH.globalConfig.uniqueTooltip&&l&&eH.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(PM.tooltipHide,Object.assign(Object.assign({},t),{source:OM.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(null==n?void 0:n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:OM.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(PM.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(PM.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?vU.canvas:vU.dom,n=hw.getComponentPluginInType(t);n||hA("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=hw.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(gA(s)||fA(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):p(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>p(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=x(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,St(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=E2(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(R2(t)){if(O2(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>gj(t,e[i])))}if(R2(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}F2.type=n.tooltip,F2.transformerConstructor=D2,F2.builtInTheme={tooltip:L2},F2.specKey="tooltip";var z2,H2;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(z2||(z2={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(H2||(H2={}));const j2={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},N2={labelZIndex:!0,gridZIndex:!0},V2={xField:!0,yField:!0,categoryField:!0,valueField:!0},W2={visible:!0,width:!0,style:!0};class U2 extends eV{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=_F.CrossHair_Grid,this.labelZIndex=_F.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),x(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(p(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Tk(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!V(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||N2[i]||V2[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||W2[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:RM.chart}:{source:OM.chart};y(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:t=s["desktop-browser"]}=this._option,e=function(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:gA(t)||fA(t)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(t);if(e){const t=G(this.trigger||"hover"),i=t=>"click"===t?"none"===this.triggerOff?null:e.clickOut:e.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:e[t],out:i(t)})})),s}return null}_registerTooltipEvent(){this.event.on(PM.tooltipHide,{source:OM.chart},this._handleTooltipHideOrRelease),this.event.on(PM.tooltipShow,{source:OM.chart},this._handleTooltipShow),this.event.on(PM.tooltipRelease,{source:OM.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=P(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{j2[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||x(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(e,i){var s,n,r;const a={},{line:o={},label:l={},visible:c}=e;if(a.visible=c,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=t(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(x(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=P(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==e?void 0:e.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=e.line.style.stroke);const t=P(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const e=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=e.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:c,outerBorder:d}=n,u=t(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:e.minWidth,maxWidth:e.maxWidth,padding:e.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:P(s,"stroke")}),panel:(h(e.visible)?e.visible:e)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:c,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}U2.specKey="crosshair";const G2={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class Y2 extends U2{static getSpecInfo(t){return cH(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=n.cartesianCrosshair,this.name=n.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=rj(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){rj(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(u(t.dimType)?"y"===t.dimType:aj(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=xk(this._regions,"cartesian");e&&(lU(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=dU(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new eG(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new iG(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}Y2.specKey="crosshair",Y2.builtInTheme={crosshair:G2},Y2.type=n.cartesianCrosshair;class X2 extends U2{static getSpecInfo(t){return cH(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=n.polarCrosshair,this.name=n.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=xk(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&u(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=ON(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=hH(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:he(d,a.getInnerRadius(),o),end:he(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=de(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=he(t,o,r),d=he(t,o,h),m=ve([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=vt(re.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new eG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new nG(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new rG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new sG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=ue(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=ue(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?he(e,p[1]+m.offset,u):he(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}X2.specKey="crosshair",X2.builtInTheme={crosshair:G2},X2.type=n.polarCrosshair;const K2=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(d(o)||d(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},$2=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(d(a)||d(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return G(r).every((i=>{t[i]>=a[0]&&t[i]<=Y(a)&&(e=!0)})),e}:t=>{let e=!1;return G(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},q2=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],p=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(d(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);u(null==t?void 0:t.max)&&u(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{d(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{G(i[e]).forEach((i=>{d(t[i])||(d(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),d(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),p.push(e)})),p},Z2=(t,e,i)=>{const s=e.domain();if(wk(e.type))return i?s[0]+(Y(s)-s[0])*(1-t):s[0]+(Y(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(Y(n)-n[0])*t;return e.invert(r)},J2=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&wk(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(Y(n)-n[0])))},Q2=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},t5=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},e5=(t,e,i)=>"start"===t?"percent"===e&&u(i.start)||"value"===e&&u(i.startValue):"percent"===e&&u(i.end)||"value"===e&&u(i.endValue),i5=(t,e,i)=>{if(wk(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class s5{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:u(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=vt(this.getState().start+f,0,1),y=vt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(A(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===hj(lj(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,h(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}U(s5,wK);class n5 extends eV{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:J2(t,this._stateScale,this._isHorizontal),a="percent"===n?e:J2(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var t;this._dataFilterEvent.initZoomEvent(),null===(t=this._relatedAxisComponent)||void 0===t||t.event.on(PM.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=Q2(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=i5(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&t5(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else _k(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),_k(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=lj(t),this._isHorizontal="horizontal"===hj(this._orient),this._dataFilterEvent=new s5(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.change=!0,i.reRender=!0,!i.reCompile&&this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0),i}_getComponentOnlySpecKeys(){return null}_isComponentOnlySpecChange(t,e){const i=this._getComponentOnlySpecKeys();if(!i)return!1;return Object.keys(Object.assign(Object.assign({},e),t)).every((s=>V(null==e?void 0:e[s],null==t?void 0:t[s])||i[s]))}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(wk(n.type)){const r=n.domain(),a=r[0],o=Y(r)-a,l=u(t)?a+o*t:+e,h=u(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=u(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=u(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(u(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):u(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),d(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>hj(t._orient)===hj(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!wk(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(u(i)&&(u(i.userId)&&(this._seriesUserId=G(i.userId)),u(i.specIndex)&&(this._seriesIndex=G(i.specIndex))),u(this._spec.seriesId)){const t=G(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(u(this._spec.seriesIndex)){const t=G(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(u(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(G(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(u(this._spec.regionId)){const t=G(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};_k(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=wk(d.getScale(0).type),p=wk(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?G(g.xField):G(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?G(g.yField):G(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else _k(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;HM(r,"dataview",Ta),zM(r,"dataFilterComputeDomain",q2);const a=new Oa(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new KF(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(zM(this._option.dataSet,"dataFilterWithNewDomain",$2),zM(this._option.dataSet,"lockStatisticsFilter",K2),_k(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>wk(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>wk(this._stateScale.type)},level:qM.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(wk(this._stateScale.type));this._stateScale.domain(a,!1),(u(this._spec.start)||u(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!V(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;e5("start",i,this._spec)&&e5("end",s,this._spec)&&(t="percent"===i?this._spec.start:J2(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:J2(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?J2(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?J2(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=Z2(this._start,this._stateScale,Q2(i,this._isHorizontal)),this._endValue=Z2(this._end,this._stateScale,Q2(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,wk(this._stateScale.type)&&this._stateScale.domain()[0]!==Y(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=i5(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&_k(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);A(null==i?void 0:i.min)&&A(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new mC:new $k,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),X(t)]:[-1/0,1/0]}return e}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:xF.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,r,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),u=t5(h);if(!this._dataUpdating&&Tk(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==u?void 0:u.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(r=this._cacheRect)||void 0===r?void 0:r.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==u?void 0:u.bandSize,Tk(c.type)){u&&(this._start||this._end)&&(this.type===n.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!d(t)||!d(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(n5,wK);class r5 extends tV{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=lw({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const a5=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),o5={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:a5(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:a5(!0)},l5={width:!0,height:!0,showDetail:!0,middleHandler:!0,background:!0,startHandler:!0,endHandler:!0,startText:!0,endText:!0,dragMask:!0,selectedBackground:!0,backgroundChart:!0,selectedBackgroundChart:!0,showBackgroundChart:!0};class h5 extends n5{constructor(t,e){var i;super(t,e),this.type=n.dataZoom,this.name=n.dataZoom,this.transformerConstructor=r5,this.specKey="dataZoom",this.layoutZIndex=_F.DataZoom,this.layoutLevel=bF.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange)if(i&&this._component)this._component.setStartAndEnd(t,e);else{const i=this._relatedAxisComponent,n=Z2(t,this._stateScale,Q2(i,this._isHorizontal)),r=Z2(e,this._stateScale,Q2(i,this._isHorizontal));if(!u(n)||!u(r))return;this._start=t,this._end=e;(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(PM.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new mC),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(Q2(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=Q2(t,this._isHorizontal),this.effect.onZoomChange())}_getComponentOnlySpecKeys(){return l5}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),d(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),d(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const u=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=u?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new mC;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(Q2(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!wk(t.type)||e[0]!==Y(e))&&(!Tk(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(G(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:u(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:Q2(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>Z2(t,this._stateScale,Q2(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new WG(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>Z2(t,this._stateScale,Q2(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:AM(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:AM(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:AM(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:AM(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:AM(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:AM(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:AM(g.style)},selectedBackgroundStyle:AM(this._spec.selectedBackground.style),dragMaskStyle:AM(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:lw(AM(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},AM(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:lw(AM(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},AM(null===(d=m.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=hH(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(Q2(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}h5.type=n.dataZoom,h5.transformerConstructor=r5,h5.builtInTheme={dataZoom:o5},h5.specKey="dataZoom";const c5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},d5={width:!0,height:!0,rail:!0,slider:!0,round:!0,innerPadding:!0,minSliderSize:!0};class u5 extends n5{constructor(t,e){var i;super(t,e),this.type=n.scrollBar,this.name=n.scrollBar,this.specKey="scrollBar",this.layoutZIndex=_F.DataZoom,this.layoutLevel=bF.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}_handleChange(t,e,i){super._handleChange(t,e,i);const s=ck(this._start,t)&&ck(this._end,e);if(this._shouldChange&&(!s||!1===this._spec.realTime)){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this._relatedAxisComponent,n=Q2(s,this._isHorizontal),r=Z2(t,this._stateScale,n),a=Z2(e,this._stateScale,n);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,r,a):this._handleStateChange(r,a))&&this.event.emit(PM.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentOnlySpecKeys(){return d5}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:u(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new zU(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return d(i)||(s.padding=i),E(null==t?void 0:t.style)||(s.railStyle=AM(t.style)),E(null==e?void 0:e.style)||(s.sliderStyle=AM(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}u5.type=n.scrollBar,u5.builtInTheme={scrollBar:c5},u5.specKey="scrollBar";const p5=(t,e)=>{const{datum:i,title:s,content:n}=c(e)?e():e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),G(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},g5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),f5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:g5("l1FontSize","primaryFontColor")},content:{visible:!0,style:g5("l2FontSize","tertiaryFontColor")}};class m5 extends eV{constructor(){super(...arguments),this.type=n.indicator,this.name=n.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=_F.Indicator,this.layoutLevel=bF.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return cH(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=G(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex))}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(wM(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(wM(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){zM(this._option.dataSet,"indicatorFilter",p5);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:()=>({title:this._title,content:this._content,datum:()=>this._activeDatum})}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new KF(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const e=this._regions[0],{width:i,height:s}=e.getLayoutRect(),{x:n,y:r}=e.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,p=t(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return G(o).forEach((t=>{const e=lw({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},SM(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?ZC(l,this._computeLayoutRadius()):0,dy:h?ZC(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!u(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},SM(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},p)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)V(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new aX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":c(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}m5.type=n.indicator,m5.builtInTheme={indicator:f5},m5.specKey="indicator";const v5=["sum","average","min","max","variance","standardDeviation","median"];function y5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function _5(t,e){return t?`${t}_${e}_extend`:`marker_${e}_extend`}function b5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return x(t.x)&&y5(e,t.x,i)&&(null===(l=null==h?void 0:(o=h.getXAxisHelper()).setExtendDomain)||void 0===l||l.call(o,_5(a,"xAxis"),t.x)),c=UC(t.x)?k5(t.x,n)+r.x:C5(h.getXAxisHelper(),[t.x])+r.x,c}function x5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return x(t.y)&&y5(e,t.y,i)&&(null===(l=null===(o=h.getYAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,_5(a,"yAxis"),t.y)),c=UC(t.y)?k5(t.y,n)+r.y:C5(h.getYAxisHelper(),[t.y])+r.y,c}function S5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return x(t.angle)&&y5(e,t.angle,i)&&(null===(a=null===(r=o.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,_5(n,"angleAxis"),t.angle)),C5(o.angleAxisHelper,[t.angle])}function A5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return x(t.radius)&&y5(e,t.radius,i)&&(null===(a=null===(r=o.radiusAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,_5(n,"radiusAxis"),t.radius)),C5(o.radiusAxisHelper,[t.radius])}function k5(t,e){return Number(t.substring(0,t.length-1))*e/100}function C5(t,e){const i=t.getScale(0);return wk(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function w5(t){return v5.includes(t)}function M5(t,e,i,s,n,r=!1,a){const o=e.getRegion(),l=o.getLayoutStartPoint(),h=i.getRegion(),c=h.getLayoutStartPoint(),d=Math.abs(Math.min(l.x,c.x)-Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width)),p=Math.abs(Math.min(l.y,c.y)-Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height)),g={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},f=[],m=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,v=s.getXAxisHelper(),y=s.getYAxisHelper(),_=v.getScale(0).domain(),b=y.getScale(0).domain(),x=r&&!v.isContinuous&&!!v.getBandwidth,S=r&&!y.isContinuous&&!!y.getBandwidth,A={min:null,max:null},k={min:null,max:null};return m.forEach((t=>{const e=u(t.x),i=u(t.y);let s,r;if(e&&i)s=b5(t,_,n,g,d,l,a),r=x5(t,b,n,g,p,l,a),T5(s,x,A,f.length),T5(r,S,k,f.length),f.push([{x:s,y:r}]);else if(e){s=b5(t,_,n,g,d,l,a),r=Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height);const e=Math.min(l.y,c.y);T5(s,x,A,f.length),f.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(l.x,c.x),r=x5(t,b,n,g,p,l,a);const e=Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width);T5(r,S,k,f.length),f.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(f,v,y,A,k),f}function T5(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=u(t.angle),i=u(t.radius);if(e&&i){const e=S5(t,h,n,a,r),i=A5(t,c,n,a,r);o.push([{angle:e,radius:i}])}else if(e){const e=S5(t,h,n,a,r);o.push([{angle:e,radius:-d},{angle:e,radius:d}])}else if(i){const e=A5(t,c,n,a,r);o.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),o}function E5(t,e){return(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e}function P5(t,e,i,s,n){const r=[],a=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,o=y(s);return i&&a.forEach((t=>{!function(t,e,i,s){var n,r,a,o;const l=e.getXAxisHelper().getScale(0).domain(),h=e.getYAxisHelper().getScale(0).domain(),c=G(t.x),d=G(t.y);1===c.length&&x(c[0])&&y5(l,c[0],i)&&(null===(r=null===(n=e.getXAxisHelper())||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,_5(s,"xAxis"),c[0])),1===d.length&&x(d[0])&&y5(h,d[0],i)&&(null===(o=null===(a=e.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,_5(s,"yAxis"),d[0]))}(t,E5(t,e),i,n)})),a.forEach(((t,i)=>{const n=E5(t,e),a=n.getRegion(),l=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();let d=0,u=0;if(s){const t=o?s[i]:s,e=t.x,n=t.y;e&&(d=UC(e)?Number(e.substring(0,e.length-1))*h/100:e),n&&(u=UC(n)?Number(n.substring(0,n.length-1))*c/100:n)}const p=G(t.x),g=G(t.y);r.push({x:C5(n.getXAxisHelper(),p)+l.x+d,y:C5(n.getYAxisHelper(),g)+l.y+u})})),r}function O5(t,e,i,s){const n=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var r,a,o,l;const h=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,c=h.angleAxisHelper.getScale(0).domain(),d=h.radiusAxisHelper.getScale(0).domain(),u=G(t.angle),p=G(t.radius);1===u.length&&x(u[0])&&y5(c,u[0],i)&&(null===(a=null===(r=h.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,_5(s,"angleAxis"),u[0])),1===p.length&&x(p[0])&&y5(d,p[0],i)&&(null===(l=null===(o=h.radiusAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,_5(s,"radiusAxis"),p[0])),n.push({angle:C5(h.angleAxisHelper,u),radius:C5(h.radiusAxisHelper,p)})})),n}function R5(t,e,i){let{x:s,y:n}=t;return UC(s)&&(s=k5(s,e)),UC(n)&&(n=k5(n,i)),{x:s,y:n}}function I5(t,e,i){let s;if(s=c(t)?G(t(e.getData().getLatestData(),e)):G(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=R5(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>R5(t,n,r)))}function D5(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function L5(e,i,s){const{labelBackground:n={},style:r,shape:a}=e,o=t(e,["labelBackground","style","shape"]);if(!1!==e.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},AM(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},z5(AM(n.style),i,s)),u(n.padding)&&(t.padding=ai(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=z5(AM(r),i,s)),t}return{visible:!1}}function F5(t,e,i){for(const s in t)c(t[s])&&(t[s]=t[s](e,i));return t}function z5(t,e,i){return c(t)?t(e,i):t}function H5(t,e){return c(t)?t(e):t}function j5(t,e,i){return u(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function N5(t){return{isXProcess:u(t.x),isYProcess:u(t.y),isX1Process:u(t.x1),isY1Process:u(t.y1),isAngleProcess:u(t.angle),isRadiusProcess:u(t.radius),isAngle1Process:u(t.angle1),isRadius1Process:u(t.radius1),isCoordinatesProcess:u(t.coordinates),isValidProcess:u(t.process)}}function V5(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=N5(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function W5(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=N5(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function U5(t){return{doXYProcess:u(t.x)&&u(t.y),doPolarProcess:u(t.angle)&&u(t.radius),doGeoProcess:u(t.areaName)}}function G5(e,i){let s;if(i.coordinates){const e=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=e,o=t(e,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(c(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=G(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;u(r)&&(c=G(i)[r]),n&&G(i).includes(n)&&(c=n);let d=s;u(l)&&(d=G(s)[l]),a&&G(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),v(t[c])&&w5(t[c])?h.x={field:c,aggrType:t[c]}:h.x=G(c).map((e=>t[e])),v(t[d])&&w5(t[d])?h.y={field:d,aggrType:t[d]}:h.y=G(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;u(r)&&(a=G(s)[r]),n&&G(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),v(t[a])&&w5(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=G(a).map((e=>t[e])),v(t[l])&&w5(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=G(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((t=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(u(t.x)){const s=t.x;y(s)?i.x=s.map((i=>X5(i,e,t))):i.x=X5(s,e,t)}if(u(t.y)){const s=t.y;y(s)?i.y=s.map((i=>X5(i,e,t))):i.y=X5(s,e,t)}if(u(t.angle)){const s=t.angle;y(s)?i.angle=s.map((i=>X5(i,e,t))):i.angle=X5(s,e,t)}if(u(t.radius)){const s=t.radius;y(s)?i.radius=s.map((i=>X5(i,e,t))):i.radius=X5(s,e,t)}if(u(t.areaName)){const s=t.areaName;i.areaName=X5(s,e,t)}t.getRefRelativeSeries&&(i.getRefRelativeSeries=t.getRefRelativeSeries),n.push(i)})),n}const Y5={min:(t,e)=>dk(t[0].latestData,e.field),max:(t,e)=>uk(t[0].latestData,e.field),sum:function(t,e){return pk(t[0].latestData,e.field)},average:function(t,e){return gk(t[0].latestData,e.field)},variance:function(t,e){return fk(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(fk(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function X5(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(c(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return Y5[i](e,{field:s})}return t}function K5(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}const $5=t=>{var e;const i=null===(e=null==t?void 0:t.dataSet)||void 0===e?void 0:e.dataViewMap;return i?Object.values(i).filter(Boolean):[]},q5=(t,e)=>{var i,s;null===(i=null==t?void 0:t.target)||void 0===i||i.removeListener("change",e.reRunAllTransform),null===(s=null==t?void 0:t.target)||void 0===s||s.removeListener("markRunning",e.markRunning)},Z5=t=>{if(!t)return;$5(t).forEach((e=>{q5(e,t)}));const e=null==t?void 0:t.rawData;Array.isArray(e)&&e.forEach((e=>{q5(e,t)}))},J5=(t,e)=>{if(!t)return;const i=new Set($5(t)),s=[],n=t=>{const r=null==t?void 0:t.rawData;Array.isArray(r)&&r.forEach((t=>{i.has(t)&&e(t)&&!s.includes(t)&&(s.push(t),n(t))}))};n(t),(t=>{const e=Array.from(new Set(t.filter(Boolean)));e.length&&(e.forEach(Z5),e.forEach((t=>{var e;null===(e=t.destroy)||void 0===e||e.call(t)})))})([t,...s])},Q5="__vchart_marker_coordinate__",t3=["coordinate","coordinates","x","y","x1","y1","angle","angle1","radius","radius1"],e3=["position","positions","coordinatesOffset","regionRelative"],i3=["offsetX","offsetY","confine"],s3=t=>Array.isArray(t)?t.map(s3):t&&"object"==typeof t?"function"!=typeof t.formatMethod?t:Object.assign(Object.assign({},t),{formatMethod:"__vchart_marker_format_method__"}):t,n3=t=>{if(Array.isArray(t))return t.map(n3);if(!t||"object"!=typeof t)return t;const e=Object.assign({},t);return Object.keys(e).forEach((t=>{"style"===t||t.endsWith("Style")?e[t]="__vchart_marker_style__":e[t]=n3(e[t])})),e},r3=(t,e)=>{if(!t||"object"!=typeof t)return t;const i=Object.assign({},t);e.normalizeDomainPosition&&t3.forEach((t=>{i[t]=Q5})),e.normalizeAutoRange&&"autoRange"in i&&(i.autoRange="__vchart_marker_auto_range__"),e3.forEach((t=>{t in i&&(i[t]=Q5)})),"label"in i&&(i.label=s3(i.label)),Object.keys(i).forEach((t=>{i[t]=n3(i[t])}));const s=i.itemContent;if(s&&"object"==typeof s){i.itemContent=Object.assign({},s),i3.forEach((t=>{t in i.itemContent&&(i.itemContent[t]=Q5)}));const t=i.itemContent.text;t&&"object"==typeof t&&(i.itemContent.text=Object.assign(Object.assign({},s3(t)),{text:"__vchart_marker_text__"}))}return i};class a3 extends eV{constructor(){super(...arguments),this.layoutType="none",this._markerDataChangeHandler=null,this._markerDataOwned=!1,this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return cH(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getAutoRangeExtendDomainKeyPrefix(){return`marker_${this.type}_${this.id}`}_getAutoRangeExtendDomainKey(t){return`${this._getAutoRangeExtendDomainKeyPrefix()}_${t}_extend`}_clearAutoRangeExtendDomain(){var t,e;G(null===(e=(t=this._option).getAllSeries)||void 0===e?void 0:e.call(t)).forEach((t=>{var e,i,s,n,r,a,o,l,h,c;null===(s=null===(i=null===(e=null==t?void 0:t.getXAxisHelper)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.setExtendDomain)||void 0===s||s.call(i,this._getAutoRangeExtendDomainKey("xAxis"),void 0),null===(a=null===(r=null===(n=null==t?void 0:t.getYAxisHelper)||void 0===n?void 0:n.call(t))||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,this._getAutoRangeExtendDomainKey("yAxis"),void 0),null===(l=null===(o=null==t?void 0:t.angleAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,this._getAutoRangeExtendDomainKey("angleAxis"),void 0),null===(c=null===(h=null==t?void 0:t.radiusAxisHelper)||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,this._getAutoRangeExtendDomainKey("radiusAxis"),void 0)}))}_updateMarkerLayout(){this._clearAutoRangeExtendDomain(),this._markerLayout()}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return v(e)&&w5(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];G(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Pa;return e.registerParser("array",i),new Oa(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}_setMarkerData(t,e=!1){this._releaseMarkerData(),this._markerData=t,this._markerDataOwned=e}_bindMarkerDataChange(){var t;(null===(t=this._markerData)||void 0===t?void 0:t.target)&&(this._markerDataChangeHandler=()=>{this._updateMarkerLayout()},this._markerData.target.on("change",this._markerDataChangeHandler))}_releaseMarkerData(){const t=this._markerData;(null==t?void 0:t.target)&&this._markerDataChangeHandler&&t.target.removeListener("change",this._markerDataChangeHandler),this._markerDataChangeHandler=null,this._markerDataOwned&&J5(t,(t=>t.name===`${this.type}_${this.id}_data`)),this._markerData=null,this._markerDataOwned=!1}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._updateMarkerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(u(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._updateMarkerLayout.bind(this)))}clear(){super.clear(),this._markerComponent=null,this._firstSeries=null}release(){this._releaseMarkerData(),super.release()}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=xk(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){d(this._spec.offsetX)||(this._layoutOffsetX=YC(this._spec.offsetX,e.width,e)),d(this._spec.offsetY)||(this._layoutOffsetY=YC(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reRender=!0,i.change=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake||i.reCompile||!this._isAutoRangeSpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,scaleDomain:!0,layout:!0,render:!0}):i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){const i=!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange);return V(r3(e,{normalizeDomainPosition:i}),r3(t,{normalizeDomainPosition:i}))}_isAutoRangeSpecChange(t,e){return!(!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange))&&V(r3(e,{normalizeDomainPosition:!0,normalizeAutoRange:!0}),r3(t,{normalizeDomainPosition:!0,normalizeAutoRange:!0}))}reInit(t){super.reInit(t),this._releaseMarkerData(),this._bindSeries(),this._initDataView(),this._buildMarkerAttributeContext(),this._markerComponent&&this._updateMarkerLayout()}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();zM(this._option.dataSet,"markerAggregation",G5),zM(this._option.dataSet,"markerFilter",K5),this._releaseMarkerData();const i=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(i,!0),this._bindMarkerDataChange()}}function o3(t,e){return function(t,e,i){const{predict:s}=Lt(t,(t=>t[e]),(t=>t[i])),n=dk(t,e),r=uk(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class l3 extends a3{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=_F.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=V5(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:z5(AM(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>L5(t,this._markerData,this._markAttributeContext))),state:{line:F5(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:F5(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:F5(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return F5(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return F5(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:z5(AM(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:z5(AM(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||G(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=D5([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=G((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=G(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=V5(t);if(this._setMarkerData(this._getRelativeDataView()),!(i||s||n||r||a||o||l||h||c||d||e))return;zM(this._option.dataSet,"markerAggregation",G5),zM(this._option.dataSet,"markerRegression",o3),zM(this._option.dataSet,"markerFilter",K5);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Oa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(m,!0),this._bindMarkerDataChange()}}l3.specKey="markLine";const h3=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),c3={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},d3={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:h3(!1),endSymbol:h3(!0),label:c3};class u3 extends l3{constructor(){super(...arguments),this.type=n.markLine,this.name=n.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new BY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=u(e.coordinates),o=u(e.process),l=o&&u(e.process.x),h=o&&u(e.process.y),c=u(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:p,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:y}=V5(e);let _=[];if(p||f||g||m||v||a&&l||a&&h){const t=M5(i,s,n,r,d,!1,this._getAutoRangeExtendDomainKeyPrefix());_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=P5(i,r,d,e.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):c&&(_=I5(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n,r,a,o,l;const h=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const l=this._startRelativeSeries,d=this._endRelativeSeries,{multiSegment:p,mainSegmentIndex:g}=this._spec.line||{},{connectDirection:f}=this._spec;let{expandDistance:m=0}=this._spec;const{points:v,limitRect:y}=h,_=G(v).filter(Boolean);if(c(m)){const n=null===(t=null==l?void 0:l.getRegion)||void 0===t?void 0:t.call(l),r=null===(e=null==d?void 0:d.getRegion)||void 0===e?void 0:e.call(d);m=m(this._markerData,Object.assign(Object.assign({},this.getMarkAttributeContext()),{region:null===(s=null===(i=this._relativeSeries)||void 0===i?void 0:i.getRegion)||void 0===s?void 0:s.call(i),startRegion:n,endRegion:r,coordinatePoints:_}))}let b;if(UC(m)){const t=l.getRegion(),e=t.getLayoutStartPoint(),i=d.getRegion(),s=i.getLayoutStartPoint();if("bottom"===f||"top"===f){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));b=Number(m.substring(0,m.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));b=Number(m.substring(0,m.length-1))*n/100}}else b=m;if(!v||v.length<2)return void(null===(n=this._markerComponent)||void 0===n||n.setAttributes(h));const x=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(v[0],v[1],f,b);let S;S=p&&u(g)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(v[0],v[1],f,b));const k=G((null!==(a=null===(r=this._markerComponent)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{}).label),C=G(h.label),w=G(this._spec.label);null===(o=this._markerComponent)||void 0===o||o.setAttributes({points:p?[[x[0],x[1]],[x[1],x[2]],[x[2],x[3]]]:x,label:C.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=S.dx)&&void 0!==i?i:0,h=null!==(s=S.dy)&&void 0!==s?s:0;const c=null!==(n=w[e])&&void 0!==n?n:w[0];return A(null==c?void 0:c.refX)&&(a+=c.refX),A(null==c?void 0:c.refY)&&(o+=c.refY),A(null==c?void 0:c.dx)&&(l+=c.dx),A(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),S),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=k[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:y,multiSegment:p,mainSegmentIndex:g,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(l=this._markerComponent)||void 0===l||l.setAttributes(h)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=V5(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&u(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&u(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&u(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}u3.type=n.markLine,u3.coordinateType="cartesian",u3.builtInTheme={markLine:d3};class p3 extends l3{constructor(){super(...arguments),this.type=n.polarMarkLine,this.name=n.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=V5(this._spec);return e||i?new OY(t):new BY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=V5(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=B5(i,s,n,r,a,this._getAutoRangeExtendDomainKeyPrefix());p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>he(f,t.radius,t.angle)))}}else u&&(p=O5(i,r,a,this._getAutoRangeExtendDomainKeyPrefix()),g={points:p.map((t=>he(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=V5(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}p3.type=n.polarMarkLine,p3.coordinateType="polar",p3.builtInTheme={polarMarkLine:d3};class g3 extends eV{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=n.title,this.specKey=n.title,this.layoutType="normal",this.layoutZIndex=_F.Title,this.layoutLevel=bF.Title,this._orient="top",this._orient=WC(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return cH(t,this.specKey,n.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,s&&!i.reMake&&(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}afterSetLayoutStartPoint(t){A(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),A(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:A(t.width())?t.width():0,height:this._spec.height?this._spec.height:A(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=YC(this._spec.width,a.width,null,a.width),l=YC(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=u(this._spec.text)&&""!==this._spec.text,d=u(this._spec.subtext)&&""!==this._spec.subtext,p=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(p.textStyle.width=h),d&&(p.subtextStyle.width=h),u(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?p.textStyle.width=t:delete p.textStyle.width,d&&(p.subtextStyle.width=t)}return p}_createOrUpdateTitleComponent(t){if(this._titleComponent)V(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new nX(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}g3.type=n.title,g3.specKey=n.title,g3.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class f3 extends a3{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=_F.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=W5(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:z5(AM(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>L5(t,this._markerData,this._markAttributeContext))),state:{area:F5(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>F5(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return F5(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||G(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=D5([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=G(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=G(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=W5(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}f3.specKey="markArea";const m3={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class v3 extends f3{constructor(){super(...arguments),this.type=n.markArea,this.name=n.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new PY(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=W5(i),d=u(i.positions),p=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=M5(s,n,r,a,p,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=M5(s,n,r,a,p,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=P5(s,a,p,i.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):d&&(f=I5(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=W5(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}v3.type=n.markArea,v3.coordinateType="cartesian",v3.builtInTheme={markArea:m3};class y3 extends f3{constructor(){super(...arguments),this.type=n.polarMarkArea,this.name=n.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=W5(this._spec);return i||e||s?new RY(t):new PY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=W5(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=B5(i,s,n,r,c,this._getAutoRangeExtendDomainKeyPrefix());l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=O5(i,r,c,this._getAutoRangeExtendDomainKeyPrefix()),u={points:d.map((t=>he(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=W5(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}y3.type=n.polarMarkArea,y3.coordinateType="polar",y3.builtInTheme={polarMarkArea:m3};const _3=t=>AM(Object.assign({},t)),b3=t=>Object.assign(Object.assign({},t),{style:Object.assign({},AM(t.style))}),x3=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=_3(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=_3(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),y=(_=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},AM(Object.assign({},_)));var _;const b=b3(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=b3(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=b3(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=b3(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:y}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},S3=t=>"left"===t||"right"===t,A3=t=>"top"===t||"bottom"===t,k3={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class C3 extends eV{constructor(){super(...arguments),this.layoutZIndex=_F.Player,this.layoutLevel=bF.Player,this.specKey="player",this.type=n.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},x3(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},x3(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?V(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new bX(t):this._playerComponent=new AX(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...G(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...G(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...G(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...G(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=S3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=S3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...G(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...G(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...G(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...G(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(PM.rendered,this.autoPlayCallback),this._option.globalInstance.on(PM.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(gX.end,(()=>{var t;this.event.emit(PM.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(gX.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(gX.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(PM.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(gX.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(PM.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(gX.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(PM.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(gX.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(PM.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.type)!==(null==t?void 0:t.type)?(i.reMake=!0,i):(!s||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i)}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),A(t.x)){const e=S3(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(A(t.y)){const e=A3(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return x(this._spec.width)?Math.min(t.width,Number(this._spec.width)):S3(this._orient)?this._maxSize():t.width}_computeHeight(t){return x(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):A3(this._orient)?this._maxSize():t.height}_computeDx(t){return S3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return A3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];this._option.globalInstance.updateFullData(e.data),this.event.emit(PM.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}release(){this._option.globalInstance.off(PM.rendered,this.autoPlayCallback)}}C3.builtInTheme={player:k3},C3.specKey="player",C3.type=n.player;class w3 extends eV{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.layoutType="none",this.layoutZIndex=_F.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,V(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=OC({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==SF.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),f(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}w3.type=n.label;class M3 extends P${constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}M3.type="text",M3.constructorType="label";const T3=()=>{O$(),hw.registerMark(M3.constructorType,M3)};class B3 extends tV{_initTheme(t,e){return{spec:t,theme:this._theme}}}class E3 extends w3{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.specKey="label",this.transformerConstructor=B3,this.layoutZIndex=_F.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,r)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:n.label,specInfoPath:["component",this.specKey,r],regionIndexes:[r]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(PM.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(BM.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(BM.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),_k(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&u(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(u(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n),c(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",xF.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=lw({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},XK(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[Zw])):t=>t.filter((t=>t.data[qw]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?KK(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}E3.type=n.label,E3.specKey="label",E3.transformerConstructor=B3;class P3 extends w3{constructor(){super(...arguments),this.type=n.totalLabel,this.name=n.totalLabel,this.specKey="totalLabel",this.layoutZIndex=_F.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var r;null===(r=t.seriesIndexes)||void 0===r||r.forEach((t=>{const{spec:r}=e.series[t],a=r[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:n.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[Kw]},"normal",xF.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return lw({textStyle:{pickable:!0===this._spec.interactive},position:O3(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[Zw]:t.data[qw]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>KK({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function O3(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}P3.type=n.totalLabel,P3.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},P3.specKey="totalLabel";class R3 extends a3{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=_F.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=U5(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y,_,b,x,S,A,k,C,w,M,T,B,E,P,O,R,I,D;const{itemContent:L={},itemLine:F={},targetSymbol:H={}}=this._spec,j=this._relativeSeries.getRegion(),N=L,{type:V="text",text:W,symbol:U,image:G,richText:Y,customMark:X,textStyle:K,symbolStyle:$,imageStyle:q,richTextStyle:Z,customMarkStyle:J,style:Q={},state:tt={}}=N,et=t(N,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let it=null,st=null,nt=V,rt={};if("text"===V){it=null!==(e=null==W?void 0:W.state)&&void 0!==e?e:tt;const r=null!==(n=null!==(s=null!==(i=null==W?void 0:W.style)&&void 0!==i?i:null==W?void 0:W.textStyle)&&void 0!==s?s:K)&&void 0!==n?n:Q;(t=>"rich"===(null==t?void 0:t.type))(r)?(nt="richText",rt={width:100,height:100},st=z5(z(rt,(e=>{if(!e)return e;const{type:i,text:s,textConfig:n}=e,r=t(e,["type","text","textConfig"]),a=Object.assign({},r),o=u(n)?n:s;return u(o)&&(a.textConfig=o),a})(r)),this._markerData,this._markAttributeContext)):(rt={dx:0,dy:0},st=L5(Object.assign(Object.assign({},W),{style:z(rt,r)}),this._markerData,this._markAttributeContext))}else"richText"===V?(it=null!==(r=null==Y?void 0:Y.state)&&void 0!==r?r:tt,rt={width:100,height:100},st=z5(z(rt,null!==(o=null!==(a=null==Y?void 0:Y.style)&&void 0!==a?a:Z)&&void 0!==o?o:Q),this._markerData,this._markAttributeContext)):"symbol"===V?(it=null!==(l=null==U?void 0:U.state)&&void 0!==l?l:tt,rt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},st=AM(z5(z(rt,null!==(c=null!==(h=null==U?void 0:U.style)&&void 0!==h?h:$)&&void 0!==c?c:Q),this._markerData,this._markAttributeContext))):"image"===V?(it=null!==(d=null==G?void 0:G.state)&&void 0!==d?d:tt,rt={width:80,height:80},st=z5(z(rt,null!==(g=null!==(p=null==G?void 0:G.style)&&void 0!==p?p:q)&&void 0!==g?g:Q),this._markerData,this._markAttributeContext)):"custom"===V&&(it=null!==(f=null==X?void 0:X.state)&&void 0!==f?f:tt,st=z5(null!==(v=null!==(m=null==X?void 0:X.style)&&void 0!==m?m:J)&&void 0!==v?v:Q,this._markerData,this._markAttributeContext));const at={zIndex:this.layoutZIndex,interactive:null===(y=this._spec.interactive)||void 0===y||y,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(b=this._spec.interactive)||void 0===b||b,position:{x:0,y:0},clipInRange:null!==(x=this._spec.clip)&&void 0!==x&&x,itemContent:Object.assign(Object.assign({type:nt,offsetX:H5(L.offsetX,j),offsetY:H5(L.offsetY,j)},et),{style:z5(st,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(S=H.offset)&&void 0!==S?S:0,visible:null!==(A=H.visible)&&void 0!==A&&A,size:null!==(k=H.size)&&void 0!==k?k:20,style:z5(H.style,this._markerData,this._markAttributeContext)},state:{line:F5(null!==(w=null===(C=this._spec.itemLine.line)||void 0===C?void 0:C.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineStartSymbol:F5(null!==(T=null===(M=this._spec.itemLine.startSymbol)||void 0===M?void 0:M.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineEndSymbol:F5(null!==(E=null===(B=this._spec.itemLine.endSymbol)||void 0===B?void 0:B.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext),itemContent:F5(it,this._markerData,this._markAttributeContext),textBackground:F5(null===(O=null===(P=this._spec.itemContent.text)||void 0===P?void 0:P.labelBackground)||void 0===O?void 0:O.state,this._markerData,this._markAttributeContext),targetItem:F5(null!==(I=null===(R=this._spec.targetSymbol)||void 0===R?void 0:R.state)&&void 0!==I?I:{},this._markerData,this._markAttributeContext)},animation:null!==(D=this._spec.animation)&&void 0!==D&&D,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:ot,line:lt={}}=F,ht=t(F,["visible","line"]);at.itemLine=!1!==ot?Object.assign(Object.assign({},ht),{visible:!0,lineStyle:AM(lt.style)}):{visible:!1};return new DY(at)}_markerLayout(){var e,i,s,n,r,a,o,l,h,c,d,p,g;const f=this._spec,m=this._markerData,v=this._relativeSeries,{point:y}=this._computePointsAttr(),_=this._getRelativeDataView().latestData,b=m?m.latestData[0]&&m.latestData[0].latestData?m.latestData[0].latestData:m.latestData:_,{itemLine:x={},itemContent:S={}}=this._spec,A=this._relativeSeries.getRegion(),{visible:k,line:C={}}=x,w=t(x,["visible","line"]),M=!1!==k?Object.assign(Object.assign({},w),{visible:!0,lineStyle:AM(C.style)}):{visible:!1},T=L5(Object.assign(Object.assign({},S.text),{style:z({dx:0,dy:0},null!==(i=null===(e=S.text)||void 0===e?void 0:e.style)&&void 0!==i?i:S.style)}),m,this._markAttributeContext);let B;if(f.clip||(null===(s=f.itemContent)||void 0===s?void 0:s.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=D5([v.getRegion()]);B={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(n=this._markerComponent.attribute)&&void 0!==n?n:{},e=null!==(a=null===(r=t.itemContent)||void 0===r?void 0:r.textStyle)&&void 0!==a?a:{},i=null===(o=this._spec.itemContent.text)||void 0===o?void 0:o.text,s=H5(S.offsetX,A),f=H5(S.offsetY,A);this._markerComponent.setAttributes({position:void 0===y?{x:null,y:null}:y,itemContent:Object.assign(Object.assign({},t.itemContent),{panel:null!==(l=T.panel)&&void 0!==l?l:null===(h=t.itemContent)||void 0===h?void 0:h.panel,padding:null!==(c=T.padding)&&void 0!==c?c:null===(d=t.itemContent)||void 0===d?void 0:d.padding,textStyle:Object.assign(Object.assign(Object.assign({},e),null!==(p=T.textStyle)&&void 0!==p?p:{}),{text:(null===(g=this._spec.itemContent.text)||void 0===g?void 0:g.formatMethod)?this._spec.itemContent.text.formatMethod(b,_):u(i)?i:e.text}),offsetX:j5(y,s,A),offsetY:j5(y,f,A)}),itemLine:M,limitRect:B,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=U5(t);(u(t.coordinate)||e||i||s)&&this._initCommonDataView()}}R3.specKey="markPoint";const I3={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class D3 extends R3{constructor(){super(...arguments),this.type=n.markPoint,this.name=n.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=u(s.x)&&u(s.y),o=u(s.coordinate),l=u(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=M5(n,r,r,r,h,!1,this._getAutoRangeExtendDomainKeyPrefix()))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=P5(n,r,h,s.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix())[0]:l&&(c=I5(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=U5(t),i=u(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}D3.type=n.markPoint,D3.coordinateType="cartesian",D3.builtInTheme={markPoint:I3};class L3 extends R3{constructor(){super(...arguments),this.type=n.polarMarkPoint,this.name=n.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=B5(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e,this._getAutoRangeExtendDomainKeyPrefix())[0][0];return{point:he({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}L3.type=n.polarMarkPoint,L3.coordinateType="polar",L3.builtInTheme={polarMarkPoint:I3};class F3 extends R3{constructor(){super(...arguments),this.type=n.geoMarkPoint,this.name=n.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{u(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}F3.type=n.geoMarkPoint,F3.coordinateType="geo",F3.builtInTheme={geoMarkPoint:I3};const z3="inBrush",H3="outOfBrush",j3={style:!0,inBrush:!0,outOfBrush:!0};class N3 extends eV{constructor(){super(...arguments),this.layoutType="none",this.type=n.brush,this.name=n.brush,this.specKey="brush",this.layoutZIndex=_F.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return cH(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),z3,xF.Series),i.setMarkStyle(s,Object.assign({},e),H3,xF.Series))}))}))}reInit(t){super.reInit(t),this.init()}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&G(t).includes(n.userId.toString())||e&&G(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){u(this._spec.regionId)||u(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(u(this._spec.brushLinkSeriesId)||u(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(G(this._spec.brushLinkSeriesId),G(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){u(this._spec.axisId)?G(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):u(this._spec.axisIndex)?G(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return V(e,t)||(i.change=!0,i.reRender=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||j3[i]))}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){var i;const s=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(Object.assign({brushStyle:AM(null===(i=this._spec)||void 0===i?void 0:i.style)},s)),this._initMarkBrushState(e,""),n.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new MX(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:AM(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r),this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(xX.brushActive,(i=>{this._initMarkBrushState(e,H3),this._emitEvent(PM.brushActive,t,i)})),r.addEventListener(xX.drawStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(PM.brushStart,t,e)})),r.addEventListener(xX.moveStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(PM.brushStart,t,e)})),r.addEventListener(xX.drawing,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(PM.brushChange,t,e)})),r.addEventListener(xX.moving,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(PM.brushChange,t,e)})),r.addEventListener(xX.brushClear,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0),this._initMarkBrushState(e,""),this._emitEvent(PM.brushClear,t,i)})),r.addEventListener(xX.drawEnd,(i=>{var s;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:n}=i.detail,{updateElementsState:r=!0}=this._spec;if(r&&this._handleBrushChange(t,i),null===(s=this._spec)||void 0===s?void 0:s.onBrushEnd)!0===this._spec.onBrushEnd(i)?(this.clearGraphic(),this._initMarkBrushState(e,""),this._emitEvent(PM.brushClear,t,i)):(this._spec.onBrushEnd(i),this._emitEvent(PM.brushEnd,t,i));else{const e=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&e.length>0||!r)&&this._setAxisAndDataZoom(n,t),this._emitEvent(PM.brushEnd,t,i)}})),r.addEventListener(xX.moveEnd,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&this._handleBrushChange(t,e);const n=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&n.length>0||s)&&this._setAxisAndDataZoom(i,t),this._emitEvent(PM.brushEnd,t,e)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},AM(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_setBrushState(t,e){var i;const s=null!==(i=t.currentStates)&&void 0!==i?i:[];gz(t,[...s.filter((t=>t!==z3&&t!==H3)),e])}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(this._setBrushState(i,z3),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(this._setBrushState(i,H3),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(this._setBrushState(i,z3),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(this._setBrushState(i,H3),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Ee(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;mz(s,[z3,H3]),i&&fz(s,i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=Y(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}N3.type=n.brush,N3.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},N3.specKey="brush";const V3={style:!0,state:!0};class W3 extends eV{constructor(){super(...arguments),this.type=n.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=_F.CustomMark,this.layoutLevel=bF.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${Rw}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=jH({},NH(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(d(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),u(t.dataId)||A(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i.change=!0,i.reRender=!0,i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||V3[i]))}reInit(t){super.reInit(t),this._updateMarkStyleWithSpec(this._spec,this.getMarks()[0]),this.getMarks().forEach((t=>{t.commit(!1,!0)}))}_updateMarkStyleWithSpec(t,e){var i,s,n,r;if(t&&e&&(this.initMarkStyleWithSpec(e,t),"group"===t.type)){const a=null!==(n=null===(s=(i=e).getMarks)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[];null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._updateMarkStyleWithSpec(t,a[e])}))}}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ne).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ne;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}W3.type=n.customMark,W3.specKey="customMark";class U3{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(A(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:c(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&u(e.modelId)){if(u(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&u(e.modelKey)&&"modelIndex"in e&&u(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>G3(t))),a=n.filter((t=>!G3(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>G3(t))),h=o.filter((t=>!G3(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);A(h.width)||(h.width=l.width),A(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function G3(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}U3.type="grid";const Y3="vchart-tooltip",X3=`${Y3}-container`,K3=`${Y3}-title`,$3=`${Y3}-content-box`,q3={offsetX:10,offsetY:10},Z3="99999999999999";function J3(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const Q3=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,t4=t=>v(t)&&""!==(null==t?void 0:t.trim())||x(t)?J3(t):"",e4=(t,e)=>{let i;if(u(t))if(x(t))i=t;else if(c(t)){const s=t(e);x(s)&&(i=s)}return i},i4={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},s4=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=i4[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class n4 extends BN{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,d,g;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,S="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:k,offsetY:C}=this._option,w=m[_],M=fH(null==w?void 0:w.position,b,e),T=null!==(r=fH(null==w?void 0:w.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,O=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==O?void 0:O.width)&&void 0!==o?o:Iw,I=null!==(l=null==O?void 0:O.height)&&void 0!==l?l:Dw;let D=!1;const L={width:0,height:0};let F,z={x:0,y:0},H={x:0,y:0},j=1,N=1;const V=pA(this._env);if(V&&!m.confine?(L.width=window.innerWidth,L.height=window.innerHeight):(L.width=R,L.height=I),V&&!P){const t=this._getParentElement(m);H=null!==(d=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==d?d:v;const e=null!==(g=this._compiler.getCanvas())&&void 0!==g?g:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-H.x,y:F.y-H.y},j=Q3(e,F),N=Q3(t,H)}const W=N/j,U={},G={x:M,y:M},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?k:C;if("mark"===i){D=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==S?void 0:S.series)||void 0===r?void 0:r.coordinate)&&S.datum&&S.datum.length){D=!0;const t=f(S,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(D){const e=Y[n][0],i="x"===n?B:E;switch(s4(t,n)){case-2:U[e]=a-i*W-c;break;case-1.5:U[e]=a+c;break;case 0:U[e]=(a+o)/2-i*W/2;break;case-1:U[e]=(a+o)/2-i*W-c;break;case 1:U[e]=(a+o)/2+c;break;case 1.5:U[e]=o-i*W-c;break;case 2:U[e]=o+c}}},K=["x","y"];if(p(M))if((t=>p(t)&&(u(t.left)||u(t.right)||u(t.top)||u(t.bottom)))(M)){const{left:t,right:e,top:i,bottom:s}=M;U.left=e4(t,y),U.top=e4(i,y),U.right=e4(e,y),U.bottom=e4(s,y)}else(t=>p(t)&&(u(t.x)||u(t.y)))(M)&&K.forEach((t=>{const e=M[t];x(e)||c(e)?U[Y[t][0]]=e4(e,y):X(e,t)}));else u(M)&&(X({orient:M,mode:T},"x"),X({orient:M,mode:T},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?B:E,s="x"===t?R:I,n="x"===t?k:C,r=s4(G[t],t);if(A(U[Y[t][0]]))$[t]=U[Y[t][0]];else if(A(U[Y[t][1]]))$[t]=s-i*W-U[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+n:0===r?e-i*W/2:e-i*W-n}$[t]*=j,V&&($[t]+=z[t]),$[t]/=N;const a="x"===t?L.width:L.height,o=m.confine?-(H[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/N:-H[t]/N,l=a/N+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(D?$[t]=l:($[t]-=0===r?n+i/2:2*n+i,$[t]u(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",a4=(t={},e={})=>{var i,s;u(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return u(n)&&(e.color=n),u(t.fontWeight)&&(e.fontWeight=t.fontWeight),u(t.textAlign)&&(e.textAlign=t.textAlign),u(t.fontSize)&&(e.fontSize=r4(t.fontSize)),u(t.maxWidth)&&(e.maxWidth=r4(t.maxWidth)),t.multiLine||u(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},o4=(t={})=>{const{lineHeight:e}=t;return t.fontSize?YC(e,t.fontSize):0},l4=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return u(l)&&(a.borderRadius=A(l)?`${l}px`:`${l}`),u(r)&&(o=ai(r),a.padding=r4(o)),{panelStyle:a,panelPadding:o}};function h4(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const c4=t=>{hw.registerComponentPlugin(t.type,t)};class d4 extends n4{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(d4.type),this.type=vU.dom,this._tooltipContainer=null==uA?void 0:uA.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(uA&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=l4(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),A(g)&&(y.marginBottom=`${g}px`);const _={width:r4(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=a4(h),x=a4(u),S=a4(p),k="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[k]=r4(null!==(i=c.spacing)&&void 0!==i?i:8),x[k]=r4(null!==(s=u.spacing)&&void 0!==s?s:26),S[k]=r4(null!==(n=p.spacing)&&void 0!==n?n:0);const C=Math.max(o4(p),o4(u));return y.lineHeight=C>0?`${C}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(K3))),l=a.find((t=>t.className.includes($3)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(K3),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(h4(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${Y3}-column`),e.classList.add(`${Y3}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add($3),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];h4(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));h4(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${Y3}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=t4(e.key),e.keyStyle&&a4(e.keyStyle,l)):"value"===i?(o.innerHTML=t4(e.value),e.valueStyle&&a4(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,g=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?J3(t.shapeLineWidth)+"px":"0px";let m="currentColor";const y=()=>c?J3(c):m,_=g,b=t=>new Jp({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ne));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const w=su.IsGradientStr(u);if(!u||v(u)&&!w||d)return m=d?"none":u?J3(u):"currentColor",`\n \n \n \n `;const M=w?su.Parse(u):p(u)?u:null;if(M){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=M.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===M.gradient?t=`\n ${i}\n `:"linear"===M.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),h4(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes($3))),h=[...o.children].find((t=>t.className.includes(K3)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(u(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(K3)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=YC(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,h4(l,c))}const p=l.children,g=[];if(p){for(let i=0;i{c4(d4)},p4={fontFamily:ew.fontFamily,spacing:10,wordBreak:"break-word"},g4=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=xf({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n});return{width:r.width(),height:r.height(),text:s}};function f4(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:p4),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:u(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const m4=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return u(a)&&(r.cornerRadius=[a,a,a,a]),r};class v4 extends n4{constructor(){super(v4.type),this.type=vU.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new OX({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:p,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=ai(d.padding),b=$C(d.padding),x=f4(Object.assign({textAlign:"right"===y?"right":"left"},p),i),S=f4(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=f4(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},C={panel:m4(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:w={},content:M=[]}=t;let T=b.left+b.right,B=b.top+b.bottom,E=0;const P=!!M.length;let O=0,R=0,I=0,D=0;if(P){const t=[],e=[],i=[],s=[];let n=0;C.content=M.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:p,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:C}=r,w={height:0,spaceRow:null!=_?_:v};if(u(h)){const i=lw({},S,f4(b,void 0,{})),{width:s,height:n,text:r}=g4(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),y?e.push(s):t.push(s),o=Math.max(o,n)}if(u(m)){const t=lw({},A,f4(x,void 0,{})),{width:e,height:s,text:n}=g4(m,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};C?t.stroke=d:t.fill=d,t.stroke=null!=p?p:d,t.lineWidth=g,w.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aW.autoWidth&&!1!==W.multiLine;if(H){W=lw({},x,f4(N,void 0,{})),U()&&(W.multiLine=null===(r=W.multiLine)||void 0===r||r,W.maxWidth=null!==(a=W.maxWidth)&&void 0!==a?a:P?Math.ceil(E):void 0);const{text:t,width:e,height:i}=g4(j,W);C.title.value=Object.assign(Object.assign({width:U()?Math.min(e,null!==(o=W.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},W),{text:t}),L=C.title.value.width,F=C.title.value.height,z=F+(P?C.title.spaceRow:0)}return B+=z,C.title.width=L,C.title.height=F,U()?T+=E||L:T+=Math.max(L,E),P&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=T-b.left-b.right-D-O-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=T,C.panel.height=B,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?u(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}v4.type=vU.canvas;const y4=()=>{c4(v4)},_4=(t="chart",e,i)=>{var s,r,a,o,l,h,c,d,u,p,g;const f={modelInfo:[]};if("chart"===t)f.isChart=!0,f.modelInfo.push({spec:e,type:"chart"});else if("region"===t)f.modelType="region",f.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(r=e.series)||void 0===r||r.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(kC).includes(t))f.modelType="series",f.specKey="series",f.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&f.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(n).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=hw.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=G(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=G(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=hw.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=G(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);G(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},b4=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:u,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=_4(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!d(e)||G(e).some((e=>c(e)?e(t,i,s):nw(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=lw({},i),m=c(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:lw(f,m),hasChanged:!0};const i=lw({},t,m);rw(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);y(f[u])?f[u].push(t):d(f[u])?f[u]="component"===h?t:[t]:f[u]=[f[u],t]}return{chartSpec:f,hasChanged:!0}},x4=t=>{hw.registerChartPlugin(t.type,t)};class S4 extends BN{constructor(){super(S4.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[S4.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[S4.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=ow(this._option.globalInstance.getSpec(),["data",S4.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=ow(this._baseChartSpec,["data",S4.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(u(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(u(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(u(t.minWidth)&&e.width{const n=b4(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=ow(i,["data",S4.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}S4.pluginType="chart",S4.specKey="media",S4.type="MediaQueryPlugin";const A4=()=>{x4(S4)},k4=/\{([^}]+)\}/,C4=/\{([^}]+)\}/g,w4=/:/;class M4 extends BN{constructor(){super(M4.type),this.type="formatterPlugin",this._timeModeFormat={utc:vi.getInstance().timeUTCFormat,local:vi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ci.getInstance().format,this._numericSpecifier=Ci.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[M4.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;c(r)?this._formatter=r:(this._formatter=this._format.bind(this),c(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),hw.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=k4.test(i),this._isNumericFormatterCache.set(i,s))),s){return i.replace(C4,((t,i)=>{if(!w4.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}))}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(Si.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}M4.pluginType="chart",M4.specKey="formatter",M4.type="formatterPlugin";const T4=()=>{x4(M4)};class B4 extends BN{constructor(){super(B4.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[B4.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=kK(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom{x4(B4)};eH.useRegisters([()=>{kL(),rI.registerBuiltInAnimate("scaleIn",pD),rI.registerBuiltInAnimate("scaleOut",gD),rI.registerBuiltInAnimate("fadeIn",PI),rI.registerBuiltInAnimate("fadeOut",OI),rI.registerBuiltInAnimate("moveIn",oD),rI.registerBuiltInAnimate("moveOut",lD),rI.registerBuiltInAnimate("rotateIn",dD),rI.registerBuiltInAnimate("rotateOut",uD),rI.registerBuiltInAnimate("update",_D),rI.registerBuiltInAnimate("state",fD),rI.registerBuiltInAnimate("fromTo",RI),rI.registerBuiltInAnimate(aT,Iz)},()=>{SU(),kU(),wU(),QW(),JW(),IW(),CW(),gN(),mN(),Nz(),zz(),rW(),xW(),hw.registerSeries(DW.type,DW),hw.registerChart(MU.type,MU)},()=>{SU(),kU(),wU(),JW(),IW(),CW(),gN(),EU(),mN(),RU(),rW(),xW(),hw.registerSeries(LX.type,LX),QW(),hw.registerChart(zX.type,zX)},()=>{SU(),kU(),wU(),JW(),QX(),QW(),hw.registerChart(eK.type,eK)},()=>{SU(),kU(),QW(),JW(),uK(),hw.registerChart(gK.type,gK)},()=>{kU(),pq(),hw.registerChart(_1.type,_1)},()=>{SU(),kU(),QW(),JW(),Oq(),hw.registerChart(S1.type,S1)},()=>{SU(),kU(),wU(),QW(),JW(),Nq(),hw.registerChart(k1.type,k1)},()=>{SU(),kU(),wU(),QW(),JW(),QX(),hw.registerTransform("bin",qr),hw.registerChart(E1.type,E1)},()=>{kU(),TK(),_K(),hw.registerSeries(EK.type,EK),hw.registerImplement("registerMap",WM),hw.registerImplement("unregisterMap",UM),Hz(),hw.registerChart(p1.type,p1)},()=>{kU(),T0(),hw.registerSeries(E0.type,E0),rq(),rZ(),Tq(),hZ(),hw.registerChart(I1.type,I1)},()=>{kU(),QJ(),hw.registerChart(F1.type,F1)},()=>{kU(),bQ(),hw.registerChart(H1.type,H1)},()=>{SU(),kU(),wU(),QW(),JW(),a$(),hw.registerChart(Z1.type,Z1)},()=>{SU(),kU(),QW(),JW(),E$(),hw.registerTransform("boxplot",Zr),hw.registerChart(Q1.type,Q1)},()=>{SU(),kU(),QW(),JW(),hZ(),hw.registerChart(O1.type,O1)},()=>{SU(),kU(),QW(),JW(),yZ(),hw.registerChart(N1.type,N1)},()=>{SU(),kU(),QW(),JW(),N$(),hw.registerChart(W1.type,W1)},()=>{SU(),kU(),wU(),QW(),JW(),EU(),rW(),xW(),hw.registerSeries(Y$.type,Y$),hw.registerChart(s2.type,s2)},()=>{kU(),zQ(),hw.registerChart(G1.type,G1)},()=>{kU(),UQ(),hw.registerChart(X1.type,X1)},()=>{kU(),y0(),hw.registerChart($1.type,$1)},()=>{kU(),jU(),c0(),hw.registerChart(e2.type,e2)},()=>{kU(),z0(),hw.registerChart(r2.type,r2)},()=>{kU(),Q0(),hw.registerChart(o2.type,o2)},()=>{SU(),kU(),wU(),QW(),hw.registerChart(w1.type,w1),JW()},xW,rW,()=>{hw.registerGraphicComponent(iV.lineAxis,((t,e)=>new QV(t,e))),hw.registerGraphicComponent(sV.lineAxisGrid,((t,e)=>new TV(t,e))),uV(),hw.registerComponent(RX.type,RX)},()=>{hw.registerGraphicComponent(iV.lineAxis,((t,e)=>new QV(t,e))),hw.registerGraphicComponent(sV.lineAxisGrid,((t,e)=>new TV(t,e))),uV(),hw.registerComponent(IX.type,IX)},()=>{hw.registerGraphicComponent(iV.lineAxis,((t,e)=>new QV(t,e))),hw.registerGraphicComponent(sV.lineAxisGrid,((t,e)=>new TV(t,e))),uV(),hw.registerComponent(DX.type,DX)},Eq,Tq,()=>{hw.registerComponent(g2.type,g2)},()=>{hw.registerComponent(w2.type,w2)},()=>{hw.registerComponent(F2.type,F2)},()=>{hw.registerComponent(Y2.type,Y2)},()=>{hw.registerComponent(X2.type,X2)},()=>{hw.registerComponent(h5.type,h5)},()=>{hw.registerComponent(u5.type,u5)},()=>{hw.registerComponent(m5.type,m5)},TK,()=>{hw.registerComponent(u3.type,u3),TY()},()=>{hw.registerComponent(v3.type,v3),EY()},()=>{hw.registerComponent(D3.type,D3),IY()},()=>{hw.registerComponent(p3.type,p3),OY._animate=hY,TY()},()=>{hw.registerComponent(y3.type,y3),RY._animate=dY,EY()},()=>{hw.registerComponent(L3.type,L3),IY()},()=>{hw.registerComponent(F3.type,F3),IY()},()=>{hw.registerComponent(g3.type,g3)},()=>{hw.registerComponent(C3.type,C3)},()=>{hw.registerGraphicComponent(E3.type,(t=>new xG(t))),T3(),rV(),hw.registerComponent(E3.type,E3,!0,1/0)},()=>{hw.registerGraphicComponent(P3.type,(t=>new xG(t))),T3(),rV(),hw.registerComponent(P3.type,P3,!0)},()=>{hw.registerComponent(N3.type,N3)},()=>{hw.registerComponent(W3.type,W3)},()=>{QU(qy()),QU(mb()),vb()},()=>{hw.registerLayout(U3.type,U3)},y4,Xz,qz]),eH.useRegisters([()=>{YP(e_)}]);export{xF as AttributeLevel,EN as AxisSyncPlugin,v4 as CanvasTooltipHandler,PM as ChartEvent,B4 as ChartResizeZoomPlugin,Dw as DEFAULT_CHART_HEIGHT,Iw as DEFAULT_CHART_WIDTH,nH as DEFAULT_CLOSE_STROKE_JOIN,Fw as DEFAULT_DATA_INDEX,zw as DEFAULT_DATA_KEY,Hw as DEFAULT_DATA_SERIES_FIELD,nM as DEFAULT_KEY,vF as DEFAULT_LAYOUT_RECT_LEVEL,yF as DEFAULT_LAYOUT_RECT_LEVEL_MIN,sH as DEFAULT_LINEAR_INTERPOLATE,rM as DEFAULT_MAP_LOOK_UP_KEY,Lw as DEFAULT_MEASURE_CANVAS_ID,jw as DEFAULT_SERIES_STYLE_NAME,iH as DEFAULT_SMOOTH_INTERPOLATE,SL as DefaultTicker,rH as Direction,d4 as DomTooltipHandler,hw as Factory,M4 as FormatterPlugin,bF as LayoutLevel,_F as LayoutZIndex,eM as MOSAIC_CAT_END_PERCENT,tM as MOSAIC_CAT_START_PERCENT,Qw as MOSAIC_VALUE_END_PERCENT,Jw as MOSAIC_VALUE_START_PERCENT,oH as ManualTicker,S4 as MediaQuery,Rw as PREFIX,s as RenderModeEnum,sM as SEGMENT_FIELD_END,iM as SEGMENT_FIELD_START,Ww as STACK_FIELD_END,Xw as STACK_FIELD_END_OffsetSilhouette,Gw as STACK_FIELD_END_PERCENT,Nw as STACK_FIELD_KEY,Vw as STACK_FIELD_START,Yw as STACK_FIELD_START_OffsetSilhouette,Uw as STACK_FIELD_START_PERCENT,Kw as STACK_FIELD_TOTAL,Zw as STACK_FIELD_TOTAL_BOTTOM,$w as STACK_FIELD_TOTAL_PERCENT,qw as STACK_FIELD_TOTAL_TOP,AF as STATE_VALUE_ENUM,rL as StreamLight,Cw as ThemeManager,qM as TransformLevel,mF as USER_LAYOUT_RECT_LEVEL,eH as VChart,KC as boundsInRect,gw as builtinThemes,YC as calcLayoutNumber,XC as calcPadding,EC as computeActualDataScheme,qC as convertPoint,Xg as createArc,Ug as createArea,ef as createGroup,ig as createLine,ag as createRect,zg as createRichText,Qp as createSymbol,Xp as createText,sw as darkTheme,JC as dataScheme,eH as default,fw as defaultThemeName,OC as getActualColor,ZC as getActualNumValue,LC as getColorSchemeBySeries,BC as getDataScheme,uw as getFunnelTheme,Aw as getMergedTheme,cH as getSpecInfo,bw as getTheme,yw as hasThemeMerged,RC as isColorKey,UC as isPercent,GC as isPercentOffset,IC as isProgressiveDataColorScheme,tw as isTokenKey,WC as isValidOrient,iw as lightTheme,dH as lookup,Ow as measureText,$C as normalizeLayoutPaddingSpec,PC as queryColorFromColorScheme,QC as queryToken,y4 as registerCanvasTooltipHandler,x4 as registerChartPlugin,E4 as registerChartResizeZoomPlugin,HM as registerDataSetInstanceParser,zM as registerDataSetInstanceTransform,u4 as registerDomTooltipHandler,T4 as registerFormatPlugin,A4 as registerMediaQuery,_w as registerTheme,xw as removeTheme,Sw as themeExist,mw as themes,ew as token,DC as transformColorSchemeToStandardStruct,AM as transformToGraphic,uH as version,t_ as vglobal,lA as warn}; diff --git a/packages/lark-vchart/package.json b/packages/lark-vchart/package.json index 8ef9f4d3d2..225806f31e 100644 --- a/packages/lark-vchart/package.json +++ b/packages/lark-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/lark-vchart", - "version": "2.0.22", + "version": "2.1.0", "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 049c93c048..5b19d37a5a 100644 --- a/packages/lark-vchart/src/vchart/index.js +++ b/packages/lark-vchart/src/vchart/index.js @@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function V(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function U(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(V(t)!==V(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=N(t),n=N(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!U(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=it){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var _t=function(t,e,i){return ti?i:t};var yt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=m(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Mt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function wt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const Ct=4294967296;const Et=t=>e=>L(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(y(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Lt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Rt=t=>0,Ot=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=It(f.min,f);for(let r=0;r=1?Ht:t<=-1?-Ht:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ae{static distancePP(t,e){return Kt(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Kt(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return Kt(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Vt;)t+=Vt;else if(t>0)for(;t>Vt;)t-=Vt;return t};function ce(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=pe(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(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 me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ye(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Me(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function we(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ce(t,e){const i=e?oe(t.angle):t.angle,s=we(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=Ce(t,i),n=Ce(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(we(t),we(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+Ht;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+Ht;u>Nt&&(u-=Nt),g>Nt&&(g-=Nt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Me(n,i)+Me(n,s))/2>Me(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Oe(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Fe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(_(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return He(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ne extends Ve{}class Ue extends Ve{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ue(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class We{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new We,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new We;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new We(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=le(r.rotateDeg),r}}class Ge{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Ye(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Xe(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const $e=/^#([0-9a-f]{3,8})$/,Ke={transparent:4294967040},qe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ze(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Je(t){return S(t)?new si(t>>16,t>>8&255,255&t,1):y(t)?new si(t[0],t[1],t[2]):new si(255,255,255)}function Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ei=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new si((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Je(t):8===e?new si(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ii{static Brighter(t,e=1){return 1===e?t:new ii(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ii(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ii?t:new ii(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Ke[t]))return function(t){return S(t)?new si(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new si(t[0],t[1],t[2],t[3]):new si(255,255,255,1)}(Ke[t]);if(p(qe[t]))return Je(qe[t]);const e=`${t}`.trim().toLowerCase(),i=ei(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new si(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new si(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ii.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new si(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Xe(this.color.r,this.color.g,this.color.b),r=Ye(u(t)?n.h:_t(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new si(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ei(e,!0);return null!=i?i:this}setColorName(t){const e=qe[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ii(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class si{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Ze(this.r)+Ze(this.g)+Ze(this.b)+(1===this.opacity?"":Ze(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Xe(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ni(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new si(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Xe});function ai(t){if(k(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function oi(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function li(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function hi(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const ci=1e-10;function di(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ci)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=fi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ui(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ci,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ui(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function pi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ui(t,t-(i*i-e*e+t*t)/(2*i))+ui(e,s)}function gi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function fi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let _i;function yi(t,e){const i=vi(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class bi{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const xi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Si(t){let e;if(e=xi.exec(t))return new bi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});ot.getInstance().error("invalid format: "+t)}const Ai=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class ki{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return ki.instance||(ki.instance=new ki),ki.instance}newFormat(t){const e=Si(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Mi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?m:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?Ai[8+_i/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Si(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=vi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ai[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>yi(100*t,e),r:yi,s:function(t,e){const i=vi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(_i=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+vi(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function Ti(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Bi(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Bi(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Ri(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ei(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},ts=Math.sqrt,es=Math.tan;function is(t){return t>1?0:t<-1?ji:Math.acos(t)}function ss(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function ns(){}function rs(t,e){t&&os.hasOwnProperty(t.type)&&os[t.type](t,e)}var as={Feature:function(t,e){rs(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sji?t+Math.round(-t/Ni)*Ni:t,e]}function bs(t,e,i){return(t%=Ni)?e||i?_s(Ss(t),As(e,i)):Ss(t):e||i?As(e,i):ys}function xs(t){return function(e,i){return[(e+=t)>ji?e-Ni:e<-ji?e+Ni:e,i]}}function Ss(t){var e=xs(t);return e.invert=xs(-t),e}function As(t,e){var i=$i(t),s=Ji(t),n=$i(e),r=Ji(e);function a(t,e){var a=$i(e),o=$i(t)*a,l=Ji(t)*a,h=Ji(e),c=h*i+o*s;return[Xi(l*n-c*r,o*i-h*s),ss(c*n+l*r)]}return a.invert=function(t,e){var a=$i(e),o=$i(t)*a,l=Ji(t)*a,h=Ji(e),c=h*n-l*r;return[Xi(l*n+h*r,o*i+c*s),ss(c*i-o*s)]},a}function ks(t,e){(e=us(e))[0]-=t,vs(e);var i=is(-e[1]);return((-e[2]<0?-i:i)+Ni-zi)%Ni}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ns,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ts(t,e){return Gi(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function Es(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Is(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function Ds(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Is(a);var t=function(t,e){var i=Rs(e),s=e[1],n=Ji(s),r=[Ji(i),-$i(i),0],a=0,o=0;Ls.reset(),1===n?s=Hi+zi:-1===n&&(s=-Hi-zi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>ji,w=f*x;if(Ls.add(Xi(w*k*Ji(M),m*S+w*$i(M))),a+=T?A+k*Ni:A,T^p>=i^y>=i){var C=gs(us(u),us(_));vs(C);var E=gs(r,C);vs(E);var B=(T^A>=0?-1:1)*ss(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-zi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Fs))}return u}}function Fs(t){return t.length>1}function zs(t,e){return((t=t.x)[0]<0?t[1]-Hi-zi:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-zi:Hi-e[1])}1===(Bs=Os).length&&(Ps=Bs,Bs=function(t,e){return Os(Ps(t),e)});var js=Ds((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?ji:-ji,l=Gi(r-i);Gi(l-ji)0?Hi:-Hi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=ji&&(Gi(i-n)zi?Yi((Ji(e)*(r=$i(s))*Ji(i)-Ji(s)*(n=$i(e))*Ji(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*Hi,s.point(-ji,n),s.point(0,n),s.point(ji,n),s.point(ji,0),s.point(ji,-n),s.point(0,-n),s.point(-ji,-n),s.point(-ji,0),s.point(-ji,n);else if(Gi(t[0]-e[0])>zi){var r=t[0]0,n=Gi(e)>zi;function r(t,i){return $i(t)*$i(i)>e}function a(t,i,s){var n=[1,0,0],r=gs(us(t),us(i)),a=ps(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=gs(n,r),u=ms(n,h);fs(u,ms(r,c));var p=d,g=ps(u,p),f=ps(p,p),m=g*g-f*(ps(u,u)-1);if(!(m<0)){var v=ts(m),_=ms(p,(-g-v)/f);if(fs(_,u),_=ds(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Gi(_[0]-b)ji^(b<=_[0]&&_[0]<=x)){var T=ms(p,(-g+v)/f);return fs(T,u),[_,ds(T)]}}}function o(e,i){var n=s?t:ji-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Ds(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?ji:-ji),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ts(e,p)||Ts(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&Ts(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=$i(e),o=Ji(e),l=s*i;null==n?(n=e+s*Ni,r=e-l/2):(n=ks(a,n),r=ks(a,r),(s>0?nr)&&(n+=s*Ni));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Gi(s[0]-t)0?0:3:Gi(s[0]-i)0?2:1:Gi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,_,y=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=Is(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Cs(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&m)y.point(r,a);else{var l=[g=Math.max(Ns,Math.min(Vs,g)),f=Math.max(Ns,Math.min(Vs,f))],b=[r=Math.max(Ns,Math.min(Vs,r)),a=Math.max(Ns,Math.min(Vs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ws(t){return t}var Gs,Ys,Xs,$s,Ks=Oi(),qs=Oi(),Zs={point:ns,lineStart:ns,lineEnd:ns,polygonStart:function(){Zs.lineStart=Js,Zs.lineEnd=en},polygonEnd:function(){Zs.lineStart=Zs.lineEnd=Zs.point=ns,Ks.add(Gi(qs)),qs.reset()},result:function(){var t=Ks/2;return Ks.reset(),t}};function Js(){Zs.point=Qs}function Qs(t,e){Zs.point=tn,Gs=Xs=t,Ys=$s=e}function tn(t,e){qs.add($s*t-Xs*e),Xs=t,$s=e}function en(){tn(Gs,Ys)}var sn=Zs,nn=1/0,rn=nn,an=-nn,on=an;var ln,hn,cn,dn,un={point:function(t,e){tan&&(an=t);eon&&(on=e)},lineStart:ns,lineEnd:ns,polygonStart:ns,polygonEnd:ns,result:function(){var t=[[nn,rn],[an,on]];return an=on=-(rn=nn=1/0),t}},pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn=0,Sn={point:An,lineStart:kn,lineEnd:wn,polygonStart:function(){Sn.lineStart=Cn,Sn.lineEnd=En},polygonEnd:function(){Sn.point=An,Sn.lineStart=kn,Sn.lineEnd=wn},result:function(){var t=xn?[yn/xn,bn/xn]:_n?[mn/_n,vn/_n]:fn?[pn/fn,gn/fn]:[NaN,NaN];return pn=gn=fn=mn=vn=_n=yn=bn=xn=0,t}};function An(t,e){pn+=t,gn+=e,++fn}function kn(){Sn.point=Mn}function Mn(t,e){Sn.point=Tn,An(cn=t,dn=e)}function Tn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,An(cn=t,dn=e)}function wn(){Sn.point=An}function Cn(){Sn.point=Bn}function En(){Pn(ln,hn)}function Bn(t,e){Sn.point=Pn,An(ln=cn=t,hn=dn=e)}function Pn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,yn+=(n=dn*t-cn*e)*(cn+t),bn+=n*(dn+e),xn+=3*n,An(cn=t,dn=e)}var Ln=Sn;function Rn(t){this._context=t}Rn.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,Ni)}},result:ns};var On,In,Dn,Fn,zn,jn=Oi(),Hn={point:ns,lineStart:function(){Hn.point=Vn},lineEnd:function(){On&&Nn(In,Dn),Hn.point=ns},polygonStart:function(){On=!0},polygonEnd:function(){On=null},result:function(){var t=+jn;return jn.reset(),t}};function Vn(t,e){Hn.point=Nn,In=Fn=t,Dn=zn=e}function Nn(t,e){Fn-=t,zn-=e,jn.add(ts(Fn*Fn+zn*zn)),Fn=t,zn=e}var Un=Hn;function Wn(){this._string=[]}function Gn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Yn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),cs(t,i(s))),s.result()}return r.area=function(t){return cs(t,i(sn)),sn.result()},r.measure=function(t){return cs(t,i(Un)),Un.result()},r.bounds=function(t){return cs(t,i(un)),un.result()},r.centroid=function(t){return cs(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ws):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Wn):new Rn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Xn(t){return function(e){var i=new $n;for(var s in t)i[s]=t[s];return i.stream=e,i}}function $n(){}function Kn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),cs(i,t.stream(un)),e(un.result()),null!=s&&t.clipExtent(s),t}function qn(t,e,i){return Kn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Zn(t,e,i){return qn(t,[[0,0],e],i)}function Jn(t,e,i){return Kn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Qn(t,e,i){return Kn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Wn.prototype={_radius:4.5,_circle:Gn(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=Gn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},$n.prototype={constructor:$n,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var tr=16,er=$i(30*Wi);function ir(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=ts(b*b+x*x+S*S),k=ss(S/=A),M=Gi(Gi(S)-1)e||Gi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Wi:0,E()):[m*Ui,v*Ui,_*Ui]},w.angle=function(t){return arguments.length?(y=t%360*Wi,E()):y*Ui},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=ir(o,T=t*t),B()):ts(T)},w.fitExtent=function(t,e){return qn(w,t,e)},w.fitSize=function(t,e){return Zn(w,t,e)},w.fitWidth=function(t,e){return Jn(w,t,e)},w.fitHeight=function(t,e){return Qn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function lr(t){var e=0,i=ji/3,s=or(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Wi,i=t[1]*Wi):[e*Ui,i*Ui]},n}function hr(t,e){var i=Ji(t),s=(i+Ji(e))/2;if(Gi(s)2?t[2]*Wi:0),e.invert=function(e){return(e=t.invert(e[0]*Wi,e[1]*Wi))[0]*=Ui,e[1]*=Ui,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===mr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function _r(t){return es((Hi+t)/2)}function yr(t,e){var i=$i(t),s=t===e?Ji(t):qi(i/$i(e))/qi(_r(e)/_r(t)),n=i*Zi(_r(t),s)/s;if(!s)return mr;function r(t,e){n>0?e<-Hi+zi&&(e=-Hi+zi):e>Hi-zi&&(e=Hi-zi);var i=n/Zi(_r(e),s);return[i*Ji(s*t),n-i*$i(s*t)]}return r.invert=function(t,e){var i=n-e,r=Qi(s)*ts(t*t+i*i),a=Xi(t,Gi(i))*Qi(i);return i*s<0&&(a-=ji*Qi(t)*Qi(i)),[a/s,2*Yi(Zi(n/r,1/s))-Hi]},r}function br(t,e){return[t,e]}function xr(t,e){var i=$i(t),s=t===e?Ji(t):(i-$i(e))/(e-t),n=i/s+t;if(Gi(s)zi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Br.invert=pr(ss),Pr.invert=pr((function(t){return 2*Yi(t)})),Lr.invert=function(t,e){return[-e,2*Yi(Ki(t))-Hi]};var Ir={exports:{}},Dr=function(t,e){this.p1=t,this.p2=e};Dr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Dr.prototype.run=function(){return this.p2[0]-this.p1[0]},Dr.prototype.slope=function(){return this.rise()/this.run()},Dr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Dr.prototype.isVertical=function(){return!isFinite(this.slope())},Dr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Dr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Dr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Dr.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)},Dr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Fr=Dr,zr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Fr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=zr(t.slice(0,s),e),o=zr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},jr=zr;!function(t){var e=jr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Vr(Wr,e),{tolerance:s}=i;return Hr(t,s)};var Yr;!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"}(Yr||(Yr={}));const Xr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let M=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/M:0,T.push(_[t])}return T},Kr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],w=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=w.length?w:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:M,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!T.length)return $r(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...w,...T];return $r(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",w=null!==(o=k.mean)&&void 0!==o?o:"mean",C=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",L=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",O=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",I=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,j=new Map,H=new Map,V=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&j.set(r,[]),y(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=j.get(r);t&&t.push(i)}}y(S)&&(S=[_t(Math.min.apply(null,S),0,1),_t(Math.max.apply(null,S),0,1)]);const N=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[w]=o,f[C]=l,f[E]=h,f[B]=c,f[P]=d,f[L]=n,f[R]=r,f[O]=u,f[I]=p,f[D]=g,A&&(f[F]=j.get(t)||[]),N.push(f)}return N};var Zr={},Jr={};function Qr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ta(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ea(t,e){var i=t+"",s=i.length;return s9999?"+"+ea(e,6):ea(e,4))+"-"+ea(t.getUTCMonth()+1,2)+"-"+ea(t.getUTCDate(),2)+(r?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"."+ea(r,3)+"Z":n?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"Z":s||i?"T"+ea(i,2)+":"+ea(s,2)+"Z":"")}function sa(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Jr;if(h)return h=!1,Zr;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a0}function ga(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=oa(t));var r=[];switch(t.type){case"GeometryCollection":return fa(t,(function(t){va(t,s)})),t;case"FeatureCollection":return ga(t,(function(t){ga(va(t,s),(function(t){r.push(t)}))})),hi(r)}return va(t,s)}function va(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return fa(t,(function(t){va(t,e)})),t;case"LineString":return _a(ua(t),e),t;case"Polygon":return ya(ua(t),e),t;case"MultiLineString":return ua(t).forEach((function(t){_a(t,e)})),t;case"MultiPolygon":return ua(t).forEach((function(t){ya(t,e)})),t;case"Point":case"MultiPoint":return t}}function _a(t,e){pa(t)===e&&t.reverse()}function ya(t,e){pa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ba(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ka=(t,e={},i)=>{i.type=Yr.GEO;const s=Vr(Sa,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Aa(t))})):e.push(Aa(t))})),e})(t);let l=t.features;return o&&(l=ma(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=xa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=xa.bounds(t);t.bbox=e}})),t.features=l,t},Ma={},Ta=(t,e,i)=>{i.type=Yr.GEO;const s=Vr(Sa,Ma,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Or(a,t)}))}:Or(a,o));var a,o;return ka(r,s,i)},wa=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Ca=0;function Ea(t="dataset"){return Ca>1e8&&(Ca=0),t+"_"+Ca++}class Ba{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:Ea("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Pa{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ea("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Pa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?j({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Xr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Yn();const La={},Ra={albers:dr,albersusa:function(){var t,e,i,s,n,r,a=dr(),o=cr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=cr().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}},Oa=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ia(t,e){return function i(){const s=e();return s.type=t,s.path=Yn().projection(s),s.copy=s.copy||function(){const t=i();return Oa.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Da{static GenAutoIncrementId(){return Da.auto_increment_id++}}Da.auto_increment_id=0;class Fa{constructor(t){this.id=Da.GenAutoIncrementId(),this.registry=t}}const za="named",ja="inject",Ha="multi_inject",Va="inversify:tagged",Na="inversify:paramtypes";class Ua{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===za?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Wa=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Ga(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Wa.hasOwnMetadata(t,e)&&(r=Wa.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Wa.defineMetadata(t,r,e)}(Va,t,i.toString(),s)}function Ya(t){return(e,i,s)=>{Ga(e,0,s,t)}}function Xa(t){return e=>(i,s,n)=>Ya(new Ua(t,e))(i,s,n)}const $a=Xa(ja),Ka=Xa(Ha);function qa(){return function(t){return Wa.defineMetadata(Na,null,t),t}}function Za(t){return Ya(new Ua(za,t))}const Ja="Singleton",Qa="Transient",to="ConstantValue",eo="DynamicValue",io="Factory",so="Function",no="Instance",ro="Invalid";class ao{constructor(t,e){this.id=Da.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=ro,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new ao(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ja&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class oo{getConstructorMetadata(t){return{compilerGeneratedMetadata:Wa.getMetadata(Na,t),userGeneratedMetadata:Wa.getMetadata(Va,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const lo=(ho=za,t=>{const e=e=>{if(null==e)return!1;if(e.key===ho&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const po=Symbol("ContributionProvider");class go{constructor(t,e){this.serviceIdentifier=t,this.container=e,mo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function fo(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).inSingletonScope().whenTargetNamed(e)}class mo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}mo.store=new Map;class vo{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class _o extends vo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const yo=Symbol.for("EnvContribution"),bo=Symbol.for("VGlobal"),xo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Qa,this.options=e,this.id=Da.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new oo}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,za,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new ao(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new uo(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[ja],multiInject:s[Ha]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case to:case so:e=t.cache;break;case no:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Ja&&(t.cache=e,t.activated=!0)}},So=Symbol.for("RenderService");const Ao=new class{get renderService(){return this._renderService||(this._renderService=xo.get(So)),this._renderService}};let ko=0;class Mo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Ao.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++ko,t),this.tryRunAnimationFrameNextFrame(),ko}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class To{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var wo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Co=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eo=function(t,e){return function(i,s){e(i,s,t)}},Bo=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let Po=class extends To{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Da.GenAutoIncrementId(),this.hooks={onSetEnv:new _o(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Mo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Bo(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Lo,Ro,Oo,Io;Po=wo([qa(),Eo(0,$a(po)),Eo(0,Za(yo)),Co("design:paramtypes",[Object])],Po),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Lo||(Lo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Ro||(Ro={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Oo||(Oo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Io||(Io={}));const Do=Vt-1e-8;class Fo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Do)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Vt)<0&&(s+=Vt),(n%=Vt)<0&&(n+=Vt),nn;++o,a-=Ht)g(a);else for(a=s-s%Ht+Ht,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const jo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ho={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},Vo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let No,Uo,Wo,Go,Yo,Xo;var $o,Ko,qo,Zo,Jo,Qo;function tl(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),f=Math.cos(n),m=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,A=i+m,k=S+y*m,M=A-y*f;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function el(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=oe(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Vt:C>0&&0===r&&(C-=Vt);const E=Math.ceil(Math.abs(C/(Ht+.001))),B=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function sl(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=cl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function ul(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new pl(i,n),new pl(n,s)]}class pl extends nl{constructor(t,e){super(),this.type=Jo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p1.x):t===Zo.COLUMN?Ut(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class gl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new pl(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Zo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ut(t.p0.y-s.y)}if(t===Zo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ut(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class fl extends gl{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function ml(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function vl(t,e,i){const s=null!=e?e:Ut(i[i.length-1].x-i[0].x)>Ut(i[i.length-1].y-i[0].y)?Zo.ROW:Zo.COLUMN;return"monotoneY"===t?new fl(t,s):new gl(t,s)}class _l{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 yl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new _l(n,s),t),n}function bl(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class xl{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&bl(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:bl(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 Sl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("basis",i,t);return function(t,e){ml(t,e,2)}(new xl(n,s),t),n}function Al(t){return t<0?-1:1}function kl(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Al(r)+Al(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ml(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Tl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class wl{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Tl(this,this._t0,Ml(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Tl(this,Ml(this,e=kl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Tl(this,this._t0,e=kl(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class Cl extends wl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function El(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneX",i,t);return function(t,e){ml(t,e,2)}(new wl(n,s),t),n}function Bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneY",i,t);return function(t,e){ml(t,e,2)}(new Cl(n,s),t),n}let Pl=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class Ll extends Pl{lineEnd(){this.context.closePath()}}function Rl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Pl(r,e,n),t),r}function Ol(t,e){return ml(t,e,1)}class Il extends _l{lineEnd(){this.context.closePath()}}function Dl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new Il(n,s),t),n}function Fl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function zl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return yl(i,n);const o=vl(t,r,i);return ml(new e(o,s,a),i,2),o}}const jl=zl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Hl=zl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Vl extends nl{constructor(t,e,i){super(),this.type=Jo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return hl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,rl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p2.x):t===Zo.COLUMN?Ut(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=Xt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=hl(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new Vl(i,a,r),new Vl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Nl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new pl(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new Vl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Ul(t,e,i){var s,n;switch(e){case"linear":default:return yl(t,i);case"basis":return Sl(t,i);case"monotoneX":return El(t,i);case"monotoneY":return Bl(t,i);case"step":return Rl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Ll(r,e,n),t),r}(t,.5,i);case"stepBefore":return Rl(t,0,i);case"stepAfter":return Rl(t,1,i);case"catmullRom":return jl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Hl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Dl(t,i)}}class Wl extends zo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Fo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Vo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Vo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Vo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([Vo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([Vo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([Vo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([Vo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([Vo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Vo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Nl(this);sl(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Vo.M]=t=>`M${t[1]} ${t[2]}`,t[Vo.L]=t=>`L${t[1]} ${t[2]}`,t[Vo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Vo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Vo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Vo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tXo){let t,e=Wo;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),sl(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Zo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.y-e.p1.y)}if(this.direction===Zo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),lh=Object.assign(Object.assign({},th),{points:[],cornerRadius:0,closePath:!0}),hh=Object.assign(Object.assign({},th),{width:100,height:100,spikes:5,thickness:.5}),ch=Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const dh=Object.assign(Object.assign({},th),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),uh=Object.assign(Object.assign(Object.assign({},th),Zl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),ph=Object.assign(Object.assign(Object.assign({},th),Zl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),gh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},th),{fill:!0,cornerRadius:0,cornerType:"round"}),fh=Object.assign(Object.assign({},gh),{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}),mh=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=m("shape",/^(circle)/i,0);return t&&(t.style=f()||h()),t}()||function(){const t=m("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return m("extent-keyword",t.extentKeywords,1)}function c(){if(m("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=m("hex",t.hexColor,1)||m("rgba",t.rgbaColor,1)||m("rgb",t.rgbColor,1)||m("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return m("%",t.percentageValue,1)||m("position-keyword",t.positionKeywords,1)||f()}function f(){return m("px",t.pixelValue,1)||m("em",t.emValue,1)}function m(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class vh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(vh.IsGradientStr(t))try{const e=mh(t)[0];if(e){if("linear"===e.type)return vh.ParseLinear(e);if("radial"===e.type)return vh.ParseRadial(e);if("conic"===e.type)return vh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2,n=parseFloat(e.value)/180*jt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Nt,stops:vh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:vh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2;let n="angular"===e.type?parseFloat(e.value)/180*jt:0;for(;n<0;)n+=Nt;for(;n>=Nt;)n-=Nt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const bh={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"}},xh=!0,Sh=!1,Ah=/\w|\(|\)|-/,kh=/[.?!,;:/,。?!、;:]/,Mh=/\S/,Th=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function wh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Ao.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Ch(t,a)),a}function Ch(t,e,i=!1){let s=e;for(;Ah.test(t[s-1])&&Ah.test(t[s])||kh.test(t[s]);)if(s--,s<=0)return i?Eh(t,e):e;return s}function Eh(t,e){let i=e;for(;Ah.test(t[i+1])&&Ah.test(t[i])||kh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Ao.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Ph=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Lh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=uh.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Ch(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Ch(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};Lh=Ph([qa()],Lh);var Rh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Oh=Symbol.for("TextMeasureContribution");let Ih=class extends Lh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Ih=Rh([qa()],Ih);const Dh=Symbol.for("CanvasFactory"),Fh=Symbol.for("Context2dFactory");function zh(t){return xo.getNamed(Dh,Ao.global.env)(t)}const jh=1e-4,Hh=Math.sqrt(3),Vh=1/3;function Nh(t){return t>-ec&&tec||t<-ec}const Wh=[0,0],Gh=[0,0],Yh=[0,0];function Xh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function $h(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Kh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function qh(t){return(t%=Nt)<0&&(t+=Nt),t}function Zh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Nt);let d=Math.atan2(l,o);return d<0&&(d+=Nt),d>=s&&d<=n||d+Nt>=s&&d+Nt<=n}function tc(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(Nh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const sc=[-1,-1,-1],nc=[-1,-1];function rc(){const t=nc[0];nc[0]=nc[1],nc[1]=t}function ac(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Nh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Vh):Math.pow(i,Vh),s=s<0?-Math.pow(-s,Vh):Math.pow(s,Vh);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+Hh*Math.sin(e)))/(3*a),h=(-o+i*(s-Hh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,sc);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&rc(),p=Kh(e,s,r,o,nc[0]),u>1&&(g=Kh(e,s,r,o,nc[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Nh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,sc);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=$h(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);sc[0]=-l,sc[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Nt-1e-4){s=0,n=Nt;const e=r?1:-1;return a>=sc[0]+t&&a<=sc[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Nt,n+=Nt);let c=0;for(let e=0;e<2;e++){const i=sc[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Nt+t),(t>=s&&t<=n||t+Nt>=s&&t+Nt<=n)&&(t>jt/2&&t<1.5*jt&&(e=-e),c+=e)}}return c}function hc(t){return Math.round(t/jt*1e8)/1e8%2*jt}function cc(t,e){let i=hc(t[0]);i<0&&(i+=Nt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Nt?n=i+Nt:e&&i-n>=Nt?n=i-Nt:!e&&i>n?n=i+(Nt-hc(i-n)):e&&i1&&(i||(h+=Re(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;dc[0]=S,dc[1]=A,cc(dc,Boolean(a[6])),S=dc[0],A=dc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Vo.M:u=m,p=v,c=u,d=p;break;case Vo.L:if(i){if(tc(c,d,m,v,e,s,n))return!0}else h+=Re(c,d,m,v,s,n)||0;c=m,d=v;break;case Vo.C:if(i){if(Jh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ac(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Vo.Q:if(i){if(Zh(c,d,m,v,_,y,e,s,n))return!0}else h+=oc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Vo.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Re(c,d,o,l,s,n),i){if(Qh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=lc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Vo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(tc(u,p,o,p,e,s,n)||tc(o,p,o,l,e,s,n)||tc(o,l,u,l,e,s,n)||tc(u,l,u,p,e,s,n))return!0}else h+=Re(o,p,o,l,s,n),h+=Re(u,l,u,p,s,n);break;case Vo.Z:if(i){if(tc(c,d,u,p,e,s,n))return!0}else h+=Re(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mc=Symbol.for("VWindow"),vc=Symbol.for("WindowHandlerContribution");let _c=class extends To{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){super(),this.hooks={onChange:new _o(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(xo.getNamed(vc,t.env).configure(this,t),this.actived=!0)},this._uid=Da.GenAutoIncrementId(),this.global=Ao.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&>(this.width,t.width())&>(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};_c=gc([qa(),fc("design:paramtypes",[])],_c);var yc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xc=function(t,e){return function(i,s){e(i,s,t)}};let Sc=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Ao.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=pc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Zl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Zl.fontFamily,fontSize:Zl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=xo.get(mc),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Ac;Sc=yc([qa(),xc(0,$a(po)),xc(0,Za(Oh)),bc("design:paramtypes",[Object])],Sc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Ac||(Ac={}));const kc=new We;let Mc=class{constructor(){this.matrix=new We}init(t){return this.mode=Ac.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Ac.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(kc.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(kc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}scale(t,e,i){return this.mode===Ac.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Ac.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return kc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}translate(t,e){return this.mode===Ac.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Ac.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Mc=yc([qa(),bc("design:paramtypes",[])],Mc);const Tc={arc:eh,area:ih,circle:sh,line:ah,path:oh,symbol:dh,text:uh,rect:ch,polygon:lh,star:hh,richtext:ph,richtextIcon:fh,image:gh,group:nh,glyph:rh},wc=Object.keys(Tc);function Cc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Ec={arc:Object.assign({},Tc.arc),area:Object.assign({},Tc.area),circle:Object.assign({},Tc.circle),line:Object.assign({},Tc.line),path:Object.assign({},Tc.path),symbol:Object.assign({},Tc.symbol),text:Object.assign({},Tc.text),rect:Object.assign({},Tc.rect),polygon:Object.assign({},Tc.polygon),star:Object.assign({},Tc.star),richtext:Object.assign({},Tc.richtext),richtextIcon:Object.assign({},Tc.richtextIcon),image:Object.assign({},Tc.image),group:Object.assign({},Tc.group),glyph:Object.assign({},Tc.glyph)};class Bc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},wc.forEach((t=>{this._defaultTheme[t]=Object.create(Ec[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;wc.forEach((s=>{const n=Object.create(Ec[s]);t&&t[s]&&Cc(n,t[s]),i[s]&&Cc(n,i[s]),e[s]&&Cc(n,e[s]),this.combinedTheme[s]=n})),e.common&&wc.forEach((t=>{Cc(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Pc=new Bc;function Lc(t,e){return t.glyphHost?Lc(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)):Pc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Lc(t.attachedThemeGraphic)||Pc.getTheme()}var Rc=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Oc extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=Da.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Rc(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Vc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Vc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Vc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Vc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Hc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Vc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(Vc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,Vc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Vc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof zc))return void ot.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Hc.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Nc(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Fc,this.rootWheelEvent=new zc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class Yc{static GetImage(t,e){var i;const s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Yc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Yc.cache.set(t,s),s.dataPromise=Ao.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Yc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Yc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ao.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ao.global.loadBlob(t):"json"===e&&(i.dataPromise=Ao.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Yc.isLoading&&Yc.toLoadAueue.length){Yc.isLoading=!0;const t=Yc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Yc.cache.set(i,n),n.dataPromise=Ao.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()})).catch((t=>{console.error(t),Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()}))}}),0)}static loadImage(t,e){const i=Xc(t,Yc.toLoadAueue);if(-1!==i)return Yc.toLoadAueue[i].marks.push(e),void Yc.loading();Yc.toLoadAueue.push({url:t,marks:[e]}),Yc.loading()}static improveImageLoading(t){const e=Xc(t,Yc.toLoadAueue);if(-1!==e){const t=Yc.toLoadAueue.splice(e,1);Yc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Xc(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(qc[0]=t[0],qc[2]=t[0],qc[1]=t[1],qc[3]=t[1],qc):t:t:0,Jc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Qc=[1,2,3,0,1,2,3,0];function td(t,e,i,s){for(;t>=Nt;)t-=Nt;for(;t<0;)t+=Nt;for(;t>e;)e+=Nt;Jc[0].x=i,Jc[1].y=i,Jc[2].x=-i,Jc[3].y=-i;const n=Math.ceil(t/Ht)%4,r=Math.ceil(e/Ht)%4;if(s.add(Gt(t)*i,$t(t)*i),s.add(Gt(e)*i,$t(e)*i),n!==r||e-t>jt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}nd.TimeOut=1e3/60;const rd=new nd,ad=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class od{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function ld(t,e,i,s,n){return n?t.arc(i,s,e,0,Vt,!1,n):t.arc(i,s,e,0,Vt),!1}var hd=new class extends od{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return ld(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ld(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var cd=new class extends od{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function dd(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var ud=new class extends od{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return dd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return dd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return dd(t,this.parseSize(e)/2+n,i,s,r)}};function pd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var gd=new class extends od{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return pd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return pd(t,this.parseSize(e)/2+n,i,s)}};function fd(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class md extends od{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return fd(t,this.parseSize(e)/2,i,s,n)}}var vd=new md;var _d=new class extends md{constructor(){super(...arguments),this.type="triangle"}};const yd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),bd=Math.sin(Vt/10)*yd,xd=-Math.cos(Vt/10)*yd;function Sd(t,e,i,s){const n=bd*e,r=xd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Vt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Ad=new class extends od{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Sd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Sd(t,this.parseSize(e)/2+n,i,s)}};const kd=Kt(3);function Md(t,e,i,s){const n=e,r=n/kd,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Td=new class extends od{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};function wd(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Cd=new class extends od{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return wd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return wd(t,this.parseSize(e)/2+n,i,s)}};function Ed(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Bd=new class extends od{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ed(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/2+n,i,s)}};const Pd=-.5,Ld=Kt(3)/2,Rd=1/Kt(12);function Od(t,e,i,s){const n=e/2,r=e*Rd,a=n,o=e*Rd+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Pd*n-Ld*r+i,Ld*n+Pd*r+s),t.lineTo(Pd*a-Ld*o+i,Ld*a+Pd*o+s),t.lineTo(Pd*l-Ld*h+i,Ld*l+Pd*h+s),t.lineTo(Pd*n+Ld*r+i,Pd*r-Ld*n+s),t.lineTo(Pd*a+Ld*o+i,Pd*o-Ld*a+s),t.lineTo(Pd*l+Ld*h+i,Pd*h-Ld*l+s),t.closePath(),!1}var Id=new class extends od{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Od(t,this.parseSize(e)/2+n,i,s)}};function Dd(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var Fd=new class extends od{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return Dd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};function zd(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var jd=new class extends od{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2,i,s,n)}};function Hd(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var Vd=new class extends od{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return Hd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Hd(t,this.parseSize(e)/2,i,s,n)}};const Nd=Kt(3);function Ud(t,e,i,s){const n=e*Nd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Wd=new class extends od{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Ud(t,this.parseSize(e)/2/Nd,i,s)}drawOffset(t,e,i,s,n){return Ud(t,this.parseSize(e)/2/Nd+n,i,s)}};function Gd(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var Yd=new class extends od{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function Xd(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var $d=new class extends od{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return Xd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Xd(t,this.parseSize(e)/4+n,i,s)}};function Kd(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var qd=new class extends od{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return Kd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Kd(t,this.parseSize(e)/4+n,i,s)}};function Zd(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var Jd=new class extends od{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return Zd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Zd(t,this.parseSize(e)/4+n,i,s)}};function Qd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var tu=new class extends od{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function eu(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var iu=new class extends od{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return eu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return eu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function su(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var nu=new class extends od{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return su(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return su(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function ru(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function au(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ou=new class extends od{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?au(t,e,i,s):ru(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?au(t,e+2*n,i,s):ru(t,[e[0]+2*n,e[1]+2*n],i,s)}};const lu=new Ne;class hu{constructor(t,e,i=!1){this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),sl(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(sl(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{lu.x1=i.bounds.x1*t,lu.y1=i.bounds.y1*t,lu.x2=i.bounds.x2*t,lu.y2=i.bounds.y2*t,e.union(lu)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const cu={};[hd,cd,ud,gd,Wd,_d,Ad,Td,Cd,Bd,Id,Fd,jd,vd,Vd,Yd,$d,qd,Jd,ou,tu,iu,nu].forEach((t=>{cu[t.type]=t}));const du={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class uu{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function pu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function gu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=gu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=pu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=gu(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new uu(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new uu(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function vu(t,e){return _u(t)}function _u(t,e){const i={};for(let e=0;ewu.set(t,!0)));const Cu=new Map;function Eu(t){if(wu.has(t))return!0;if(Cu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Cu.set(t,!0)));const Bu=Mu(),Pu=Mu(),Lu=Mu(),Ru=Mu(),Ou=Mu(),Iu=Mu(),Du=Mu(),Fu=Mu(),zu=Mu(),ju=Mu();Mu();const Hu=Mu();Mu();const Vu=Mu();Mu();const Nu=Mu(),Uu=Mu(),Wu=Symbol.for("GraphicService"),Gu=Symbol.for("GraphicCreator"),Yu={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Xu=Object.keys(Yu),$u={duration:200,easing:"cubicOut"};function Ku(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function qu(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Zu(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 Ju(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*f,t[1]=y*n+b*l+x*u+S*m,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*f,t[5]=y*n+b*l+x*u+S*m,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*f,t[9]=y*n+b*l+x*u+S*m,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Qu(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class tp{constructor(){this.pools=[]}static identity(t){return Ku(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 tp.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},np=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rp=new We(1,0,0,1,0,0),ap={x:0,y:0};let op=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this.path=new Wl,this._clearMatrix=new We(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return ep.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ap),function(t,e,i){return uc(t,0,!1,e,i)}(this.path.commandList,ap.x,ap.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ap);const i=_h(this,this.lineWidth,this.dpr);return function(t,e,i,s){return uc(t,e,!0,i,s)}(this.path.commandList,i,ap.x,ap.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(rp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};op=sp([qa(),np("design:paramtypes",[Object,Number])],op);const lp={WIDTH:500,HEIGHT:500,DPR:1};class hp{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=lp.WIDTH,height:n=lp.HEIGHT,dpr:r=lp.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var cp;hp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(cp||(cp={}));class dp{static Get(t,e=cp.Color1,i=[0,0,0,1]){if(e===cp.Color1){const e=dp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ii.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];dp.store1[t]=e,dp.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=dp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ii.parseColorString(t);return n&&(dp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],dp.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===cp.Color1){if(dp.store1[t])return;dp.store1[t]=i,dp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(dp.store255[t])return;dp.store255[t]=i,dp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function up(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function pp(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return gp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):gp(t,e,i,s,n)}function gp(t,e,i,s,n){if(!t||!e)return t&&up(t)||e&&up(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=dp.Get(t,cp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=dp.Get(e,cp.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:up(a)})))});return o?pp(r,l,i,s,n):pp(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:_p(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:_p(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:_p(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),up(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}function fp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}dp.store255={},dp.store1={};const mp=[0,0,0,0],vp=[0,0,0,0];function _p(t,e,i){return dp.Get(t,cp.Color255,mp),dp.Get(e,cp.Color255,vp),`rgba(${Math.round(mp[0]+(vp[0]-mp[0])*i)},${Math.round(mp[1]+(vp[1]-mp[1])*i)},${Math.round(mp[2]+(vp[2]-mp[2])*i)},${mp[3]+(vp[3]-mp[3])*i})`}class yp{static GetCanvas(){try{return yp.canvas||(yp.canvas=Ao.global.createCanvas({})),yp.canvas}catch(t){return null}}static GetCtx(){if(!yp.ctx){const t=yp.GetCanvas();yp.ctx=t.getContext("2d")}return yp.ctx}}class bp extends Ge{static getInstance(){return bp._instance||(bp._instance=new bp),bp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=yp.GetCanvas(),s=yp.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new bp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class xp{static GetSize(t){for(let e=0;e=t)return xp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=xp.GenKey(t,e,i,s,n),l=xp.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=xp.GenKey(t,e,i,s,n);xp.cache[l]?xp.cache[l].push({width:a,height:o,pattern:r}):xp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}xp.cache={},xp.ImageSize=[20,40,80,160,320,640,1280,2560];const Sp=new Ne,Ap=new We;new Ne;const kp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Mp=["x","y"],Tp=["scaleX","scaleY"],wp=["angle"],Cp=new re,Ep={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Bp extends Oc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=cu[t];if(e)return e;if(e=Bp.userSymbolMap[t],e)return e;if(!0===((i=t=du[t]||t).startsWith("{const e=(new Wl).fromString(t.d),i={};Xu.forEach((e=>{t[e]&&(i[Yu[e]]=t[e])})),n.push({path:e,attribute:i}),Sp.union(e.bounds)}));const r=Sp.width(),a=Sp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new hu(t,n,!0);return Bp.userSymbolMap[t]=l,l}var i;const s=(new Wl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Yt(n,r);s.transform(0,0,a,a);const o=new hu(t,s);return Bp.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Zc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Fo(t);return sl(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new We),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&$o.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&$o.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&$o.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&$o.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&$o.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&$o.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=$o.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Ko.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i))}_setAttributes(t,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:$u;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:qo.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if(this.currentStates){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stateSort&&(t=t.sort(this.stateSort));const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=$o.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=$o.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=$o.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&$o.UPDATE_SHAPE_AND_BOUNDS)===$o.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=$o.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=$o.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=$o.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=$o.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=$o.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=$o.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=$o.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&$o.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Xl.x,y:e=Xl.y,scaleX:i=Xl.scaleX,scaleY:s=Xl.scaleY,angle:n=Xl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Gt(a),f=$t(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+d*v-x*_-A*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),Ao.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Xl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ap.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:qo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Ao.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new Wl).fromString(t):this.pathProxy=new Wl,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),Ao.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new jc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Ao.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new op(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Pp;Bp.userSymbolMap={},Bp.mixin(Uc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Pp||(Pp={}));let Lp=class t extends Bp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Iu,this._childUpdateTag=$o.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 Bc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Bc)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Ko.GLOBAL){const i=new re(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&$o.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Xl.x,y:e=Xl.y,dx:i=Xl.dx,dy:s=Xl.dy,scaleX:n=Xl.scaleX,scaleY:r=Xl.scaleY,angle:a=Xl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Lc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Ao.graphicService.updateTempAABBBounds(i),Ao.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=$o.CLEAR_BOUNDS,this._childUpdateTag&=$o.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=$o.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&$o.UPDATE_BOUNDS||(this._childUpdateTag|=$o.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&$o.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Ao.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Rp(t){return new Lp(t)}Lp.NOWORK_ANIMATE_ATTR=Ep;class Op extends Lp{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Bc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Ao.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Ao.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Ip=Symbol.for("TransformUtil"),Dp=Symbol.for("GraphicUtil"),Fp=Symbol.for("LayerService"),zp=Symbol.for("StaticLayerHandlerContribution"),jp=Symbol.for("DynamicLayerHandlerContribution"),Hp=Symbol.for("VirtualLayerHandlerContribution");var Vp,Np=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Up=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Wp=Vp=class{static GenerateLayerId(){return`${Vp.idprefix}_${Vp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Ao.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?xo.get(zp):"dynamic"===t?xo.get(jp):xo.get(Hp),e}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Op(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Vp.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};Wp.idprefix="visactor_layer",Wp.prefix_count=0,Wp=Vp=Np([qa(),Up("design:paramtypes",[])],Wp);var Gp=new Fa((t=>{t(bo).to(Po).inSingletonScope(),t(mc).to(_c),t(Dp).to(Sc).inSingletonScope(),t(Ip).to(Mc).inSingletonScope(),t(Fp).to(Wp).inSingletonScope()}));function Yp(t,e){return!(!t&&!e)}function Xp(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function $p(t,e,i){return i&&t*e>0}function Kp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function qp(t,e){return t*e>0}function Zp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Jp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Qp(t,e,i,s,n){const r=Ut(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Gt(c),k=n*$t(c),M=s*Gt(u),T=s*$t(u);let w,C,E,B;if((b>zt||_>zt)&&(w=n*Gt(d),C=n*$t(d),E=s*Gt(p),B=s*$t(p),r1?0:P<-1?jt:Math.acos(P))/2),l=Kt(t[0]*t[0]+t[1]*t[1]);S=Xt(b,(s-l)/(o-1)),x=Xt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function tg(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ut(l-o),c=l>o;let d=!1;if(n=Nt-zt)e.moveTo(i+n*Gt(o),s+n*$t(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*$t(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Qp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=Xt(v,m),r=Xt(_,m),o=Jp(g,f,u,p,n,t,Number(c)),l=Jp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*$t(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*$t(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Gt(M),s+n*$t(M));if(!(r>zt)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=Xt(B,T),n=Xt(P,T),o=Jp(S,A,b,x,r,-n,Number(c)),l=Jp(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*$t(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Gt(E),s+r*$t(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*$t(o)):e.closePath(),d}const eg=Symbol.for("ArcRenderContribution"),ig=Symbol.for("AreaRenderContribution"),sg=Symbol.for("CircleRenderContribution"),ng=Symbol.for("GroupRenderContribution"),rg=Symbol.for("ImageRenderContribution"),ag=Symbol.for("PathRenderContribution"),og=Symbol.for("PolygonRenderContribution"),lg=Symbol.for("RectRenderContribution"),hg=Symbol.for("SymbolRenderContribution"),cg=Symbol.for("TextRenderContribution"),dg=Symbol.for("InteractiveSubRenderContribution");function ug(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function pg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var gg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mg=function(t,e){return function(i,s){e(i,s,t)}};function vg(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Ku(t),qu(t,t,[n+o,r+l,a+h]),qu(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),qu(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=ip.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}qu(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,f),qu(i,i,[-s[0],-s[1],0]),Ju(t,t,i)}}let _g=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new _o(["graphic"]),onSetStage:new _o(["graphic","stage"]),onRemove:new _o(["graphic"]),onRelease:new _o(["graphic"]),onAddIncremental:new _o(["graphic","group","stage"]),onClearIncremental:new _o(["graphic","group","stage"]),beforeUpdateAABBBounds:new _o(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new _o(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new _o(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ne,this.tempAABBBounds2=new Ne}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Fo(t);return sl(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=pg(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=ug(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Au(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Au(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&He(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};_g=gg([qa(),mg(0,$a(Gu)),fg("design:paramtypes",[Object])],_g);const yg=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},bg=["radius","startAngle","endAngle",...kp];class xg extends Bp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Ru}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Lc(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Nt-zt?i.set(-r,-r,r,r):td(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,bg)}needUpdateTag(t){return super.needUpdateTag(t,bg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Wl,s.arc(0,0,r,a,o),s}clone(){return new xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xg.NOWORK_ANIMATE_ATTR}}function Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Ep;class Ag{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Lo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Uu,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Lc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Mg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Ao.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Au(n,o/Math.abs(r+a),!0,l),i.union(n)}return Ao.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,He(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Ag(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const M=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new Ag(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=ug(_,a),e=this.cache.verticalList.length*v,i=pg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Tu.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const x=ug(_,a),S=this.cache.verticalList.length*v,A=pg(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=ad(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=kg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=kg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Mg.baselineMapAlign}getAlignMapBaseline(){return Mg.alignMapBaseline}}function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ep),Mg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Mg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const wg=["symbolType","size",...kp];let Cg=class t extends Bp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Nu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Lc(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Au(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,wg)}needUpdateTag(t){return super.needUpdateTag(t,wg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Wl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Wl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Eg(t){return new Cg(t)}Cg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ep);const Bg=["segments","points","curveType","curveTension",...kp];let Pg=class t extends Bp{constructor(t={}){super(t),this.type="line",this.numberType=Fu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}getGraphicTheme(){return Lc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Wl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Lg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const Rg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},Og=["width","x1","y1","height","cornerRadius",...kp];class Ig extends Bp{constructor(t){super(t),this.type="rect",this.numberType=Hu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Lc(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Og)}needUpdateTag(t){return super.needUpdateTag(t,Og)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Rg(e);return t=new Wl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ig.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Ig(t)}Ig.NOWORK_ANIMATE_ATTR=Ep;class Fg extends Bp{constructor(t){super(t),this.type="glyph",this.numberType=Ou,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Lc(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Fg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Fg.NOWORK_ANIMATE_ATTR}}function zg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Ep;class jg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=bh[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Hg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Vg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=ad(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Bh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Hg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=wh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Ng=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...kp];class Ug extends Bp{constructor(t){super(t),this.type="image",this.numberType=Du,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Lc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return gh[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}clone(){return new Ug(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ug.NOWORK_ANIMATE_ATTR}}function Wg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Ep);class Gg extends Ug{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Zc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Zc(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=gh.width,height:e=gh.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Yg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Gg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Vg){const e=Mh.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Gg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bh(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sh;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Th(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?yh(t,s,{AABBBounds:i}):s,Th(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Gg)break;const{width:n}=Bh(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Gg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Xg{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=bh[this.direction]}store(t){if(t instanceof Gg){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 Yg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Gg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=wh(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Vg(i,t.newLine,t.character,t.ascentDescentMode),new Vg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let $g=!1;try{$g=Intl&&"function"==typeof Intl.Segmenter}catch(t){$g=!1}const Kg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...kp];class qg extends Bp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Vu,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Lc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&qg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&qg.splitText(t.text).length>1)))}static splitText(t){if($g){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=qg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Ao.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!qg.AllSingleCharacter(_)&&(_=qg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new jg(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new Xg(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new qg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ep);const Jg=["path","customPath",...kp];class Qg extends Bp{constructor(t){super(t),this.type="path",this.numberType=zu}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Wl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Wl?this.cache:t.path)}getGraphicTheme(){return Lc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new Wl).fromString(t.path):t.customPath&&(this.cache=new Wl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Jg)}needUpdateTag(t){return super.needUpdateTag(t,Jg)}toCustomPath(){return(new Wl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qg.NOWORK_ANIMATE_ATTR}}function tf(t){return new Qg(t)}Qg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ep);const ef=["segments","points","curveType","curveTension",...kp];class sf extends Bp{constructor(t){super(t),this.type="area",this.numberType=Lu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Lc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,ef)}needUpdateTag(t){return super.needUpdateTag(t,ef)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Wl;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new sf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sf.NOWORK_ANIMATE_ATTR}}function nf(t){return new sf(t)}sf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const rf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...kp];class af extends Bp{constructor(t){super(t),this.type="arc",this.numberType=Bu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=he(e),i=e+r,s&&Ut(r)zt&&o>zt)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=Kt(a*a+o*o)}=this.attribute,h=Ut(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*$t(g)),n=Zt(Number(l)/a*$t(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Lc(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Nt-zt?i.set(-s,-s,s,s):(td(l,o,s,i),td(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,rf)}needUpdateTag(t){return super.needUpdateTag(t,rf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Ut(o-a),d=o>a;if(h=Nt-zt)n.moveTo(0+h*Gt(a),0+h*$t(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*$t(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*$t(a),i=l*Gt(o),s=l*$t(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new af(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return af.NOWORK_ANIMATE_ATTR}}function of(t){return new af(t)}af.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ep);const lf=["points","cornerRadius",...kp];class hf extends Bp{constructor(t){super(t),this.type="polygon",this.numberType=ju}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Lc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,lf)}needUpdateTag(t){return super.needUpdateTag(t,lf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Wl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new hf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return hf.NOWORK_ANIMATE_ATTR}}function cf(t){return new hf(t)}hf.NOWORK_ANIMATE_ATTR=Ep;class df extends Lp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function uf(t){return new df(t)}const pf=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let gf,ff;function mf(t){return gf||(gf=pf.CreateGraphic("text",{})),gf.initAttributes(t),gf.AABBBounds}var vf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yf=function(t,e){return function(i,s){e(i,s,t)}};class bf{constructor(){this.time=Qo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(Af(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Lc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){Ef(t,e,i,s)}}const xf=new bf,Sf=new Set(["top","center","bottom"]);function Af(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function kf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Mf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Tf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function wf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:Sf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Tf(s,e,"left","center","right"),y:Tf(n,i,"top","center","bottom")}}function Cf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Ef(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=function(t){if(!t)return null;const e=Cf(t.naturalWidth,t.videoWidth,t.width),i=Cf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}(e),{backgroundRepeatMode:m,backgroundSizing:v}=function({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Mf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:kf({backgroundFit:e,backgroundKeepAspectRatio:i})}}({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let _=p,y=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=wf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(_=i*(g/s),y=g):"repeat-y"===m&&(y=s*(p/i),_=p);const n=t.dpr,r=pc.allocate({width:_,height:y,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,_,y),a.drawImage(e,0,0,_,y),e=r.nativeCanvas),pc.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}let Bf=class{constructor(t){this.subRenderContribitions=t,this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Bf=vf([qa(),yf(0,$a(po)),yf(0,Za(dg)),_f("design:paramtypes",[Object])],Bf);const Pf=new class{constructor(){this.time=Qo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Lf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class Rf{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=pc.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),pc.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Nt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=pc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Eg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:_h(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),tg(t,e,i,s,w+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},Df=Of,Ff=xf;const zf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},jf=Of,Hf=xf;const Vf=new class extends bf{constructor(){super(...arguments),this.time=Qo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:_=l.backgroundScale,backgroundOffsetX:y=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Af(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:_,backgroundOffsetX:y,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Nf=jt/2;function Uf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Ut(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ut(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ut(t[0]),i=Ut(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ut(l[0]),l[1]=Ut(l[1]),l[2]=Ut(l[2]),l[3]=Ut(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Nf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Nf,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Nf,jt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],jt,jt+Nf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Wf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Gf{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:_h(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),Uf(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let Yf=class{constructor(){this.time=Qo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Yf=Wf([qa()],Yf);let Xf=class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return Uf(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Xf=Wf([qa()],Xf);const $f=new Gf,Kf=Of,qf=xf;const Zf=new class extends Gf{constructor(){super(...arguments),this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},Jf=xf;const Qf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},tm=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},em=Of,im=xf;const sm={x:0,y:0,z:0,lastModelMatrix:null};class nm{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Pf),this.builtinContributions.push(Lf),this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Qo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Qo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Lc(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,_=$p(d,u,h),y=qp(d,g),b=Yp(h),x=Xp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return sl(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=$p(o,l,n),p=qp(o,c),g=Yp(n,r),f=Xp(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;sm.x=n,sm.y=r,sm.z=a,sm.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(s,d||s,n),sm.x=0,sm.y=0,sm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ip.free(n)}if(g&&!d){const s=t.getOffsetXY(e);sm.x+=s.x,sm.y+=s.y,sm.z=a,i.setTransformForCurrent()}else if(p)sm.x=0,sm.y=0,sm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);sm.x+=s.x,sm.y+=s.y,this.transformWithoutTranslate(i,sm.x,sm.y,sm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),sm.x=0,sm.y=0,sm.z=0;return sm}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,f,m,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ip.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var rm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},am=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},om=function(t,e){return function(i,s){e(i,s,t)}};let lm=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Bu,this.builtinContributions=[If,Ff,Df],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nzt){const t=Xt(b,y),r=Xt(x,y),a=Jp(v,_,f,m,n,t,Number(u)),o=Jp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>zt){const t=Xt(B,w),n=Xt(P,w),a=Jp(M,T,A,k,r,-n,Number(u)),o=Jp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*$t(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ut(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Kc[s]=t,i&&(i=!(null!==(e=Kc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Kc[e]=!!t[e],i&&(i=!!Kc[e]);else Kc[0]=!1,Kc[1]=!1,Kc[2]=!1,Kc[3]=!1;return{isFullStroke:i,stroke:Kc}})(d);if((_||E)&&(e.beginPath(),tg(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),tg(t,e,i,s,k,M,B),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ut(h-r)>=Nt-zt){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Nt;for(;i>Nt;)i-=Nt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),pp(o.color,l.color,h,!1)}(0,0,h,n);a||$p&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};lm=rm([qa(),om(0,$a(po)),om(0,Za(eg)),am("design:paramtypes",[Object])],lm);var hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dm=function(t,e){return function(i,s){e(i,s,t)}};let um=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[zf,Hf,jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function pm(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=cl(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function gm(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function fm(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=gm(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),pm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Zo.ROW:"y"===s?u=Zo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let vm=class extends nm{constructor(){super(...arguments),this.numberType=Fu}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();fm(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Ul(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Xt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function _m(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),pm(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),pm(t,l,1,s),o=!1):o=!0}t.closePath()}vm=mm([qa()],vm);const ym=new class extends Rf{constructor(){super(...arguments),this.time=Qo.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:sd(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:sd(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:sd(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:sd(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},bm=xf;var xm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Am=function(t,e){return function(i,s){e(i,s,t)}};let km=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[ym,bm],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Lc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Ul(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Ul(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Ul(e,E,{curveTension:b}),n=Ul(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,y,r[u],[g,t.attribute],Xt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Zo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Ut(_.x-b.x),A=Ut(_.y-b.y);x=null==_.x1?Zo.ROW:null==_.y1?Zo.COLUMN:Number.isFinite(S+A)?S>A?Zo.ROW:Zo.COLUMN:Zo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Zo.ROW:Zo.COLUMN,Number.isFinite(c)||(o=Zo.COLUMN),Number.isFinite(d)||(o=Zo.ROW);const u=i*(o===Zo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),fm(t,i[0]?e.top:e.bottom,l,x===Zo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};km=xm([qa(),Am(0,$a(po)),Am(0,Za(ig)),Sm("design:paramtypes",[Object])],km);const Mm=Of,Tm=xf;var wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};let Bm=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[Tm,Mm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Lc(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)sl(t.pathShape.commandList,e,i,s,1,1,f);else{sl((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Bm=wm([qa(),Em(0,$a(po)),Em(0,Za(ag)),Cm("design:paramtypes",[Object])],Bm);var Pm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rm=function(t,e){return function(i,s){e(i,s,t)}};let Om=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Hu,this.builtinContributions=[$f,qf,Kf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Kp(g,f,T,w,h),E=Zp(g,v,T,w,M),B=Yp(h,c),P=Xp(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),Uf(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Om=Pm([qa(),Rm(0,$a(po)),Rm(0,Za(lg)),Lm("design:paramtypes",[Object])],Om);var Im=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fm=function(t,e){return function(i,s){e(i,s,t)}};let zm=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Nu,this.builtinContributions=[Qf,im,em,tm],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Lc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};zm=Im([qa(),Fm(0,$a(po)),Fm(0,Za(hg)),Dm("design:paramtypes",[Object])],zm);const jm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ne)}allocate(t,e,i,s){if(!this.pools.length)return(new Ne).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ne(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const Hm=new class extends bf{constructor(){super(...arguments),this.time=Qo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,_,y,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:M=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:w=l.backgroundKeepAspectRatio,backgroundScale:C=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:L=l.backgroundClip,backgroundCornerRadius:R=l.backgroundCornerRadius}=t.attribute;let O,{background:I}=t.attribute;if(!I)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),O&&e.setTransformFromMatrix(O,!0,1))};let F;"richtext"===t.type&&(O=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(I)&&I.background?I:null,j=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(_=z.height)&&void 0!==_?_:e.height();if(F=jm.allocate(i,s,i+n,s+r),I=z.background,!j){const t=F.width(),e=F.height();F.set((null!==(y=z.x)&&void 0!==y?y:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,j||(F=mf(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const i=t.resources.get(I);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),j&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,L&&(e.beginPath(),R?Uf(e,F.x1,F.y1,F.width(),F.height(),R,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:M,backgroundFit:T,backgroundKeepAspectRatio:w,backgroundScale:C,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=I,R?(Uf(e,F.x1,F.y1,F.width(),F.height(),R,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&jm.free(F),D()}};var Vm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Um=function(t,e){return function(i,s){e(i,s,t)}};let Wm=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Uu,this.builtinContributions=[Hm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Lc(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=ad(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=ep.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),ep.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:ug(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Gm(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jm=function(t,e){return function(i,s){e(i,s,t)}};let Qm=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ju,this.builtinContributions=[Km,$m],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Gm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Gm(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=Ym(d,u),b=Ym(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Xm(h,_,y,d,u),A=Xm(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Ym(k,M),w=Xm(h,Ym(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let B=E-C;B<0&&(C=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Qm=qm([qa(),Jm(0,$a(po)),Jm(0,Za(og)),Zm("design:paramtypes",[Object])],Qm);var tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ev=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iv=function(t,e){return function(i,s){e(i,s,t)}};let sv=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Iu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Vf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Lc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Kp(p,m,g,f,c),C=Zp(p,v,g,f),E=Yp(c,u),B=Xp(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Uf(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Vf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Qo.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Qo.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Ao.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Lc(t,null==s?void 0:s.theme).group,i=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(i,p||i,n),a.modelMatrix=i,ip.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ip.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};sv=tv([qa(),iv(0,$a(po)),iv(0,Za(ng)),ev("design:paramtypes",[Object])],sv);var nv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},av=function(t,e){return function(i,s){e(i,s,t)}};const ov=["","repeat-x","repeat-y","repeat"];function lv({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=function(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?ov[i]:"no-repeat"}(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const hv={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function cv(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=lv({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?function(t){return{backgroundMode:hv[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Ef(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}let dv=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[Zf,Jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:_=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:M,doFill:T,doStroke:w}=A;if(!S||!t.resources)return;const C=t.resources.get(S);if("success"!==C.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Uf(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const L=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),cv(e,C.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x})))},R=()=>{w&&(o?o(e,t.attribute,l):M&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},O=function({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0,imagePosition:a="top-left"}){const{repeatMode:o,sizingMode:l}=lv({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===o&&("cover"===l||"auto"===l||1!==s||0!==n||0!==r)}({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x}),I=P||O;g?(R(),I&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),L(),I&&e.restore()):(I&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),L(),I&&e.restore(),R()),this.afterRenderStep(t,e,i,s,T,!1,k,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void Yc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Lc(t).image;this._draw(t,a,!1,i)}};dv=nv([qa(),av(0,$a(po)),av(0,Za(rg)),rv("design:paramtypes",[Object])],dv);const uv=Symbol.for("IncrementalDrawContribution"),pv=Symbol.for("ArcRender"),gv=Symbol.for("AreaRender"),fv=Symbol.for("CircleRender"),mv=Symbol.for("GraphicRender"),vv=Symbol.for("GroupRender"),_v=Symbol.for("LineRender"),yv=Symbol.for("PathRender"),bv=Symbol.for("PolygonRender"),xv=Symbol.for("RectRender"),Sv=Symbol.for("SymbolRender"),Av=Symbol.for("TextRender"),kv=Symbol.for("RichTextRender"),Mv=Symbol.for("GlyphRender"),Tv=Symbol.for("ImageRender"),wv=Symbol.for("DrawContribution"),Cv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Pu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Nt;for(;o<0;)o+=Nt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var Ev=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Pv=Symbol.for("DrawItemInterceptor"),Lv=new Ne,Rv=new Ne;class Ov{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Lv.copy(s.dirtyBounds),Rv.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,ep.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Lv),s.backupDirtyBounds.copy(Rv)),!0}}class Iv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Dv=class{constructor(){this.order=1,this.interceptors=[new Ov,new zv,new Fv,new Iv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ip.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var jv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vv=function(t,e){return function(i,s){e(i,s,t)}};let Nv=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Nv=jv([qa(),Vv(0,$a(wv)),Hv("design:paramtypes",[Object])],Nv);var Uv=new Fa((t=>{t(So).to(Nv)}));const Wv=Symbol.for("PickerService"),Gv=Symbol.for("GlobalPickerService"),Yv=Symbol.for("PickItemInterceptor"),Xv=Symbol.for("PickServiceInterceptor");var $v=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Kv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Kv=$v([qa()],Kv);let qv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Lc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=ep.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};qv=$v([qa()],qv);let Zv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Zv=$v([qa()],Zv);let Jv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=Cv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Jv=$v([qa()],Jv);var Qv=new Fa(((t,e,i)=>{i(Wv)||(t(Gv).toSelf(),t(Wv).toService(Gv)),t(Jv).toSelf().inSingletonScope(),t(Yv).toService(Jv),t(qv).toSelf().inSingletonScope(),t(Yv).toService(qv),t(Zv).toSelf().inSingletonScope(),t(Yv).toService(Zv),fo(t,Yv),t(Kv).toSelf().inSingletonScope(),t(Xv).toService(Kv),fo(t,Xv)})),t_=new Fa((t=>{t(Wu).to(_g),t(Gu).toConstantValue(pf)}));const e_=Symbol.for("AutoEnablePlugins"),i_=Symbol.for("PluginService");var s_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},n_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r_=function(t,e){return function(i,s){e(i,s,t)}};let a_=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&xo.isBound(e_)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};a_=s_([qa(),r_(0,$a(po)),r_(0,Za(e_)),n_("design:paramtypes",[Object])],a_);var o_=new Fa((t=>{t(i_).to(a_),function(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).whenTargetNamed(e)}(t,e_)})),l_=new Fa((t=>{fo(t,yo)})),h_=new Fa((t=>{t(Oh).to(Ih).inSingletonScope(),fo(t,Oh)})),c_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},d_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let u_=class{constructor(){this.type="static",this.offscreen=!1,this.global=Ao.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=zh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};u_=c_([qa(),d_("design:paramtypes",[])],u_);var p_=new Fa((t=>{t(u_).toSelf(),t(zp).toService(u_)}));var g_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function f_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function m_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=f_(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=f_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var y_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},b_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},x_=function(t,e){return function(i,s){e(i,s,t)}};let S_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):m_(e,th.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ve,this.backupDirtyBounds=new Ve,this.global=Ao.global,this.layerService=Ao.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,ep.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=__(e,i,th.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=jm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=ep.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),jm.free(n),ep.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||xo.get(uv);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let k_=class extends vm{constructor(){super(...arguments),this.numberType=Fu}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Lc(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=$p(u,p,c),_=qp(u,g),y=Yp(c),b=Xp(d,f);if(!t.valid||!m)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};k_=A_([qa()],k_);var M_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let T_=class extends km{constructor(){super(...arguments),this.numberType=Lu}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Lc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=$p(u,d,c),f=Yp(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};T_=M_([qa()],T_);var w_,C_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},E_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},B_=function(t,e){return function(i,s){e(i,s,t)}},P_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(w_||(w_={}));let L_=class extends S_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=w_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new _o([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return P_(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return P_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return P_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){if(2!==t.count)yield v_(t,th.zIndex,((i,s)=>{if(this.status===w_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return P_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return P_(this,void 0,void 0,(function*(){this.rendering&&(this.status=w_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=w_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return P_(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){yield v_(t,th.zIndex,(t=>P_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};L_=C_([qa(),B_(0,Ka(mv)),B_(1,$a(k_)),B_(2,$a(T_)),B_(3,$a(po)),B_(3,Za(Pv)),E_("design:paramtypes",[Array,Object,Object,Object])],L_);var R_=new Fa((t=>{t(bf).toSelf().inSingletonScope(),t(Rf).toSelf().inSingletonScope(),t(wv).to(S_),t(uv).to(L_),t(vv).to(sv).inSingletonScope(),t(mv).toService(vv),fo(t,ng),t(Bf).toSelf().inSingletonScope(),fo(t,dg),fo(t,mv),t(Dv).toSelf().inSingletonScope(),t(Pv).toService(Dv),fo(t,Pv)}));function O_(){O_.__loaded||(O_.__loaded=!0,xo.load(Gp),xo.load(t_),xo.load(Uv),xo.load(Qv),xo.load(o_),function(t){t.load(l_),t.load(h_),t.load(p_)}(xo),function(t){t.load(R_)}(xo))}O_.__loaded=!1,O_();const I_=xo.get(bo);Ao.global=I_;const D_=xo.get(Dp);Ao.graphicUtil=D_;const F_=xo.get(Ip);Ao.transformUtil=F_;const z_=xo.get(Wu);Ao.graphicService=z_;const j_=xo.get(Fp);Ao.layerService=j_;class H_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class V_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Ao.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Ao.global.getRequestAnimationFrame();this.rafId=t((()=>{Ao.global.devicePixelRatio!==this.dpr&&(this.dpr=Ao.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Ao.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class N_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ao.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const U_=new Ne;class W_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()}));const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(U_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(U_,t.parent&&t.parent.globalTransMatrix)))})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let G_;function Y_(){!function(){if(null==G_)try{const t=document.createElement("canvas"),e=t.getContext("2d");G_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),G_&&(G_=!!document.createElement)}catch(t){G_=!1}}();const t=Ao.global&&Ao.global.env;return t?"browser"===t:G_}let X_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};X_._pluginClasses={};const $_="white";class K_ extends Lp{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:$_}set background(t){this._background=t,this.syncBackgroundImage(t)}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}syncBackgroundImage(t){var e;const i=null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t;this.backgroundImg=!1,this.isImageBackgroundSource(i)&&this.loadImage(i,!0)}isImageBackgroundSource(t){if(!t)return!1;if("string"==typeof t)return t.startsWith("{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Bc,this.hooks={beforeRender:new _o(["stage"]),afterRender:new _o(["stage"]),afterClearScreen:new _o(["stage"]),afterClearRect:new _o(["stage"])},this.global=Ao.global,!this.global.env&&Y_()&&this.global.setEnv("browser"),this.window=xo.get(mc),this.renderService=xo.get(So),this.pluginService=xo.get(i_),this.layerService=xo.get(Fp),this.graphicService=xo.get(Wu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:$_,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&this.syncBackgroundImage(this._background),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Gc(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1);const k=X_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=X_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=X_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new H_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new V_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new N_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ve;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new W_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=X_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=X_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=X_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=xo.get(mc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=xo.get(Wv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var q_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Z_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let J_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ne}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return Z_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};J_=q_([qa()],J_);var Q_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ty=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ey=class{constructor(){this._uid=Da.GenAutoIncrementId(),this.viewBox=new Ne,this.modelMatrix=new We(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};ey=Q_([qa(),ty("design:paramtypes",[])],ey);var iy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ny=function(t,e){return function(i,s){e(i,s,t)}};let ry=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=Ao.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ne).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new We(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=Lc(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new re(e.x,e.y);l.transformPoint(a,a);const o=Lc(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&ip.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),ep.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function ay(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function oy(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function py(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),_y=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},yy=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Ve;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return _y(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return _y(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);yy(n[0],s,i),yy(n[1],e-s,i)}};let by=!1;const xy=new Fa((t=>{by||(by=!0,t(lm).toSelf().inSingletonScope(),t(pv).to(lm).inSingletonScope(),t(mv).toService(pv),t(eg).toService(Bf),fo(t,eg))}));let Sy=!1;const Ay=new Fa((t=>{Sy||(Sy=!0,t(Om).toSelf().inSingletonScope(),t(xv).to(Om).inSingletonScope(),t(mv).toService(xv),t(Xf).toSelf(),t(Yf).toSelf(),t(lg).toService(Xf),t(lg).toService(Yf),t(lg).toService(Bf),fo(t,lg))}));let ky=!1;const My=new Fa((t=>{ky||(ky=!0,t(vm).toSelf().inSingletonScope(),t(k_).toSelf().inSingletonScope(),t(_v).to(vm).inSingletonScope(),t(mv).toService(_v))}));let Ty=!1;const wy=new Fa((t=>{Ty||(Ty=!0,t(km).toSelf().inSingletonScope(),t(gv).to(km).inSingletonScope(),t(mv).toService(gv),t(ig).toService(Bf),fo(t,ig),t(T_).toSelf().inSingletonScope())}));let Cy=!1;const Ey=new Fa((t=>{Cy||(Cy=!0,t(zm).toSelf().inSingletonScope(),t(Sv).to(zm).inSingletonScope(),t(mv).toService(Sv),t(hg).toService(Bf),fo(t,hg))}));let By=!1;const Py=new Fa((t=>{By||(By=!0,t(um).toSelf().inSingletonScope(),t(fv).to(um).inSingletonScope(),t(mv).toService(fv),t(sg).toService(Bf),fo(t,sg))}));let Ly=!1;const Ry=new Fa((t=>{Ly||(Ly=!0,t(Av).to(Wm).inSingletonScope(),t(mv).toService(Av),t(cg).toService(Bf),fo(t,cg))}));let Oy=!1;const Iy=new Fa((t=>{Oy||(Oy=!0,t(Bm).toSelf().inSingletonScope(),t(yv).to(Bm).inSingletonScope(),t(mv).toService(yv),t(ag).toService(Bf),fo(t,ag))}));let Dy=!1;const Fy=new Fa((t=>{Dy||(Dy=!0,t(bv).to(Qm).inSingletonScope(),t(mv).toService(bv),t(og).toService(Bf),fo(t,og))}));var zy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jy=class{constructor(){this.numberType=Ou}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Lc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};jy=zy([qa()],jy);let Hy=!1;const Vy=new Fa((t=>{Hy||(Hy=!0,t(Mv).to(jy).inSingletonScope(),t(mv).toService(Mv))}));var Ny=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Wy=class extends nm{constructor(){super(),this.numberType=Vu,this.builtinContributions=[Hm],this.init()}drawShape(t,e,i,s,n){const r=Lc(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=$p(o,l,!0),d=$p(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Lc(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Uf(e,i-t,s-n,v,_,f,!0)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Lc(t).richtext;this._draw(t,s,!1,i)}};Wy=Ny([qa(),Uy("design:paramtypes",[])],Wy);let Gy=!1;const Yy=new Fa((t=>{Gy||(Gy=!0,t(kv).to(Wy).inSingletonScope(),t(mv).toService(kv))}));let Xy=!1;const $y=new Fa((t=>{Xy||(Xy=!0,t(Tv).to(dv).inSingletonScope(),t(mv).toService(Tv),t(rg).toService(Bf),fo(t,rg))}));function Ky(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),Jy=(t,e)=>(d(tb.warnHandler)&&tb.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),Qy=(t,e,i)=>{if(!d(tb.errorHandler))throw new Error(t);tb.errorHandler.call(null,t,e)},tb={silent:!1,warnHandler:!1,errorHandler:!1},eb=Y_(),ib=eb&&globalThis?globalThis.document:void 0;function sb(t){return("desktop-browser"===t||"mobile-browser"===t)&&eb}function nb(t){return rb(t)||"mobile-browser"===t}function rb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let ab=0;function ob(){return ab>=9999999&&(ab=0),ab++}function lb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function hb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const cb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class db extends Lp{constructor(t,e){super(t),this._skipRenderAttributes=cb,(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},jb=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class Hb extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=Hc.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=Hc.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||zb(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=jb(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=Hc.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=jb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=zb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Hc.now()-i>this.config.press.time&&jb(s[0],t){Ao.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Ub=[0,0,0];let Wb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},$l),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ql),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Zl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this._clearMatrix=new We(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return ep.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&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Nt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*y),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&xp.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Qu(Ub,[t,e,i],this.modelMatrix),t=Ub[0],e=Ub[1],i=Ub[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(Qu(Ub,[t,e,i],this.modelMatrix),t=Ub[0],e=Ub[1],i=Ub[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Qu(Ub,[e,i,s],this.modelMatrix),e=Ub[0],i=Ub[1],s=Ub[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t,e=Ao.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Ao.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Zl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Zl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Qu(Ub,[e,i,s],this.modelMatrix),e=Ub[0],i=Ub[1],s=Ub[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=yh(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:_h(this,a,this.dpr),r.strokeStyle=yh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};Wb.env="browser",Wb=Vb([qa(),Nb("design:paramtypes",[Object,Number])],Wb);var Gb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Xb=class extends hp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ao.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Wb(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function $b(t,e){return new Fa((i=>{i(Dh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Fh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Xb.env="browser",Xb=Gb([qa(),Yb("design:paramtypes",[Object])],Xb);const Kb=$b(Xb,Wb);var qb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jb=function(t,e){return function(i,s){e(i,s,t)}};let Qb=class extends ry{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=pc.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ex=class{constructor(){this.type="group",this.numberType=Iu}contains(t,e,i){return!1}};ex=tx([qa()],ex);const ix=new Fa(((t,e,i,s)=>{ix.__vloaded||(ix.__vloaded=!0,t(Db).to(ex).inSingletonScope(),t(Fb).toService(Db),fo(t,Fb))}));ix.__vloaded=!1;var sx=ix;const nx=new Fa(((t,e,i,s)=>{i(Qb)||t(Qb).toSelf().inSingletonScope(),i(Wv)?s(Wv).toService(Qb):t(Wv).toService(Qb)}));var rx,ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ox=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lx=rx=class extends ey{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${rx.idprefix}_${rx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ao.global,this.viewBox=new Ne,this.modelMatrix=new We(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:rx.GenerateCanvasId(),canvasControled:!0};this.canvas=new Xb(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new Xb({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};lx.env="browser",lx.idprefix="visactor_window",lx.prefix_count=0,lx=rx=ax([qa(),ox("design:paramtypes",[])],lx);const hx=new Fa((t=>{t(lx).toSelf(),t(vc).toDynamicValue((t=>t.container.get(lx))).whenTargetNamed(lx.env)}));var cx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ux=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class px{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function gx(t,e=!1){const i=document.createElement("img");if(Ao.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let fx=class extends J_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new px(t)}return new Ne}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return gx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return gx(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:Da.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return ux(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};fx=cx([qa(),dx("design:paramtypes",[])],fx);const mx=new Fa((t=>{mx.isBrowserBound||(mx.isBrowserBound=!0,t(fx).toSelf().inSingletonScope(),t(yo).toService(fx))}));function vx(t,e=!0){vx.__loaded||(vx.__loaded=!0,t.load(mx),t.load(Kb),t.load(hx),e&&function(t){t.load(sx),t.load(nx)}(t))}mx.isBrowserBound=!1,vx.__loaded=!1;var _x=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let yx=class extends Wb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};yx.env="feishu",yx=_x([qa()],yx);var bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Sx=class extends hp{constructor(t){super(t)}init(){this._context=new yx(this,this._dpr)}release(...t){}};Sx.env="feishu",Sx=bx([qa(),xx("design:paramtypes",[Object])],Sx);const Ax=$b(Sx,yx);var kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tx=function(t,e){return function(i,s){e(i,s,t)}};class wx{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 Cx=class extends ey{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new wx}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:Da.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Sx(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Sx({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Cx.env="feishu",Cx=kx([qa(),Tx(0,$a(bo)),Mx("design:paramtypes",[Object])],Cx);const Ex=new Fa((t=>{t(Cx).toSelf(),t(vc).toDynamicValue((t=>t.container.get(Cx))).whenTargetNamed(Cx.env)}));var Bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Px=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lx=function(t,e){return function(i,s){e(i,s,t)}};let Rx=class extends ry{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new op(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};Rx=Bx([qa(),Lx(0,$a(po)),Lx(0,Za(ub)),Lx(1,$a(po)),Lx(1,Za(Yv)),Lx(2,$a(po)),Lx(2,Za(Xv)),Px("design:paramtypes",[Object,Object,Object])],Rx);const Ox=new Fa((t=>{Ox.__vloaded||(Ox.__vloaded=!0,fo(t,ub))}));Ox.__vloaded=!1;var Ix=Ox;class Dx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:_h(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var Fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jx=function(t,e){return function(i,s){e(i,s,t)}};let Hx=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};Hx=Fx([qa(),jx(0,$a(pv)),zx("design:paramtypes",[Object])],Hx);let Vx=!1;const Nx=new Fa(((t,e,i,s)=>{Vx||(Vx=!0,t(pb).to(Hx).inSingletonScope(),t(ub).toService(pb))}));var Ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gx=function(t,e){return function(i,s){e(i,s,t)}};let Yx=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};Yx=Ux([qa(),Gx(0,$a(gv)),Wx("design:paramtypes",[Object])],Yx);let Xx=!1;const $x=new Fa(((t,e,i,s)=>{Xx||(Xx=!0,t(gb).to(Yx).inSingletonScope(),t(ub).toService(gb))}));var Kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zx=function(t,e){return function(i,s){e(i,s,t)}};let Jx=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};Jx=Kx([qa(),Zx(0,$a(fv)),qx("design:paramtypes",[Object])],Jx);let Qx=!1;const tS=new Fa(((t,e,i,s)=>{Qx||(Qx=!0,t(fb).to(Jx).inSingletonScope(),t(ub).toService(fb))}));class eS{constructor(){this.type="glyph",this.numberType=Ou}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var iS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nS=function(t,e){return function(i,s){e(i,s,t)}};let rS=class extends eS{constructor(t){super(),this.canvasRenderer=t}};rS=iS([qa(),nS(0,$a(Mv)),sS("design:paramtypes",[Object])],rS);let aS=!1;const oS=new Fa(((t,e,i,s)=>{aS||(aS=!0,t(Ab).to(rS).inSingletonScope(),t(rS).toService(Ab))}));var lS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let hS=class{constructor(){this.type="image",this.numberType=Du}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};hS=lS([qa()],hS);let cS=!1;const dS=new Fa(((t,e,i,s)=>{cS||(cS=!0,t(mb).to(hS).inSingletonScope(),t(hS).toService(mb))}));var uS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gS=function(t,e){return function(i,s){e(i,s,t)}};let fS=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};fS=uS([qa(),gS(0,$a(_v)),pS("design:paramtypes",[Object])],fS);let mS=!1;const vS=new Fa(((t,e,i,s)=>{mS||(mS=!0,t(vb).to(fS).inSingletonScope(),t(ub).toService(vb))}));var _S=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bS=function(t,e){return function(i,s){e(i,s,t)}};let xS=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};xS=_S([qa(),bS(0,$a(bv)),yS("design:paramtypes",[Object])],xS);let SS=!1;const AS=new Fa(((t,e,i,s)=>{SS||(SS=!0,t(Sb).to(xS).inSingletonScope(),t(ub).toService(Sb))}));var kS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TS=function(t,e){return function(i,s){e(i,s,t)}};let wS=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};wS=kS([qa(),TS(0,$a(yv)),MS("design:paramtypes",[Object])],wS);let CS=!1;const ES=new Fa(((t,e,i,s)=>{CS||(CS=!0,t(_b).to(wS).inSingletonScope(),t(ub).toService(_b))})),BS=new Ne;class PS{constructor(){this.type="rect",this.numberType=Hu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:_h(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;BS.setValue(i.x1,i.y1,i.x2,i.y2),BS.expand(-r/2),h=!BS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var LS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OS=function(t,e){return function(i,s){e(i,s,t)}};let IS=class extends PS{constructor(t){super(),this.canvasRenderer=t}};IS=LS([qa(),OS(0,$a(xv)),RS("design:paramtypes",[Object])],IS);let DS=!1;const FS=new Fa(((t,e,i,s)=>{DS||(DS=!0,t(yb).to(IS).inSingletonScope(),t(ub).toService(yb))}));let zS=!1;const jS=new Fa(((t,e,i,s)=>{zS||(zS=!0,t(mb).to(hS).inSingletonScope(),t(hS).toService(mb))}));var HS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NS=function(t,e){return function(i,s){e(i,s,t)}};let US=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nu}};US=HS([qa(),NS(0,$a(Sv)),VS("design:paramtypes",[Object])],US);let WS=!1;const GS=new Fa(((t,e,i,s)=>{WS||(WS=!0,t(bb).to(US).inSingletonScope(),t(ub).toService(bb))}));var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let XS=class{constructor(){this.type="text",this.numberType=Uu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};XS=YS([qa()],XS);let $S=!1;const KS=new Fa(((t,e,i,s)=>{$S||($S=!0,t(xb).to(XS).inSingletonScope(),t(ub).toService(xb))})),qS=new Fa(((t,e,i,s)=>{i(Rx)||t(Rx).toSelf().inSingletonScope(),i(Wv)?s(Wv).toService(Rx):t(Wv).toService(Rx)}));class ZS{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var JS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let tA=class extends J_{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,s,n,r){const a=null!=r?r:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,r)=>{const o=tt.createCanvasContext(e),l=new ZS(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),r>=s&&n.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};tA=JS([qa(),QS("design:paramtypes",[])],tA);const eA=new Fa((t=>{eA.isFeishuBound||(eA.isFeishuBound=!0,t(tA).toSelf().inSingletonScope(),t(yo).toService(tA))}));function iA(t,e=!0){iA.__loaded||(iA.__loaded=!0,t.load(eA),t.load(Ax),t.load(Ex),e&&function(t){t.load(Ix),t.load(qS),t.load(Nx),t.load($x),t.load(tS),t.load(oS),t.load(dS),t.load(vS),t.load(AS),t.load(ES),t.load(FS),t.load(jS),t.load(GS),t.load(KS)}(t))}eA.isFeishuBound=!1,iA.__loaded=!1;var sA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let rA=class extends Wb{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 We(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};rA.env="node",rA=sA([qa(),nA("design:paramtypes",[Object,Number])],rA);var aA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lA=class extends hp{constructor(t){super(t)}init(){this._context=new rA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};lA.env="node",lA=aA([qa(),oA("design:paramtypes",[Object])],lA);const hA=$b(lA,rA);var cA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uA=function(t,e){return function(i,s){e(i,s,t)}};let pA=class extends ey{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:Da.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new lA(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new lA({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};pA.env="node",pA=cA([qa(),uA(0,$a(bo)),dA("design:paramtypes",[Object])],pA);const gA=new Fa((t=>{t(pA).toSelf(),t(vc).toDynamicValue((t=>t.container.get(pA))).whenTargetNamed(pA.env)}));var fA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let mA=class extends J_{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};mA=fA([qa()],mA);const vA=new Fa((t=>{vA.isNodeBound||(vA.isNodeBound=!0,t(mA).toSelf().inSingletonScope(),t(yo).toService(mA))}));function _A(t,e=!0){_A.__loaded||(_A.__loaded=!0,t.load(vA),t.load(hA),t.load(gA))}vA.isNodeBound=!1,_A.__loaded=!1;var yA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xA=function(t,e){return function(i,s){e(i,s,t)}};let SA=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};SA=yA([qa(),xA(0,$a(pv)),bA("design:paramtypes",[Object])],SA);let AA=!1;const kA=new Fa(((t,e,i,s)=>{AA||(AA=!0,t(kb).to(SA).inSingletonScope(),t(Fb).toService(kb))}));var MA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wA=function(t,e){return function(i,s){e(i,s,t)}};let CA=class extends PS{constructor(t){super(),this.canvasRenderer=t}};CA=MA([qa(),wA(0,$a(xv)),TA("design:paramtypes",[Object])],CA);let EA=!1;const BA=new Fa(((t,e,i,s)=>{EA||(EA=!0,t(Bb).to(CA).inSingletonScope(),t(Fb).toService(Bb))}));class PA extends nm{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var LA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OA=function(t,e){return function(i,s){e(i,s,t)}};let IA=class extends PA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};IA=LA([qa(),OA(0,$a(_v)),RA("design:paramtypes",[Object])],IA);let DA=!1;const FA=new Fa(((t,e,i,s)=>{DA||(DA=!0,t(Cb).to(IA).inSingletonScope(),t(Fb).toService(Cb))}));var zA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HA=function(t,e){return function(i,s){e(i,s,t)}};let VA=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};VA=zA([qa(),HA(0,$a(gv)),jA("design:paramtypes",[Object])],VA);let NA=!1;const UA=new Fa(((t,e,i,s)=>{NA||(NA=!0,t(Mb).to(VA).inSingletonScope(),t(Fb).toService(Mb))}));class WA extends nm{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var GA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let $A=class extends WA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ip.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};$A=GA([qa(),XA(0,$a(Sv)),YA("design:paramtypes",[Object])],$A);let KA=!1;const qA=new Fa(((t,e,i,s)=>{KA||(KA=!0,t(Pb).to($A).inSingletonScope(),t(Fb).toService(Pb))}));var ZA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},JA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},QA=function(t,e){return function(i,s){e(i,s,t)}};let tk=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};tk=ZA([qa(),QA(0,$a(fv)),JA("design:paramtypes",[Object])],tk);let ek=!1;const ik=new Fa(((t,e,i,s)=>{ek||(ek=!0,t(Tb).to(tk).inSingletonScope(),t(Fb).toService(Tb))}));var sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rk=function(t,e){return function(i,s){e(i,s,t)}};let ak=class extends WA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Uu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=pg(a,u,n),v=ug(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&ip.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};ak=sk([qa(),rk(0,$a(Av)),nk("design:paramtypes",[Object])],ak);let ok=!1;const lk=new Fa(((t,e,i,s)=>{ok||(ok=!0,t(Lb).to(ak).inSingletonScope(),t(Fb).toService(Lb))}));var hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ck=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dk=function(t,e){return function(i,s){e(i,s,t)}};let uk=class extends PA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};uk=hk([qa(),dk(0,$a(yv)),ck("design:paramtypes",[Object])],uk);let pk=!1;const gk=new Fa(((t,e,i,s)=>{pk||(pk=!0,t(Eb).to(uk).inSingletonScope(),t(Fb).toService(Eb))}));var fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vk=function(t,e){return function(i,s){e(i,s,t)}};let _k=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};_k=fk([qa(),vk(0,$a(bv)),mk("design:paramtypes",[Object])],_k);let yk=!1;const bk=new Fa(((t,e,i,s)=>{yk||(yk=!0,t(Rb).to(_k).inSingletonScope(),t(Fb).toService(Rb))}));var xk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ak=function(t,e){return function(i,s){e(i,s,t)}};let kk=class extends eS{constructor(t){super(),this.canvasRenderer=t}};kk=xk([qa(),Ak(0,$a(Mv)),Sk("design:paramtypes",[Object])],kk);let Mk=!1;const Tk=new Fa(((t,e,i,s)=>{Mk||(Mk=!0,t(Ib).to(kk).inSingletonScope(),t(Fb).toService(Ib))}));var wk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ck=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ek=function(t,e){return function(i,s){e(i,s,t)}};let Bk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Bk=wk([qa(),Ek(0,$a(kv)),Ck("design:paramtypes",[Object])],Bk);let Pk=!1;const Lk=new Fa(((t,e,i,s)=>{Pk||(Pk=!0,t(Ob).to(Bk).inSingletonScope(),t(Fb).toService(Ob))}));var Rk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ik=function(t,e){return function(i,s){e(i,s,t)}};let Dk=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Du}};Dk=Rk([qa(),Ik(0,$a(Tv)),Ok("design:paramtypes",[Object])],Dk);let Fk=!1;const zk=new Fa(((t,e,i,s)=>{Fk||(Fk=!0,t(wb).to(Dk).inSingletonScope(),t(Fb).toService(wb))})),jk=Y_();function Hk(){Hk.__loaded||(Hk.__loaded=!0,pf.RegisterGraphicCreator("arc",of),xo.load(xy),xo.load(jk?kA:Nx))}Hk.__loaded=!1;const Vk=Hk;function Nk(){Nk.__loaded||(Nk.__loaded=!0,pf.RegisterGraphicCreator("area",nf),xo.load(wy),xo.load(jk?UA:$x))}Nk.__loaded=!1;const Uk=Nk;function Wk(){Wk.__loaded||(Wk.__loaded=!0,pf.RegisterGraphicCreator("circle",Sg),xo.load(Py),xo.load(jk?ik:tS))}Wk.__loaded=!1;const Gk=Wk;function Yk(){Yk.__loaded||(Yk.__loaded=!0,pf.RegisterGraphicCreator("glyph",zg),xo.load(Vy),xo.load(jk?Tk:oS))}Yk.__loaded=!1;const Xk=Yk;function $k(){$k.__loaded||($k.__loaded=!0,pf.RegisterGraphicCreator("group",Rp))}$k.__loaded=!1;const Kk=$k;function qk(){qk.__loaded||(qk.__loaded=!0,pf.RegisterGraphicCreator("image",Wg),xo.load($y),xo.load(jk?zk:dS))}qk.__loaded=!1;const Zk=qk;function Jk(){Jk.__loaded||(Jk.__loaded=!0,pf.RegisterGraphicCreator("line",Lg),xo.load(My),xo.load(jk?FA:vS))}Jk.__loaded=!1;const Qk=Jk;function tM(){tM.__loaded||(tM.__loaded=!0,pf.RegisterGraphicCreator("path",tf),xo.load(Iy),xo.load(jk?gk:ES))}tM.__loaded=!1;const eM=tM;function iM(){iM.__loaded||(iM.__loaded=!0,pf.RegisterGraphicCreator("polygon",cf),xo.load(Fy),xo.load(jk?bk:AS))}iM.__loaded=!1;const sM=iM;function nM(){nM.__loaded||(nM.__loaded=!0,pf.RegisterGraphicCreator("rect",Dg),xo.load(Ay),xo.load(jk?BA:FS))}nM.__loaded=!1;const rM=nM;function aM(){aM.__loaded||(aM.__loaded=!0,pf.RegisterGraphicCreator("richtext",Zg),xo.load(Yy),xo.load(jk?Lk:jS))}aM.__loaded=!1;const oM=aM;function lM(){lM.__loaded||(lM.__loaded=!0,pf.RegisterGraphicCreator("shadowRoot",uf))}lM.__loaded=!1;const hM=lM;function cM(){cM.__loaded||(cM.__loaded=!0,pf.RegisterGraphicCreator("symbol",Eg),xo.load(Ey),xo.load(jk?qA:GS))}cM.__loaded=!1;const dM=cM;function uM(){uM.__loaded||(uM.__loaded=!0,pf.RegisterGraphicCreator("text",Tg),xo.load(Ry),xo.load(jk?lk:KS))}uM.__loaded=!1;const pM=uM;function gM(){Kk(),rM()}const fM=-.5*Math.PI,mM=1.5*Math.PI,vM="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var _M;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(_M||(_M={}));const yM={[_M.selectedReverse]:{},[_M.selected]:{},[_M.hover]:{},[_M.hoverReverse]:{}},bM={container:"",width:30,height:30,style:{}},xM="scrollDrag";function SM(){return"browser"===I_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const AM={debounce:St,throttle:At};gM();let kM=class t extends db{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=_t(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=_t(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=SM(),a="browser"===I_.env?I_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=_t(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:AM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:yt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=yt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(xM,{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",AM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===I_.env?I_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(yt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ai(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ai(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=_t(t[0],0,1),c=_t(t[1],0,1),d=_t(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=yt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?yt([a+i*n,a+s*n],a,n-l):yt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=SM(),e="browser"===I_.env?I_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===I_.env?I_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};kM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};var MM,TM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wM=MM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ve).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Ut(t.deltaX)>Ut(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ne,e.addEventListener("wheel",this.scroll),this.params=MM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(xM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new kM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(wM)||(t(wM).toSelf(),t(e_).toService(wM))}));function EM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&EM(t,e)}))}const BM=t=>!u(t)&&!1!==t.visible;function PM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function LM(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const OM=["#ffffff","#000000"];function IM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ii(t).toHex(),o=new ii(e).toHex();return DM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...OM);for(const n of a)if(t!==n&&DM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function DM(t,e,i,s,n){if("lightness"===n){const i=ii.getColorBrightness(new ii(e));return ii.getColorBrightness(new ii(t))<.5?i>=.5:i<.5}return s?FM(t,e)>s:"largeText"===i?FM(t,e)>3:FM(t,e)>4.5}function FM(t,e){const i=zM(t),s=zM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function zM(t){const e=ni(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function jM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function HM(t,e){return[t[0]*e,t[1]*e]}function VM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function NM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const UM=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:vM,fontSize:14},s),getTextBounds:i?void 0:mf,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function WM(t,e,i={}){if(!t)return{width:0,height:0};const s=mf({text:t,fontFamily:e.fontFamily||i.fontFamily||vM,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function GM(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function YM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function XM(t,e="type"){const i=GM(t,e);return"rich"===i?pf.richtext(YM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),pf.text(t))}function $M(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const KM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function qM(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function ZM(t,e){const{dx:i,dy:s}=qM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function JM(){Kk(),rM(),dM(),oM(),pM()}var QM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=QM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Wl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},tT.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}tT.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const eT={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}},iT={poptip:j({},eT)};var sT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",Xt(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",Xt(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:jt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:jt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:jt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}cT.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};var dT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let uT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};j(s,cT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new cT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,iT.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};uT=dT([qa()],uT);var pT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class gT{constructor(){this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let fT=class extends gT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};fT=pT([qa()],fT);let mT=class extends gT{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};mT=pT([qa()],mT);const vT=new Fa(((t,e,i,s)=>{i(uT)||(t(uT).toSelf().inSingletonScope(),t(dg).toService(uT)),i(fT)||(t(fT).toSelf(),t(e_).toService(fT)),i(mT)||(t(mT).toSelf(),t(e_).toService(mT))}));class _T extends db{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}Kk(),Qk();class yT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},yT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}yT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Kk(),rM();class bT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},bT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}bT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},Kk(),Vk();class xT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},xT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}xT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},Kk(),Vk();class ST extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ST.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=fM,endAngle:s=mM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}ST.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},Kk(),eM();class AT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},AT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ce(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}function kT(){Kk(),Qk(),sM(),dM()}function MT(){Kk(),Qk(),Vk(),dM()}AT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},kT();class TT extends db{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TT.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=pf.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=pf.line;Y(i)[0].cornerRadius&&(t=pf.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=pf.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}TT.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}}},MT();class wT extends TT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TT.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=pf.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var CT,ET;!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.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(CT||(CT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(ET||(ET={}));const BT={[ET.selectedReverse]:{},[ET.selected]:{},[ET.hover]:{},[ET.hoverReverse]:{}},PT={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},LT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const RT=Math.sin(Math.PI/10);function OT(t,e=RT){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function IT(t,e=RT){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function DT(t){const e={};return EM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function FT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function zT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return HM(r,(s?-1:1)*(n?-1:1)*t/VM(r))}function jT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function VT(t,e,i){var s;if(IT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>ze(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>ze(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function NT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(_M.hover,!0),EM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(_M.hoverReverse,!0)})),s):i},WT=(t,e,i)=>i?(EM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(_M.hoverReverse),t.removeState(_M.hover))})),null):i,GT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(_M.selected)?(EM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(_M.selectedReverse),t.removeState(_M.selected))})),null):s.name&&!P(s.states)?(s.addState(_M.selected,!0),EM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(_M.selectedReverse,!0)})),s):i};class YT extends db{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const XT={type:"default",duration:300,easing:"linear"};class $T extends YT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=UT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=WT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=GT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=pf.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prepare(),this._prevInnerView=this._innerView&&DT(this._innerView),this.removeAllChild(!0),this._innerView=pf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(XT)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=pf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=CT.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=pf.group({x:0,y:0,pickable:!1});t.name=CT.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=pf.group({x:0,y:0,pickable:!1});i.name=CT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=pf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=CT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=yM;else{const t=this.data[s],e=j({},yM,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=pf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=CT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=yM;else{const i=j({},yM,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=pf.group({x:0,y:0,pickable:!1});return r.name=`${CT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=XM(this._getLabelAttribute(t,e,n,i));if(a.name=CT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=yM;else{const s=j({},yM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new tT(Object.assign({},e));i.name=CT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return FT(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Ut(s[0])>Ut(s[1])?o=jt/2*(l.x>e.x?1:-1):h=jt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?j({},PT.label.style,_(t,e,i,s)):_;_=j(this.getLabelAlign(m,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return d(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},EM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const KT={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&VT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function qT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function ZT(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:KT[n]||KT.parity;if(s.length>=3&&NT(s,r)){do{s=a(s,r)}while(s.length>=3&&NT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);VT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),ZT(l,s,n,(t=>VT(t,l,r))),ZT(h,s,o,(t=>VT(t,h,r)||!(!n||t===l)&&VT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function QT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},iw(t,e.attribute.angle)),{angle:ew(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({},sw(t,e.attribute.angle)),{angle:ew(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function ew(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function iw(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=ew(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function sw(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=ew(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function nw(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=IT(h),m=OT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function rw(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class aw{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=VM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return HM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class ow{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-ow.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*ow.bounceIn(2*t):.5*ow.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Nt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Nt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Nt/e)*.5+1}}static registerFunc(t,e){ow[t]=e}}function lw(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}ow.quadIn=ow.getPowIn(2),ow.quadOut=ow.getPowOut(2),ow.quadInOut=ow.getPowInOut(2),ow.cubicIn=ow.getPowIn(3),ow.cubicOut=ow.getPowOut(3),ow.cubicInOut=ow.getPowInOut(3),ow.quartIn=ow.getPowIn(4),ow.quartOut=ow.getPowOut(4),ow.quartInOut=ow.getPowInOut(4),ow.quintIn=ow.getPowIn(5),ow.quintOut=ow.getPowOut(5),ow.quintInOut=ow.getPowInOut(5),ow.backIn=ow.getBackIn(1.7),ow.backOut=ow.getBackOut(1.7),ow.backInOut=ow.getBackInOut(1.7),ow.elasticIn=ow.getElasticIn(1,.3),ow.elasticOut=ow.getElasticOut(1,.3),ow.elasticInOut=ow.getElasticInOut(1,.3*1.5),ow.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),ow.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},ow.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)ow[`flicker${t}`]=e=>lw(e,t);for(let t=2;t<10;t++)ow[`aIn${t}`]=e=>t*e*e+(1-t)*e;function hw(t,e,i){return t+(e-t)*i}const cw=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=hw(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=hw(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=hw(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=hw(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=hw(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=hw(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=hw(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=hw(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=hw(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=pp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?fp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=pp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?fp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=hw(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=hw(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=hw(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=hw(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=hw(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=hw(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=hw(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=hw(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=hw(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=id(e,i,s),r.addUpdateBoundTag()}}};function dw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=ow[s])&&void 0!==n?n:ow.linear:ow.linear,"wait"===t&&(this.onUpdate=uw),this.id=Da.GenAutoIncrementId(),this.syncAttributeUpdate=uw}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=dp.Get(i,cp.Color255),r=dp.Get(s,cp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(cw["fill"===e?"fillPure":"strokePure"])}else cw[e]?t.push(cw[e]):t.push(dw)}else cw[e]?t.push(cw[e]):t.push(dw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class gw extends pw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class fw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Da.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Io.END?this.removeAnimate(t,!0):t.status!==Io.RUNNING&&t.status!==Io.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const mw=new fw;mw.isGlobal=!0;class vw{constructor(t=Da.GenAutoIncrementId(),e=mw,i){this.id=t,this.status=Io.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new pw(Oo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new gw(Oo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new pw(Oo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Io.RUNNING&&(this.status=Io.PAUSED)}resume(){this.status===Io.PAUSED&&(this.status=Io.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Io.END&&this.onEnd(),this.status=Io.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Io.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Io.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Io.END);this.status=Io.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const _w=new Mo;class yw{constructor(){this.released=!1}tick(t,e){_w.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class bw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Ro.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Ro.INITIAL,Ao.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Ao.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new yw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Ro.INITIAL&&(this.status=Ro.PAUSE,!0)}resume(){return this.status!==Ro.INITIAL&&(this.status=Ro.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Ro.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Ro.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Ro.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Ao.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function Aw(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}Sw.getInstance();class kw{static registerBuiltInAnimate(t,e){kw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:kw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=Aw(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:kw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=Aw(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),O.attrOutChannel&&e.setAttributes(O.attrOutChannel),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_,y,b;if(e&&i){i=Aw(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(_=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:kw.builtInAnimateMap[r],f=t.custom?t.customType:Aw(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Io.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}kw.builtInAnimateMap={};const Mw="appear",Tw="disappear",ww="update",Cw="highlight",Ew="unhighlight";class Bw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class Pw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=Sw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new kw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new kw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([Mw],[{name:Mw,animation:t}],e)}applyDisappearState(t,e){this.applyState([Tw],[{name:Tw,animation:t}],e)}applyUpdateState(t,e){this.applyState([ww],[{name:ww,animation:t}],e)}applyHighlightState(t,e){this.applyState([Cw],[{name:Cw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([Ew],[{name:Ew,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class Lw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new Pw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new Bw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new Lw)._getAnimationStateManager(t),t}}class Rw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new vw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:mw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new fw}createTicker(t){return new bw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new kw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function Ow(){G(Bp,Lw),G(Bp,Rw)}class Iw extends pw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Dw extends Iw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Fw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new kw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function zw(t){return new Fw(t)}class jw extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Hw=1e3,Vw="quadInOut",Nw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Uw=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=pp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Ww=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?uy(t):[],n=uy(e);i&&s&&(i.fromTransform&&py(s,i.fromTransform.clone().getInverse()),py(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Yw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Xw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Yw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?dp.Get(t,cp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class $w extends Iw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Ww(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Uw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Kw=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Gw(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Xw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new $w({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Hw,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Vw);return c.play(d),c};class qw extends Iw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Ww(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&Uw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Zw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Nw.includes(t))(i)||(e[i]=t[i])})),e},Jw=(t,e,i)=>{const s=Zw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=Ao.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Qw=(t,e,i)=>{const s=[],n=i?null:Zw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Zw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Rg(t.attribute),n=fy(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Ao.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=fy(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(Ao.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=fy(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(Ao.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return my(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return my(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ao.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:vy(i)}];const s=[];return yy(i,e,s),s})(t,e).forEach((t=>{s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return yy(l,e,h),h})(t,e).forEach((t=>{s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=uy(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(Ao.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Jw(t,s,e),s};class eC extends Iw{constructor(t,e,i,s,n){super(null,{},i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){super.onBind(),this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:qo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:qo.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:qo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class iC extends eC{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=Ao.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class sC extends eC{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Ao.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class nC extends Iw{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=_t(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=ed(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class oC extends rC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class lC extends aC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const hC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class cC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class dC extends cC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=hC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class uC extends cC{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class pC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class gC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const fC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class mC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=fC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class vC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const _C=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class yC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>ed(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class bC extends yC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:_C(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class xC extends yC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:_C(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const SC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class AC extends yC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:SC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class kC extends yC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:SC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const MC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class TC extends yC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:MC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class wC extends yC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:MC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const CC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class EC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class BC extends EC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=CC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class PC extends EC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const LC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class RC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=LC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class OC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class IC extends Dw{onBind(){var t;const e=zw(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class DC extends Dw{onBind(){const t=zw(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function FC(){Kk(),Qk(),oM(),pM(),kw.registerBuiltInAnimate("axisEnter",IC),kw.registerBuiltInAnimate("axisUpdate",DC)}var zC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=pf.group({zIndex:999});e.name=CT.axisBreak,e.id=this._getNodeId(`${CT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},LT,s),a=null!==(e=r.size)&&void 0!==e?e:LT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=pf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=CT.axisBreakSymbol;const h=pf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=CT.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=pf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=CT.background,n.id=this._getNodeId("background"),n.states=j({},BT,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new tT(Object.assign({},t));e.name=CT.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=zC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:j({},BT,l),symbol:j({},BT,l)});const d=new TT(c);d.name=CT.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=zC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+L(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let T,w,{angle:C}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(C)&&o){C=NM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else T=this.getTextAlign(M),w=this.getTextBaseline(M,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(C!==Math.PI/2){const t=Math.abs(Math.cos(null!=C?C:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(C&&0!==C){const t=Math.abs(Math.sin(C));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:w},a),state:{text:j({},BT,c.text),shape:j({},BT,c.shape),panel:j({},BT,c.background)}});return B.angle=C,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=zC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(u(b)&&a){b=NM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return iw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return sw(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),tw(i,t),!QT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=IT(a),l=OT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=rw(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Xt(c,i))}}else{if(l){const i=rw(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Xt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);nw(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&JT(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=pf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=CT.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=WM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ai(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}jC.defaultAttributes=PT,G(jC,aw);class HC{isInValidValue(t){const{startAngle:e=fM,endAngle:i=mM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=fM,endAngle:i=mM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return zT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function VC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=VC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var WC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=jT(n,l,c,e,i);h=pf.path(Object.assign(Object.assign({},a.style),{path:HT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=pf.circle(t)}h.name=CT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},BT,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=WC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:j({},BT,d.text),shape:j({},BT,d.shape),panel:j({},BT,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=VC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&NC(e,c,i)}else e.AABBBounds.width()>r&&NC(e,r,i)}else o>a.x&&h.x2>n.x2?(NC(e,n.x2-o,i),r&&UC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}GC.defaultAttributes=PT,G(GC,HC);const YC=t=>t.map(((t,e)=>({index:e,value:t}))),XC=(t,e,i=0)=>{const s=new Ne(t).expand(i/2),n=new Ne(e).expand(i/2);return s.intersects(n)},$C=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=UM(a),_=t.range();let y=[];for(let i=0;i{ZC[t]=!0}));const iE=t=>-Math.log(-t),sE=t=>-Math.exp(-t),nE=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,rE=t=>10===t?nE:t===Math.E?Math.exp:e=>Math.pow(t,e),aE=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),oE=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),lE=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function hE(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 cE(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function dE(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function uE(t,e,i,s){return 1===i&&(i=0),dE(t,i,s)*(e/(1-i))}function pE(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function gE(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class mE{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=pE(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=_t(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const vE=Symbol("implicit");class _E extends mE{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=qC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=vE}clone(){const t=(new _E).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==vE)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return yE(t,e,r,n)}class xE extends _E{constructor(t){super(),this.type=qC.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=uE(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:bE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return bE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new xE(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:SE}=ri;function AE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=ii.parseColorString(e)){const e=SE(ii.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof si?SE(t,e):e instanceof ii?SE(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class kE extends mE{constructor(t=eE,e=eE){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=eE,this._piecewise=cE,this._interpolate=AE}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Mt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=bt(i[0],i[r-1])),this._piecewise=r>2?gE:cE,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:eE),this.rescale(i)):this._clamp!==eE}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const ME=Math.sqrt(50),TE=Math.sqrt(10),wE=Math.sqrt(2),CE=[1,2,5,10],EE=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=RE(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?PE(0,-(e-1)/s,s):PE((e-1)/s,0,s)},BE=vt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return EE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return EE(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=PE(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=PE(t,e,l);return n&&r.reverse(),r})),RE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=CE[0];return i>=ME?s=CE[3]:i>=TE?s=CE[2]:i>=wE&&(s=CE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function OE(t,e,i){const s=(e-t)/Math.max(0,i);return RE(s)}function IE(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=OE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function FE(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const zE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),jE=vt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),HE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=LE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?zE(t,e,n):zE(t,e,fE(n)),h=zE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),VE=vt(((t,e,i,s,n)=>IE(s(t),s(e),i).map((t=>fE(n(t))))));class NE extends kE{constructor(){super(...arguments),this.type=qC.Linear}clone(){var t;const e=new NE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return BE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=LE(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return IE(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function WE(t){return e=>-t(-e)}function GE(t=Number.EPSILON){return e=>Math.max(e,t)}class YE extends kE{constructor(){super(aE(10),rE(10)),this.type=qC.Log,this._limit=GE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new YE).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=aE(this._base),s=rE(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=WE(i),this._pows=WE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=iE,this.untransformer=sE):(this._logs=i,this._pows=s,this._limit=GE(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return eE}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return jE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return HE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return VE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return VE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(YE,UE);class XE extends NE{constructor(){super(oE(1),lE(1)),this.type=qC.Symlog,this._const=1}clone(){return(new XE).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=oE(t),this.untransformer=lE(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return jE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return HE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return VE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return VE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(XE,UE);class $E{constructor(){this.type=qC.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[lt(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 $E).domain(this._domain).range(this._range).unknown(this._unknown)}}function KE(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function qE(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!JC(t.type))return YC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return YC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=KE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=KE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=KE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=KC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=KC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?JE.greedy:JE.parity;for(;l.length>=3&&NT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;VT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),qE(t,l,a,(e=>VT(e,t,i))),qE(n,l,o,(e=>VT(e,n,i)||!(!a||e===t)&&VT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return YC(m)},JE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&VT(i,t,e)||(i=t,0))))}},QE=(t,e,i,s)=>{const n=KC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},tB=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,eB=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?YC([s[s.length-1]]):YC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(g),a=$(g);if(s.length<=f/n){const i=QE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=sB(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=QE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!tB(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?eB(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=UM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=FT(r,zT(s,r,e,n));return o=a,l=zT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(gt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return YC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=nB(t,i,e),r=K(s),l=$(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=aB(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return YC(c)},aB=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&XC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},oB=new Uint32Array(33),lB=new Uint32Array(33);lB[0]=0,oB[0]=~lB[0];for(let t=1;t<=32;++t)lB[t]=lB[t-1]<<1|1,oB[t]=~lB[t];function hB(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&oB[31&o]&lB[1+(31&l)])return!0}else{if(i[h]&oB[31&o])return!0;if(i[c]&lB[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,oB[31&o]&lB[1+(31&l)]);else for(s(h,oB[31&o]),s(c,lB[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,lB[31&a]|oB[1+(31&o)]);else for(n(l,lB[31&a]),n(h,oB[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function cB(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=_t(i,-o,t.width+l),d=_t(s,-o,t.width+l),u=_t(n,-a,t.height+h),p=_t(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function dB(t,e,i=!1){return i?cB(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function uB(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=dB(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=cB(t,r)),e.getRange(r)))}function pB(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return pB(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return pB(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return pB(t,e,n,s,h,c)}return!1}const fB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],mB=["top","inside-top","inside"];function vB(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const _B={mode:"same-time",duration:300,easing:"linear"};function yB(t){return 3===t||4===t}function bB(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const xB=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function SB(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}var AB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const TB=(t,e)=>Math.ceil(t)>Math.floor(e),wB=([t,e],[i,s])=>s>t&&e>i;function CB(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var EB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(_M.hover,!0),EM(this,(t=>{t===e||P(t.states)||t.addState(_M.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(EM(this,(t=>{P(t.states)||(t.removeState(_M.hoverReverse),t.removeState(_M.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void EM(this,(t=>{P(t.states)||(t.removeState(_M.selectedReverse),t.removeState(_M.selected))}));P(e.states)||(e.addState(_M.selected,!0),EM(this,(t=>{t===e||P(t.states)||t.addState(_M.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===qo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===qo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[SB(g,f,c,d,a,o),SB(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=pf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Wl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],h=o;if(!c(e)&&d(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?h.push(i):l.push(i)}))}d(r)?o=r(h,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(h).concat(l)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return XM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&TB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&TB(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(CB([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!wB([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(dB(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(dB(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(dB(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{PB[t]=e};var RB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}OB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const IB=()=>{LB("symbol",OB),LB("line-data",OB)};var DB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}FB.tag="rect-label",FB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var zB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};jB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const HB=()=>{LB("line",jB),LB("area",jB)};var VB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new NB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):yB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=yB(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=yB(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=yB(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?yB(t.quadrant)?"left":"right":yB(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(yB(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function YB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ae.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function XB(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=HT(t,!!n),o=HT(r,!!n);const h=ae.distancePP(s,l),c=ae.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=YB(e,t,!1,!!n),o=YB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=HT(t,!!n),o=HT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}GB.defaultAttributes={pickable:!1};class $B extends db{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&DT(this._innerView),this.removeAllChild(!0),this._innerView=pf.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return FT(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=j({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${CT.grid}-sub`:`${CT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=HT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=YB(t,o,!1,!!a)}const u=pf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:$B.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=HT(o,!!a),m=Ut(o[0].x-o[1].x),v=Ut(o[0].y-o[1].y),_=pf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*jt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:$B.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}$B.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},Kk(),eM();class KB extends $B{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},$B.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=fM,endAngle:r=mM}=this.attribute;i=jT(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=j({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}G(KB,aw);var qB,ZB,JB,QB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(tP,HC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(qB||(qB={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(ZB||(ZB={})),function(t){t.dataZoomChange="dataZoomChange"}(JB||(JB={}));const eP="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",iP={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:eP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:eP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},sP={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}},nP=0,rP=1,aP=2,oP=3,lP=4,hP=5,cP=5,dP=999,uP=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var pP=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:aP},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:aP},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:nP},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T;const{orient:w,middleHandlerStyle:C={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:L,end:R}=this._getState(),{position:O,width:I,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:O.x+L*I,y:O.y-t,width:(R-L)*I,height:t,zIndex:hP},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:O.x+(L+R)/2*I,y:O.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:hP},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+L*I,y:O.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},sP.horizontal),{zIndex:hP}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+R*I,y:O.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},sP.horizontal),{zIndex:hP}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+L*I-t/2,y:O.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:dP},sP.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+R*I-g/2,y:O.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:dP},sP.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===w?O.x-t:O.x+I,y:O.y+L*D,width:t,height:(R-L)*D,zIndex:hP},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===w?O.x-t/2:O.x+I+t/2,y:O.y+(L+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:hP},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+L*D,size:I,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},sP.vertical),{zIndex:hP}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+R*D,size:I,symbolType:null!==(M=B.symbolType)&&void 0!==M?M:"square",zIndex:hP},sP.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+I/2+t/2,y:O.y+L*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dP},sP.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+I/2+i/2,y:O.y+R*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dP},sP.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:oP},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:oP},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:rP},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:lP},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ve).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=pP(c,["formatMethod"]),{formatMethod:g}=d,f=pP(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:uP(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},w={textAlign:uP(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:uP(A,t,"start",this._isHorizontal)?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:uP(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:cP}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:cP}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new tT(e),s.name=i,t.add(s)),s}}const fP={debounce:St,throttle:At};class mP extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=qB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=qB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=qB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=qB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=qB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===I_.env?I_:this.stage,s=SM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===qB.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===qB.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===qB.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===qB.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(ZB.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(ZB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(ZB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===qB.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(ZB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(ZB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:fP[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===I_.env?I_:this.stage,e=SM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===I_.env?I_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===I_.env?I_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:_t(e+t,0,1),end:_t(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=qB.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}JM(),rM(),dM(),Uk(),Qk();let vP=class t extends db{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new gP(this._getRendererAttrs()),this._interaction=new mP(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(ZB.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(ZB.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(JB.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(ZB.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(JB.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var _P,yP,bP,xP;function SP(){Kk(),JM(),Ow()}vP.defaultAttributes=iP,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(_P||(_P={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(yP||(yP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(bP||(bP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(xP||(xP={}));class AP extends db{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=UT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=WT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=GT(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=pf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=pf.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=pf.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function kP(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function MP(t,e,i,s){t&&(kP(t.startSymbol,e,i,s),t.lines.forEach((t=>kP(t,e,i,s))),kP(t.line,e,i,s),kP(t.endSymbol,e,i,s))}function TP(t,e,i,s){t&&(kP(t.getTextShape(),e,i,s),kP(t.getBgRect(),e,i,s))}function wP(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function CP(t,e,i,s){t&&(wP(t.startSymbol,e,i,s),t.lines.forEach((t=>wP(t,e,i,s))),wP(t.line,e,i,s),wP(t.endSymbol,e,i,s))}function EP(t,e,i,s){t&&(wP(t.getTextShape(),e,i,s),wP(t.getBgRect(),e,i,s))}function BP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;kP(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),kP(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;kP(t.getTextShape(),e,l,n),kP(t.getBgRect(),e,l,n)}))}function PP(t,e,i,s,n){MP(t,s,i,n),Y(e).forEach((t=>{TP(t,s,i,n)}))}function LP(t,e,i,s,n){kP(t,s,i,n),Y(e).forEach((t=>{TP(t,s,i,n)}))}function RP(t,e,i,s,n){kP(t,s,i,n),Y(e).forEach((t=>{TP(t,s,i,n)}))}function OP(t,e,i,s,n,r){var a;MP(t,n,s,r),kP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?TP(i,n,s,r):kP(i,n,s,r)}function IP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;kP(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),kP(e,n+o+l,h,r),kP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(kP(i.getTextShape(),n+o+l+h+c,d,r),kP(i.getBgRect(),n+o+l+c,d,r)):kP(i,n+o+l+c,d,r)}function DP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?BP(t,e,s,r,a):"fadeIn"===i&&PP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?BP(t,e,s,n,a):"fadeIn"===i&&PP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){CP(t,s,i,n),Y(e).forEach((t=>{EP(t,s,i,n)}))}(t,e,i,s,n)}}function FP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&LP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&LP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wP(t,s,i,n),Y(e).forEach((t=>{EP(t,s,i,n)}))}(t,e,i,s,n)}}function zP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&RP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&RP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wP(t,s,i,n),Y(e).forEach((t=>{EP(t,s,i,n)}))}(t,e,i,s,n)}}function jP(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?OP(n,r,e,i,s,o):"callIn"===t&&IP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?OP(n,r,e,i,s,a):"callIn"===t&&IP(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;CP(t,n,s,r),wP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?EP(i,n,s,r):wP(i,n,s,r)}(n,r,e,t,i,s)}}const HP={type:"clipIn",duration:500,easing:"linear",delay:0},VP={type:"fadeIn",duration:500,easing:"linear",delay:0},NP={type:"callIn",duration:500,easing:"linear",delay:0},UP={type:"fadeOut",duration:500,easing:"linear",delay:0};class WP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new tT(Object.assign(Object.assign({},h),{state:{panel:j({},yM,null!==(o=a[n])&&void 0!==o?o:X(a)),text:j({},yM,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},yM,null!==(a=r[s])&&void 0!==a?a:X(r)),text:j({},yM,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class GP extends AP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=HP,this.defaultExitAnimation=UP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;ZM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(GP,WP);const YP=.001,XP={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:_P.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]}},$P={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},KP={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:bP.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},qP={interactive:!0,label:{position:yP.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}},ZP={interactive:!0,label:{autoRotate:!0,position:bP.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},JP={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},QP={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},tL={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function eL(){iL._animate=DP}SP(),kT(),Ow();class iL extends GP{markerAnimate(t){iL._animate&&this._animationConfig&&iL._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},iL.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(PM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return LM(Math.abs(e),Math.PI/2,YP)||LM(Math.abs(e),3*Math.PI/2,YP)?RM(i,e,t):PM(e)?$P.postiveXAxis[t]:$P.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new TT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},yM,null==a?void 0:a.line),startSymbol:j({},yM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},yM,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:j({},yM,null==a?void 0:a.line),startSymbol:j({},yM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},yM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",iL.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(iL.defaultAttributes.label)}}function sL(){nL._animate=FP}iL.defaultAttributes=XP,SP(),sM(),Ow();class nL extends AP{markerAnimate(t){nL._animate&&this._animationConfig&&nL._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},nL.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=VP,this.defaultExitAnimation=UP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},QP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;ZM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=pf.polygon(Object.assign({points:e},i));n.states=j({},yM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",nL.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},yM,null==i?void 0:i.area)),this._updateMarkLabels(nL.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}nL.defaultAttributes=qP,G(nL,WP),SP(),MT(),Ow();class rL extends GP{markerAnimate(t){rL._animate&&this._animationConfig&&rL._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},rL.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case bP.arcInnerStart:l=n;case bP.arcOuterStart:l=n;break;case bP.arcInnerEnd:l=r;case bP.arcOuterEnd:l=r;break;case bP.center:case bP.arcInnerMiddle:case bP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return JP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new wT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},yM,null==o?void 0:o.line),startSymbol:j({},yM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},yM,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},yM,null==o?void 0:o.line),startSymbol:j({},yM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},yM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",rL.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(rL.defaultAttributes.label)}}rL.defaultAttributes=KP,SP(),Vk(),Ow();class aL extends AP{markerAnimate(t){aL._animate&&this._animationConfig&&aL._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},aL.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=VP,this.defaultExitAnimation=UP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case bP.center:h=(s+n)/2,c=(r+a)/2;break;case bP.arcInnerStart:h=s,c=r;break;case bP.arcOuterStart:h=n,c=r;break;case bP.arcInnerEnd:h=s,c=a;break;case bP.arcOuterEnd:h=n,c=a;break;case bP.arcInnerMiddle:h=s,c=(r+a)/2;break;case bP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},JP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;ZM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=pf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},yM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",aL.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=j({},yM,null==o?void 0:o.area)),this._updateMarkLabels(aL.defaultAttributes.label)}isValidPoints(){return!0}}function oL(){lL._animate=jP}aL.defaultAttributes=ZP,G(aL,WP),SP(),kT(),MT(),dM(),Zk(),Qk(),Ow();class lL extends AP{markerAnimate(t){lL._animate&&this._animationConfig&&lL._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lL.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=NP,this.defaultExitAnimation=UP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return LM(Math.abs(s),Math.PI/2,YP)||LM(Math.abs(s),3*Math.PI/2,YP)?RM(t,s,n):PM(s)?tL.postiveXAxis[n]:tL.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=xP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},yM,null==p?void 0:p.textBackground),text:j({},yM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},yM,null==p?void 0:p.itemContent));const v=PM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=pf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},yM,null==s?void 0:s.itemContent)):"text"===n?o=new tT(Object.assign(Object.assign({},i),{state:{panel:j({},yM,null==s?void 0:s.textBackground),text:j({},yM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=pf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},yM,null==s?void 0:s.itemContent)):"image"===n?(o=pf.image(Object.assign(Object.assign({},i),r)),o.states=j({},yM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},yM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=LM(c,0,YP)||LM(d,0,YP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=KM(e-u,t-d),o=KM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(vL.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(vL.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===vL.focus||"focus"===o){const s=a.hasState(fL.focus);a.toggleState(fL.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[fL.unSelected,fL.unSelectedHover,fL.focus],t),this._setLegendItemState(e,fL.selected,t)})):(this._setLegendItemState(a,fL.selected,t),this._removeLegendItemState(a,[fL.unSelected,fL.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[fL.selected,fL.selectedHover,fL.focus],t),this._setLegendItemState(e,fL.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(fL.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(fL.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(mL.legendItemClick,a,t);i?(this._removeLegendItemState(a,[fL.selected,fL.selectedHover],t),this._setLegendItemState(a,fL.unSelected,t)):(this._setLegendItemState(a,fL.selected,t),this._removeLegendItemState(a,[fL.unSelected,fL.unSelectedHover],t))}else this._setLegendItemState(a,fL.selected,t),this._removeLegendItemState(a,[fL.unSelected,fL.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[fL.selected,fL.selectedHover],t),this._setLegendItemState(e,fL.unSelected,t))}))}this._dispatchLegendEvent(mL.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,fL.selected),this._removeLegendItemState(e,[fL.unSelected,fL.unSelectedHover])):(this._removeLegendItemState(e,[fL.selected,fL.selectedHover]),this._setLegendItemState(e,fL.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=uL,spaceRow:l=pL,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=pf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ai(c);let w;!1===x.visible?(w=pf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,vL.item,t,w)):(w=pf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,vL.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?fL.selected:fL.unSelected);const C=pf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=pf.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,vL.itemShape,t,w,S.state),s.addState(e?fL.selected:fL.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=pf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,vL.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=XM(Object.assign(Object.assign({x:P/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,vL.itemLabel,t,w,A.state),D.addState(e?fL.selected:fL.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=XM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,vL.itemValue,t,w,k.state),r.addState(e?fL.selected:fL.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new dL(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new dL(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new kM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new kM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=uL,spaceRow:o=pL}=n,l=this._itemsContainer,{space:h=gL,defaultCurrent:c=1}=r,d=xL(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=pf.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=uL,spaceRow:a=pL}=s,o=this._itemsContainer,{space:l=gL,defaultCurrent:h=1}=n,c=xL(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=pf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=pf.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(_t(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(_t(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(fL.selected)?this._setLegendItemState(t,fL.selectedHover,e):this._setLegendItemState(t,fL.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===vL.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(mL.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(fL.unSelectedHover)||t.hasState(fL.selectedHover))&&(i=!0),t.removeState(fL.unSelectedHover),t.removeState(fL.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(fL.unSelectedHover)&&!t.hasState(fL.selectedHover)||(i=!0),t.removeState(fL.unSelectedHover),t.removeState(fL.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===vL.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(mL.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(mL.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==vL.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(mL.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==vL.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(mL.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(fL.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},SL,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(fL.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var kL;function ML(t){return y(t)?t:[t,t]}function TL(t){return t?"ew-resize":"ns-resize"}AL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:uL,spaceRow:pL,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:gL,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"}(kL||(kL={})),yL();class wL extends db{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},wL.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=_t(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=SM(),n="browser"===I_.env?I_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=_t(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=SM(),n="browser"===I_.env?I_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?_t(t+p,h,c):_t(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?_t(t+p,0,c-h):_t(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:ML(d)[0],endValue:ML(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=pf.group({x:0,y:0});f.name=kL.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=pf.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=kL.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=pf.group({x:g?v:0,y:g?0:v});f.add(_);const y=pf.group({x:0,y:0});let b;if(y.name=kL.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=pf.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=kL.endText,f.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=pf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=kL.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=ML(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":TL(p)},r));if(v.name=kL.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=kL.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":TL(p)},r));if(i.name=kL.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=kL.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=yt(h,i,s);c=t[0],d=t[1]}else c=i,d=_t(h,i,s);const p=this._isHorizontal;e||(c=i);const f=pf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=kL.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":TL(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=pf.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=kL.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return pf.symbol(t)}_renderHandlerText(t,e){return pf.text(this._getHandlerTextAttributes(t,e))}_getHandlerPosition(t){return this.attribute.range&&t?"start":"end"}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":TL(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=pf.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=pf.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===I_.env?I_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=SM(),e="browser"===I_.env?I_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const n=t.name===kL.startHandler?this._startHandlerText:this._endHandlerText;if(n){const e=this._getHandlerPosition(t.name===kL.startHandler);n.setAttributes(this._getHandlerTextAttributes(i,e))}t.name===kL.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){const s=this._isHorizontal,n=this._getHandlerPosition(t.name===kL.startHandlerText);t.setAttributes(this._getHandlerTextAttributes(i,n));const r=t.name===kL.startHandlerText?this._startHandler:this._endHandler;r&&r.setAttributes({[s?"x":"y"]:e}),t.name===kL.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===I_.env?I_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}wL.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},bL(),yL();class CL extends _L{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},CL.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function EL(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}CL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},bL(),yL(),eM();class BL extends _L{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},BL.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=pf.group({x:0,y:0});this._innerView.add(x);const S=new wL({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:EL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=pf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}BL.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)"}},Kk(),pM(),oM();let PL=class t extends db{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ai(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},bM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},bM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};PL.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 LL={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"}}};Kk(),pM(),oM();let RL=class extends db{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(LL,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=XM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=WM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class OL extends Cg{constructor(t){super(t)}}var IL,DL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(IL||(IL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(DL||(DL={}));class FL extends db{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FL.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"},FL.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"},FL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},FL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},FL.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new OL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new OL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new OL(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(IL.OnPlay)},this.pause=()=>{this._dispatchEvent(IL.OnPause)},this.forward=()=>{this._dispatchEvent(IL.OnForward)},this.backward=()=>{this._dispatchEvent(IL.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}FL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},FL.defaultAttributes={[DL.Start]:{},[DL.Pause]:{},[DL.Backward]:{},[DL.Forward]:{}};const zL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},jL=[200,10];var HL,VL;!function(t){t.Default="default",t.Reverse="reverse"}(HL||(HL={})),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"}(VL||(VL={}));const NL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===HL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===HL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),UL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===HL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===HL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),WL=t=>"top"===t||"bottom"===t;class GL extends db{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},GL.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Yt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(WL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:jL[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:jL[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new wL(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=WL(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new FL(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=WL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:jL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(WL(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:WL(this._orient)?t+s:(this._size.width-r)/2,y:WL(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:WL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:WL(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:WL(this._orient)?t+s:(this._size.width-r)/2,y:WL(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function YL(){yL(),Kk(),dM()}GL.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({},zL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},zL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},zL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},zL),{key:"backward",position:"start"})}},YL();class XL extends GL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:HL.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(IL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(IL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(IL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(IL.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(VL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(NL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||UL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===HL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(VL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=I_.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(VL.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(VL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=I_.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(),I_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(VL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,I_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(VL.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(VL.change),this.dispatchCustomEvent(VL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var $L,KL=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};YL();class qL extends GL{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(IL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(IL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(IL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(IL.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(VL.change))},this.play=()=>KL(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(VL.play),this._rafId=I_.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=I_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,I_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(VL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,I_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(VL.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(VL.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(VL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}($L||($L={}));const ZL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},JL=5;const QL={debounce:St,throttle:At};Kk(),sM();let tR=class t extends db{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=ZL.updateTrigger,endTrigger:i=ZL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:QL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($L.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=ZL.trigger,resetTrigger:e=ZL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent($L.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent($L.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=JL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent($L.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent($L.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent($L.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=JL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($L.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($L.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=ZL.updateTrigger,endTrigger:e=ZL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=pf.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Le(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};tR.defaultAttributes=ZL;const eR=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},iR=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},sR={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:vM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:vM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:vM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ne).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},nR=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];Kk(),rM(),dM(),pM(),oM();let rR=class t extends db{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ai(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",j({symbolType:"circle"},u.shape,{visible:BM(u)&&BM(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},iR(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:BM(u)&&BM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},iR(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},bM),u.value),visible:BM(u)&&BM(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=BM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=BM(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!BM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(BM(n.key)?r+n.key.spacing:0)+(BM(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&($M(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:BM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),$M(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(BM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=ad(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(BM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},iR(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},iR(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},bM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(BM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},iR(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},iR(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>nR.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&BM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=BM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=UM(d),_=UM(u);let y=0;if(BM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(BM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&cu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return eR({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return eR({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};rR.defaultAttributes=sR;const aR=gt;function oR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function lR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function hR(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function cR(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function dR(t,e){const i=cR(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function uR(t,e){const i=pR(t),s=pR(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function pR(t,e={x:0,y:0}){return ae.distancePP(t,e)}function gR(t){return k(t.x)&&k(t.y)}function fR(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function mR(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const vR=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function yR(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&yR(t[i],e)}}var bR,xR,SR;function AR(t){var e,i;const{type:s}=t;return s===xR.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(bR||(bR={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(xR||(xR={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(SR||(SR={}));const kR={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},MR={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function TR(t,e){var i;if(!t)return[];const s=RR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?PR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>BR(i)?CR(t,i,e):i)).filter(p)}))):i.map((i=>BR(i)?CR(t,i,e):i)).filter(p):[]}return[]}function wR(t,e){var i,s;return PR(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function CR(t,e,i){var s;const n=RR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=kR[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=MR[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new ii(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Xe(t,i,s),a=Ye(n,r,e.l),l=new ii(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const ER=(t,e)=>{if(e&&BR(t)){const i=CR(e,t);if(i)return i}return t};function BR(t){return t&&"palette"===t.type&&!!t.key}function PR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function LR(t){return y(t)?{dataScheme:t}:t}function RR(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=AR(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class OR extends _E{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(!PR(this._range))return void super.range(this._range);const t=wR(this._range,this._domain);super.range(t)}}const IR={linear:NE,band:xE,point:class extends xE{constructor(t){super(!1),this.type=qC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:_E,threshold:$E,colorOrdinal:OR};function DR(t){const e=IR[t];return e?new e:null}function FR(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function zR(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function jR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function HR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function VR(t){return!!_(t)&&(!!t.endsWith("%")&&lb(t.substring(0,t.length-1)))}function NR(t){return!!g(t)&&("percent"in t||"offset"in t)}function UR(t,e,i,s=0){var n,r;return S(t)?t:VR(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function WR(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=UR(t[s],e.size,i)}))})),o}function GR(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function YR(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||VR(t)||d(t)||NR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function XR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const $R=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},KR=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function qR(t,e){return t&&e.key in t?t[e.key]:e.default}function ZR(t){return t&&"token"===t.type&&!!t.key}const JR={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},QR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:KR,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:JR,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},tO={name:"dark",colorScheme:{default:{dataScheme:KR,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},eO=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),eO(t[s],e.slice(1),i))};function iO(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=LR(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}sO._charts={},sO._series={},sO._components={},sO._graphicComponents={},sO._marks={},sO._regions={},sO._animations={},sO._implements={},sO._chartPlugin={},sO._vChartPlugin={},sO._componentPlugin={},sO.transforms={fields:Xr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},sO.dataParser={csv:(t,e={},i)=>(i.type=Yr.DSV,na(t)),dsv:(t,e={},i)=>{i.type=Yr.DSV;const s=Vr(aa,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return sa(n).parse(t)},tsv:(t,e={},i)=>(i.type=Yr.DSV,ra(t))},sO._layout={},sO._grammarTransforms={},sO._stageEventPlugins={},sO.registerStageEventPlugin=(t,e)=>{sO._stageEventPlugins[t]=e},sO.getStageEventPlugin=t=>sO._stageEventPlugins[t],sO._interactionTriggers={},sO.registerInteractionTrigger=(t,e)=>{sO._interactionTriggers[t]=e},sO._composedEventMap={},sO.registerComposedEvent=(t,e)=>{sO._composedEventMap[t]=e},sO._tooltipProcessors={},sO.registerTooltipProcessor=(t,e)=>{sO._tooltipProcessors[t]=e},sO.createTooltipProcessor=(t,e)=>{const i=sO._tooltipProcessors[t];return i?new i(e):null};const aO=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},oO=aO(),lO={[QR.name]:QR},hO=QR.name,cO=new Map(Object.keys(lO).map((t=>[t,lO[t]]))),dO=new Map,uO=new Map(Object.keys(lO).map((t=>[t,t===hO]))),pO=(t,e)=>{if(!t)return;const i=vO(e);cO.set(t,i),uO.set(t,!0)},gO=(t=hO)=>(uO.has(t)&&!uO.get(t)&&pO(t,cO.get(t)),cO.get(t)),fO=t=>cO.delete(t)&&dO.delete(t)&&uO.delete(t),mO=t=>!!_(t)&&cO.has(t),vO=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:hO;return nO({},gO(i),t)};class _O{static registerInstance(t){_O.instances.set(t.id,t)}static unregisterInstance(t){_O.instances.delete(t.id)}static getInstance(t){return _O.instances.get(t)}static instanceExist(t){return _O.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return _O.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}_O.instances=new Map;class yO{static registerTheme(t,e){pO(t,e)}static getTheme(t,e=!1){return gO(t)}static removeTheme(t){return fO(t)}static themeExist(t){return mO(t)}static getDefaultTheme(){return yO.themes.get(hO)}static setCurrentTheme(t){yO.themeExist(t)&&(yO._currentThemeName=t,_O.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return yO.getTheme(yO._currentThemeName,t)}static getCurrentThemeName(){return yO._currentThemeName}}function bO(t){return _(t)?yO.themeExist(t)?yO.getTheme(t):{}:g(t)?t:{}}yO.themes=cO,yO._currentThemeName=hO;const xO=["animationThreshold","colorScheme","name","padding"];function SO(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];xO.includes(n)?s[n]=r:m(r)?BR(r)?s[n]=ER(r,e):ZR(r)?s[n]=qR(i,r):s[n]=SO(r,e,i):s[n]=r})),s}function AO(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=AO(t[s],e)}return i}return y(t)?t.map((t=>AO(t,e))):t}function kO(t,e){if(!t)return t;if(m(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=kO(t[s],e)}return i}return y(t)?t.map((t=>kO(t,e))):t}function MO(t,...e){return d(t)?t(...e):t}const TO=(t,e,i,s)=>((t,e,i)=>UM(t,e,i,{fontFamily:JR.fontFamily,fontSize:JR.fontSize}))(e,i,s).measure(t),wO="__VCHART",CO=500,EO=500,BO=`${wO}_MEASURE_CANVAS_ID`,PO=`${wO}_DEFAULT_DATA_INDEX`,LO=`${wO}_DEFAULT_DATA_KEY`,RO=`${wO}_DEFAULT_DATA_SERIES_FIELD`,OO=`${wO}_DEFAULT_SERIES_STYLE_NAME`,IO=`${wO}_STACK_KEY`,DO=`${wO}_STACK_START`,FO=`${wO}_STACK_END`,zO=`${wO}_STACK_START_PERCENT`,jO=`${wO}_STACK_END_PERCENT`,HO=`${wO}_STACK_START_OffsetSilhouette`,VO=`${wO}_STACK_END_OffsetSilhouette`,NO=`${wO}_STACK_TOTAL`,UO=`${wO}_STACK_TOTAL_PERCENT`,WO=`${wO}_STACK_TOTAL_TOP`,GO=`${wO}_STACK_TOTAL_BOTTOM`,YO=`${wO}_MOSAIC_VALUE_START_PERCENT`,XO=`${wO}_MOSAIC_VALUE_END_PERCENT`,$O=`${wO}_MOSAIC_CAT_START_PERCENT`,KO=`${wO}_MOSAIC_CAT_END_PERCENT`,qO=`${wO}_SEGMENT_START`,ZO=`${wO}_SEGMENT_END`,JO=`${wO}_KEY`,QO=`${wO}_MAP_LOOK_UP_KEY`;function tI(t,e){for(let i=0;it.key===e))}function iI(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function sI(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},lI(t,a,n[o],l,e,r))})),s?nI(n):n}function nI(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):nI(t[e].nodes);return t}function rI(t,e){if("values"in t&&t.values.length){const i=hR(t.values,e),s=lR(t.values,jO);t.values.forEach((t=>{t[NO]=i,t[UO]=s}))}else for(const i in t.nodes)rI(t.nodes[i],e)}function aI(t){if(!t.values.length)return;const e=t.values[t.values.length-1][FO]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)oI(t.nodes[r],e,i,s,n)}function lI(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[FO]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),lI(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const hI=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=dI(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function uI(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>fI(t.style(e,i,s,n)):P(t.style)||(e.style=fI(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>fI(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=fI(t.state[e]))})),e.state=i}return e}function pI(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>fI(t[i](e,s,n,r)):P(t[i])||(e[i]=fI(t[i]))})),e}function gI(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),fI(i)}function fI(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const mI=t=>"line"===t||"area"===t,vI=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return mI(i)?e:null==e?void 0:e[0]},_I=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let yI=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=sO.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(sO.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var bI;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(bI||(bI={}));const xI=["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 SI,AI,kI;t.ChartEvent=void 0,(SI=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",SI.rendered="rendered",SI.renderFinished="renderFinished",SI.animationFinished="animationFinished",SI.regionSeriesDataFilterOver="regionSeriesDataFilterOver",SI.afterInitData="afterInitData",SI.afterInitEvent="afterInitEvent",SI.afterInitMark="afterInitMark",SI.rawDataUpdate="rawDataUpdate",SI.viewDataFilterOver="viewDataFilterOver",SI.viewDataUpdate="viewDataUpdate",SI.viewDataStatisticsUpdate="viewDataStatisticsUpdate",SI.markDeltaYUpdate="markDeltaYUpdate",SI.viewDataLabelUpdate="viewDataLabelUpdate",SI.scaleDomainUpdate="scaleDomainUpdate",SI.scaleRawDomainUpdate="scaleRawDomainUpdate",SI.scaleUpdate="scaleUpdate",SI.dataZoomChange="dataZoomChange",SI.drill="drill",SI.layoutStart="layoutStart",SI.layoutEnd="layoutEnd",SI.layoutRectUpdate="layoutRectUpdate",SI.playerPlay="playerPlay",SI.playerPause="playerPause",SI.playerEnd="playerEnd",SI.playerChange="playerChange",SI.playerForward="playerForward",SI.playerBackward="playerBackward",SI.scrollBarChange="scrollBarChange",SI.brushStart="brushStart",SI.brushChange="brushChange",SI.brushEnd="brushEnd",SI.brushClear="brushClear",SI.brushActive="brushActive",SI.legendSelectedDataChange="legendSelectedDataChange",SI.legendFilter="legendFilter",SI.legendItemClick="legendItemClick",SI.legendItemHover="legendItemHover",SI.legendItemUnHover="legendItemUnHover",SI.tooltipShow="tooltipShow",SI.tooltipHide="tooltipHide",SI.tooltipRelease="tooltipRelease",SI.afterResize="afterResize",SI.afterRender="afterRender",SI.afterLayout="afterLayout",SI.afterMarkLayoutEnd="afterMarkLayoutEnd",SI.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(AI||(AI={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(kI||(kI={}));const MI=[kI.mark,kI.model,kI.chart,kI.vchart];class TI{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(kI.vchart,[]),this._levelNodes.set(kI.chart,[]),this._levelNodes.set(kI.model,[]),this._levelNodes.set(kI.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const wI={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class CI{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>vI(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||AI.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||AI.chart);o.get(t)||o.set(t,new TI);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||AI.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||AI.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||AI.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||AI.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?MI.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[AI.chart,AI.window,AI.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&L(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return wI[a]&&(a=wI[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?kI.model:kI.vchart:kI.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=AI.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==kI.model&&s!==kI.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=kI.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case AI.chart:return this._viewBubbles;case AI.window:return this._windowBubbles;case AI.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case AI.chart:return this._viewListeners;case AI.window:return this._windowListeners;case AI.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return xI.includes(t)||Object.values(bI).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&sO.hasInteractionTrigger(e)}}function EI(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function BI(t,e,i){t.getParser(e)||t.registerParser(e,i)}const PI=new Map;let LI;function RI(){LI||(LI=new Ba,BI(LI,"geojson",ka),BI(LI,"topojson",Ta),EI(LI,"simplify",Gr))}function OI(t,e,i={type:"geojson",centroid:!0}){PI.has(t)&&Jy(`map type of '${t}' already exists, will be overwritten.`),RI();const s=new Pa(LI),n=j({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),PI.set(t,s)}function II(t){PI.has(t)?PI.delete(t):Jy(`map type of '${t}' does not exists.`)}function DI(t,e=!1){let i=e;return t.latestData instanceof Pa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const FI=(t,e)=>0===t.length?[]:1===t.length?DI(t[0],null==e?void 0:e.deep):t.map((t=>DI(t,null==e?void 0:e.deep)));function zI(e,i,s){EI(i=i instanceof Ba?i:e.dataSet,"copyDataView",FI);const n=new Pa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function jI(t,e,i=[]){var s;if(t instanceof Pa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Pa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Jy(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Jy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Jy("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function HI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var VI,NI,UI,WI;t.TransformLevel=void 0,(VI=t.TransformLevel||(t.TransformLevel={}))[VI.copyDataView=-10]="copyDataView",VI[VI.treemapFilter=-8]="treemapFilter",VI[VI.treemapFlatten=-7]="treemapFlatten",VI[VI.dotObjFlat=-7]="dotObjFlat",VI[VI.linkDotInfo=-7]="linkDotInfo",VI[VI.sankeyLayout=-7]="sankeyLayout",VI[VI.dataZoomFilter=-6]="dataZoomFilter",VI[VI.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(NI||(NI={})),function(t){t.data="data",t.mark="mark"}(UI||(UI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(WI||(WI={}));const GI=["line","area","trail"];function YI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(JO,i?t.slice().sort(i):t.slice()),{keys:[JO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const XI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function $I(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{$I(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function qI(t,e,i,s){const n=YI(t,(t=>i(t))),r=YI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const ZI=`${wO}_BuiltIn_CallBack_Disappear`;var JI;!function(t){t.render="render",t.disappear="disappear"}(JI||(JI={}));class QI{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;I_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new K_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Rp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:nb(o))&&!1!==c&&sO.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=WI.before}_setCanvasStyle(){if(this._stage&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(I_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=I_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>$I(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>$I(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{$I(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Zy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===WI.before&&(this._layoutState=WI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=WI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),Zy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=KI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=qI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=qI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=YI(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=YI(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:ZI,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{$I(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===NI.appear))?NI.appear:e.every((t=>t===NI.disappear))?NI.disappear:NI.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===AI.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:vI(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===AI.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===AI.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===AI.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===AI.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===AI.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{$I(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=KI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return sb(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return Su(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ao.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{$I(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=I_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){I_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function tD(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:Qy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function eD(t){t.crosshair=Y(t.crosshair||{}).map((e=>iO({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function iD(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=oi(l,i.width,i.height);a=t,o=e}else if(h&&sb(e.mode)){let t;t=_(h)?I_.getElementById(h):h;const{width:e,height:s}=oi(t,i.width,i.height);a=e,o=s}else if(rb(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function sD(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function nD(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var rD,aD,oD,lD,hD,cD;t.LayoutZIndex=void 0,(rD=t.LayoutZIndex||(t.LayoutZIndex={}))[rD.SeriesGroup=0]="SeriesGroup",rD[rD.Axis_Grid=50]="Axis_Grid",rD[rD.CrossHair_Grid=100]="CrossHair_Grid",rD[rD.Region=450]="Region",rD[rD.Mark=300]="Mark",rD[rD.Node=400]="Node",rD[rD.Axis=100]="Axis",rD[rD.MarkLine=500]="MarkLine",rD[rD.MarkArea=100]="MarkArea",rD[rD.MarkPoint=500]="MarkPoint",rD[rD.DataZoom=500]="DataZoom",rD[rD.ScrollBar=500]="ScrollBar",rD[rD.Player=500]="Player",rD[rD.Legend=500]="Legend",rD[rD.CrossHair=500]="CrossHair",rD[rD.Indicator=500]="Indicator",rD[rD.Title=500]="Title",rD[rD.Label=500]="Label",rD[rD.Brush=500]="Brush",rD[rD.CustomMark=500]="CustomMark",rD[rD.Interaction=700]="Interaction",t.LayoutLevel=void 0,(aD=t.LayoutLevel||(t.LayoutLevel={}))[aD.Indicator=10]="Indicator",aD[aD.Region=20]="Region",aD[aD.Axis=30]="Axis",aD[aD.DataZoom=40]="DataZoom",aD[aD.Player=40]="Player",aD[aD.ScrollBar=40]="ScrollBar",aD[aD.Legend=50]="Legend",aD[aD.Title=70]="Title",aD[aD.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(oD=t.AttributeLevel||(t.AttributeLevel={}))[oD.Default=0]="Default",oD[oD.Theme=1]="Theme",oD[oD.Chart=2]="Chart",oD[oD.Base_Series=3]="Base_Series",oD[oD.Series=4]="Series",oD[oD.Mark=5]="Mark",oD[oD.User_Chart=6]="User_Chart",oD[oD.User_Series=7]="User_Series",oD[oD.User_Mark=8]="User_Mark",oD[oD.User_SeriesStyle=9]="User_SeriesStyle",oD[oD.Built_In=99]="Built_In";class dD{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,j({},dD.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}dD.defaultMarkInfo={};class uD{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class pD{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>iO({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class gD extends uD{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=pD,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new dD,this._lastLayoutRect=null,this.id=ob(),this.userId=t.id,this._spec=t,this.effect={},this.event=new yI(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${wO}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=sO.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return L(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class fD{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=WR(YR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:UR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:UR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:UR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:UR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:UR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:UR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=UR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=UR(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=UR(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(GR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class mD extends gD{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new fD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=j(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=j(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class vD extends pD{_initTheme(t,e){return{spec:t,theme:this._theme}}}class _D extends mD{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=vD,this.modelType="region",this.specKey="region",this.type=_D.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function yD(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function bD(t,e,i){e?t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function xD(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function SD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=TD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),xD(d,!0,p,l),s&&bD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function AD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=TD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=TD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),xD(d,!1,p,o),s&&bD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function MD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=TD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=TD(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=yD(t);n.length&&SD(n,e,i,!1,"left",s),r.length&&SD(r,e,i,!0,"left",s),a.length&&AD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=yD(t);n.length&&kD(n,e,i,!1,"top",s),r.length&&kD(r,e,i,!0,"top",s),a.length&&MD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=yD(t);n.length&&SD(n,e,i,!1,"right",s),r.length&&SD(r,e,i,!0,"right",s),a.length&&AD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=yD(t);n.length&&kD(n,e,i,!1,"bottom",s),r.length&&kD(r,e,i,!0,"bottom",s),a.length&&MD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=TD(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{U(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=TD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Qy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}wD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(lD||(lD={})),t.STATE_VALUE_ENUM=void 0,(hD=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",hD.STATE_HOVER="hover",hD.STATE_HOVER_REVERSE="hover_reverse",hD.STATE_DIMENSION_HOVER="dimension_hover",hD.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",hD.STATE_SELECTED="selected",hD.STATE_SELECTED_REVERSE="selected_reverse",hD.STATE_SANKEY_EMPHASIS="selected",hD.STATE_SANKEY_EMPHASIS_REVERSE="blur",hD.STATE_HIGHLIGHT="highlight",hD.STATE_BLUR="blur",hD.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(cD||(cD={}));const CD=["linear","radial","conical"],ED={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const BD={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{BD[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class PD extends uD{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class LD extends PD{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,GI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!BD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(wO)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(wO))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(JC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class RD extends uD{constructor(){super(...arguments),this.id=ob(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=sO.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class OD extends RD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const ID=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,DD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=ID(l.delay,n,a,o),d=ID(l.duration,n,a,o),u=ID(l.oneByOne,n,a,o),p=ID(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Qw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:tC)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Kw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Qw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:tC)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Gw(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Xw(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:qo.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new $w({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Hw,null!==(l=i.easing)&&void 0!==l?l:Vw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:qo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new qw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Hw,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Vw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Kw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},FD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},zD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class jD extends RD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new OD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Rp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Wl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==lD.enter&&t.context.diffState!==lD.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=e,this.model=i.model,this.key=i.key,this.state=new LD(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&iO(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(QC(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=DR(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):CD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):QC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=wR(TR(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},ED[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ii.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)CD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=wR(TR(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return YI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return sO.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[LO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=YI(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===NI.appear))?NI.appear:t.every((t=>t===NI.disappear))?NI.disappear:t[0];return null!=e?e:NI.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{zD(t),s.push(...t.getGraphics())})),e.forEach((t=>{zD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);DD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=FD(e,n),r=FD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===NI.exit?NI.exit:i===NI.update?NI.update:NI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===lD.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===lD.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=lD.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=lD.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=lD.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=NI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=NI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return XI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=XI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),u(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=_I(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=sO.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=sO.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===WI.before||(this._product||this._initProduct(),Zy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===lD.exit&&!e.isExiting)if(e.context.animationState===lD.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:lD.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Rp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{t.clearStates()}))}}var HD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(HD||(HD={}));class VD extends jD{constructor(){super(...arguments),this.type=VD.type,this._marks=[],this._diffState=lD.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Jy("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?(Jy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return $I(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===lD.update){const t=this.hasAnimation(),e=_I(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=lD.update}render(){this._isCommited&&(Zy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}VD.type="group";const ND={measureText:TO};class UD{static instance(){return UD.instance_||(UD.instance_=new UD),UD.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class WD{constructor(){this.id=ob(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Jy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class GD extends WD{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const YD={type:"fadeIn"};function XD(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return YD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const $D={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},KD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},qD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},ZD=()=>{sO.registerAnimation("scaleInOut",(()=>KD))},JD=()=>{sO.registerAnimation("fadeInOut",(()=>qD))},QD=(t,e)=>({appear:XD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:nC,duration:$D.update.duration,easing:$D.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),tF=()=>{sO.registerAnimation("line",QD)},eF=()=>{kw.registerBuiltInAnimate("growPointsIn",bC),kw.registerBuiltInAnimate("growPointsOut",xC),kw.registerBuiltInAnimate("growPointsXIn",AC),kw.registerBuiltInAnimate("growPointsXOut",kC),kw.registerBuiltInAnimate("growPointsYIn",TC),kw.registerBuiltInAnimate("growPointsYOut",wC),kw.registerBuiltInAnimate("clipIn",oC),kw.registerBuiltInAnimate("clipOut",lC)},iF=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class sF{constructor(t){this._markSet=new dD,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const nF={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class rF extends sF{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},nF,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}rF.type="element-highlight",rF.defaultOptions=nF;const aF=()=>{sO.registerInteractionTrigger(rF.type,rF)},oF={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class lF extends sF{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},oF,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}lF.type="element-select",lF.defaultOptions=oF;const hF=()=>{sO.registerInteractionTrigger(lF.type,lF)};class cF extends WD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class dF{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>sO.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>sO.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>sO.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return sO.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>sO.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){sO.registerTransform(t,e)}static registerFunction(t,e){t&&e&&UD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&UD.instance().unregisterFunction(t)}static getFunction(t){return t?UD.instance().getFunction(t):null}static getFunctionList(){return UD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=sO.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=sO.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,PI.get(e);var e}static registerSVG(t,e,i){const s=sO.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=sO.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){_O.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 ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=ob(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=JI.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=sD(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?sO.getSeriesBuiltInTheme(e):sO.getComponentBuiltInTheme(e);i=i?iO({},s,i[e]):s}s===t.length-1&&p(i)&&(i=SO({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},yR(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=sb(v);if(S?vx(xo):"node"===v&&_A(xo),S&&f&&(this._container=_(f)?I_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=yO.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new QI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new CI(this,this._compiler),this._event=new yI(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),_O.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=iO({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=AO(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;dF.getFunctionList()&&dF.getFunctionList().length&&(t=kO(t,dF)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=sO.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=sO.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=sO.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return iD(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:CO,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:EO})}_initDataSet(t){this._dataSet=t instanceof Ba?t:new Ba,BI(this._dataSet,"dataview",wa),BI(this._dataSet,"array",s),EI(this._dataSet,"copyDataView",FI);for(const t in sO.transforms)EI(this._dataSet,t,sO.transforms[t]);for(const t in sO.dataParser)BI(this._dataSet,t,sO.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(!0),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))):t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?NI.none:NI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,_O.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Pa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=jI(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?iO({},t[n][e.index],i):i):t[n]=s?iO({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?iO({},t[n][r],i):i)}else t.id===e&&(t[n]=s?iO({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=iO({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=nO({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=bO(this._currentThemeName),this._currentTheme=o(a,l);else{const t=nO({},bO(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),bO(n),bO(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(iT.poptip,eT,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!sb(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return bO(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!yO.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield tD(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!sb(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t,e,i;null===(t=this._chart)||void 0===t||t.resetLayoutItemTag(),null===(e=this._chart)||void 0===e||e.setLayoutTag(!0,null,!1),null===(i=this._compiler)||void 0===i||i.render()}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?I_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?XR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Jy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?XR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Jy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return UD.instance().getFunction(t)}registerFunction(t,e){t&&e&&UD.instance().registerFunction(t,e)}unregisterFunction(t){t&&UD.instance().unregisterFunction(t)}getFunctionList(){return UD.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=sO.getChartPlugins();t.length>0&&(this._chartPlugin=new GD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=sO.getVChartPlugins();e.length>0&&(this._vChartPlugin=new cF(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=JI.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;this._renderState=JI.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent()}}dF.InstanceManager=_O,dF.ThemeManager=yO,dF.globalConfig={uniqueTooltip:!0},dF.Utils=ND,dF.vglobal=I_;sO.registerRegion("region",_D),sO.registerLayout("base",wD),hM(),Kk(),sO.registerMark(VD.type,VD),sO.registerStageEventPlugin("gesture",Hb),aF(),hF(),pO(tO.name,tO);const uF="monotone",pF="linear",gF="bevel";function fF(t,e){return e("component",t)}function mF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=sO.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const vF=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},_F=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))},yF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},bF=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=mF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},xF=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const SF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function AF(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=MF(bF(h,r,a,c),d,g),o.value=MF(bF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=bF(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function kF(t,e,i,s,n,r,a){if(d(e)){AF(t,e(n,a),i,s,r,a)}else e&&AF(t,e,i,s,r,a)}const MF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=mi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class TF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{kF(a,t,e,i,s,n,r)})):d(t)?kF(a,t,e,i,s,n,r):t&&AF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:bF(r.visible,t,n),value:MF(bF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:bF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=bF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&SF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const wF={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?$(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?$(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},CF=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=tI([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return EF(a,n,o)},EF=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{lb(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{lb(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=wF[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},BF=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{lb(t[e])||(t[e]=0)}))})),t},PF=`${wO}_HIERARCHY_DEPTH`,LF=`${wO}_HIERARCHY_ROOT`,RF=`${wO}_HIERARCHY_ROOT_INDEX`;function OF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function IF(t,e,i){t&&(i.needDefaultSeriesField&&(t[RO]=i.defaultSeriesField),t[PO]=e,t[LO]=i.getKey(t,e,i))}function DF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function FF(t,e,i,s=0,n,r){void 0===r&&(r=e),IF(t,e,i),t[PF]=s,t[LF]=n||t[i.categoryField],t[RF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>FF(e,s,i,t[PF]+1,t[LF],r)))}const zF={label:{name:"label",type:"text"}},jF=`${wO}_rect_x`,HF=`${wO}_rect_x1`,VF=`${wO}_rect_y`,NF=`${wO}_rect_y1`,UF={data:!0},WF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},GF=[...Object.keys($D),"normal"];function YF(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return ZF(n)&&delete n.type,n.oneByOne&&(n=$F(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:KF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=iO({},o[e],a);return ZF(n)&&delete n.type,n.oneByOne&&(n=$F(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:KF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function XF(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),JF(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function $F(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function KF(t,e){var i;return null!==(i=null==t?void 0:t[PO])&&void 0!==i?i:e.context.graphicIndex}function qF(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function ZF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function JF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),JF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),JF(t[s],e,i))}function QF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class tz extends pD{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=AR(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=sO.getSeriesMarkMap(o)?function(t,e,i){const s=sO.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=iO({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return iO({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=iO({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>iO({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class ez extends gD{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${wO}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=tz,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=QF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(EI(this._rawData.dataSet,"invalidTravel",BF),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=jI(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=zI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=zI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new OD(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=$(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=EF(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){EI(this._dataSet,"dimensionStatistics",CF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Pa(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&tI(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){EI(this._dataSet,"dimensionStatistics",CF);const s=new Pa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=tI(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&tI(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Pa(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(EI(this._rawData.dataSet,"addVChartProperty",yF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:OF.bind(this),call:IF}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=YF({},XF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:nb(s)||rb(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=iO(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=iO(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=iF(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=iF(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=iF(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:RO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:OO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,OO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new TF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},UF),WF),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>WF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Pa||HI(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();QF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:RO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new OR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return TR(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:RO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,iO({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:LO}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==FO&&t!==jO&&t!==DO&&t!==zO||(t=this.getStackValueField()),null!==(e=iI(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>lb(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:RO]}}function iz(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();JC(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function sz(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}ez.mark=zF,ez.transformerConstructor=tz;class nz extends ez{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);JC(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${wO}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(FO),this.setFieldX2(DO)):(this.setFieldY(FO),this.setFieldY2(DO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(jO),this.setFieldX2(zO)):(this.setFieldY(jO),this.setFieldY2(zO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(VO),this.setFieldX2(HO)):(this.setFieldY(VO),this.setFieldY2(HO))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(iz("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function rz(t){return"bottom"===t||"top"===t}function az(t){return"left"===t||"right"===t}function oz(t){return"z"===t}function lz(t,e){return HR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function hz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function cz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?rz(t)?"linear":"band":rz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const dz=(t,e,i)=>{var s;const n=null!==(s="band"===e?fF("axisBand",i):["linear","log","symlog"].includes(e)?fF("axisLinear",i):{})&&void 0!==s?s:{},r=rz(t)?fF("axisX",i):az(t)?fF("axisY",i):fF("axisZ",i);return iO({},fF("axis",i),n,r)};class uz{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:Qy)("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:Qy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>tE(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return rz(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class pz extends uz{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:AI.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const gz=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},fz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},mz=(t,e,i,s)=>{var n;const r=e.getScale(),a=tE(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:vz(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,_z=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class yz extends uz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!gz(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:AI.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:AI.canvas}),callback:this.onMouseOut}),nb(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:AI.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),nb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var bz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(bz||(bz={}));const xz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class Sz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(xz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:gF,curveType:pF,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===uF?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(xz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:qF(this._spec,xz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Pa(this._option.dataSet,{name:`${wO}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(bz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[xz.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(bz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,iO({},this._spec[xz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Az=Object.assign(Object.assign({},zF),xz),kz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>kz(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},Mz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class Tz extends jD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return Mz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(QC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?kz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:lD.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[LO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class wz extends Tz{constructor(){super(...arguments),this.type=wz.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)===xR.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}wz.type="line";const Cz=()=>{sO.registerMark(wz.type,wz),hM(),Qk(),HB(),IB(),eF(),sO.registerGraphicComponent("line",Lg)};class Ez extends jD{constructor(){super(...arguments),this.type=Ez.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}Ez.type="symbol";const Bz=()=>{sO.registerMark(Ez.type,Ez),hM(),dM(),IB(),sO.registerGraphicComponent("symbol",Eg)};class Pz extends tz{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function Lz(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function Rz(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function Oz(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function Iz(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function Dz(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function Fz(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const zz=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return YC(v)};class jz{constructor(t){this.id=ob(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Hz extends jz{constructor(){super(Hz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!JC(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&Lz(c)&&Lz(d)))return;const u=Rz(t,c),p=Rz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!Iz(u,p))return}else if(0===y&&0===b){if(!Iz(p,u))return}else if(_||A)if(_&&!A){if(!Oz(u,p))return}else if(A&&!_){if(!Oz(p,u))return}else{if(f===b)return;if(f>b){if(!Dz(u,p))return}else if(!Dz(p,u))return}else{if(0===f&&0===y){if(!Fz(u,p))return}else if(0===b&&0===g&&!Fz(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){EI(e.getOption().dataSet,"tickAlign",zz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Hz.pluginType="component",Hz.type="AxisSyncPlugin";const Vz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Nz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function Uz(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function Wz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Gz=t=>"band"===t||"ordinal"===t||"point"===t;function Yz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Xz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class $z extends WD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const Kz=`${wO}_ARC_TRANSFORM_VALUE`,qz=`${wO}_ARC_RATIO`,Zz=`${wO}_ARC_START_ANGLE`,Jz=`${wO}_ARC_END_ANGLE`,Qz=`${wO}_ARC_K`,tj=`${wO}_ARC_MIDDLE_ANGLE`,ej=`${wO}_ARC_QUADRANT`,ij=`${wO}_ARC_RADIAN`,sj=-Math.PI/2,nj=3*Math.PI/2,rj=.6,aj=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},oj=(t,e,i)=>{var s;const n=null!==(s="band"===e?fF("axisBand",i):"linear"===e?fF("axisLinear",i):{})&&void 0!==s?s:{},r=fF("angle"===t?"axisAngle":"axisRadius",i);return iO({},fF("axis",i),n,r)};function lj(t,e,i,s){switch(t){case r.cartesianBandAxis:return dz(lz(i,["z"]),"band",e);case r.cartesianLinearAxis:return dz(lz(i,["z"]),"linear",e);case r.cartesianLogAxis:return dz(lz(i,["z"]),"log",e);case r.cartesianSymlogAxis:return dz(lz(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return dz(lz(i),void 0,e);case r.polarBandAxis:return oj(i.orient,"band",e);case r.polarLinearAxis:return oj(i.orient,"linear",e);case r.polarAxis:return oj(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=fF(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>rz(t.orient)));let g;g=p(u)?iO({},Gz(u.type)?a:o,l):l;const f=n.find((t=>az(t.orient)));let m;return m=p(f)?iO({},tE(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=fF(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?iO({},Gz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?iO({},tE(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return hj(i,fF(t,e));default:return fF(t,e)}}const hj=(t,e)=>{var i;const s=iO({},e,e[hz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class cj extends pD{getTheme(t,e){return lj(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},YR(e)),{[s]:0}))}}class dj extends mD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=cj,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof jc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:AI.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new $z(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!U(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(t.release(!0),null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var uj,pj;dj.transformerConstructor=cj,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(uj||(uj={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(pj||(pj={}));class gj extends jD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=sO.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(bI.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}gj.type="component";const fj=()=>{sO.registerMark(gj.type,gj)},mj=t=>t;class vj extends dj{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?uj.circleAxis:uj.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?pj.circleAxisGrid:pj.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=YF(null===(h=sO.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this._specVisible&&(this.getVisible()||this._spec.forceInitTick||this._hideWhenEmpty)}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new OD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&fR(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?JC(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!JC(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return fR(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=mR(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),fR(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):fR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(fR(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=$(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=uI(s=t.domainLine)).startSymbol=uI(s.startSymbol),s.endSymbol=uI(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return fI(iO({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:fI(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>fI(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=fI(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return fI(iO({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:fI(t.tick.style)),t.tick.state&&(i.tick.state=pI(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return fI(iO({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:fI(t.subTick.style)),t.subTick.state&&(i.subTick.state=pI(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=Vz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:iO({},d,fI(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:fI(h.style)}),h.state&&(i.title.state.shape=pI(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:fI(o.style)}),o.state&&(i.title.state.background=pI(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=pI(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=fI(t.background.style)),t.background.state&&(i.panel.state=pI(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:MO(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return fI(iO({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:fI(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:MO(t.subGrid.alternateColor),style:fI(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=mF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){BI(this._option.dataSet,"scale",mj);const i=this.registerTicksTransform();return new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===CT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}vj.specKey="axes";const _j=()=>{fj(),sO.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},yj=[Hz];class bj extends vj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),fR(this._regions,(t=>{const e=this.getOrient();rz(e)?Xz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):az(e)?Xz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):oz(e)&&Xz(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=iO({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(iO({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=rz(this.getOrient()),n=t=>{var e;return(s?!rz(t.getOrient()):rz(t.getOrient()))&&JC(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=lz(i,["z"]),oz(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!Wz(e))return null;const{axisType:t,componentName:s}=cz(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>az(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!Wz(t))return;const{axisType:s,componentName:n}=cz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=sO.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return rz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):oz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(yj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){rz(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!rz(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!oz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;az(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=UR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=UR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=rz(this.getOrient())?t.fieldX:oz(this.getOrient())?t.fieldZ:t.fieldY,JC(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:JC(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(bI.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(rz(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=rz(this._orient)?{x:$(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return fR(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:rz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:oz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();fR(this._regions,(e=>{rz(t)?Xz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):az(t)?Xz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):oz(t)&&Xz(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=rz(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=rz(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=iO(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ve).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=rz(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?_t(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):_t(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return Yz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:JC(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}bj.type=r.cartesianAxis,bj.specKey="axes";const xj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Sj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,kj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function Mj(t,e,i="count"){const s=kj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const Tj=Math.sqrt(50),wj=Math.sqrt(10),Cj=Math.sqrt(2);class Ej{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=Uz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=rz(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Aj),e.sort(Aj),{domain:Sj(t,e),scope:Mj(t,e,i)}}(r,Ky(t),this._spec.breaks[0].scopeType);e=Ky(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=Uz(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-$(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=Tj?10:n>=wj?5:n>=Cj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const Bj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},Pj={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},Lj={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},Rj={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}};class Oj extends bj{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new NE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!oz(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=rz(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=VR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=Ky(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,ZE),t}}Oj.type=r.cartesianLinearAxis,Oj.specKey="axes",Oj.builtInTheme={axis:Rj,axisLinear:Bj,axisX:Pj,axisY:Lj},G(Oj,Ej);const Ij=()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),_j(),sO.registerComponent(Oj.type,Oj)};class Dj{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new OD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=Yz(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>Yz(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const Fj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class zj extends bj{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new xE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,iB),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=uE(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),_j(),sO.registerComponent(zj.type,zj,!1)};class Hj extends Oj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),fR(this._regions,(t=>{rz(this.getOrient())?Xz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Xz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=iO({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new OD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=mi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>Yz(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>Yz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,ZE),t}transformScaleDomain(){}}Hj.type=r.cartesianTimeAxis,Hj.specKey="axes",Hj.builtInTheme={axis:Rj,axisX:Pj,axisY:Lj};class Vj extends Oj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new YE}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,ZE),t}transformScaleDomain(){}}Vj.type=r.cartesianLogAxis,Vj.specKey="axes",Vj.builtInTheme={axis:Rj,axisLinear:Bj,axisX:Pj,axisY:Lj},G(Vj,Ej);class Nj extends Oj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new XE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,ZE),t}transformScaleDomain(){}}Nj.type=r.cartesianSymlogAxis,Nj.specKey="axes",Nj.builtInTheme={axis:Rj,axisLinear:Bj,axisX:Pj,axisY:Lj},G(Nj,Ej);const Uj=`${wO}_hide_`;function Wj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Gj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[Uj]&&(Wj(t,!0),t[Uj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[Uj]=!0,Wj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},Yj=()=>{sO.registerGrammarTransform("symbolOverlap",{transform:Gj,runType:"afterEncode"})},Xj={min:K,max:$,average:cR,sum:hR};function $j(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function Kj(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function qj(t,e,i,s){return Kj(t,e,i,"min",s)}function Zj(t,e,i,s){return Kj(t,e,i,"max",s)}function Jj(t,e,i,s){return Kj(t,e,i,"average",s)}function Qj(t,e,i,s){return Kj(t,e,i,"sum",s)}const tH=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=$j;if("min"===n?l=qj:"max"===n?l=Zj:"average"===n?l=Jj:"sum"===n&&(l=Qj),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},eH=()=>{sO.registerGrammarTransform("dataSampling",{transform:tH})};class iH extends nz{constructor(){super(...arguments),this.type=xR.line,this.transformerConstructor=Pz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),XF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=sz(this);this._symbolMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),XF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}iH.type=xR.line,iH.mark=Az,iH.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},iH.transformerConstructor=Pz,G(iH,Sz);class sH{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{HI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Pa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Jy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Jy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class nH{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{hb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{tI(e,[{key:t,operations:JC(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&tI(e,[{key:i.field,operations:JC(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?DR("colorOrdinal"):DR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(hb(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(U(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),hb(s.domain)?e.reRender=!0:U(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!hb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=JC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=JC(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;JC(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(JC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=JC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));JC(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class rH{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class aH extends uD{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=ob(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:CO,height:EO},this._viewRect={width:CO,height:EO},this._viewBox={x1:0,y1:0,x2:CO,y2:EO},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=YR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new yI(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new sH(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new rH;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=sO.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(YF({},XF("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=sO.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=sO.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof gD)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof jD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof jD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&HI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=iD(this._spec,this._option,{width:CO,height:EO})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=TR(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new nH(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){sD(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=TR(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{sD(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,sD(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):sD(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];sD(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=WR(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(bI.AFTER_MARK_RENDER_END,e)};this._event.on(bI.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:vI;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(mI(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===bz.dimensionHover||s===bz.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>tE(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>tE(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const oH=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class lH{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):eO(t,a,c.spec),eO(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=oH(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=oH(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(sO.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(sO.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=sO.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=sO.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=sO.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):vF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=vF(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class hH extends lH{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),L(i,"trimPadding")&&iO(i,nD(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class cH extends hH{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),eD(t)}}const dH=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=sI(t,!0);for(const e in o)for(const i in o[e].nodes)oI(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)aI(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&rI(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class pH{_beforeInit(){this._dataSet&&EI(this._dataSet,"stackSplit",dH)}_initStack(){this._stack=new uH(this),this._stack.init()}}const gH={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:bz.dimensionHover};class fH extends sF{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},gH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=vI(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}fH.type="dimension-hover",fH.defaultOptions=gH;const mH=()=>{sO.registerInteractionTrigger(fH.type,fH)},vH=()=>{sO.registerComposedEvent(bz.dimensionHover,yz),sO.registerComposedEvent(bz.dimensionClick,pz)},_H=t=>t.fieldX[0],yH=t=>t.fieldY[0],bH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},xH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},SH=(t,e)=>t?e?_H:bH:e?yH:xH,AH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=_z(t,(t=>rz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=_z(t,(t=>az(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{tE(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=kH(t,i,SH(e,tE(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=kH(t,i,SH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},kH=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:MH(t,s,i)},MH=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=mz(e,t,"cartesian",null!=i?i:rz(t.getOrient())?_H:yH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},TH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(tE(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(JC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Nz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};CH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&wH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),wH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=mF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},CH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},EH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=BH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},BH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},PH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return TH(c,r,e),c.xField.cacheInfo?EH(c.xField):c.yField.cacheInfo?EH(c.yField):void 0},LH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],RH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&LH.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(OH(s).every((t=>{var e;return!SF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},OH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},IH={dom:`${wO}_TOOLTIP_HANDLER_DOM`,canvas:`${wO}_TOOLTIP_HANDLER_CANVAS`},DH={key:"其他",value:"..."};var FH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(FH||(FH={}));class zH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=RH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},DH),t):DH;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&SF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class jH extends zH{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!tE(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const HH=()=>{sO.registerTooltipProcessor("dimension",jH)};class VH extends zH{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Ko.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(vI(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const NH=()=>{sO.registerTooltipProcessor("mark",VH)};class UH extends zH{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const WH=()=>{sO.registerTooltipProcessor("group",UH)};class GH extends aH{constructor(){super(...arguments),this.transformerConstructor=cH,this.type="line",this.seriesType=xR.line}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}GH.type="line",GH.seriesType=xR.line,GH.transformerConstructor=cH,G(GH,pH);const YH=[...Mz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class XH extends Tz{constructor(){super(...arguments),this.type=XH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return YH}_getIgnoreAttributes(){return[]}}XH.type="area";const $H=()=>{sO.registerMark(XH.type,XH),hM(),Uk(),HB(),IB(),eF(),sO.registerGraphicComponent("area",nf)};class KH extends TF{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const qH=Object.assign(Object.assign(Object.assign({},zF),xz),{area:{name:"area",type:"area"}}),ZH=()=>{sO.registerAnimation("area",QD),tF(),ZD()};class JH extends Pz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=iO({},f.style,g.style),l.state=iO({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class QH extends nz{constructor(){super(...arguments),this.type=xR.area,this.transformerConstructor=JH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(QH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===uF?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return FR(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return FR(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[FO]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),XF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),XF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=sz(this);this._symbolMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),XF("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new KH(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}QH.type=xR.area,QH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},QH.mark=qH,QH.transformerConstructor=JH,G(QH,Sz);class tV extends hH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),eD(t)}}class eV extends aH{constructor(){super(...arguments),this.transformerConstructor=tV,this.type="area",this.seriesType=xR.area}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}eV.type="area",eV.seriesType=xR.area,eV.transformerConstructor=tV,G(eV,pH);function iV(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const sV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:iV(t,e)}),nV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:iV(t,e)}),rV={type:"fadeIn"},aV={type:"growCenterIn"};function oV(t,e){if(!1===e)return{};switch(e){case"fadeIn":return rV;case"scaleIn":return aV;default:return sV(t)}}class lV extends jD{constructor(){super(...arguments),this.type=lV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}lV.type="rect";const hV=()=>{hM(),rM(),LB("rect",FB),sO.registerMark(lV.type,lV),kw.registerBuiltInAnimate("growHeightIn",mC),kw.registerBuiltInAnimate("growHeightOut",vC),kw.registerBuiltInAnimate("growWidthIn",RC),kw.registerBuiltInAnimate("growWidthOut",OC),kw.registerBuiltInAnimate("growCenterIn",pC),kw.registerBuiltInAnimate("growCenterOut",gC),sO.registerGraphicComponent("rect",Dg)},cV=Object.assign(Object.assign({},zF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function dV(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=$R(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[jF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):FR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[HF]):FR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=FR(this._dataToPosX(t),e,i),n=FR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[VF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):FR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[NF]):FR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=FR(this._dataToPosY(t),e,i),n=FR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},gV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:qF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(gV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(EI(this._option.dataSet,"addVChartProperty",yF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};EI(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Pa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:OF.bind(this),call:IF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new OD(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=NF,s=VF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=HF,s=jF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=sI(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)dV(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=FR(this[r](t),l,i),u=FR(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!zR(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[DO],n=e[FO],r=e[zO],d=e[jO];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?VF:jF],i=e[a?NF:HF];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[DO]:s,[FO]:o}),c?{[zO]:u,[jO]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(Dg(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>FR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>FR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=$(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=sz(this);this._barMark.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),XF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=$R(this._spec.barWidth,a)),l&&(c=Math.max(c,$R(this._spec.barMinWidth,a))),h&&(c=Math.min(c,$R(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=$R(null!==(l=i[r-1])&&void 0!==l?l:X(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=JC(g.type||"band");return d(e,m)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}gV.type=xR.bar,gV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},gV.mark=cV,gV.transformerConstructor=pV;const fV=()=>{eH(),hV(),sO.registerAnimation("bar",((t,e)=>({appear:oV(t,e),enter:sV(t,!1),exit:nV(t,!1),disappear:{duration:$D.disappear.duration}}))),jj(),Ij(),sO.registerSeries(gV.type,gV)};class mV extends hH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),eD(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class vV extends aH{constructor(){super(...arguments),this.transformerConstructor=mV,this.type="bar",this.seriesType=xR.bar}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}vV.type="bar",vV.seriesType=xR.bar,vV.transformerConstructor=mV,G(vV,pH);const _V=[10,20],yV=qC.Linear,bV="circle",xV=qC.Ordinal,SV=["circle","square","triangle","diamond","star"],AV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},kV=Object.assign(Object.assign({},zF),{point:{name:"point",type:"symbol"}});class MV extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class TV extends nz{constructor(){super(...arguments),this.type=xR.scatter,this.transformerConstructor=MV,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${wO}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${wO}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:yV,defaultRange:_V},"size")}getShapeAttribute(t,e){return u(e)?bV:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:xV,defaultRange:SV},"shape")}initMark(){this._symbolMark=this._createMark(TV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:qF(this._spec,TV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=sz(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),XF("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:bV},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i,s,n;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.y)}))}));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==r?void 0:r.renderInner)&&r.renderInner();const a=null===(i=null==r?void 0:r.getComponent)||void 0===i?void 0:i.call(r);(null==a?void 0:a.evaluate)&&a.evaluate(null,null);const o=null===(s=null==r?void 0:r.getProduct)||void 0===s?void 0:s.call(r);o&&(null==t?void 0:t.scale)&&(null==t?void 0:t.scaleCenter)&&((null===(n=o.attribute)||void 0===n?void 0:n.postMatrix)||o.setAttributes({postMatrix:new We}),o.scale(t.scale,t.scale,t.scaleCenter))}handlePan(t){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}TV.type=xR.scatter,TV.mark=kV,TV.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},TV.transformerConstructor=MV;const wV=()=>{Bz(),sO.registerAnimation("scatter",((t,e)=>Object.assign({appear:AV(0,e)},KD))),jj(),Ij(),sO.registerSeries(TV.type,TV)};class CV extends hH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class EV extends aH{constructor(){super(...arguments),this.transformerConstructor=CV,this.type="scatter",this.seriesType=xR.scatter}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}EV.type="scatter",EV.seriesType=xR.scatter,EV.transformerConstructor=CV,G(EV,pH);class BV extends ez{constructor(){super(...arguments),this.type=xR.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${wO}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const PV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[PO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[QO]=e.nameMap[n]:t[QO]=n})),t.features);class LV extends TF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class RV extends jD{constructor(){super(...arguments),this.type=RV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}RV.type="path";const OV=()=>{sO.registerMark(RV.type,RV),hM(),eM(),sO.registerGraphicComponent("path",tf)},IV=Object.assign(Object.assign({},zF),{area:{name:"area",type:"path"}});class DV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ia(i,e):Ra[i]?(La[i]||(La[i]=Ia(i,Ra[i])),La[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class FV{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class zV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function jV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:FV}:nb(e)||rb(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:zV}:null}const HV={debounce:St,throttle:At};class VV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=nb(this._renderMode)||rb(this._renderMode),jV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return jV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:kI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:kI.chart,consume:!1}];l.on(...c,HV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,HV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||jV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||jV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:kI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:kI.chart,consume:!1}];l.on(...c,HV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,HV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){jV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||jV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:kI.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:kI.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||jV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:kI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||jV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:kI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:kI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:kI.chart,source:AI.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:kI.chart,source:AI.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=HV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=HV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:kI.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:kI.chart,source:AI.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:kI.chart,source:AI.chart},this._handleDragMouseUp)}))}}function NV(t,e){return`${wO}_${e}_${t}`}class UV extends dj{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:NV(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=iO(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new DV(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===xR.map||e.type===xR.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),fR(this._regions,(t=>{var e;if(t.type===xR.map||t.type===xR.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new We})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==xR.map&&e.type!==xR.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[QO],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}UV.type=r.geoCoordinate,G(UV,VV);const WV=()=>{sO.registerComponent(UV.type,UV)};class GV extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class YV extends BV{constructor(){super(...arguments),this.type=xR.map,this.transformerConstructor=GV,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),PI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),EI(this._dataSet,"copyDataView",FI),EI(this._dataSet,"map",PV),EI(this._dataSet,"lookup",_F);const s=PI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Pa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:QO,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new OD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(YV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:qF(this._spec,YV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:RO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:RO]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(YF(null===(t=sO.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),XF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new LV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[PO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[PO],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s,n;const{scale:r,scaleCenter:a}=t;if(1===r)return;const o=this.getRootMark().getProduct();o&&(o.attribute.postMatrix||o.setAttributes({postMatrix:new We}),o.scale(r,r,a));const l=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==l?void 0:l.renderInner)&&l.renderInner();const h=null===(i=null==l?void 0:l.getComponent)||void 0===i?void 0:i.call(l);(null==h?void 0:h.evaluate)&&h.evaluate(null,null);const c=null===(s=null==l?void 0:l.getProduct)||void 0===s?void 0:s.call(l);c&&r&&a&&((null===(n=c.attribute)||void 0===n?void 0:n.postMatrix)||c.setAttributes({postMatrix:new We}),c.scale(r,r,a))}handlePan(t){var e,i,s,n;const{delta:r}=t;if(0===r[0]&&0===r[1])return;const a=this.getRootMark().getProduct();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new We}),a.translate(r[0],r[1]));const o=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==o?void 0:o.renderInner)&&o.renderInner();const l=null===(i=null==o?void 0:o.getComponent)||void 0===i?void 0:i.call(o);(null==l?void 0:l.evaluate)&&l.evaluate(null,null);const h=null===(s=null==o?void 0:o.getProduct)||void 0===s?void 0:s.call(o);h&&r&&((null===(n=h.attribute)||void 0===n?void 0:n.postMatrix)||h.setAttributes({postMatrix:new We}),h.translate(r[0],r[1]))}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return PO}getActiveMarks(){return[this._pathMark]}}YV.type=xR.map,YV.mark=IV,YV.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},YV.transformerConstructor=GV;const XV=`${wO}_waterfall_default_seriesField`,$V=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[WO]=!0:delete t[WO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=KV([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const f=g[0];let{start:m,end:v}=qV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=se(_,e)):(t[c]=+y,y=se(y,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=KV(r,t,n,a,c,h,i,e),a.push(n)})),a};function KV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=qV(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===XV)&&(t[XV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function qV(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?Jy("total.collectCountField error"):n=e[a].start;o<0?Jy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=se(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const ZV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},JV={type:"fadeIn"},QV={type:"growCenterIn"};function tN(t,e){switch(e){case"fadeIn":return JV;case"scaleIn":return QV;default:return sV(t,!1)}}class eN extends jD{constructor(){super(...arguments),this.type=eN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Lg(t)}}eN.type="rule";const iN=()=>{sO.registerMark(eN.type,eN),hM(),Qk(),sO.registerGraphicComponent("line",Lg)},sN=Object.assign(Object.assign({},cV),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),nN=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:rN(t.map((t=>t.latestData)).flat(),e.fields,i)}};function rN(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>rN(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class aN{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new Pa(e instanceof Ba?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),EI(e,"dimensionTree",nN),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class oN extends pV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const lN={rect:gN,symbol:uN,arc:mN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=uN(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:vN,line:_N,area:_N,rect3d:gN,arc3d:mN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function hN(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=lN[t])&&void 0!==i?i:lN.point;return e.series.type===xR.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=dN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:yN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function cN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==xR.sankey){const{formatFunc:t,args:n}=mF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function dN(t){return d(t)?e=>t(e.data):t}function uN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=dN(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:pN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function pN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function gN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=dN(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:fN(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function fN(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function mN(t){var e;const{labelSpec:i}=t,s=null!==(e=dN(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function vN(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=cN(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Tg(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function _N(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[RO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function yN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class bN extends gV{constructor(){super(...arguments),this.type=xR.waterfall,this.transformerConstructor=oN,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&rI(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new aN(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=XV)}getSeriesKeys(){return this._seriesField===XV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),EI(this._dataSet,"waterfallFillTotal",ZV),EI(this._dataSet,"waterfall",$V),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=zI(this.getViewData(),this._dataSet,{name:`${wO}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new OD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:DO,endAs:FO,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=sz(this);this._barMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),XF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),XF("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(bN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return vN(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?FR(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):FR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&zR([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}bN.type=xR.waterfall,bN.mark=sN,bN.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},bN.transformerConstructor=oN;const xN=()=>{iN(),hV(),sO.registerAnimation("waterfall",((t,e)=>({appear:tN(t,e),enter:sV(t,!1),exit:nV(t,!1),disappear:{duration:$D.disappear.duration}}))),JD(),jj(),Ij(),sO.registerSeries(bN.type,bN)},SN=`${wO}_BOX_PLOT_OUTLIER_VALUE`;var AN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(AN||(AN={}));const kN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[SN]:e};return n.forEach((e=>{i[e]=t[e]})),p(r)&&(i[r]=t[r]),i})))})),i};class MN extends TF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===AN.OUTLIER)return this.series.getOutliersField();if(t===AN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case AN.MIN:return this.series.getMinField();case AN.MAX:return this.series.getMaxField();case AN.MEDIAN:return this.series.getMedianField();case AN.Q1:return this.series.getQ1Field();case AN.Q3:return this.series.getQ3Field();case AN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===AN.OUTLIER)return e[SN];if(t===AN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case AN.MIN:return e[this.series.getMinField()];case AN.MAX:return e[this.series.getMaxField()];case AN.MEDIAN:return e[this.series.getMedianField()];case AN.Q1:return e[this.series.getQ1Field()];case AN.Q3:return e[this.series.getQ3Field()];case AN.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[SN])}getDefaultContentList(t){return[{key:this.getContentKey(AN.OUTLIER),value:this.getContentValue(AN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(AN.MAX),value:this.getContentValue(AN.MAX)},{key:this.getContentKey(AN.Q3),value:this.getContentValue(AN.Q3)},{key:this.getContentKey(AN.MEDIAN),value:this.getContentValue(AN.MEDIAN)},{key:this.getContentKey(AN.Q1),value:this.getContentValue(AN.Q1)},{key:this.getContentKey(AN.MIN),value:this.getContentValue(AN.MIN)},{key:this.getContentKey(AN.SERIES_FIELD),value:this.getContentValue(AN.SERIES_FIELD)}]}}class TN extends jD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==lD.enter&&t.context.diffState!==lD.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=zg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=sO.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const wN=()=>{sO.registerGraphicComponent("glyph",zg),hM(),Xk()},CN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],EN=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class BN extends TN{constructor(){super(...arguments),this.type=BN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=CN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=EN,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}BN.type="boxPlot";const PN=Object.assign(Object.assign({},zF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),LN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},RN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},ON=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),IN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=ON(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=ON(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=ON(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=ON(t,"box").attribute.width,i=ON(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=ON(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=ON(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=ON(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=ON(t,"box").attribute.height,i=ON(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},DN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=ON(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=ON(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=ON(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=ON(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=ON(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=ON(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=ON(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=ON(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=ON(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=ON(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class FN extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return LN(IN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class zN extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return RN(IN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class jN extends FN{computeAttribute(){return LN(DN)(this.target,this.params,this.params.options)}}class HN extends zN{computeAttribute(){return RN(DN)(this.target,this.params,this.params.options)}}class VN extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class NN extends nz{constructor(){super(...arguments),this.type=xR.boxPlot,this.transformerConstructor=VN,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(NN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(NN.mark.outlier,{key:PO,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>FR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>FR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>FR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>FR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>FR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>FR(e(this.getDatumPositionValues(t,SN),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>FR(e(this.getDatumPositionValues(t,SN),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;EI(this._dataSet,"foldOutlierData",kN),EI(this._dataSet,"addVChartProperty",yF);const t=new Pa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${wO}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:OF.bind(this),call:IF}},!1),this._outlierData=new OD(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=$R(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,$R(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,$R(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=$R(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=JC(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=sz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=sO.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(XF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(YF(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(YF(null===(a=sO.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new MN(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}NN.type=xR.boxPlot,NN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},NN.mark=PN,NN.transformerConstructor=VN;const UN=()=>{wN(),Qk(),rM(),sO.registerGraphicComponent("line",(t=>Lg(t))),sO.registerGraphicComponent("rect",(t=>Dg(t))),sO.registerMark(BN.type,BN),Bz(),ZD(),jj(),Ij(),kw.registerBuiltInAnimate("boxplotScaleIn",FN),kw.registerBuiltInAnimate("boxplotScaleOut",zN),kw.registerBuiltInAnimate("barBoxplotScaleIn",jN),kw.registerBuiltInAnimate("barBoxplotScaleOut",HN),sO.registerSeries(NN.type,NN)};class WN extends jD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=WN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Zg(t):Tg(t)}}WN.type="text";const GN=()=>{sO.registerMark(WN.type,WN),hM(),pM(),oM(),sO.registerGraphicComponent("text",Tg),sO.registerGraphicComponent("richtext",Zg)};class YN extends TF{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const XN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),$N={type:"fadeIn"},KN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function qN(t,e){return"fadeIn"===e?$N:XN(t)}const ZN=Object.assign(Object.assign({},cV),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class JN extends pV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class QN extends gV{constructor(){super(...arguments),this.type=xR.rangeColumn,this._barMarkType="rect",this._barName=xR.bar,this.transformerConstructor=JN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(QN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:qF(this._spec,QN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(QN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(QN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=sz(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),XF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),XF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(YF(null===(n=sO.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),XF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new YN(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}QN.type=xR.rangeColumn,QN.mark=ZN,QN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},QN.transformerConstructor=JN;const tU=()=>{hV(),GN(),sO.registerAnimation("rangeColumn",((t,e)=>({appear:qN(t,e),enter:XN(t),exit:KN(t),disappear:{duration:$D.disappear.duration}}))),JD(),jj(),Ij(),sO.registerSeries(QN.type,QN)};var eU,iU;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(eU||(eU={})),function(t){t.middle="middle",t.start="start",t.end="end"}(iU||(iU={}));class sU extends TF{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const nU=Object.assign({},qH);class rU extends QH{constructor(){super(...arguments),this.type=xR.rangeArea}initMark(){this._areaMark=this._createMark(rU.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new sU(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}rU.type=xR.rangeArea,rU.mark=nU;class aU extends ez{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=rj,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};JC(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:[]};JC(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&iz(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function oU(t){return lb(t)?Number.parseFloat(t):0}const lU=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&hU(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[Kz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[Kz]*t;v(e,A,i),A+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},hU=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===oU(t[e])))||!i&&0===t.reduce(((t,i)=>t+oU(i[e])),0)));function cU(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const dU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:cU(t,!0,NI.appear)}),uU={type:"fadeIn"},pU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:cU(t,!0,NI.enter)}),gU=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:cU(t,!0,NI.exit)});function fU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return uU;case"growRadius":return dU(Object.assign(Object.assign({},t),{growField:"radius"}));default:return dU(Object.assign(Object.assign({},t),{growField:"angle"}))}}class mU extends jD{constructor(t,e){super(t,e),this.type=vU.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[tj])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class vU extends mU{constructor(){super(...arguments),this.type=vU.type}}vU.type="arc";const _U=()=>{hM(),Vk(),LB("arc",UB),kw.registerBuiltInAnimate("growRadiusIn",BC),kw.registerBuiltInAnimate("growRadiusOut",PC),kw.registerBuiltInAnimate("growAngleIn",dC),kw.registerBuiltInAnimate("growAngleOut",uC),sO.registerGraphicComponent("arc",of),sO.registerMark(vU.type,vU)},yU=Object.assign(Object.assign({},zF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class bU extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=iO({},this._theme,i,t);const n=(t,e)=>iO({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const xU=`${wO}_LABEL_VISIBLE`;class SU extends aU{constructor(){super(...arguments),this.transformerConstructor=bU,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:UR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:UR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=sj,this._endAngle=nj,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[tj];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;EI(this._dataSet,"pie",lU),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:Zz,asEndAngle:Jz,asRatio:qz,asMiddleAngle:tj,asRadian:ij,asQuadrant:ej,asK:Qz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Pa(this._dataSet,{name:`${wO}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new OD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},SU.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:LO,groupKey:this._seriesField,isSeriesMark:!0},{morph:qF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return _R(Zz)(t)}endAngleScale(t){return _R(Jz)(t)}_computeLayoutRadius(){return aj((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:jR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:jR(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:_R(xU).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[tj];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===NI.appear)return this._startAngle;if(i===NI.disappear)return this._endAngle;const r=[NI.disappear,NI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[PO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[PO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[PO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[PO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[tj]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[tj]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[tj]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[tj]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=YF(null===(i=sO.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}SU.transformerConstructor=bU,SU.mark=yU,SU.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class AU extends SU{constructor(){super(...arguments),this.type=xR.pie}}AU.type=xR.pie;const kU=()=>{_U(),sO.registerAnimation("pie",((t,e)=>({appear:fU(t,e),enter:pU(t),exit:gU(t),disappear:{duration:$D.disappear.duration}}))),sO.registerAnimation("emptyCircle",((t,e)=>({appear:fU(t,e)}))),sO.registerSeries(AU.type,AU)};function MU(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const TU=t=>({type:MU(t.growField),options:{overall:!0}}),wU={type:"fadeIn"},CU=t=>({type:MU(t.growField)}),EU=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function BU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return wU;case"growAngle":return TU(Object.assign(Object.assign({},t),{growField:"angle"}));default:return TU(Object.assign(Object.assign({},t),{growField:"radius"}))}}class PU extends aU{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(FO),this.setInnerRadiusField(DO)}setValueFieldToPercent(){this.setRadiusField(jO),this.setInnerRadiusField(zO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const LU=Object.assign(Object.assign({},zF),{rose:{name:"rose",type:"arc"}});class RU extends tz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class OU extends vj{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=sO.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=sj,this._endAngle=nj,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),fR(this._regions,(t=>{"radius"===this.getOrient()?Xz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Xz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:UR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:UR(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:Nz(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){fR(this._regions,(t=>{"radius"===this.getOrient()?Xz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Xz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return JC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:JC(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>Yz(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ae.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return aj((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=rj,e=0;const i=this.getChart().getSpec();return fR(this.getRegions(),(s=>{const n=s;if(r=n.type,[xR.rose,xR.radar,xR.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(iO({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(iO({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}OU.type=r.polarAxis,OU.specKey="axes";const IU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},DU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class FU extends OU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new NE}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,ZE),t}}FU.type=r.polarLinearAxis,FU.specKey="axes",FU.builtInTheme={axis:Rj,axisLinear:Bj,axisAngle:DU,axisRadius:IU},G(FU,Ej);const zU=()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),sO.registerGraphicComponent(uj.circleAxis,((t,e)=>new GC(t,e))),sO.registerGraphicComponent(pj.circleAxisGrid,((t,e)=>new tP(t,e))),_j(),sO.registerComponent(FU.type,FU)};class jU extends OU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new xE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,rB),t}transformScaleDomain(){}}jU.type=r.polarBandAxis,jU.specKey="axes",jU.builtInTheme={axis:Rj,axisBand:Fj,axisAngle:DU,axisRadius:IU},G(jU,Dj);const HU=()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),sO.registerGraphicComponent(uj.circleAxis,((t,e)=>new GC(t,e))),sO.registerGraphicComponent(pj.circleAxisGrid,((t,e)=>new tP(t,e))),_j(),sO.registerComponent(jU.type,jU)};class VU extends PU{constructor(){super(...arguments),this.type=xR.rose,this.transformerConstructor=RU,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(VU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:qF(this._spec,VU.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>FR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=FR(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),XF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}VU.type=xR.rose,VU.mark=LU,VU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},VU.transformerConstructor=RU;const NU=()=>{sO.registerSeries(VU.type,VU),_U(),sO.registerAnimation("rose",((t,e)=>({appear:BU(t,e),enter:CU(t),exit:EU(t),disappear:{duration:$D.disappear.duration}}))),HU(),zU()};class UU extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,aR(this._fromAngle,this._toAngle)&&aR(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class WU extends nC{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!gR(t)&&!gR(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const GU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function YU(t,e,i){return"fadeIn"===e?GU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function XU(t,e,i){return"fadeIn"===e?GU(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const $U=(t,e)=>({custom:iC,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),KU=Object.assign(Object.assign(Object.assign({},zF),xz),{area:{name:"area",type:"area"}});class qU extends PU{constructor(){super(...arguments),this.type=xR.radar,this.transformerConstructor=Pz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(qU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:pF,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?oe(this._spec.startAngle):sj},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(YF(null===(s=sO.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),XF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=sO.getAnimationInKey(e);t.setAnimationConfig(YF(null==i?void 0:i(n,r),XF(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}qU.type=xR.radar,qU.mark=KU,qU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},qU.transformerConstructor=Pz,G(qU,Sz);const ZU=()=>{sO.registerSeries(qU.type,qU),$H(),Cz(),Bz(),sO.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:YU(t,e,"in"),enter:YU(t,e,"in"),exit:YU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:$D.disappear.duration},update:[{channel:["points","center"],custom:WU,customParameters:t,duration:$D.update.duration,easing:$D.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),sO.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:XU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:$D.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:UU,customParameters:t,duration:$D.update.duration,easing:$D.update.easing}]}))),sO.registerAnimation("radarGroup",((t,e)=>({appear:$U(t,"in"),disappear:{duration:$D.disappear.duration}}))),Vk(),HU(),zU()};class JU extends TF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>mi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const QU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(wO)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[PO]:r,[LO]:`${s}_${e}`})),r++}))})),n},tW={fill:"#bbb",fillOpacity:.2},eW=Object.assign(Object.assign({},zF),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}});class iW extends nz{constructor(){super(...arguments),this.type=xR.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),EI(this._option.dataSet,"objFlat",QU),EI(this._option.dataSet,"copyDataView",FI),BI(this._option.dataSet,"dataview",wa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(iO(tW,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(iW.mark.group),this._containerMark=this._createMark(iW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(iW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(iW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(iW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(iW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(iW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(iW.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!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",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:RO}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new OR).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:RO}}initTooltip(){this._tooltipHelper=new JU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}iW.type=xR.dot,iW.mark=eW,iW.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class sW extends TF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>mi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const nW=Object.assign(Object.assign({},zF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),rW=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class aW extends nz{constructor(){super(...arguments),this.type=xR.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),EI(this._option.dataSet,"linkDotInfo",rW),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(aW.mark.group),this._containerMark=this._createMark(aW.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(aW.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(aW.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:RO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new sW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}aW.type=xR.link,aW.mark=nW,aW.builtInTheme={link:{arrow:{style:{size:10}}}};const oW=Object.assign(Object.assign({},zF),{group:{name:"group",type:"group"}});class lW extends aU{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?DO:qO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?FO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?oe(n):sj;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):nj,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=FR(this.angleAxisHelper.dataToPosition([t[DO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=FR(this.angleAxisHelper.dataToPosition([t[FO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?FR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(lW.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return of(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Dg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const uW=()=>{sO.registerAnimation("circularProgress",((t,e)=>({appear:dW(t,e),enter:{type:"growAngleIn"},disappear:{duration:$D.disappear.duration}})))};class pW extends tz{constructor(){super(...arguments),this._supportStack=!0}}class gW extends lW{constructor(){super(...arguments),this.type=xR.circularProgress,this.transformerConstructor=pW,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(gW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:qF(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(gW.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?DO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?FO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),XF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),XF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}gW.type=xR.circularProgress,gW.mark=hW,gW.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},gW.transformerConstructor=pW;const fW=()=>{sO.registerSeries(gW.type,gW),_U(),uW(),JD(),HU(),zU()};function mW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const vW={type:"fadeIn"};function _W(t,e="grow"){return!1===e?{}:"fadeIn"===e?vW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:mW(t)}))(t)}class yW extends TF{enableByType(t){return"dimension"!==t}}const bW=Object.assign(Object.assign({},zF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class xW extends nz{constructor(){super(...arguments),this.type=xR.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(xW.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return FR(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return FR(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?FR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return FR(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return FR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?FR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(xW.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return FR(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return FR(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),XF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),XF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new yW(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}xW.type=xR.linearProgress,xW.mark=bW,xW.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const SW=()=>{hV(),sO.registerAnimation("linearProgress",((t,e)=>({appear:_W(t,e),enter:_W(t),disappear:{duration:$D.disappear.duration}}))),JD(),sO.registerSeries(xW.type,xW)},AW=[0],kW=[20,40],MW=[200,500],TW={shrink:!1,enlarge:!1,fontSizeLimitMin:0},wW=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class CW{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const EW=`${wO}_WORD_CLOUD_TEXT`,BW=Object.assign(Object.assign({},zF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),PW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class LW extends ez{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=kW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:MW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:AW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?EW:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:TW},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||sb(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:AW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!wW.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new CW(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(LW.mark.word,{key:LO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(LW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(YF(sO.getAnimationInKey("wordCloud")(n,s),XF("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new OR).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:RO])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new NE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new NE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[PO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:LO,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:I_.createCanvas.bind(I_),getTextBounds:mf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Wg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}LW.mark=BW,LW.builtInTheme={wordCloud:PW};function RW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||$D.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=OW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},IW=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=IW(t.children,e,t,n))})),s},DW=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=DW(t.children,e,t,n)),n=e(t,s,i,n)})),n},FW=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):FW(t.children,e,i)))})),e};function zW(t,e){let i,s;if(VW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function VW(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function GW(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function YW(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function XW(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function $W(t){return{_:t,next:null,prev:null}}function KW(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];GW(n,s,r);let a,o,l,h,c,d,u,p=$W(s),g=$W(n),f=$W(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=OW(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Ct)/Ct}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:QW.defaultOpionts.nodeSort;IW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)IW([o],qW(h)),DW([o],ZW(this._getPadding,.5,a)),IW([o],JW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);IW([o],qW(QW.defaultOpionts.setRadius)),DW([o],ZW(Rt,1,a)),c&&DW([o],ZW(this._getPadding,o.radius/t,a)),IW([o],JW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}QW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const tG=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=tG(t.children):t.value=0),e+=Math.abs(t.value)})),e};function eG(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){tG(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function iG(t){return t.depth}function sG(t,e){return e-1-t.endDepth}const nG=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),rG=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},aG={left:iG,right:sG,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:iG,end:sG},oG=bt(0,1);class lG{constructor(t){this._ascendingSourceBreadth=(t,e)=>nG(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>nG(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},lG.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):aG[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return eG(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[rG(s[t.source]),rG(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=_t(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*oG(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(nG),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(nG),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];hG(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),cG);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},dG.defaultOpionts,t):Object.assign({},dG.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Lt(this.options.center[0],t.width),s=t.y0+Lt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>Lt(t,n))):Lt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Lt(t,n))):Lt(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Lt(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=OW(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ce({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function uG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:hG,slice:uG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?uG:hG)(t,e,i,s,n)}};class fG{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},fG.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?pG(this.options.aspectRatio):null!==(e=gG[this.options.splitType])&&void 0!==e?e:gG.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=OW(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function mG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ci?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=mG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Ci(o.map(Ci))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rwt(e)));u=Ri(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=vG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function kG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Pi((function(i){return-1*MG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},wG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||yG,s=e.lossFunction||_G,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];di(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:TG(f),arcs:f})}))},CG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:EG,triangle:EG,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 EG(){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 BG(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const PG=t=>CG[t]?CG[t]():CG.circle(),LG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function RG(t){return d(t)?t:function(){return t}}class OG{constructor(t){var e,i;switch(this.options=j({},OG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=PG(this.options.shape),this.getText=null!==(e=RG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=RG(this.options.fontWeight),this.getTextFontSize=RG(this.options.fontSize),this.getTextFontStyle=RG(this.options.fontStyle),this.getTextFontFamily=RG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>LG(10,50);break;case"random-light":this.getTextColor=()=>LG(50,90);break;default:this.getTextColor=RG(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return oe(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():wt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class DG extends OG{constructor(t){var e;super(j({},DG.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<=DG.defaultOptions.minFontSize&&(this.options.minFontSize=DG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=IG[this.options.spiral])&&void 0!==e?e:IG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=RG(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=BG(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(HG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(jG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}HG(p,this._size)&&(p=VG(p,this._size))}else if(HG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||zG(p,i))&&(!i||!FG(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function FG(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function zG(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,HG=(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 VG(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},UG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},WG=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},GG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=BG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=PG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)WG(n,UG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)WG(n,UG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)WG(n,UG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)WG(n,UG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)WG(n,UG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=UG({x:l,y:h},o,-Math.PI/2,5),e=UG({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);WG(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var C=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var M=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const w=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)};const B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=M(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function U(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=U(t),n=U(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=it){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var yt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function _(t){return o=void 0,u&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Ct(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const wt=4294967296;const Et=t=>e=>R(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(_(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Rt=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,Ot=t=>0,It=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Lt(f.min,f);for(let r=0;r=1?jt:t<=-1?-jt:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ae{static distancePP(t,e){return $t(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return $t(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return $t(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Nt;)t+=Nt;else if(t>0)for(;t>Nt;)t-=Nt;return t};function ce(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=pe(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(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 me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function _e(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Ce(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?oe(t.angle):t.angle,s=Me(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+jt;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+jt;u>Ut&&(u-=Ut),g>Ut&&(g-=Ut);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Ce(n,i)+Ce(n,s))/2>Ce(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Ie(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Fe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}},He=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ne(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ue{}class We extends Ue{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class Ge{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ge,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ge;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ge(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=le(r.rotateDeg),r}}class Ye{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Xe(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Ke(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const $e=/^#([0-9a-f]{3,8})$/,qe={transparent:4294967040},Ze={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Je(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Qe(t){return S(t)?new ni(t>>16,t>>8&255,255&t,1):_(t)?new ni(t[0],t[1],t[2]):new ni(255,255,255)}function ti(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ei(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ii=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ni((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Qe(t):8===e?new ni(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class si{static Brighter(t,e=1){return 1===e?t:new si(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new si(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof si?t:new si(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(qe[t]))return function(t){return S(t)?new ni(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ni(t[0],t[1],t[2],t[3]):new ni(255,255,255,1)}(qe[t]);if(p(Ze[t]))return Qe(Ze[t]);const e=`${t}`.trim().toLowerCase(),i=ii(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ni(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Xe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ni(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=si.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ni(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Ke(this.color.r,this.color.g,this.color.b),r=Xe(u(t)?n.h:yt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ni(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ii(e,!0);return null!=i?i:this}setColorName(t){const e=Ze[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new si(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ei(t.color.r),this.color.g=ei(t.color.g),this.color.b=ei(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ni{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Je(this.r)+Je(this.g)+Je(this.b)+(1===this.opacity?"":Je(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Ke(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ri(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new ni(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Ke});function oi(t){if(k(t))return[t,t,t,t];if(_(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function li(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const hi=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function ci(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function di(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const ui=1e-10;function pi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ui)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=vi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=gi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ui,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function gi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function fi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return gi(t,t-(i*i-e*e+t*t)/(2*i))+gi(e,s)}function mi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function vi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let bi;function xi(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class Si{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ai=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ki(t){let e;if(e=Ai.exec(t))return new Si({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});ot.getInstance().error("invalid format: "+t)}const Ci=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ti{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return Ti.instance||(Ti.instance=new Ti),Ti.instance}newFormat(t){const e=ki(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Mi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:y,group:_,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?m:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?Ci[8+bi/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?y+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=_(k,1/0));let C=S.length+k.length+A.length,T=C>1)+S+k+A+T.slice(C);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=ki(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=_i(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ci[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>xi(100*t,e),r:xi,s:function(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(bi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+_i(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function wi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Ri(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ri(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Pi(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},is=Math.sqrt,ss=Math.tan;function ns(t){return t>1?0:t<-1?Ni:Math.acos(t)}function rs(t){return t>1?Ui:t<-1?-Ui:Math.asin(t)}function as(){}function os(t,e){t&&hs.hasOwnProperty(t.type)&&hs[t.type](t,e)}var ls={Feature:function(t,e){os(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sNi?t+Math.round(-t/Wi)*Wi:t,e]}function Ss(t,e,i){return(t%=Wi)?e||i?bs(ks(t),Cs(e,i)):ks(t):e||i?Cs(e,i):xs}function As(t){return function(e,i){return[(e+=t)>Ni?e-Wi:e<-Ni?e+Wi:e,i]}}function ks(t){var e=As(t);return e.invert=As(-t),e}function Cs(t,e){var i=qi(t),s=ts(t),n=qi(e),r=ts(e);function a(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*i+o*s;return[$i(l*n-c*r,o*i-h*s),rs(c*n+l*r)]}return a.invert=function(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*n-l*r;return[$i(l*n+h*r,o*i+c*s),rs(c*i-o*s)]},a}function Ts(t,e){(e=gs(e))[0]-=t,_s(e);var i=ns(-e[1]);return((-e[2]<0?-i:i)+Wi-ji)%Wi}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:as,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ws(t,e){return Xi(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function Ps(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Fs(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function zs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Fs(a);var t=function(t,e){var i=Ls(e),s=e[1],n=ts(s),r=[ts(i),-qi(i),0],a=0,o=0;Is.reset(),1===n?s=Ui+ji:-1===n&&(s=-Ui-ji);for(var l=0,h=t.length;l=0?1:-1,C=k*A,T=C>Ni,M=f*x;if(Is.add($i(M*k*ts(C),m*S+M*qi(C))),a+=T?A+k*Wi:A,T^p>=i^_>=i){var w=ms(gs(u),gs(y));_s(w);var E=ms(r,w);_s(E);var B=(T^A>=0?-1:1)*rs(E[2]);(s>B||s===B&&(w[0]||w[1]))&&(o+=T^A>=0?1:-1)}}return(a<-ji||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Hs))}return u}}function Hs(t){return t.length>1}function js(t,e){return((t=t.x)[0]<0?t[1]-Ui-ji:Ui-t[1])-((e=e.x)[0]<0?e[1]-Ui-ji:Ui-e[1])}1===(Rs=Ds).length&&(Os=Rs,Rs=function(t,e){return Ds(Os(t),e)});var Ns=zs((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Ni:-Ni,l=Xi(r-i);Xi(l-Ni)0?Ui:-Ui),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ni&&(Xi(i-n)ji?Ki((ts(e)*(r=qi(s))*ts(i)-ts(s)*(n=qi(e))*ts(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*Ui,s.point(-Ni,n),s.point(0,n),s.point(Ni,n),s.point(Ni,0),s.point(Ni,-n),s.point(0,-n),s.point(-Ni,-n),s.point(-Ni,0),s.point(-Ni,n);else if(Xi(t[0]-e[0])>ji){var r=t[0]0,n=Xi(e)>ji;function r(t,i){return qi(t)*qi(i)>e}function a(t,i,s){var n=[1,0,0],r=ms(gs(t),gs(i)),a=fs(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ms(n,r),u=ys(n,h);vs(u,ys(r,c));var p=d,g=fs(u,p),f=fs(p,p),m=g*g-f*(fs(u,u)-1);if(!(m<0)){var v=is(m),y=ys(p,(-g-v)/f);if(vs(y,u),y=ps(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Xi(y[0]-b)Ni^(b<=y[0]&&y[0]<=x)){var T=ys(p,(-g+v)/f);return vs(T,u),[y,ps(T)]}}}function o(e,i){var n=s?t:Ni-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return zs(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Ni:-Ni),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ws(e,p)||ws(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&ws(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=qi(e),o=ts(e),l=s*i;null==n?(n=e+s*Wi,r=e-l/2):(n=Ts(a,n),r=Ts(a,r),(s>0?nr)&&(n+=s*Wi));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Xi(s[0]-t)0?0:3:Xi(s[0]-i)0?2:1:Xi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,y,_=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&_.lineEnd()},polygonStart:function(){_=b,l=[],h=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=y&&e,n=(l=Fs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Bs(l,o,e,r,a),a.polygonEnd());_=a,l=h=c=null}};function S(t,e){n(t,e)&&_.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(_.lineStart(),_.point(r,a));else if(o&&m)_.point(r,a);else{var l=[g=Math.max(Ws,Math.min(Vs,g)),f=Math.max(Ws,Math.min(Vs,f))],b=[r=Math.max(Ws,Math.min(Vs,r)),a=Math.max(Ws,Math.min(Vs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(_.lineStart(),_.point(r,a),y=!1):(m||(_.lineStart(),_.point(l[0],l[1])),_.point(b[0],b[1]),o||_.lineEnd(),y=!1)}g=r,f=a,m=o}return x}}function Ys(t){return t}var Xs,Ks,$s,qs,Zs=Di(),Js=Di(),Qs={point:as,lineStart:as,lineEnd:as,polygonStart:function(){Qs.lineStart=tn,Qs.lineEnd=nn},polygonEnd:function(){Qs.lineStart=Qs.lineEnd=Qs.point=as,Zs.add(Xi(Js)),Js.reset()},result:function(){var t=Zs/2;return Zs.reset(),t}};function tn(){Qs.point=en}function en(t,e){Qs.point=sn,Xs=$s=t,Ks=qs=e}function sn(t,e){Js.add(qs*t-$s*e),$s=t,qs=e}function nn(){sn(Xs,Ks)}var rn=Qs,an=1/0,on=an,ln=-an,hn=ln;var cn,dn,un,pn,gn={point:function(t,e){tln&&(ln=t);ehn&&(hn=e)},lineStart:as,lineEnd:as,polygonStart:as,polygonEnd:as,result:function(){var t=[[an,on],[ln,hn]];return ln=hn=-(on=an=1/0),t}},fn=0,mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn={point:Cn,lineStart:Tn,lineEnd:En,polygonStart:function(){kn.lineStart=Bn,kn.lineEnd=Pn},polygonEnd:function(){kn.point=Cn,kn.lineStart=Tn,kn.lineEnd=En},result:function(){var t=An?[xn/An,Sn/An]:bn?[yn/bn,_n/bn]:vn?[fn/vn,mn/vn]:[NaN,NaN];return fn=mn=vn=yn=_n=bn=xn=Sn=An=0,t}};function Cn(t,e){fn+=t,mn+=e,++vn}function Tn(){kn.point=Mn}function Mn(t,e){kn.point=wn,Cn(un=t,pn=e)}function wn(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,Cn(un=t,pn=e)}function En(){kn.point=Cn}function Bn(){kn.point=Rn}function Pn(){On(cn,dn)}function Rn(t,e){kn.point=On,Cn(cn=un=t,dn=pn=e)}function On(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,xn+=(n=pn*t-un*e)*(un+t),Sn+=n*(pn+e),An+=3*n,Cn(un=t,pn=e)}var In=kn;function Ln(t){this._context=t}Ln.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Wi)}},result:as};var Dn,Fn,zn,Hn,jn,Nn=Di(),Un={point:as,lineStart:function(){Un.point=Vn},lineEnd:function(){Dn&&Wn(Fn,zn),Un.point=as},polygonStart:function(){Dn=!0},polygonEnd:function(){Dn=null},result:function(){var t=+Nn;return Nn.reset(),t}};function Vn(t,e){Un.point=Wn,Fn=Hn=t,zn=jn=e}function Wn(t,e){Hn-=t,jn-=e,Nn.add(is(Hn*Hn+jn*jn)),Hn=t,jn=e}var Gn=Un;function Yn(){this._string=[]}function Xn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Kn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),us(t,i(s))),s.result()}return r.area=function(t){return us(t,i(rn)),rn.result()},r.measure=function(t){return us(t,i(Gn)),Gn.result()},r.bounds=function(t){return us(t,i(gn)),gn.result()},r.centroid=function(t){return us(t,i(In)),In.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ys):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Yn):new Ln(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function $n(t){return function(e){var i=new qn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function qn(){}function Zn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),us(i,t.stream(gn)),e(gn.result()),null!=s&&t.clipExtent(s),t}function Jn(t,e,i){return Zn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Qn(t,e,i){return Jn(t,[[0,0],e],i)}function tr(t,e,i){return Zn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function er(t,e,i){return Zn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Yn.prototype={_radius:4.5,_circle:Xn(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=Xn(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}},qn.prototype={constructor:qn,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 ir=16,sr=qi(30*Yi);function nr(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,y=c-n,_=v*v+y*y;if(_>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=is(b*b+x*x+S*S),k=rs(S/=A),C=Xi(Xi(S)-1)e||Xi((v*E+y*B)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Yi:0,E()):[m*Gi,v*Gi,y*Gi]},M.angle=function(t){return arguments.length?(_=t%360*Yi,E()):_*Gi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},M.precision=function(t){return arguments.length?(a=nr(o,T=t*t),B()):is(T)},M.fitExtent=function(t,e){return Jn(M,t,e)},M.fitSize=function(t,e){return Qn(M,t,e)},M.fitWidth=function(t,e){return tr(M,t,e)},M.fitHeight=function(t,e){return er(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&w,E()}}function cr(t){var e=0,i=Ni/3,s=hr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Yi,i=t[1]*Yi):[e*Gi,i*Gi]},n}function dr(t,e){var i=ts(t),s=(i+ts(e))/2;if(Xi(s)2?t[2]*Yi:0),e.invert=function(e){return(e=t.invert(e[0]*Yi,e[1]*Yi))[0]*=Gi,e[1]*=Gi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===yr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function br(t){return ss((Ui+t)/2)}function xr(t,e){var i=qi(t),s=t===e?ts(t):Ji(i/qi(e))/Ji(br(e)/br(t)),n=i*Qi(br(t),s)/s;if(!s)return yr;function r(t,e){n>0?e<-Ui+ji&&(e=-Ui+ji):e>Ui-ji&&(e=Ui-ji);var i=n/Qi(br(e),s);return[i*ts(s*t),n-i*qi(s*t)]}return r.invert=function(t,e){var i=n-e,r=es(s)*is(t*t+i*i),a=$i(t,Xi(i))*es(i);return i*s<0&&(a-=Ni*es(t)*es(i)),[a/s,2*Ki(Qi(n/r,1/s))-Ui]},r}function Sr(t,e){return[t,e]}function Ar(t,e){var i=qi(t),s=t===e?ts(t):(i-qi(e))/(e-t),n=i/s+t;if(Xi(s)ji&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Rr.invert=fr(rs),Or.invert=fr((function(t){return 2*Ki(t)})),Ir.invert=function(t,e){return[-e,2*Ki(Zi(t))-Ui]};var Fr={exports:{}},zr=function(t,e){this.p1=t,this.p2=e};zr.prototype.rise=function(){return this.p2[1]-this.p1[1]},zr.prototype.run=function(){return this.p2[0]-this.p1[0]},zr.prototype.slope=function(){return this.rise()/this.run()},zr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},zr.prototype.isVertical=function(){return!isFinite(this.slope())},zr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},zr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},zr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},zr.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)},zr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Hr=zr,jr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Hr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=jr(t.slice(0,s),e),o=jr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Nr=jr;!function(t){var e=Nr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Vr(Yr,e),{tolerance:s}=i;return Ur(t,s)};var Kr;!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"}(Kr||(Kr={}));const $r=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),_(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let C=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/C:0,T.push(y[t])}return T},Zr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],w=M.length?M:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:w});if(!T.length)return qr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...M,...T];return qr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},Jr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",w=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",R=null!==(p=k.min)&&void 0!==p?p:"min",O=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(y=k.values)&&void 0!==y?y:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),_(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}_(S)&&(S=[yt(Math.min.apply(null,S),0,1),yt(Math.max.apply(null,S),0,1)]);const U=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[M]=o,f[w]=l,f[E]=h,f[B]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,A&&(f[F]=H.get(t)||[]),U.push(f)}return U};var Qr={},ta={};function ea(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ia(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function sa(t,e){var i=t+"",s=i.length;return s9999?"+"+sa(e,6):sa(e,4))+"-"+sa(t.getUTCMonth()+1,2)+"-"+sa(t.getUTCDate(),2)+(r?"T"+sa(i,2)+":"+sa(s,2)+":"+sa(n,2)+"."+sa(r,3)+"Z":n?"T"+sa(i,2)+":"+sa(s,2)+":"+sa(n,2)+"Z":s||i?"T"+sa(i,2)+":"+sa(s,2)+"Z":"")}function ra(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return ta;if(h)return h=!1,Qr;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a0}function ma(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=ha(t));var r=[];switch(t.type){case"GeometryCollection":return va(t,(function(t){_a(t,s)})),t;case"FeatureCollection":return ma(t,(function(t){ma(_a(t,s),(function(t){r.push(t)}))})),di(r)}return _a(t,s)}function _a(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return va(t,(function(t){_a(t,e)})),t;case"LineString":return ba(ga(t),e),t;case"Polygon":return xa(ga(t),e),t;case"MultiLineString":return ga(t).forEach((function(t){ba(t,e)})),t;case"MultiPolygon":return ga(t).forEach((function(t){xa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ba(t,e){fa(t)===e&&t.reverse()}function xa(t,e){fa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Sa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Ta=(t,e={},i)=>{i.type=Kr.GEO;const s=Vr(ka,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ca(t))})):e.push(Ca(t))})),e})(t);let l=t.features;return o&&(l=ya(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=Aa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=Aa.bounds(t);t.bbox=e}})),t.features=l,t},Ma={},wa=(t,e,i)=>{i.type=Kr.GEO;const s=Vr(ka,Ma,e),{object:n}=s;if(!y(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Dr(a,t)}))}:Dr(a,o));var a,o;return Ta(r,s,i)},Ea=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!_(t))throw new TypeError("Invalid data: must be DataView array!");return _(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Ba=0;function Pa(t="dataset"){return Ba>1e8&&(Ba=0),t+"_"+Ba++}class Ra{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:Pa("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Oa{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Pa("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Oa||!0!==(null==e?void 0:e.clone)||(i=!0),i?L(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?H({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",$r),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Kn();const Ia={},La={albers:pr,albersusa:function(){var t,e,i,s,n,r,a=pr(),o=ur().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=ur().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}},Da=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Fa(t,e){return function i(){const s=e();return s.type=t,s.path=Kn().projection(s),s.copy=s.copy||function(){const t=i();return Da.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class za{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class Ha extends za{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}class ja{static GenAutoIncrementId(){return ja.auto_increment_id++}}ja.auto_increment_id=0;class Na{}const Ua=new Na;let Va=0;class Wa{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Ua.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Va,t),this.tryRunAnimationFrameNextFrame(),Va}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class Ga{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Ya=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Xa extends Ga{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=ja.GenAutoIncrementId(),this.hooks={onSetEnv:new Ha(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Wa);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Wa),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Ya(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}var Ka=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class $a extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=ja.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Ka(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(io(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=io(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=io(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=io(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=eo.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(io(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(io(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,io(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):io(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof Qa))return void ot.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=eo.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new so(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Ja,this.rootWheelEvent=new Qa,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&y(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const oo=Nt-1e-8;class lo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>oo)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Nt)<0&&(s+=Nt),(n%=Nt)<0&&(n+=Nt),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const co=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,uo={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},po={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let go,fo,mo,vo,yo,_o;function bo(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;t_o){let t,e=mo;for(let s=1,r=i.length;s1&&(g=Math.sqrt(g),i*=g,s*=g);const f=d/i,m=c/i,v=-c/s,y=d/s,_=f*o+m*l,b=v*o+y*l,x=f*t+m*e,S=v*t+y*e;let A=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const C=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),M=Math.atan2(b-T,_-C);let w=Math.atan2(S-T,x-C)-M;w<0&&1===r?w+=Nt:w>0&&0===r&&(w-=Nt);const E=Math.ceil(Math.abs(w/(jt+.001))),B=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Ro(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=No(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Vo(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new Wo(i,n),new Wo(n,s)]}class Wo extends Oo{constructor(t,e){super(),this.type=Co.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===ko.ROW?Vt(this.p0.x-this.p1.x):t===ko.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class Go{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new Uo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new Wo(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===ko.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===ko.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Yo extends Go{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Xo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Ko(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?ko.ROW:ko.COLUMN;return"monotoneY"===t?new Yo(t,s):new Go(t,s)}class $o{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 qo(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ko("linear",i,t);return Zo(new $o(n,s),t),n}function Zo(t,e){return Xo(t,e,1)}function Jo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Qo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Jo(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:Jo(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 tl(t,e){return Xo(t,e,2)}function el(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return qo(t,e);const n=Ko("basis",i,t);return tl(new Qo(n,s),t),n}function il(t){return t<0?-1:1}function sl(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(il(r)+il(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function nl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function rl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class al{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:rl(this,this._t0,nl(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,rl(this,nl(this,e=sl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:rl(this,this._t0,e=sl(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class ol extends al{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ll(t,e){return Xo(t,e,2)}function hl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return qo(t,e);const n=Ko("monotoneX",i,t);return ll(new al(n,s),t),n}function cl(t,e){return Xo(t,e,2)}function dl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return qo(t,e);const n=Ko("monotoneY",i,t);return cl(new ol(n,s),t),n}let ul=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class pl extends ul{lineEnd(){this.context.closePath()}}function gl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Go("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?ko.ROW:ko.COLUMN);return fl(new ul(r,e,n),t),r}function fl(t,e){return Xo(t,e,1)}function ml(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Go("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?ko.ROW:ko.COLUMN);return fl(new pl(r,e,n),t),r}class vl extends $o{lineEnd(){this.context.closePath()}}function yl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ko("linear",i,t);return _l(new vl(n,s),t),n}function _l(t,e){return Xo(t,e,1)}function bl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function xl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return qo(i,n);const o=Ko(t,r,i);return Xo(new e(o,s,a),i,2),o}}const Sl=xl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:bl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Al=xl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:bl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class kl extends Oo{constructor(t,e,i){super(),this.type=Co.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Ho(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?jo(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===ko.ROW?Vt(this.p0.x-this.p2.x):t===ko.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=Xt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Ho(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new kl(i,a,r),new kl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Cl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Wo(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new kl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new Uo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Tl(t,e,i){var s,n;switch(e){case"linear":default:return qo(t,i);case"basis":return el(t,i);case"monotoneX":return hl(t,i);case"monotoneY":return dl(t,i);case"step":return gl(t,.5,i);case"stepClosed":return ml(t,.5,i);case"stepBefore":return gl(t,0,i);case"stepAfter":return gl(t,1,i);case"catmullRom":return Sl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Al(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return yl(t,i)}}class Ml extends ho{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new lo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([po.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([po.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([po.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([po.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([po.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([po.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([po.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([po.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([po.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Cl(this);Ro(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[po.M]=t=>`M${t[1]} ${t[2]}`,t[po.L]=t=>`L${t[1]} ${t[2]}`,t[po.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[po.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[po.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];Bo(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[po.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=bo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=Tl(e,i);"x"===s?this.direction=ko.ROW:"y"===s?this.direction=ko.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[po.M]=this.moveToTransform,t[po.L]=this.lineToTransform,t[po.Q]=this.quadraticCurveToTransform,t[po.C]=this.bezierCurveToTransform,t[po.AT]=this.arcToTransform,t[po.E]=this.ellipseTransform,t[po.R]=this.rectTransform,t[po.A]=this.arcTransform,t[po.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Ro(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===ko.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===ko.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),Ql=Object.assign(Object.assign({},Gl),{points:[],cornerRadius:0,closePath:!0}),th=Object.assign(Object.assign({},Gl),{width:100,height:100,spikes:5,thickness:.5}),eh=Object.assign(Object.assign({},Gl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),ih=Object.assign(Object.assign({},Gl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),sh=Object.assign(Object.assign({},Gl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),nh=Object.assign(Object.assign(Object.assign({},Gl),jl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),rh=Object.assign(Object.assign(Object.assign({},Gl),jl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ah=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Gl),{fill:!0,cornerRadius:0,cornerType:"round"}),oh=Object.assign(Object.assign({},ah),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});class lh{static GetImage(t,e){var i;const s=lh.cache.get(t);s?"fail"===s.loadState?Ua.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):lh.loadImage(t,e)}static GetSvg(t,e){var i;let s=lh.cache.get(t);s?"fail"===s.loadState?Ua.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},lh.cache.set(t,s),s.dataPromise=Ua.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=lh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},lh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ua.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ua.global.loadBlob(t):"json"===e&&(i.dataPromise=Ua.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!lh.isLoading&&lh.toLoadAueue.length){lh.isLoading=!0;const t=lh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(lh.cache.set(i,n),n.dataPromise=Ua.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()})).catch((t=>{console.error(t),lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()}))}}),0)}static loadImage(t,e){const i=hh(t,lh.toLoadAueue);if(-1!==i)return lh.toLoadAueue[i].marks.push(e),void lh.loading();lh.toLoadAueue.push({url:t,marks:[e]}),lh.loading()}static improveImageLoading(t){const e=hh(t,lh.toLoadAueue);if(-1!==e){const t=lh.toLoadAueue.splice(e,1);lh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function hh(t,e){for(let i=0;i{var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)dh[s]=t,i&&(i=!(null!==(e=dh[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)dh[e]=!!t[e],i&&(i=!!dh[e]);else dh[0]=!1,dh[1]=!1,dh[2]=!1,dh[3]=!1;return{isFullStroke:i,stroke:dh}},ph=[0,0,0,0],gh=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ph[0]=t[0],ph[2]=t[0],ph[1]=t[1],ph[3]=t[1],ph):t:t:0,fh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],mh=[1,2,3,0,1,2,3,0];function vh(t,e,i,s){for(;t>=Ut;)t-=Ut;for(;t<0;)t+=Ut;for(;t>e;)e+=Ut;fh[0].x=i,fh[1].y=i,fh[2].x=-i,fh[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Gt(t)*i,Kt(t)*i),s.add(Gt(e)*i,Kt(e)*i),n!==r||e-t>Ht){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Sh.TimeOut=1e3/60;const Ah=new Sh,kh=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,Ch=(t,e)=>{const i=kh(t,e);return isNaN(i)?i:Math.max(e,i)};class Th{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Mh(t,e,i,s,n){return n?t.arc(i,s,e,0,Nt,!1,n):t.arc(i,s,e,0,Nt),!1}var wh=new class extends Th{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return Mh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Mh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Eh=new class extends Th{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Ph=new class extends Th{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Rh(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Th{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2+n,i,s)}};function Ih(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Lh extends Th{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Ih(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ih(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Lh;var Fh=new class extends Lh{constructor(){super(...arguments),this.type="triangle"}};const zh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Hh=Math.sin(Nt/10)*zh,jh=-Math.cos(Nt/10)*zh;function Nh(t,e,i,s){const n=Hh*e,r=jh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Nt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Uh=new class extends Th{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Nh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Nh(t,this.parseSize(e)/2+n,i,s)}};const Vh=$t(3);function Wh(t,e,i,s){const n=e,r=n/Vh,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Gh=new class extends Th{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Yh(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Xh=new class extends Th{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Yh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Yh(t,this.parseSize(e)/2+n,i,s)}};function Kh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var $h=new class extends Th{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Kh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Kh(t,this.parseSize(e)/2+n,i,s)}};const qh=-.5,Zh=$t(3)/2,Jh=1/$t(12);function Qh(t,e,i,s){const n=e/2,r=e*Jh,a=n,o=e*Jh+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(qh*n-Zh*r+i,Zh*n+qh*r+s),t.lineTo(qh*a-Zh*o+i,Zh*a+qh*o+s),t.lineTo(qh*l-Zh*h+i,Zh*l+qh*h+s),t.lineTo(qh*n+Zh*r+i,qh*r-Zh*n+s),t.lineTo(qh*a+Zh*o+i,qh*o-Zh*a+s),t.lineTo(qh*l+Zh*h+i,qh*h-Zh*l+s),t.closePath(),!1}var tc=new class extends Th{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Qh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qh(t,this.parseSize(e)/2+n,i,s)}};function ec(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ic=new class extends Th{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return ec(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return ec(t,this.parseSize(e)/2,i,s,n)}};function sc(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var nc=new class extends Th{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return sc(t,this.parseSize(e)/2,i,s,n)}};function rc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var ac=new class extends Th{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return rc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return rc(t,this.parseSize(e)/2,i,s,n)}};const oc=$t(3);function lc(t,e,i,s){const n=e*oc;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var hc=new class extends Th{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return lc(t,this.parseSize(e)/2/oc,i,s)}drawOffset(t,e,i,s,n){return lc(t,this.parseSize(e)/2/oc+n,i,s)}};function cc(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var dc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return cc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return cc(t,this.parseSize(e)/4+n,i,s)}};function uc(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var pc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return uc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return uc(t,this.parseSize(e)/4+n,i,s)}};function gc(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var fc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return gc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return gc(t,this.parseSize(e)/4+n,i,s)}};function mc(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var vc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return mc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return mc(t,this.parseSize(e)/4+n,i,s)}};function yc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var _c=new class extends Th{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return yc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function bc(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var xc=new class extends Th{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return bc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return bc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Sc(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var Ac=new class extends Th{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return Sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Sc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function kc(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Cc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Tc=new class extends Th{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?Cc(t,e,i,s):kc(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Cc(t,e+2*n,i,s):kc(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Mc=new Ve;class wc{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Ro(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Ro(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Mc.x1=i.bounds.x1*t,Mc.y1=i.bounds.y1*t,Mc.x2=i.bounds.x2*t,Mc.y2=i.bounds.y2*t,e.union(Mc)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const Ec=[wh,Eh,Ph,Oh,hc,Fh,Uh,Gh,Xh,$h,tc,ic,nc,Dh,ac,dc,pc,fc,vc,Tc,_c,xc,Ac],Bc={};Ec.forEach((t=>{Bc[t.type]=t}));const Pc={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Rc{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ic(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ic(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ic(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Rc(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Rc(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function Fc(t,e){return zc(t)}function zc(t,e){const i={};for(let e=0;e{Ua.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)}))}function Yc(t,e,i,s=0){return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let Xc=0;function Kc(){return Xc++}var $c;function qc(t){const e=[];let i=0,s="";for(let n=0;nZc.set(t,!0)));const Jc=new Map;function Qc(t){if(Zc.has(t))return!0;if(Jc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function td(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Jc.set(t,!0)));const ed=Kc(),id=Kc(),sd=Kc(),nd=Kc(),rd=Kc(),ad=Kc(),od=Kc(),ld=Kc(),hd=Kc(),cd=Kc(),dd=Kc(),ud=Kc(),pd=Kc(),gd=Kc(),fd=Kc(),md=Kc(),vd=Kc(),yd=Symbol.for("GraphicService"),_d=Symbol.for("GraphicCreator"),bd={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},xd=Object.keys(bd),Sd={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Ad=Object.keys(Sd),kd={duration:200,easing:"cubicOut"},Cd=Symbol.for("CanvasFactory"),Td=Symbol.for("Context2dFactory");function Md(t){return function(){var t,e;const i=null===(t=Ua.global)||void 0===t?void 0:t.env,s=i?null===(e=Ua.canvasFactory)||void 0===e?void 0:e.call(Ua,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const wd=1e-4,Ed=Math.sqrt(3),Bd=1/3;function Pd(t){return t>-Gd&&tGd||t<-Gd}function Od(t){return"number"==typeof t&&Number.isFinite(t)}const Id=[0,0],Ld=[0,0],Dd=[0,0];function Fd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function zd(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Hd(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function jd(t){return(t%=Ut)<0&&(t+=Ut),t}function Nd(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Ut);let d=Math.atan2(l,o);return d<0&&(d+=Ut),d>=s&&d<=n||d+Ut>=s&&d+Ut<=n}function Wd(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(Pd(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Xd=[-1,-1,-1],Kd=[-1,-1];function $d(){const t=Kd[0];Kd[0]=Kd[1],Kd[1]=t}function qd(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Pd(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Bd):Math.pow(i,Bd),s=s<0?-Math.pow(-s,Bd):Math.pow(s,Bd);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+Ed*Math.sin(e)))/(3*a),h=(-o+i*(s-Ed*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Xd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&$d(),p=Hd(e,s,r,o,Kd[0]),u>1&&(g=Hd(e,s,r,o,Kd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Pd(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Xd);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=zd(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Xd[0]=-l,Xd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ut-1e-4){s=0,n=Ut;const e=r?1:-1;return a>=Xd[0]+t&&a<=Xd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ut,n+=Ut);let c=0;for(let e=0;e<2;e++){const i=Xd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ut+t),(t>=s&&t<=n||t+Ut>=s&&t+Ut<=n)&&(t>Ht/2&&t<1.5*Ht&&(e=-e),c+=e)}}return c}function Qd(t){return Math.round(t/Ht*1e8)/1e8%2*Ht}function tu(t,e){let i=Qd(t[0]);i<0&&(i+=Ut);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ut?n=i+Ut:e&&i-n>=Ut?n=i-Ut:!e&&i>n?n=i+(Ut-Qd(i-n)):e&&i1&&(i||(h+=Oe(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,A=b;eu[0]=S,eu[1]=A,tu(eu,Boolean(a[6])),S=eu[0],A=eu[1];const k=S,C=A-S,T=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case po.M:u=m,p=v,c=u,d=p;break;case po.L:if(i){if(Wd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case po.C:if(i){if(Ud(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=qd(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(Nd(c,d,m,v,y,_,e,s,n))return!0}else h+=Zd(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case po.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Vd(m,v,y,k,k+C,T,e,M,n))return!0}else h+=Jd(m,v,y,k,k+C,T,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case po.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Wd(u,p,o,p,e,s,n)||Wd(o,p,o,l,e,s,n)||Wd(o,l,u,l,e,s,n)||Wd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case po.Z:if(i){if(Wd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class nu{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(nu.IsGradientStr(t))try{const e=su(t)[0];if(e){if("linear"===e.type)return nu.ParseLinear(e);if("radial"===e.type)return nu.ParseRadial(e);if("conic"===e.type)return nu.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2,n=parseFloat(e.value)/180*Ht-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ut,stops:nu.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:nu.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2;let n="angular"===e.type?parseFloat(e.value)/180*Ht:0;for(;n<0;)n+=Ut;for(;n>=Ut;)n-=Ut;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function ou(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function lu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s,t}function hu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n,t}function cu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s,t}function du(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function uu(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function pu(t,e,i){const s=i[0],n=i[1],r=i[2];return t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function gu(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function fu(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],v=s[0],y=s[1],_=s[2],b=i[0],x=i[1],S=i[2];return Math.abs(g-b)0&&(Au.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Au.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Tu),function(t,e,i){return iu(t,0,!1,e,i)}(this.path.commandList,Tu.x,Tu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Tu);const i=ru(this,this.lineWidth,this.dpr);return function(t,e,i,s){return iu(t,e,!0,i,s)}(this.path.commandList,i,Tu.x,Tu.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(Cu,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Au.free(t))),this.stack.length=0}}const wu={WIDTH:500,HEIGHT:500,DPR:1};class Eu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=wu.WIDTH,height:n=wu.HEIGHT,dpr:r=wu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Bu;Eu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Bu||(Bu={}));class Pu{static Get(t,e=Bu.Color1,i=[0,0,0,1]){if(e===Bu.Color1){const e=Pu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=si.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Pu.store1[t]=e,Pu.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Pu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=si.parseColorString(t);return n&&(Pu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Pu.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Bu.Color1){if(Pu.store1[t])return;Pu.store1[t]=i,Pu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Pu.store255[t])return;Pu.store255[t]=i,Pu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Ru(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Ou(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Iu(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Iu(t,e,i,s,n)}function Iu(t,e,i,s,n){if(!t||!e)return t&&Ru(t)||e&&Ru(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Pu.Get(t,Bu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Pu.Get(e,Bu.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:Ru(a)})))});return o?Ou(r,l,i,s,n):Ou(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return Lu(s,n,i);if("radial"===s.gradient)return Du(s,n,i);if("conical"===s.gradient)return Fu(s,n,i)}return!1}return n&&n(r,a),Ru(zu(r,a,i),s)}function Lu(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Uu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Uu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Fu(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Uu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function zu(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]}function Hu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Pu.store255={},Pu.store1={};const ju=[0,0,0,0],Nu=[0,0,0,0];function Uu(t,e,i){return Pu.Get(t,Bu.Color255,ju),Pu.Get(e,Bu.Color255,Nu),`rgba(${Math.round(ju[0]+(Nu[0]-ju[0])*i)},${Math.round(ju[1]+(Nu[1]-ju[1])*i)},${Math.round(ju[2]+(Nu[2]-ju[2])*i)},${ju[3]+(Nu[3]-ju[3])*i})`}class Vu{static GetCanvas(){try{return Vu.canvas||(Vu.canvas=Ua.global.createCanvas({})),Vu.canvas}catch(t){return null}}static GetCtx(){if(!Vu.ctx){const t=Vu.GetCanvas();Vu.ctx=t.getContext("2d")}return Vu.ctx}}class Wu extends Ye{static getInstance(){return Wu._instance||(Wu._instance=new Wu),Wu._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Vu.GetCanvas(),s=Vu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Wu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Gu{static GetSize(t){for(let e=0;e=t)return Gu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Gu.GenKey(t,e,i,s,n),l=Gu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=Gu.GenKey(t,e,i,s,n);Gu.cache[l]?Gu.cache[l].push({width:a,height:o,pattern:r}):Gu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Yu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Ut;for(;i>Ut;)i-=Ut;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),Ou(o.color,l.color,h,!1)}function Xu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Vu.GetCanvas(),d=Vu.GetCtx();if(!d)return null;const u=Gu.GetSize(o),p=Gu.GetSize(l);let g=Gu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Wu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);t++){const e=y.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Gu.Set(e,i,s,r,a,g,u,p),g}Gu.cache={},Gu.ImageSize=[20,40,80,160,320,640,1280,2560];const Ku=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function $u(t){return null==t?void 0:t}class qu{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:$u(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Ku.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:$u(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function Zu(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Ju(t){if(!Zu(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Ju(t[i])})),e}function Qu(t,e){var i;const s=null!==(i=Ju(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];Zu(n)&&Zu(i)?s[t]=Qu(n,i):s[t]=Ju(i)})),s}class tp{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Ju(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];Zu(r)&&Zu(n)?t[i]=Qu(r,n):!Zu(r)&&Zu(a)&&Zu(n)?t[i]=Qu(a,n):t[i]=Ju(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?ep.PAINT|ep.BOUNDS|ep.PICK:ep.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?ep.PAINT|ep.BOUNDS:ep.PAINT}};class np{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:kd;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:Ao.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:Ao.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:Ao.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const rp=new qu;function ap(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,op(t),!0)}function op(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=rp.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function lp(t){if(t)return t.parentScope&&lp(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&op(t),t}function hp(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function cp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function dp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,cp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),hp(null!=e?e:t.ownerStage))}const up=new Ve,pp=new Ge,gp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],fp=["x","y"],mp=["scaleX","scaleY"],vp=["angle"],yp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),_p=new re,bp=[],xp=ep.PAINT|ep.SHAPE|ep.BOUNDS|ep.TRANSFORM|ep.LAYOUT;function Sp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Ap(t){if(!Sp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=Sp(s)?Ap(s):s})),i}function kp(t,e){return t===e||!!(Sp(t)||Sp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function Cp(t,e){var i;const s=null!==(i=Ap(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];Sp(n)&&Sp(i)?s[t]=Cp(n,i):s[t]=Ap(i)})),s}const Tp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Mp extends $a{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,cp(this.stage,this),hp(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&lp(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Ao.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(lp(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new qu).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Ap(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&Sp(n)&&Sp(s)?e[t]=Cp(n,s):e[t]=Ap(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:Ap(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e){const i=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((s=>{const n=Object.prototype.hasOwnProperty.call(e,s),r=t[s];if(!n)return void(Object.prototype.hasOwnProperty.call(t,s)&&(i.set(s,{prev:r,next:void 0}),delete t[s]));const a=e[s];kp(r,a)||(i.set(s,{prev:r,next:a}),t[s]=Ap(a))})),i}_syncAttribute(){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const t=this.buildStaticAttributeSnapshot(),e=this.syncObjectToSnapshot(this.attribute,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,e}_syncFinalAttributeFromStaticTruth(){const t=this.finalAttribute;if(!t)return;const e=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(t,e)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=sp[t];return n?n(e,i):null!==(s=ip[t])&&void 0!==s?s:ep.PAINT}(e,i,s):null!==(n=ip[e])&&void 0!==n?n:ep.PAINT;return r&ep.PICK&&(r|=ep.BOUNDS),r===ep.PAINT&&this.needUpdateTag(e)&&(r=ep.SHAPE|ep.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&xp)!==xp?(t&ep.SHAPE?this.addUpdateShapeAndBoundsTag():t&ep.BOUNDS&&this.addUpdateBoundTag(),t&ep.PAINT&&this.addUpdatePaintTag(),t&ep.TRANSFORM&&this.addUpdatePositionTag(),t&ep.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=ep.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!Sp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=Sp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&xo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Mp.userSymbolMap[t],e)return e;if(!0===Nc(t=Pc[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=_(i.path)?i.path:[i.path];up.clear();const n=[];s.forEach((t=>{const e=(new Ml).fromString(t.d),i={};Ad.forEach((e=>{t[e]&&(i[Sd[e]]=t[e])})),n.push({path:e,attribute:i}),up.union(e.bounds)}));const r=up.width(),a=up.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new wc(t,n,!0);return Mp.userSymbolMap[t]=l,l}const i=(new Ml).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Yt(s,n);i.transform(0,0,r,r);const a=new wc(t,i);return Mp.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=gh(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new lo(t);return Ro(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ge),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&xo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&xo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&xo.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&xo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=xo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===So.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===Ao.STATE||null!=i&&i>=Ao.ANIMATE_BIND&&i<=Ao.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===Ao.STATE||null!=o&&o>=Ao.ANIMATE_BIND&&o<=Ao.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!kp(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:bp,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Ao.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:Ao.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:kd}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:bp,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Ap(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Ao.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:Ao.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:bp,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:bp,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Ao.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:Ao.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Ao.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Dl.x,y:e=Dl.y,scaleX:i=Dl.scaleX,scaleY:s=Dl.scaleY,angle:n=Dl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Gt(a),f=Kt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const y=m-i,_=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*y-S*_,t.f=p+h*m+d*v-x*y-A*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),Ua.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Dl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=pp.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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:Ua.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:Ao.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:Ao.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=Ua.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Ml).fromString(t):this.pathProxy=new Ml,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:Ua.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new to(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):$a.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:Ao.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:Ao.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Ua.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Mu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}function wp(t){return!!t&&("string"==typeof t?!yp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Op=Pp();class Ip{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Bp.forEach((t=>{this._defaultTheme[t]=Object.create(Op[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Bp.forEach((s=>{const n=Object.create(Op[s]);t&&t[s]&&Rp(n,t[s]),i[s]&&Rp(n,i[s]),e[s]&&Rp(n,e[s]),this.combinedTheme[s]=n})),e.common&&Bp.forEach((t=>{Rp(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Lp=new Ip;function Dp(t,e){return t.glyphHost?Dp(t.glyphHost):e?(t.isContainer,e):Fp(t)||t.attachedThemeGraphic&&Dp(t.attachedThemeGraphic)||Lp.getTheme()}function Fp(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)):Lp.getTheme()}return null}const zp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},Hp=["radius","startAngle","endAngle",...gp];class jp extends Mp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=nd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Dp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ua.graphicService.updateTempAABBBounds(i);return zp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ut-zt?i.set(-r,-r,r,r):vh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Hp)}needUpdateTag(t){return super.needUpdateTag(t,Hp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Ml,s.arc(0,0,r,a,o),s}clone(){return new jp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return jp.NOWORK_ANIMATE_ATTR}}function Np(t){return new jp(t)}function Up(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Vp(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Wp(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[hi(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=hi(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}jp.NOWORK_ANIMATE_ATTR=Tp;class Gp{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Bl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=vd}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Dp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Xp({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Ua.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Yc(n,o/Math.abs(r+a),!0,l),i.union(n)}return Ua.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ua.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ne(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=Ua.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Gp(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=Ua.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new Gp(a,T,C),w=_(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=Up(y,a),e=this.cache.verticalList.length*v,i=Vp(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>qc(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===$c.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const S=Up(y,a),A=x.verticalList.length*v,k=Vp(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Ch(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Yp){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Yp){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Xp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xp.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Xp.baselineMapAlign}getAlignMapBaseline(){return Xp.alignMapBaseline}}function Kp(t){return new Xp(t)}Xp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Tp),Xp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Xp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const $p=["heightLimit","lineClamp"];class qp extends Xp{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=Ch(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=Ua.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new Gp(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),T=[],M=[0,0];let w=1/0;if(y>0&&(w=Math.max(Math.floor(y/x),1)),b&&(w=Math.min(w,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Yc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Jp)}needUpdateTag(t){return super.needUpdateTag(t,Jp)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Ml).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Ml).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function tg(t){return new Qp(t)}Qp.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Tp);const eg=["segments","points","curveType","curveTension",...gp];let ig=class t extends Mp{constructor(t={}){super(t),this.type="line",this.numberType=ld}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}getGraphicTheme(){return Dp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Ua.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,eg)}needUpdateTag(t){return super.needUpdateTag(t,eg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Ml;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function sg(t){return new ig(t)}ig.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const ng=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},rg=["width","x1","y1","height","cornerRadius",...gp];class ag extends Mp{constructor(t){super(t),this.type="rect",this.numberType=ud}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Dp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);return zp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,rg)}needUpdateTag(t){return super.needUpdateTag(t,rg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=ng(e);return t=new Ml,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new ag(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ag.NOWORK_ANIMATE_ATTR}}function og(t){return new ag(t)}ag.NOWORK_ANIMATE_ATTR=Tp;const lg=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class hg extends ag{constructor(t){super(t),this.type="rect3d",this.numberType=pd}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Xt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;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,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Dp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new dg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return dg.NOWORK_ANIMATE_ATTR}}function ug(t){return new dg(t)}dg.NOWORK_ANIMATE_ATTR=Tp;const pg=Symbol.for("EnvContribution"),gg=Symbol.for("VGlobal"),fg="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",mg={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"}},vg=!0,yg=!1,_g=/\w|\(|\)|-/,bg=/[.?!,;:/,。?!、;:]/,xg=/\S/,Sg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Ag(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Ua.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=kg(t,a)),a}function kg(t,e,i=!1){let s=e;for(;_g.test(t[s-1])&&_g.test(t[s])||bg.test(t[s]);)if(s--,s<=0)return i?Cg(t,e):e;return s}function Cg(t,e){let i=e;for(;_g.test(t[i+1])&&_g.test(t[i])||bg.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Tg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Ua.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Mg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=mg[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function wg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Eg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Ch(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Tg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Tg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ag(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Tg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=wg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ag(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Tg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Ag(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Tg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Bg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...gp];class Pg extends Mp{constructor(t){super(t),this.type="image",this.numberType=od,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Dp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);return zp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ah[t]}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}clone(){return new Pg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Pg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Tp);class Og extends Pg{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=gh(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=gh(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=ah.width,height:e=ah.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Ig{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Og?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=mg[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Eg){const e=xg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Og)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Tg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||yg;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Sg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||vg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?au(t,s,{AABBBounds:i}):s,Sg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Og)break;const{width:n}=Tg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Og?t.width:t.getWidthWithEllips(this.direction)})),i}}class Lg{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=mg[this.direction]}store(t){if(t instanceof Og){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 Ig(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Og?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Ag(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Eg(i,t.newLine,t.character,t.ascentDescentMode),new Eg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Dg=!1;try{Dg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Dg=!1}const Fg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...gp];class zg extends Mp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=gd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:rh.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:rh.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:rh.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:rh.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:rh.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:rh.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:rh.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:rh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Dp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&zg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&zg.splitText(t.text).length>1)))}static splitText(t){if(Dg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=zg.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Ua.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ua.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!zg.AllSingleCharacter(y)&&(y=zg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Mg(0,0,(k?n:x?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Lg(T);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&T.lines[T.lines.length-1].paragraphs.push(s)):M.deal(s,!0),T.lines.length!==t&&(t=T.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,T.lines[T.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===T.layoutDirection?k:C)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:s)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new zg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return zg.NOWORK_ANIMATE_ATTR}}function Hg(t){return new zg(t)}zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Tp);const jg=["path","customPath",...gp];class Ng extends Mp{constructor(t){super(t),this.type="path",this.numberType=hd}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Ml?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Ml?this.cache:t.path)}getGraphicTheme(){return Dp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);zp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Ml).fromString(t.path):t.customPath&&(this.cache=new Ml,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,jg)}needUpdateTag(t){return super.needUpdateTag(t,jg)}toCustomPath(){return(new Ml).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Ng(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ng.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Ng(t)}Ng.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Tp);const Vg=["segments","points","curveType","curveTension",...gp];class Wg extends Mp{constructor(t){super(t),this.type="area",this.numberType=sd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Dp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Ua.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Ml;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Wg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wg.NOWORK_ANIMATE_ATTR}}function Gg(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const Yg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...gp];class Xg extends Mp{constructor(t){super(t),this.type="arc",this.numberType=ed}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=he(e),i=e+a,s&&Vt(a)>zt&&Vt(a)zt&&o>zt)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=$t(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Kt(g)),n=Zt(Number(l)/a*Kt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Dp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ua.graphicService.updateTempAABBBounds(i);zp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Ut-zt?i.set(-s,-s,s,s):(vh(l,o,s,i),vh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Yg)}needUpdateTag(t){return super.needUpdateTag(t,Yg)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ut-zt)n.moveTo(0+h*Gt(a),0+h*Kt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Kt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Kt(a),i=l*Gt(o),s=l*Kt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function Kg(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Tp);const $g=["width","height","spikes","thickness",...gp];class qg extends Mp{constructor(t){super(t),this.type="star",this._cachedPoints=[],this.numberType=fd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e,spikes:i}=this.attribute;return(null==t||t>0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return Dp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Ml,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Tp;class Jg extends Xg{constructor(t){super(t),this.type="arc3d",this.numberType=id}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),Ua.graphicService.updateTempAABBBounds(i),Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return Jg.NOWORK_ANIMATE_ATTR}}function Qg(t){return new Jg(t)}var tf;Jg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Tp),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(tf||(tf={}));let ef=class t extends Mp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=ad,this._childUpdateTag=xo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(ap(this.sharedStateScope,t),dp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Ip),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Ip)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===So.GLOBAL){const i=new re(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&xo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Dl.x,y:e=Dl.y,dx:i=Dl.dx,dy:s=Dl.dy,scaleX:n=Dl.scaleX,scaleY:r=Dl.scaleY,angle:a=Dl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Dp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Ua.graphicService.updateTempAABBBounds(i),Ua.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=xo.CLEAR_BOUNDS,this._childUpdateTag&=xo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&xo.UPDATE_BOUNDS||(this._childUpdateTag|=xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:Ua.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&xo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Ua.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&ap(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return op({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function sf(t){return new ef(t)}ef.NOWORK_ANIMATE_ATTR=Tp;const nf=["points","cornerRadius",...gp];class rf extends Mp{constructor(t){super(t),this.type="polygon",this.numberType=cd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Dp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Ua.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,nf)}needUpdateTag(t){return super.needUpdateTag(t,nf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Ml,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new rf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rf.NOWORK_ANIMATE_ATTR}}function af(t){return new rf(t)}rf.NOWORK_ANIMATE_ATTR=Tp;class of extends rf{constructor(t){super(t),this.type="pyramid3d",this.numberType=dd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),Ua.graphicService.updateTempAABBBounds(i),Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,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}getNoWorkAnimateAttr(){return of.NOWORK_ANIMATE_ATTR}}function lf(t){return new of(t)}of.NOWORK_ANIMATE_ATTR=Tp;class hf extends ef{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function cf(t){return new hf(t)}class df{constructor(){this.registry=new Map}create(t,e){const i=this.registry.get(t);if(!i)throw new Error(`GraphicFactory has no creator registered for type "${t}"`);return new i(e)}register(t,e){if(!t)throw new Error("GraphicFactory requires a non-empty graphic type");this.registry.set(t,e)}}const uf=new df;const pf=new class{constructor(){this.store=new Map}registerStore(t,e){this.store.set(t,e),this[t]=e}RegisterGraphicCreator(t,e){gf(t,e)}CreateGraphic(t,e){return this.store.has(t)?ff(t,e):null}};function gf(t,e){if(!t)throw new Error("Graphic registration requires a non-empty graphic type");pf.registerStore(t,e),uf.register(t,function(t){return class{constructor(e){try{return new t(e)}catch(i){return t(e)}}}}(e))}function ff(t,e){return uf.create(t,e)}function mf(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=m[1];y[2]=null!==(s=m[2])&&void 0!==s?s:0}if(ou(t),du(t,t,[n+o,r+l,a+h]),du(t,t,[y[0],y[1],y[2]]),lu(t,t,g),hu(t,t,p),du(t,t,[-y[0],-y[1],y[2]]),pu(t,t,[c,d,u]),f){const i=ku.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}du(i,i,[s[0],s[1],0]),cu(i,i,f),du(i,i,[-s[0],-s[1],0]),gu(t,t,i)}}function vf(t){const{alpha:e,beta:i}=t.attribute;return e||i}class yf{constructor(t=pf){this.creator=t,this.hooks={onAttributeUpdate:new Ha(["graphic"]),onSetStage:new Ha(["graphic","stage"]),onRemove:new Ha(["graphic"]),onRelease:new Ha(["graphic"]),onAddIncremental:new Ha(["graphic","group","stage"]),onClearIncremental:new Ha(["graphic","group","stage"]),beforeUpdateAABBBounds:new Ha(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Ha(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new Ha(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Vp(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Up(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Yc(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Yc(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Ne(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}let _f,bf;function xf(t){return _f||(_f=ff("text",{})),_f.initAttributes(t),_f.AABBBounds}function Sf(t){return bf||(bf=ff("richtext",{})),bf.setAttributes(t),bf.AABBBounds}const Af=Symbol.for("TransformUtil"),kf=Symbol.for("GraphicUtil"),Cf=Symbol.for("LayerService"),Tf=Symbol.for("StaticLayerHandlerContribution"),Mf=Symbol.for("DynamicLayerHandlerContribution"),wf=Symbol.for("VirtualLayerHandlerContribution"),Ef=Symbol.for("RenderService"),Bf=Symbol.for("BeforeRenderConstribution"),Pf=Symbol.for("AutoEnablePlugins"),Rf=Symbol.for("PluginService"),Of=Symbol.for("GraphicPicker"),If=Symbol.for("PickerService"),Lf=Symbol.for("BoundsPicker"),Df=Symbol.for("GlobalPickerService"),Ff=Symbol.for("PickItemInterceptor"),zf=Symbol.for("PickServiceInterceptor"),Hf=Symbol.for("IncrementalDrawContribution"),jf=Symbol.for("ArcRender"),Nf=Symbol.for("Arc3dRender"),Uf=Symbol.for("AreaRender"),Vf=Symbol.for("CircleRender"),Wf=Symbol.for("GraphicRender"),Gf=Symbol.for("GroupRender"),Yf=Symbol.for("LineRender"),Xf=Symbol.for("PathRender"),Kf=Symbol.for("PolygonRender"),$f=Symbol.for("RectRender"),qf=Symbol.for("Rect3DRender"),Zf=Symbol.for("SymbolRender"),Jf=Symbol.for("TextRender"),Qf=Symbol.for("RichTextRender"),tm=Symbol.for("Pyramid3dRender"),em=Symbol.for("GlyphRender"),im=Symbol.for("ImageRender"),sm=Symbol.for("RenderSelector"),nm=Symbol.for("DrawContribution"),rm=Symbol.for("StarRender"),am=Symbol.for("VWindow"),om=Symbol.for("WindowHandlerContribution");function lm(t){const e=Ua.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class hm extends Ga{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=Ua.global,e=lm){super(),this.handlerFactory=e,this.hooks={onChange:new Ha(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=ja.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&>(this.width,t.width())&>(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class cm{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Md(Object.assign({nativeCanvas:Ua.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Md(Object.assign({nativeCanvas:Ua.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const dm=new cm;class um{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Ua.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=dm.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:jl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:jl.fontFamily,fontSize:jl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=Ua.windowFactory)||void 0===s?void 0:s.call(Ua))&&void 0!==n?n:new hm(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var pm;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(pm||(pm={}));const gm=new Ge;class fm{constructor(){this.matrix=new Ge}init(t){return this.mode=pm.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=pm.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(gm.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(gm.a,gm.b,gm.c,gm.d,gm.e,gm.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(gm.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(gm.a,gm.b,gm.c,gm.d,gm.e,gm.f),this}scale(t,e,i){return this.mode===pm.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===pm.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return gm.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(gm.a,gm.b,gm.c,gm.d,gm.e,gm.f),this}translate(t,e){return this.mode===pm.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===pm.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}class mm{constructor(){this.global=Ua.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ge(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new re(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var vm=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function ym(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function _m(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=ym(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=ym(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Sm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Am{constructor(){this.time=To.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(Tm(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Dp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){Im(t,e,i,s)}}const km=new Am,Cm=new Set(["top","center","bottom"]);function Tm(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Mm({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const wm={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Em({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=wm[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Mm({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Bm(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Pm(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:Cm.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Bm(s,e,"left","center","right"),y:Bm(n,i,"top","center","bottom")}}function Rm(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Om(t){if(!t)return null;const e=Rm(t.naturalWidth,t.videoWidth,t.width),i=Rm(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Im(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Om(e),{backgroundRepeatMode:m,backgroundSizing:v}=Em({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Pm(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=dm.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),dm.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class Lm{constructor(t){this.subRenderContribitions=t,this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}}class Dm{constructor(){this.time=To.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const Fm=new Dm;class zm{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Hm=new zm,jm={getContributions:()=>[]};class Nm{constructor(t=[],e=jm,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):_m(e,Gl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ue,this.backupDirtyBounds=new Ue,this.global=null!==(s=i.global)&&void 0!==s?s:Ua.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:Ua.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:jm,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Gl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Gl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Au.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=xm(e,i,Gl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Sm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Au.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Sm.free(n),Au.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||function(){const t=Ua.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class Vm{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class Wm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Gm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Ym{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const Xm={getContributions:()=>[]};class Km{constructor(t=Xm,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new Gm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class $m{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class qm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Ua.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Ua.global.getRequestAnimationFrame();this.rafId=t((()=>{Ua.global.devicePixelRatio!==this.dpr&&(this.dpr=Ua.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Ua.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class Zm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ua.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Jm=new Ve;class Qm{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&xo.UPDATE_PAINT)||s._updateTag&xo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(Jm.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(Jm,t.parent&&t.parent.globalTransMatrix)))})),t.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let tv;function ev(){if(null==tv)try{const t=document.createElement("canvas"),e=t.getContext("2d");tv=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),tv&&(tv=!!document.createElement)}catch(t){tv=!1}}function iv(){ev();const t=Ua.global&&Ua.global.env;return t?"browser"===t:tv}const sv="white";class nv extends ef{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:sv}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Ip,this.hooks={beforeRender:new Ha(["stage"]),afterRender:new Ha(["stage"]),afterClearScreen:new Ha(["stage"]),afterClearRect:new Ha(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:Ua.global,!this.global.env&&iv()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:Ua.windowFactory)&&void 0!==n?n:()=>new hm(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=Ua.pickerServiceFactory)&&void 0!==a?a:()=>new mm,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=Ua.renderServiceFactory)||void 0===h?void 0:h.call(Ua))&&void 0!==c?c:Ua.renderService)&&void 0!==d?d:new Um,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=Ua.pluginServiceFactory)||void 0===p?void 0:p.call(Ua))&&void 0!==g?g:Ua.pluginService)&&void 0!==f?f:new Km,this.layerService=null!==(v=null!==(m=e.layerService)&&void 0!==m?m:Ua.layerService)&&void 0!==v?v:new cv(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:Ua.graphicService)&&void 0!==b?b:new yf,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:sv,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,op(s)),dp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new ao(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[y,_,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,A=Math.cos(d)*Math.cos(u)*1);const k=lv.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=lv.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=lv.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new $m))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new qm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new Zm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ue;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Qm,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=lv.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=lv.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=lv.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return op({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class rv{constructor(t=nv,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class av extends ef{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Ip,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Ua.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Ua.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}class ov{constructor(t=av){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let lv=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function hv(t){const e=Ua.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}lv._pluginClasses={};class cv{static GenerateLayerId(){return`${cv.idprefix}_${cv.prefix_count++}`}constructor(t=Ua.global,e=new ov,i=hv){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:cv.GenerateLayerId(),layerHandler:n})}),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}}cv.idprefix="visactor_layer",cv.prefix_count=0;const dv=Symbol("ContributionProvider");class uv{constructor(t,e){this.serviceIdentifier=t,this.container=e,mv.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function pv(t,e){return new uv(t,e)}function gv(t,e){t(dv).toDynamicValue((({container:t})=>pv(e,t))).inSingletonScope().whenTargetNamed(e)}function fv(t,e){t(dv).toDynamicValue((({container:t})=>pv(e,t))).whenTargetNamed(e)}class mv{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}mv.store=new Map;class vv{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=nh.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=kg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=kg(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}}const yv=Symbol.for("TextMeasureContribution");class _v extends vv{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function bv({bind:t}){t(gg).toDynamicValue((({container:t})=>new Xa(pv(pg,t)))).inSingletonScope(),t(am).to(hm),t(kf).toDynamicValue((({container:t})=>new um(pv(yv,t)))).inSingletonScope(),t(Af).to(fm).inSingletonScope(),t(Cf).to(cv).inSingletonScope()}function xv({bind:t}){t(Ef).to(Um)}const Sv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===id,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Ut;for(;o<0;)o+=Ut;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};class Av{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class kv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Dp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Au.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class Cv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class Tv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=Sv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function Mv({bind:t,isBound:e}){e(If)||(t(Df).toSelf(),t(If).toService(Df)),t(Tv).toSelf().inSingletonScope(),t(Ff).toService(Tv),t(kv).toSelf().inSingletonScope(),t(Ff).toService(kv),t(Cv).toSelf().inSingletonScope(),t(Ff).toService(Cv),gv(t,Ff),t(Av).toSelf().inSingletonScope(),t(zf).toService(Av),gv(t,zf)}function wv({bind:t}){t(yd).to(yf),t(_d).toConstantValue(pf)}class Ev{constructor(){this.type="static",this.offscreen=!1,this.global=Ua.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Md({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}}function Bv(t){(function({bind:t}){gv(t,pg)})({bind:t.bind}),function({bind:t}){t(yv).to(_v).inSingletonScope(),gv(t,yv)}({bind:t.bind}),function({bind:t}){t(Ev).toSelf(),t(Tf).toService(Ev)}({bind:t.bind})}const Pv=Ht/2;function Rv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Pv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Pv,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Pv,Ht,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ht,Ht+Pv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function Ov(t,e){return!(!t&&!e)}function Iv(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Lv(t,e,i){return i&&t*e>0}function Dv(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Fv(t,e){return t*e>0}function zv(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Hv(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uB*B+P*P&&(k=T,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Nv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*Gt(c),k=n*Kt(c),C=s*Gt(u),T=s*Kt(u);let M,w,E,B;if((b>zt||y>zt)&&(M=n*Gt(d),w=n*Kt(d),E=s*Gt(p),B=s*Kt(p),r1?0:P<-1?Ht:Math.acos(P))/2),l=$t(t[0]*t[0]+t[1]*t[1]);S=Xt(b,(s-l)/(o-1)),x=Xt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:M,yore:w,xire:C,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Uv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ut-zt)e.moveTo(i+n*Gt(o),s+n*Kt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Kt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:T,innerDeltaAngle:M,innerEndAngle:w,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Nv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=Xt(v,m),r=Xt(y,m),o=jv(g,f,u,p,n,t,Number(c)),l=jv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Gt(Wt(l.y01,l.x01)),s+o.cy+m*Kt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Kt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Kt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Gt(C),s+n*Kt(C));if(!(r>zt)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=Xt(B,T),n=Xt(P,T),o=jv(S,A,b,x,r,-n,Number(c)),l=jv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Kt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,w,E,c):e.moveTo(i+r*Gt(E),s+r*Kt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Kt(o)):e.closePath(),d}const Vv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Wv{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=dm.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),dm.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Ut),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=dm.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=tg({}));const C=h.columns?v/h.columns:b,T=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,T-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:Vv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=dm.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),dm.free(l),c}dm.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const Gv=new Wv;class Yv{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{innerPadding:m=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,T-=m;const w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:ru(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:T-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Uv(t,e,i,s,M+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&w(u,"outerBorder"),f&&w(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:T,startAngle:y,endAngle:_})}}const Xv=new Yv,Kv=Gv,$v=km;class qv{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:ru(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Zv=new qv,Jv=Gv,Qv=km;class ty extends Am{constructor(){super(...arguments),this.time=To.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Tm(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const ey=new ty;class iy{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:k-i)||0,w=(null!=w?w:C-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:ru(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,w-o*g)):(e.beginPath(),Rv(e,u,p,M-o*g,w-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}class sy{constructor(){this.time=To.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}}class ny{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Rv(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ry=new iy,ay=Gv,oy=km;class ly extends iy{constructor(){super(...arguments),this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}}const hy=new ly,cy=km;class dy{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:ru(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class uy{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const py=new dy,gy=new uy,fy=Gv,my=km,vy=Gv,yy=km;class _y extends Wv{constructor(){super(...arguments),this.time=To.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:xh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:xh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:xh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:xh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class by{constructor(t){this.groupRenderContribitions=t,this.numberType=ad}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ey)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Dp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:T=l.y}=t.attribute,M=Dv(p,m,g,f,c),w=zv(p,v,g,f),E=Ov(c,u),B=Iv(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(M||w||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Rv(e,i,s,g,f,y,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ey));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===To.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,T-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,C-i,T-s,l),e.stroke()))};A?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===To.afterFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Ua.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Dp(t,null==s?void 0:s.theme).group,i=ku.allocate(),n=ku.allocate();mf(n,t,e),gu(i,p||i,n),a.modelMatrix=i,ku.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ku.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var xy,Sy=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(xy||(xy={}));class Ay extends Nm{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=xy.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Ha([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Sy(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Gl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Gl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return Sy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Sy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Sy(this,void 0,void 0,(function*(){if(2!==t.count)yield bm(t,Gl.zIndex,((i,s)=>{if(this.status===xy.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Sy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Sy(this,void 0,void 0,(function*(){this.rendering&&(this.status=xy.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=xy.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 Sy(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:()=>Sy(this,void 0,void 0,(function*(){yield bm(t,Gl.zIndex,(t=>Sy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const ky=Symbol.for("DrawItemInterceptor"),Cy=new Ve,Ty=new Ve;class My{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Cy.copy(s.dirtyBounds),Ty.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Au.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Cy),s.backupDirtyBounds.copy(Ty)),!0}}class wy{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}class Ey{constructor(){this.order=1,this.interceptors=[new My,new Py,new By,new wy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ku.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const Ry=Symbol.for("ArcRenderContribution"),Oy=Symbol.for("AreaRenderContribution"),Iy=Symbol.for("CircleRenderContribution"),Ly=Symbol.for("GroupRenderContribution"),Dy=Symbol.for("ImageRenderContribution"),Fy=Symbol.for("PathRenderContribution"),zy=Symbol.for("PolygonRenderContribution"),Hy=Symbol.for("RectRenderContribution"),jy=Symbol.for("SymbolRenderContribution"),Ny=Symbol.for("TextRenderContribution"),Uy=Symbol.for("StarRenderContribution"),Vy=Symbol.for("CommonRenderContribution"),Wy=Symbol.for("InteractiveSubRenderContribution");function Gy(t){!function({bind:t}){t(Am).toSelf().inSingletonScope(),t(Wv).toSelf().inSingletonScope(),t(nm).to(Nm),t(Hf).to(Ay),t(Gf).toDynamicValue((({container:t})=>new by(pv(Ly,t)))).inSingletonScope(),t(Wf).toService(Gf),gv(t,Ly),gv(t,Wy),t(Lm).toDynamicValue((({container:t})=>new Lm(pv(Wy,t)))).inSingletonScope(),gv(t,Wf),t(Ey).toSelf().inSingletonScope(),t(ky).toService(Ey),gv(t,ky)}({bind:t.bind})}class Yy{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class Xy{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new Yy(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function Ky(){return new Xy}const $y=Ky();function qy(){qy.__loaded||(qy.__loaded=!0,bv({bind:$y.bind}),wv({bind:$y.bind}),xv({bind:$y.bind}),Mv({bind:$y.bind,isBound:$y.isBound}),function({bind:t}){t(Rf).to(Km),fv(t,Pf)}({bind:$y.bind}),Bv($y),Gy($y))}function Zy(){return $y}function Jy(t){qy();const[e]=$y.getAll(t);return e}function Qy(t,e){return qy(),$y.getNamed(t,e)}function t_(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}qy.__loaded=!1;const e_=t_((()=>Jy(gg)));Ua.global=e_;const i_=Zy(),s_=t_((()=>Jy(kf))),n_=t_((()=>Jy(Af))),r_=t_((()=>Jy(yd))),a_=t_((()=>Jy(Cf)));function o_(){Ua.global=e_,Ua.graphicUtil=s_,Ua.transformUtil=n_,Ua.graphicService=r_,Ua.layerService=a_,Ua.canvasFactory=t=>Qy(Cd,t),Ua.context2dFactory=t=>Qy(Td,t),Ua.windowFactory=()=>new hm(Ua.global),Ua.windowHandlerFactory=t=>function(t){const e=Qy(om,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),Ua.renderServiceFactory=()=>Jy(Ef),Ua.renderService=t_((()=>Jy(Ef))),Ua.pluginServiceFactory=()=>Jy(Rf),Ua.pluginService=t_((()=>Jy(Rf))),Ua.pickerServiceFactory=()=>Jy(If),Ua.layerHandlerFactory=t=>Jy("static"===t?Tf:"dynamic"===t?Mf:wf),Ua.incrementalDrawContributionFactory=()=>Jy(Hf)}o_();const l_={x:0,y:0,z:0,lastModelMatrix:null};class h_{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(Fm),e(Hm),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===To.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===To.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Dp(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,y=Lv(d,u,h),_=Fv(d,g),b=Ov(h),x=Iv(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Ro(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Lv(o,l,n),p=Fv(o,c),g=Ov(n,r),f=Iv(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;l_.x=n,l_.y=r,l_.z=a,l_.lastModelMatrix=d;const p=u&&(s||vf(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=ku.allocate(),n=ku.allocate();mf(n,t,e),gu(s,d||s,n),l_.x=0,l_.y=0,l_.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ku.free(n)}if(g&&!d){const s=t.getOffsetXY(e);l_.x+=s.x,l_.y+=s.y,l_.z=a,i.setTransformForCurrent()}else if(p)l_.x=0,l_.y=0,l_.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);l_.x+=s.x,l_.y+=s.y,this.transformWithoutTranslate(i,l_.x,l_.y,l_.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),l_.x=0,l_.y=0,l_.z=0;return l_}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,f,m,v,y,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ku.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class c_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ed,this.builtinContributions=[Xv,$v,Kv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nzt){const t=Xt(b,_),r=Xt(x,_),a=jv(v,y,f,m,n,t,Number(u)),o=jv(A,k,C,T,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||w<.001)e.lineTo(i+C,s+T),p=!0;else if(M>zt){const t=Xt(B,M),n=Xt(P,M),a=jv(C,T,A,k,r,-n,Number(u)),o=jv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Kt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Dp(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let T=0;const M=(c(S)&&S||S[0])&&"conical"===h.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Ut-zt){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),w||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Yu(0,0,h,n);a||Lv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}class d_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=nd,this.builtinContributions=[Zv,Qv,Jv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}function u_(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=No(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function p_(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function g_(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=p_(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),u_(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=ko.ROW:"y"===s?u=ko.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function m_(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}class v_ extends h_{constructor(){super(...arguments),this.numberType=ld}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();g_(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Tl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Xt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}function y_(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?ko.ROW:ko.COLUMN,Number.isFinite(c)||(o=ko.COLUMN),Number.isFinite(d)||(o=ko.ROW);const u=i*(o===ko.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),u_(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),u_(t,l,1,s),o=!1):o=!0}t.closePath()}const b_=new _y,x_=km;class S_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=sd,this.builtinContributions=[b_,x_],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Dp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:T,points:M,segments:w}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===C&&!w&&!M.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,_,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(w&&w.length){let e,i;const s=w.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Tl(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Tl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Tl(e,E,{curveTension:b}),n=Tl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Xt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=ko.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),A=Vt(y.y-b.y);x=null==y.x1?ko.ROW:null==y.y1?ko.COLUMN:Number.isFinite(S+A)?S>A?ko.ROW:ko.COLUMN:ko.ROW,y_(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),g_(t,i[0]?e.top:e.bottom,l,x===ko.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const A_=Gv,k_=km;class C_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=hd,this.builtinContributions=[k_,A_],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Dp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)Ro(t.pathShape.commandList,e,i,s,1,1,f);else{Ro((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}class T_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=ud,this.builtinContributions=[ry,oy,ay],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Dp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:M}=t.attribute;T=(null!=T?T:b-S)||0,M=(null!=M?M:x-A)||0;const w=Dv(g,f,T,M,h),E=zv(g,v,T,M,C),B=Ov(h,c),P=Iv(d,m);if(!t.valid||!y)return;if(!B&&!P)return;if(!(w||E||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,M)):(e.beginPath(),Rv(e,i,s,T,M,u,"bevel"!==p));const R={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,w,E,l,n,a,o,R),k?(this._runStroke(t,e,i,s,l,R,E,S,A,o),this._runFill(t,e,i,s,l,R,w,S,A,a)):(this._runFill(t,e,i,s,l,R,w,S,A,a),this._runStroke(t,e,i,s,l,R,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,w,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}class M_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=md,this.builtinContributions=[py,my,fy,gy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Dp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,M=s,w=C;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,C);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,M=t.y,w=void 0}!1===A.draw(e,c,T,M,w,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,A,a)):(this._runFill(t,e,i,s,l,x,y,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const w_=new class extends Am{constructor(){super(...arguments),this.time=To.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:w=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:R=l.backgroundClip,backgroundCornerRadius:O=l.backgroundCornerRadius}=t.attribute;let I,{background:L}=t.attribute;if(!L)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(L)&&L.background?L:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Sm.allocate(i,s,i+n,s+r),L=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=xf(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const i=t.resources.get(L);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,R&&(e.beginPath(),O?Rv(e,F.x1,F.y1,F.width(),F.height(),O,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:T,backgroundKeepAspectRatio:M,backgroundScale:w,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=L,O?(Rv(e,F.x1,F.y1,F.width(),F.height(),O,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Sm.free(F),D()}};class E_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=vd,this.builtinContributions=[w_],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Dp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=Ch(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:T}=S,M=!f,w=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,T,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,w,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Au.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Au.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,w))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,w))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,w),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,w)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,w),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,w,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,w,e),this.afterRenderStep(t,e,i,s,C,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!u(c),_=y?c.width:i.clipedWidth,b=y?0:Up(d,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}function B_(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?B_(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void B_(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,y=v/m;const _=P_(d,u),b=P_(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=R_(h,y,_,d,u),A=R_(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,T=P_(k,C),M=R_(h,P_(y,v),T,k,C);let w=Math.atan2(S.y-M.y,S.x-M.x);const E=Math.atan2(A.y-M.y,A.x-M.x);let B=E-w;B<0&&(w=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const D_=["","repeat-x","repeat-y","repeat"];function F_(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?D_[i]:"no-repeat"}function z_({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=F_(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const H_={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function j_(t){return{backgroundMode:H_[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function N_({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=z_({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function U_(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=z_({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?j_(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Im(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class V_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=od,this.builtinContributions=[hy,cy],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:T,doStroke:M}=A;if(!S||!t.resources)return;const w=t.resources.get(S);if("success"!==w.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Rv(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),U_(e,w.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},O=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=N_({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),L=P||I;g?(O(),L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore()):(L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore(),O()),this.afterRenderStep(t,e,i,s,T,!1,k,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&y(s))return void lh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Dp(t).image;this._draw(t,a,!1,i)}}var W_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class G_{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return W_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class Y_{constructor(){this._uid=ja.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class X_{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Pu.Get(e,Bu.Color1),this.ambient=i;const s=$t(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Xt(Yt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=y(e)?Pu.Get(e,Bu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const K_=()=>{lv.registerPlugin("DirectionalLight",X_)};class $_{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=ku.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=ku.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return fu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=ku.allocate()),this._vp=gu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=ku.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=ku.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return mu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=ku.allocate()),this._vp=gu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return vu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;vu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const q_=()=>{lv.registerPlugin("OrthoCamera",$_)},Z_={getContributions:()=>[]},J_={getContributions:()=>[]};class Q_{constructor(t=Z_,e=J_,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:Ua.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:Z_,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:J_,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ge(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=Dp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new re(e.x,e.y);l.transformPoint(a,a);const o=Dp(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&ku.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Au.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class tb{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new Vm,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new Wm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new Ym,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new Gm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new rv(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new ov,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new df}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new Um(new Nm([],(t=this.registry.contribution,e=ky,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class eb{constructor(t={}){this.context=new tb(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function ib(t={}){return new eb(t)}class sb extends eb{}class nb extends eb{}class rb extends S_{constructor(){super(...arguments),this.numberType=sd}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Dp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Lv(u,d,c),f=Ov(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=Dp(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=Lv(u,p,c),y=Fv(u,g),_=Ov(c),b=Iv(d,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||a||o))return;const{context:x}=n;for(let n=e;n{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function fb(t,e){let i=cb.get(t);i||(i=new Map,cb.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function mb(t,e,i){const s=fb(t,e);i&&s.forEach((t=>i(t))),s.clear()}function vb(){return ub(),ob}function yb(){mv.refreshAllContributions()}function _b(){return ub(),null!=lb||(lb=new Xa(pv(pg,ob))),lb}function bb(t){const e=vb(),i=_b();Ua.global=i,Ua.canvasFactory=t=>e.getNamed(Cd,t),Ua.context2dFactory=t=>e.getNamed(Td,t),Ua.windowHandlerFactory=t=>pb(om,t),Ua.windowFactory=()=>new hm(i,(t=>pb(om,t))),Ua.pluginServiceFactory=()=>new Km(pv(Pf,e),{pluginRegistry:t.context.registry.plugin}),Ua.incrementalDrawContributionFactory=()=>new Ay([],new ab,new rb(pv(Oy,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,ky))}function xb(t){var e;const i=vb();yb();const s=i.getAll(Wf),n=fb(t.registry.renderer,"vrender:runtime-renderer");mb(t.registry.renderer,"vrender:runtime-renderer",null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),gb(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,"vrender:runtime-renderer")}function Sb(t){var e;const i=vb();yb();const s=i.getAll(ky),n=null!==(e=db.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,ky,e)})),n.clear(),db.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(ky));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(ky,e),r.add(e)),n.add(e)}))}function Ab(t,e){var i;const s=vb();yb();const n=s.getAll(e),r=fb(t.registry.picker,"vrender:runtime-picker");mb(t.registry.picker,"vrender:runtime-picker",null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),gb(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,"vrender:runtime-picker")}function kb(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function Cb(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function Tb(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function Mb(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function Lb(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=ng(t.attribute),n=Fb(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=Fb(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=Fb(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;n{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return Xb(l,e,h),h},Vb=(t,e)=>{const i=t.attribute,s=i.points;if(s)return Nb(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return Nb(t,e)}return[]};const Wb=t=>t.map((t=>({x:t.x,y:t.y}))),Gb=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},Yb=t=>{const e=new Ue;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return Gb(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return Gb(t,{x:e.x1,y:n},{x:e.x2,y:n})},Xb=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=Yb(t);Xb(n[0],s,i),Xb(n[1],e-s,i)}},Kb=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:Wb(i)}];const s=[];return Xb(i,e,s),s},$b=(t,e)=>{const i=Ib(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;rObject.assign({},t))):[]}function Zb(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:qb(t.touches),configurable:!0},changedTouches:{value:qb(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function Jb(t,e){try{return t[e]}catch(t){return}}function Qb(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Zb(t),l=Jb(t,"target"),h=Jb(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var tx=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function sx(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class nx{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:ix(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},ex(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},ex(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=tx(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=ix(i,this.selectionStartCursorIdx),a=ix(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=ex(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=sx(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),Ua.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),Ua.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class rx{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=ix(i,Math.ceil(t)),n=ix(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=ix(i.attribute.textConfig,a),h=ix(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(ax,[this.formatTextCommandCb]),this.commandCbs.set(ox,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):g(t)&&e.forEach((e=>H(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new nx,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),Ua.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(Ua.global.isMacOS()&&t.metaKey&&"c"===t.key||!Ua.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return Ua.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(Ua.global.isMacOS()&&t.metaKey&&"a"===t.key||!Ua.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},ex(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=Hg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:Sf(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||og({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},ex(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),Ua.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=sf({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,lx.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=sg({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=sf({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=Sf(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=Sf(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(og({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(og({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(og({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=Sf(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=Sf(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:Sf(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Mx=new Tx;function Ex(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Bx=new WeakSet;function Px({bind:t}){Ex(Bx,t)||(t(c_).toDynamicValue((({container:t})=>new c_(pv(Ry,t)))).inSingletonScope(),t(jf).toService(c_),t(Wf).toService(jf),t(Ry).toService(Lm),gv(t,Ry))}const Rx=Px,Ox=new WeakSet;function Ix({bind:t}){Ex(Ox,t)||(t(T_).toDynamicValue((({container:t})=>new T_(pv(Hy,t)))).inSingletonScope(),t($f).toService(T_),t(Wf).toService($f),t(ny).toSelf(),t(sy).toSelf(),t(Hy).toService(ny),t(Hy).toService(sy),t(Hy).toService(Lm),gv(t,Hy))}const Lx=Ix,Dx=new WeakSet;function Fx({bind:t}){Ex(Dx,t)||(t(v_).toDynamicValue((()=>new v_)).inSingletonScope(),t(Yf).toService(v_),t(Wf).toService(Yf))}const zx=Fx,Hx=new WeakSet;function jx({bind:t}){Ex(Hx,t)||(t(S_).toDynamicValue((({container:t})=>new S_(pv(Oy,t)))).inSingletonScope(),t(Uf).toService(S_),t(Wf).toService(Uf),t(Oy).toService(Lm),gv(t,Oy))}const Nx=jx,Ux=new WeakSet;function Vx({bind:t}){Ex(Ux,t)||(t(M_).toDynamicValue((({container:t})=>new M_(pv(jy,t)))).inSingletonScope(),t(Zf).toService(M_),t(Wf).toService(Zf),t(jy).toService(Lm),gv(t,jy))}const Wx=Vx,Gx=new WeakSet;function Yx({bind:t}){Ex(Gx,t)||(t(d_).toDynamicValue((({container:t})=>new d_(pv(Iy,t)))).inSingletonScope(),t(Vf).toService(d_),t(Wf).toService(Vf),t(Iy).toService(Lm),gv(t,Iy))}const Xx=Yx,Kx=new WeakSet;function $x({bind:t}){Ex(Kx,t)||(t(Jf).toDynamicValue((({container:t})=>new E_(pv(Ny,t)))).inSingletonScope(),t(Wf).toService(Jf),t(Ny).toService(Lm),gv(t,Ny))}const qx=$x,Zx=new WeakSet;function Jx({bind:t}){Ex(Zx,t)||(t(C_).toDynamicValue((({container:t})=>new C_(pv(Fy,t)))).inSingletonScope(),t(Xf).toService(C_),t(Wf).toService(Xf),t(Fy).toService(Lm),gv(t,Fy))}const Qx=Jx,tS=new WeakSet;function eS({bind:t}){Ex(tS,t)||(t(Kf).toDynamicValue((({container:t})=>new L_(pv(zy,t)))).inSingletonScope(),t(Wf).toService(Kf),t(zy).toService(Lm),gv(t,zy))}const iS=eS;class sS extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[yy,vy],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const nS=new WeakSet;function rS({bind:t}){Ex(nS,t)||(t(sS).toDynamicValue((({container:t})=>new sS(pv(Uy,t)))).inSingletonScope(),t(rm).toService(sS),t(Wf).toService(rm),gv(t,Uy))}const aS=rS;class oS{constructor(){this.numberType=rd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Dp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const lS=new WeakSet;function hS({bind:t}){Ex(lS,t)||(t(oS).toDynamicValue((()=>new oS)).inSingletonScope(),t(em).toService(oS),t(Wf).toService(em))}const cS=hS;class dS extends h_{constructor(){super(),this.numberType=gd,this.builtinContributions=[w_],this.init()}drawShape(t,e,i,s,n){const r=Dp(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Lv(o,l,!0),d=Lv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Dp(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,y)):(e.beginPath(),Rv(e,i-t,s-n,v,y,f,!0)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,s,o,l))}draw(t,e,i){const s=Dp(t).richtext;this._draw(t,s,!1,i)}}const uS=new WeakSet;function pS({bind:t}){Ex(uS,t)||(t(dS).toDynamicValue((()=>new dS)).inSingletonScope(),t(Qf).toService(dS),t(Wf).toService(Qf))}const gS=pS,fS=new WeakSet;function mS({bind:t}){Ex(fS,t)||(t(im).toDynamicValue((({container:t})=>new V_(pv(Dy,t)))).inSingletonScope(),t(Wf).toService(im),t(Dy).toService(Lm),gv(t,Dy))}const vS=mS;class yS extends h_{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Pu.Get(r,Bu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[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+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class _S extends yS{constructor(){super(...arguments),this.type="rect3d",this.numberType=pd}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=Dp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,T=Dv(v,y,A,k,d),M=zv(v,b,A,k,S),w=Ov(d),E=Iv(u,_);if(!t.valid||!x)return;if(!w&&!E)return;if(!(T||M||a||o))return;const{light:B}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,B,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=Dp(t).rect;this._draw(t,s,!1,i)}}const bS=new WeakSet;function xS({bind:t}){Ex(bS,t)||(t(_S).toDynamicValue((()=>new _S)).inSingletonScope(),t(qf).toService(_S),t(Wf).toService(qf))}const SS=xS;class AS extends h_{constructor(){super(...arguments),this.numberType=id}drawShape(t,e,i,s,n,r,a,o){var l;const h=Dp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Pu.Get(c,Bu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},T={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Ut-zt)e.moveTo(i+r*Gt(o),s+r*Kt(o),n),e.arc(i,s,r,o,l,!c,n),a>zt&&(e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Gt(p),y=r*Kt(p),_=a*Gt(f),b=a*Kt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>zt)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Ut,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=zt)e.moveTo(i,s,n);else if(c>=Ut-zt)e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Gt(h),s+a*Kt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Gt(c),f=a*Kt(c),m=a*Gt(p),v=a*Kt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const kS=new WeakSet;function CS({bind:t}){Ex(kS,t)||(t(AS).toDynamicValue((()=>new AS)).inSingletonScope(),t(Nf).toService(AS),t(Wf).toService(Nf))}const TS=CS;class MS extends yS{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=dd}drawShape(t,e,i,s,n,r,a,o){var l;const h=Dp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=Dp(t).polygon;this._draw(t,s,!1,i)}}const wS=new WeakSet;function ES({bind:t}){Ex(wS,t)||(t(MS).toDynamicValue((()=>new MS)).inSingletonScope(),t(tm).toService(MS),t(Wf).toService(tm))}const BS=ES;function PS(){gf("arc",Kg)}function RS(){gf("arc3d",Qg)}function OS(){gf("area",Gg)}function IS(){gf("circle",Np)}function LS(){gf("glyph",ug)}function DS(){gf("group",sf)}function FS(){gf("image",Rg)}function zS(){gf("line",sg)}function HS(){gf("path",Ug)}function jS(){gf("polygon",af)}function NS(){gf("star",Zg)}function US(){gf("pyramid3d",lf)}function VS(){gf("rect",og)}function WS(){gf("rect3d",cg)}function GS(){gf("richtext",Hg)}function YS(){gf("symbol",tg)}function XS(){gf("text",Kp)}function KS(){gf("shadowRoot",cf)}function $S(){gf("wrapText",Zp)}class qS{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?Ua.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Ua.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Wp("text"===t.type&&t.attribute?t.attribute:Dp(t).text)}getTransformOfText(t){const e=Dp(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let p=n.anchorType;if(u(p)&&(p="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===p&&(p="top-left"),"position"===p||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=ze(c,p);l=t.x,h=t.y}const f=Ua.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),v=e.viewBox,_=l+m.left-f.left+v.x1,b=h+m.top-f.top+v.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===p&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:b,left:_,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else g(n.style)?o=Object.assign(Object.assign({},o),n.style):y(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));Ua.global.updateDom(i,{width:n.width,height:n.height,style:o})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===Ua.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Gl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Gl.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&Ua.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===Ua.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const ZS=()=>{lv.registerPlugin("HtmlAttributePlugin",qS)};class JS extends qS{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?Ua.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&Ua.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const QS=()=>{lv.registerPlugin("ReactAttributePlugin",JS)};class tA{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/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,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}const eA=()=>{lv.registerPlugin("ViewTransform3dPlugin",tA)},iA=new Ve;class sA{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=ja.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Dp(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},f=g.main,m=g.cross;"column"!==r&&"column-reverse"!==r||(f.len=d,m.len=c,f.field="y",m.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,y=0;const _=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===f.field?e.width():e.height(),s="x"===m.field?e.width():e.height();_.push({mainLen:i,crossLen:s}),v+=i,y=Math.max(y,s)}));const b=[];if(v>f.len&&"wrap"===a){let t=0,e=0;_.forEach((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),b.push({idx:_.length-1,mainLen:t,crossLen:e})}else b.push({idx:_.length-1,mainLen:v,crossLen:y});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,f,_,x,t),x=t.idx+1})),y=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":m.len,center:m.len/2};this.layoutCross(p,o,m,t,_,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(m.len-y)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",m,s,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(m.len-y)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(m.len-y)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&iA.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(iA.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const nA=()=>{lv.registerPlugin("FlexLayoutPlugin",sA)};var rA=Object.freeze({__proto__:null,ARC3D_NUMBER_TYPE:id,ARC_NUMBER_TYPE:ed,AREA_NUMBER_TYPE:sd,AbstractGraphicRender:class{},get AnimateMode(){return Pl},get AnimateStatus(){return Il},get AnimateStepType(){return Ol},AppContext:tb,Application:Na,Arc:Xg,Arc3d:Jg,Arc3dRender:Nf,ArcRender:jf,ArcRenderContribution:Ry,Area:Wg,AreaRender:Uf,AreaRenderContribution:Oy,get AttributeUpdateType(){return Ao},AutoEnablePlugins:Pf,BaseCanvas:Eu,BaseEnvContribution:G_,BaseRender:h_,get BaseRenderContributionTime(){return To},BaseWindowHandlerContribution:Y_,Basis:Qo,BeforeRenderConstribution:Bf,BoundsContext:lo,BoundsPicker:Lf,BrowserEntry:eb,CIRCLE_NUMBER_TYPE:nd,Canvas3DDrawItemInterceptor:Py,Canvas3DPickItemInterceptor:Tv,CanvasFactory:Cd,CanvasTextLayout:Gp,Circle:jp,CircleRender:Vf,CircleRenderContribution:Iy,ColorInterpolate:Wu,ColorStore:Pu,get ColorType(){return Bu},CommonDrawItemInterceptorContribution:Ey,CommonRenderContribution:Vy,Context2dFactory:Td,ContributionProvider:dv,ContributionRegistry:Ym,ContributionStore:mv,CubicBezierCurve:Uo,CurveContext:Cl,get CurveTypeEnum(){return Co},CustomEvent:to,CustomPath2D:Ml,CustomSymbolClass:wc,DEFAULT_TEXT_FONT_FAMILY:fg,DebugDrawItemInterceptorContribution:wy,DefaultArcAllocate:ux,DefaultArcAttribute:Yl,DefaultArcRenderContribution:Yv,DefaultAreaAllocate:gx,DefaultAreaAttribute:Xl,DefaultAreaTextureRenderContribution:_y,DefaultAttribute:Gl,DefaultBaseBackgroundRenderContribution:Am,DefaultBaseClipRenderAfterContribution:zm,DefaultBaseClipRenderBeforeContribution:Dm,DefaultBaseInteractiveRenderContribution:Lm,DefaultBaseTextureRenderContribution:Wv,DefaultCanvasAllocate:cm,DefaultCanvasArcRender:c_,DefaultCanvasAreaRender:S_,DefaultCanvasCircleRender:d_,DefaultCanvasGroupRender:by,DefaultCanvasImageRender:V_,DefaultCanvasLineRender:v_,DefaultCanvasPathRender:C_,DefaultCanvasPolygonRender:L_,DefaultCanvasRectRender:T_,DefaultCanvasSymbolRender:M_,DefaultCanvasTextRender:E_,DefaultCircleAllocate:mx,DefaultCircleAttribute:Kl,DefaultCircleRenderContribution:qv,DefaultConnectAttribute:Vl,DefaultDebugAttribute:Wl,DefaultFillStyle:Fl,DefaultGlobal:Xa,DefaultGlobalPickerService:mm,DefaultGlyphAttribute:ql,DefaultGraphicAllocate:hx,DefaultGraphicMemoryManager:Tx,DefaultGraphicService:yf,DefaultGraphicUtil:um,DefaultGroupAttribute:$l,DefaultGroupBackgroundRenderContribution:ty,DefaultImageAttribute:ah,DefaultImageRenderContribution:ly,DefaultLayerService:cv,DefaultLayout:Ll,DefaultLineAllocate:yx,DefaultLineAttribute:Zl,DefaultMat4Allocate:Su,DefaultMatrixAllocate:xu,DefaultPathAllocate:bx,DefaultPathAttribute:Jl,DefaultPickService:Q_,DefaultPickStyle:Nl,DefaultPolygonAttribute:Ql,DefaultRect3dAttribute:ih,DefaultRectAllocate:cx,DefaultRectAttribute:eh,DefaultRectRenderContribution:iy,DefaultRenderService:Um,DefaultRichTextAttribute:rh,DefaultRichTextIconAttribute:oh,DefaultStarAttribute:th,DefaultStrokeStyle:Hl,DefaultStyle:Ul,DefaultSymbolAllocate:Sx,DefaultSymbolAttribute:sh,DefaultSymbolClipRangeStrokeRenderContribution:uy,DefaultSymbolRenderContribution:dy,DefaultTextAllocate:kx,DefaultTextAttribute:nh,DefaultTextMeasureContribution:_v,DefaultTextStyle:jl,DefaultTransform:Dl,DefaultTransformUtil:fm,DefaultWindow:hm,get Direction(){return ko},DirectionalLight:X_,DrawContribution:nm,DrawItemInterceptor:ky,DynamicLayerHandlerContribution:Mf,get Edge(){return ch},EditModule:nx,EmptyContext2d:Mu,EnvContribution:pg,EventManager:so,EventSystem:ao,EventTarget:no,FORMAT_ALL_TEXT_COMMAND:ox,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:ax,Factory:lv,FederatedEvent:qa,FederatedMouseEvent:Za,FederatedPointerEvent:Ja,FederatedWheelEvent:Qa,FlexLayoutPlugin:sA,GLYPH_NUMBER_TYPE:rd,GRAPHIC_UPDATE_TAG_KEY:gp,GROUP_NUMBER_TYPE:ad,Generator:ja,GlobalPickerService:Df,Glyph:dg,GlyphRender:em,GradientParser:nu,Graphic:Mp,GraphicCreator:_d,GraphicFactory:df,GraphicPicker:Of,GraphicRender:Wf,GraphicService:yd,GraphicUtil:kf,Group:ef,GroupRender:Gf,GroupRenderContribution:Ly,get GroupUpdateAABBBoundsMode(){return tf},HtmlAttributePlugin:qS,get IContainPointMode(){return So},IMAGE_NUMBER_TYPE:od,Image:Pg,ImageRender:im,ImageRenderContribution:Dy,IncrementalDrawContribution:Hf,InteractiveDrawItemInterceptorContribution:By,InteractivePickItemInterceptorContribution:Cv,InteractiveSubRenderContribution:Wy,LINE_NUMBER_TYPE:ld,Layer:av,LayerFactory:ov,LayerService:Cf,Line:ig,LineRender:Yf,Linear:$o,LinearClosed:vl,Mat4Allocate:_u,MatrixAllocate:yu,get MeasureModeEnum(){return Bl},MiniappEntry:nb,MonotoneX:al,MonotoneY:ol,NOWORK_ANIMATE_ATTR:Tp,Node:$a,NodeEntry:sb,OrthoCamera:$_,PATH_NUMBER_TYPE:hd,POLYGON_NUMBER_TYPE:cd,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:dd,Path:Ng,PathRender:Xf,PathRenderContribution:Fy,PerformanceRAF:Wa,PickItemInterceptor:Ff,PickServiceInterceptor:zf,PickerRegistry:Wm,PickerService:If,PluginRegistry:Gm,PluginService:Rf,Polygon:rf,PolygonRender:Kf,PolygonRenderContribution:zy,Pyramid3d:of,Pyramid3dRender:tm,RECT3D_NUMBER_TYPE:pd,RECT_NUMBER_TYPE:ud,RICHTEXT_NUMBER_TYPE:gd,RafBasedSTO:Sh,ReactAttributePlugin:JS,Rect:ag,Rect3DRender:qf,Rect3d:hg,RectRender:$f,RectRenderContribution:Hy,ReflectSegContext:Yo,RenderSelector:sm,RenderService:Ef,RendererRegistry:Vm,ResourceLoader:lh,RichText:zg,RichTextEditPlugin:lx,RichTextRender:Qf,STAR_NUMBER_TYPE:fd,get STATUS(){return Rl},SVG_ATTRIBUTE_MAP:bd,SVG_ATTRIBUTE_MAP_KEYS:xd,SVG_PARSE_ATTRIBUTE_MAP:Sd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Ad,SYMBOL_NUMBER_TYPE:md,SegContext:Go,ShadowPickServiceInterceptorContribution:Av,ShadowRoot:hf,ShadowRootDrawItemInterceptorContribution:My,ShadowRootPickItemInterceptorContribution:kv,SplitRectAfterRenderContribution:ny,SplitRectBeforeRenderContribution:sy,Stage:nv,StageFactory:rv,Star:qg,StarRender:rm,StarRenderContribution:Uy,StateDefinitionCompiler:qu,StateEngine:tp,StaticLayerHandlerContribution:Tf,Step:ul,StepClosed:pl,Symbol:Qp,SymbolRender:Zf,SymbolRenderContribution:jy,TEXT_NUMBER_TYPE:vd,Text:Xp,get TextDirection(){return $c},TextMeasureContribution:yv,TextRender:Jf,TextRenderContribution:Ny,Theme:Ip,TransformUtil:Af,get UpdateTag(){return xo},VGlobal:gg,VWindow:am,ViewTransform3dPlugin:tA,VirtualLayerHandlerContribution:wf,WILDCARD:"*",WindowHandlerContribution:om,WrapText:qp,XMLParser:Vc,_calculateLineHeight:kh,_interpolateColor:Iu,addArcToBezierPath:Bo,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:Ob,alignSubpath:Mb,application:Ua,applyTransformOnBezierCurves:Lb,arc3dModule:TS,arcModule:Rx,areaModule:Nx,bezier:wo,bezierCurversToPath:Db,binarySplitPolygon:Yb,bindArc3dRenderModule:CS,bindArcRenderModule:Px,bindAreaRenderModule:jx,bindCircleRenderModule:Yx,bindContributionProvider:gv,bindContributionProviderNoSingletonScope:fv,bindGlyphRenderModule:hS,bindImageRenderModule:mS,bindLineRenderModule:Fx,bindPathRenderModule:Jx,bindPolygonRenderModule:eS,bindPyramid3dRenderModule:ES,bindRect3dRenderModule:xS,bindRectRenderModule:Ix,bindRichtextRenderModule:pS,bindStarRenderModule:rS,bindSymbolRenderModule:Vx,bindTextRenderModule:$x,boundStroke:Yc,builtInSymbolStrMap:Pc,builtinSymbols:Ec,builtinSymbolsMap:Bc,calcLineCache:Tl,calculateArcCornerRadius:Nv,calculateLineHeight:Ch,canvasAllocate:dm,centroidOfSubpath:Bb,circleBounds:vh,circleModule:Xx,clock:eo,colorEqual:function(t,e){const i=si.parseColorString(t),s=si.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:Uu,configureRuntimeApplicationForApp:bb,container:i_,cornerTangents:jv,createApp:ib,createArc:Kg,createArc3d:Qg,createArea:Gg,createBrowserApp:ib,createCanvasEventTransformer:function(t,e,i,s){return Qb(t.parentElement,e,i,s)},createCircle:Np,createColor:au,createConicalGradient:Xu,createContributionProvider:pv,createEventTransformer:Qb,createGlyph:ug,createGraphic:ff,createGroup:sf,createImage:Rg,createLine:sg,createMat4:bu,createMiniappApp:function(t={}){return new nb(t)},createNodeApp:function(t={}){return new sb(t)},createPath:Ug,createPolygon:af,createPyramid3d:lf,createRect:og,createRect3d:cg,createRectPath:Rv,createRichText:Hg,createShadowRoot:cf,createStage:function(t){return o_(),(new rv).create(t)},createStar:Zg,createSymbol:tg,createText:Kp,createWrapText:Zp,cubicCalc:Do,cubicLength:Lo,cubicPointAt:Fo,cubicSubdivide:Tb,defaultArcAllocate:px,defaultArcBackgroundRenderContribution:$v,defaultArcRenderContribution:Xv,defaultArcTextureRenderContribution:Kv,defaultAreaAllocate:fx,defaultBaseBackgroundRenderContribution:km,defaultBaseClipRenderAfterContribution:Hm,defaultBaseClipRenderBeforeContribution:Fm,defaultBaseTextureRenderContribution:Gv,defaultCircleAllocate:vx,defaultCircleBackgroundRenderContribution:Qv,defaultCircleRenderContribution:Zv,defaultCircleTextureRenderContribution:Jv,defaultGraphicMemoryManager:Mx,defaultGroupBackgroundRenderContribution:ey,defaultImageBackgroundRenderContribution:cy,defaultImageRenderContribution:hy,defaultLineAllocate:_x,defaultPathAllocate:xx,defaultRectAllocate:dx,defaultRectBackgroundRenderContribution:oy,defaultRectRenderContribution:ry,defaultRectTextureRenderContribution:ay,defaultStarBackgroundRenderContribution:yy,defaultStarTextureRenderContribution:vy,defaultSymbolAllocate:Ax,defaultSymbolBackgroundRenderContribution:my,defaultSymbolClipRangeStrokeRenderContribution:gy,defaultSymbolRenderContribution:py,defaultSymbolTextureRenderContribution:fy,defaultTextAllocate:Cx,diff:Cb,divideCubic:No,drawArc:Eo,drawArcPath:Uv,drawAreaSegments:y_,drawBackgroundImage:Im,drawImageWithLayout:U_,drawIncrementalAreaSegments:m_,drawIncrementalSegments:f_,drawSegments:g_,enumCommandMap:po,fillVisible:Lv,findBestMorphingRotation:Rb,findConfigIndexByCursorIdx:ix,findCursorIdxByConfigIndex:sx,findNextGraphic:xm,flatten_simplify:kb,foreach:_m,foreachAsync:bm,genBasisSegments:el,genBasisTypeSegments:tl,genLinearClosedSegments:yl,genLinearClosedTypeSegments:_l,genLinearSegments:qo,genLinearTypeSegments:Zo,genMonotoneXSegments:hl,genMonotoneXTypeSegments:ll,genMonotoneYSegments:dl,genMonotoneYTypeSegments:cl,genNumberType:Kc,genStepClosedSegments:ml,genStepSegments:gl,genStepTypeSegments:fl,getAttributeFromDefaultAttrList:xh,getBackgroundImage:Tm,getConicGradientAt:Yu,getCurrentEnv:function(){return iv()?"browser":"node"},getDefaultCharacterConfig:ex,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Up(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=ku.allocate();return du(o,o,[a[0],a[1],0]),n&&lu(o,o,n),s&&hu(o,o,s),du(o,o,[-a[0],-a[1],0]),o},getLegacyBindingContext:Zy,getModelMatrix:mf,getRichTextBounds:Sf,getRuntimeInstallerBindingContext:vb,getRuntimeInstallerGlobal:_b,getScaledStroke:ru,getTextBounds:xf,getTheme:Dp,getThemeFromGroup:Fp,globalTheme:Lp,glyphModule:cS,graphicCreator:pf,graphicService:r_,graphicUtil:s_,identityMat4:ou,imageModule:vS,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeDrawContributionsToApp:Sb,installRuntimeGraphicRenderersToApp:xb,installRuntimePickersToApp:Ab,interpolateColor:Ou,interpolateGradientConicalColor:Fu,interpolateGradientLinearColor:Lu,interpolateGradientRadialColor:Du,interpolatePureColorArray:zu,interpolatePureColorArrayToStr:Hu,intersect:Hv,isBrowserEnv:iv,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){ev();const t=Ua.global&&Ua.global.env;return t?"node"===t:!tv},isSvg:Nc,isXML:Uc,layerService:a_,lineModule:zx,lookAt:fu,mapToCanvasPointForCanvas:function(t){var e;if(Od(t._canvasX)&&Od(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:uu,mat4Allocate:ku,matrixAllocate:Au,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i.c,b=i.d,x=0,S=0,t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=0,b=0,x=1,S=0,t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i.e,b=i.f,x=0,S=1,t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t},multiplyMat4Mat4:gu,newThemeObj:Pp,ortho:mu,parsePadding:gh,parseStroke:uh,parseSvgPath:bo,pathModule:Qx,pathToBezierCurves:Ib,point:Jo,pointEqual:yh,pointInterpolation:_h,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Jt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Jt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>yh(t,e[i]))):!Number.isNaN(t.x+t.y)&&yh(t,e))},pointsInterpolation:bh,polygonModule:iS,preLoadAllModule:qy,pyramid3dModule:BS,quadCalc:zo,quadLength:jo,quadPointAt:Ho,rafBasedSto:Ah,rect3dModule:SS,rectFillVisible:Dv,rectModule:Lx,rectStrokeVisible:zv,recursiveCallBinarySplit:Xb,refreshRuntimeInstallerContributions:yb,registerArc3dGraphic:RS,registerArcGraphic:PS,registerAreaGraphic:OS,registerCircleGraphic:IS,registerDirectionalLight:K_,registerFlexLayoutPlugin:nA,registerGlobalEventTransformer:function(t,e,i,s,n){const r=Qb(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:LS,registerGraphic:gf,registerGroupGraphic:DS,registerHtmlAttributePlugin:ZS,registerImageGraphic:FS,registerLineGraphic:zS,registerOrthoCamera:q_,registerPathGraphic:HS,registerPolygonGraphic:jS,registerPyramid3dGraphic:US,registerReactAttributePlugin:QS,registerRect3dGraphic:WS,registerRectGraphic:VS,registerRichtextGraphic:GS,registerShadowRootGraphic:KS,registerStarGraphic:NS,registerSymbolGraphic:YS,registerTextGraphic:XS,registerViewTransform3dPlugin:eA,registerWindowEventTransformer:function(t,e,i,s,n){const r=Qb(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:$S,renderCommandList:Ro,resolveBackgroundDrawMode:Em,resolveBackgroundParamsByImageSizing:j_,resolveBackgroundPosition:Pm,resolveBackgroundSizing:Mm,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:z_,resolveImageRepeatMode:F_,resolveRenderableImageSize:Om,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:gS,rotateX:lu,rotateY:hu,rotateZ:cu,runFill:Ov,runStroke:Iv,scaleMat4:pu,segments:Mo,shouldClipImageByLayout:N_,shouldUseMat4:vf,snapLength:Io,splitArc:Hb,splitArea:Ub,splitCircle:jb,splitLine:Vb,splitPath:$b,splitPolygon:Kb,splitRect:zb,splitToGrids:Fb,starModule:aS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Fv,symbolModule:Wx,textAttributesToStyle:Wp,textDrawOffsetX:Up,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Vp,textModule:qx,transformMat4:vu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:n_,translate:du,verticalLayout:qc,vglobal:e_,waitForAllSubLayers:Gc,wrapCanvas:Md,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=Ua.global)||void 0===t?void 0:t.env,s=i?null===(e=Ua.context2dFactory)||void 0===e?void 0:e.call(Ua,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=_(t)?t[0]:t,i=[];if(!e)return i;if(!0===Uc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};td(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};td(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});function aA(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),hA=(t,e)=>(d(dA.warnHandler)&&dA.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),cA=(t,e,i)=>{if(!d(dA.errorHandler))throw new Error(t);dA.errorHandler.call(null,t,e)},dA={silent:!1,warnHandler:!1,errorHandler:!1},uA=iv(),pA=uA&&globalThis?globalThis.document:void 0;function gA(t){return("desktop-browser"===t||"mobile-browser"===t)&&uA}function fA(t){return mA(t)||"mobile-browser"===t}function mA(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let vA=0;function yA(){return vA>=9999999&&(vA=0),vA++}function _A(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function bA(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}function xA(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&xA(t,e)}))}const SA=t=>!u(t)&&!1!==t.visible;function AA(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function kA(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const TA=["#ffffff","#000000"];function MA(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new si(t).toHex(),o=new si(e).toHex();return wA(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...TA);for(const n of a)if(t!==n&&wA(n,e,i,s,r))return n}(a,o,i,s,n,r)}function wA(t,e,i,s,n){if("lightness"===n){const i=si.getColorBrightness(new si(e));return si.getColorBrightness(new si(t))<.5?i>=.5:i<.5}return s?EA(t,e)>s:"largeText"===i?EA(t,e)>3:EA(t,e)>4.5}function EA(t,e){const i=BA(t),s=BA(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function BA(t){const e=ri(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function PA(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function RA(t,e){return[t[0]*e,t[1]*e]}function OA(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function IA(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const LA=ff,DA={arc:t=>LA("arc",t),circle:t=>LA("circle",t),group:t=>LA("group",t),image:t=>LA("image",t),line:t=>LA("line",t),path:t=>LA("path",t),polygon:t=>LA("polygon",t),rect:t=>LA("rect",t),richtext:t=>LA("richtext",t),symbol:t=>LA("symbol",t),text:t=>LA("text",t)},FA=-.5*Math.PI,zA=1.5*Math.PI,HA="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var jA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(jA||(jA={}));const NA={[jA.selectedReverse]:{},[jA.selected]:{},[jA.hover]:{},[jA.hoverReverse]:{}},UA={container:"",width:30,height:30,style:{}},VA="scrollDrag",WA=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:HA,fontSize:14},s),getTextBounds:i?void 0:xf,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function GA(t,e,i={}){if(!t)return{width:0,height:0};const s=xf({text:t,fontFamily:e.fontFamily||i.fontFamily||HA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function YA(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function XA(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function KA(t,e="type"){const i=YA(t,e);return"rich"===i?DA.richtext(XA(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),DA.text(t))}function $A(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const qA=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function ZA(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function JA(t,e){const{dx:i,dy:s}=ZA(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const QA={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},tk={size:8,stroke:"#000",lineWidth:1,zIndex:1};const ek=Math.sin(Math.PI/10);function ik(t,e=ek){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function sk(t,e=ek){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function nk(t){const e={};return xA(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function rk(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function ak(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return RA(r,(s?-1:1)*(n?-1:1)*t/OA(r))}function ok(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function hk(t,e,i){var s;if(sk(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>He(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>He(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function ck(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function pk(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function gk(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function fk(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function mk(t,e){const i=fk(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function vk(t,e){const i=yk(t),s=yk(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function yk(t,e={x:0,y:0}){return ae.distancePP(t,e)}function _k(t){return k(t.x)&&k(t.y)}function bk(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function xk(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const Sk=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function kk(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&kk(t[i],e)}}var Ck;!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"}(Ck||(Ck={}));const Tk={};function Mk(t){switch(t){case Ck.Linear:case Ck.Log:case Ck.Pow:case Ck.Sqrt:case Ck.Symlog:case Ck.Time:return!0;default:return!1}}function wk(t){return!!Tk[t]}function Ek(t){switch(t){case Ck.Ordinal:case Ck.Point:case Ck.Band:return!0;default:return!1}}function Bk(t){return t}Object.values(Ck).forEach((t=>{Tk[t]=!0}));const Pk=t=>-Math.log(-t),Rk=t=>-Math.exp(-t),Ok=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Ik=t=>10===t?Ok:t===Math.E?Math.exp:e=>Math.pow(t,e),Lk=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Dk=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Fk=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function zk(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 Hk(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function jk(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Nk(t,e,i,s){return 1===i&&(i=0),jk(t,i,s)*(e/(1-i))}function Uk(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Vk(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class Gk{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=Uk(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=yt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Yk=Symbol("implicit");class Xk extends Gk{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=Ck.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Yk}clone(){const t=(new Xk).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==Yk)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return Kk(t,e,r,n)}class qk extends Xk{constructor(t){super(),this.type=Ck.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=Nk(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:$k(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return $k(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new qk(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:Zk}=ai;function Jk(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=si.parseColorString(e)){const e=Zk(si.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof ni?Zk(t,e):e instanceof si?Zk(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class Qk extends Gk{constructor(t=Bk,e=Bk){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Bk,this._piecewise=Hk,this._interpolate=Jk}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Ct,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=bt(i[0],i[r-1])),this._piecewise=r>2?Vk:Hk,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Bk),this.rescale(i)):this._clamp!==Bk}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const tC=Math.sqrt(50),eC=Math.sqrt(10),iC=Math.sqrt(2),sC=[1,2,5,10],nC=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=lC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?aC(0,-(e-1)/s,s):aC((e-1)/s,0,s)},rC=vt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return nC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return nC(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=aC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=aC(t,e,l);return n&&r.reverse(),r})),lC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=sC[0];return i>=tC?s=sC[3]:i>=eC?s=sC[2]:i>=iC&&(s=sC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function hC(t,e,i){const s=(e-t)/Math.max(0,i);return lC(s)}function cC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=hC(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function uC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const pC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),gC=vt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),fC=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=oC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?pC(t,e,n):pC(t,e,Wk(n)),h=pC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),mC=vt(((t,e,i,s,n)=>cC(s(t),s(e),i).map((t=>Wk(n(t))))));class vC extends Qk{constructor(){super(...arguments),this.type=Ck.Linear}clone(){var t;const e=new vC;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return rC(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=oC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return cC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function _C(t){return e=>-t(-e)}function bC(t=Number.EPSILON){return e=>Math.max(e,t)}class xC extends Qk{constructor(){super(Lk(10),Ik(10)),this.type=Ck.Log,this._limit=bC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new xC).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=Lk(this._base),s=Ik(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=_C(i),this._pows=_C(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Pk,this.untransformer=Rk):(this._logs=i,this._pows=s,this._limit=bC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Bk}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return gC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return fC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(xC,yC);class SC extends vC{constructor(){super(Dk(1),Fk(1)),this.type=Ck.Symlog,this._const=1}clone(){return(new SC).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=Dk(t),this.untransformer=Fk(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return gC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return fC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(SC,yC);class AC{constructor(){this.type=Ck.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[lt(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 AC).domain(this._domain).range(this._range).unknown(this._unknown)}}var kC,CC,TC;function MC(t){var e,i;const{type:s}=t;return s===CC.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(kC||(kC={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(CC||(CC={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(TC||(TC={}));const wC={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},EC={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function BC(t,e){var i;if(!t)return[];const s=FC(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?LC(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>IC(i)?RC(t,i,e):i)).filter(p)}))):i.map((i=>IC(i)?RC(t,i,e):i)).filter(p):[]}return[]}function PC(t,e){var i,s;return LC(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function RC(t,e,i){var s;const n=FC(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=wC[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=EC[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!y(r))return r;let o=new si(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ke(t,i,s),a=Xe(n,r,e.l),l=new si(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const OC=(t,e)=>{if(e&&IC(t)){const i=RC(e,t);if(i)return i}return t};function IC(t){return t&&"palette"===t.type&&!!t.key}function LC(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function DC(t){return _(t)?{dataScheme:t}:t}function FC(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=MC(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class zC extends Xk{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!LC(this._range))return void super.range(this._range);const t=PC(this._range,this._domain);super.range(t)}}const HC={linear:vC,band:qk,point:class extends qk{constructor(t){super(!1),this.type=Ck.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:Xk,threshold:AC,colorOrdinal:zC};function jC(t){const e=HC[t];return e?new e:null}function NC(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function UC(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function VC(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function WC(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function GC(t){return!!y(t)&&(!!t.endsWith("%")&&_A(t.substring(0,t.length-1)))}function YC(t){return!!g(t)&&("percent"in t||"offset"in t)}function XC(t,e,i,s=0){var n,r;return S(t)?t:GC(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function KC(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=XC(t[s],e.size,i)}))})),o}function $C(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function qC(t){let e={};return _(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||GC(t)||d(t)||YC(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function ZC(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const JC=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},QC=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function tT(t,e){return t&&e.key in t?t[e.key]:e.default}function eT(t){return t&&"token"===t.type&&!!t.key}const iT={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},sT={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:QC,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:iT,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},nT={name:"dark",colorScheme:{default:{dataScheme:QC,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},rT=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),rT(t[s],e.slice(1),i))};function aT(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=DC(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}oT._charts={},oT._series={},oT._components={},oT._graphicComponents={},oT._marks={},oT._regions={},oT._animations={},oT._implements={},oT._chartPlugin={},oT._vChartPlugin={},oT._componentPlugin={},oT.transforms={fields:$r,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},oT.dataParser={csv:(t,e={},i)=>(i.type=Kr.DSV,aa(t)),dsv:(t,e={},i)=>{i.type=Kr.DSV;const s=Vr(la,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return ra(n).parse(t)},tsv:(t,e={},i)=>(i.type=Kr.DSV,oa(t))},oT._layout={},oT._grammarTransforms={},oT._stageEventPlugins={},oT.registerStageEventPlugin=(t,e)=>{oT._stageEventPlugins[t]=e},oT.getStageEventPlugin=t=>oT._stageEventPlugins[t],oT._interactionTriggers={},oT.registerInteractionTrigger=(t,e)=>{oT._interactionTriggers[t]=e},oT._composedEventMap={},oT.registerComposedEvent=(t,e)=>{oT._composedEventMap[t]=e},oT._tooltipProcessors={},oT.registerTooltipProcessor=(t,e)=>{oT._tooltipProcessors[t]=e},oT.createTooltipProcessor=(t,e)=>{const i=oT._tooltipProcessors[t];return i?new i(e):null};const cT=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},dT=cT(),uT={[sT.name]:sT},pT=sT.name,gT=new Map(Object.keys(uT).map((t=>[t,uT[t]]))),fT=new Map,mT=new Map(Object.keys(uT).map((t=>[t,t===pT]))),vT=(t,e)=>{if(!t)return;const i=xT(e);gT.set(t,i),mT.set(t,!0)},yT=(t=pT)=>(mT.has(t)&&!mT.get(t)&&vT(t,gT.get(t)),gT.get(t)),_T=t=>gT.delete(t)&&fT.delete(t)&&mT.delete(t),bT=t=>!!y(t)&&gT.has(t),xT=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:pT;return lT({},yT(i),t)};class ST{static registerInstance(t){ST.instances.set(t.id,t)}static unregisterInstance(t){ST.instances.delete(t.id)}static getInstance(t){return ST.instances.get(t)}static instanceExist(t){return ST.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return ST.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}ST.instances=new Map;class AT{static registerTheme(t,e){vT(t,e)}static getTheme(t,e=!1){return yT(t)}static removeTheme(t){return _T(t)}static themeExist(t){return bT(t)}static getDefaultTheme(){return AT.themes.get(pT)}static setCurrentTheme(t){AT.themeExist(t)&&(AT._currentThemeName=t,ST.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return AT.getTheme(AT._currentThemeName,t)}static getCurrentThemeName(){return AT._currentThemeName}}function kT(t){return y(t)?AT.themeExist(t)?AT.getTheme(t):{}:g(t)?t:{}}AT.themes=gT,AT._currentThemeName=pT;const CT=["animationThreshold","colorScheme","name","padding"];function TT(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];CT.includes(n)?s[n]=r:m(r)?IC(r)?s[n]=OC(r,e):eT(r)?s[n]=tT(i,r):s[n]=TT(r,e,i):s[n]=r})),s}function MT(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=MT(t[s],e)}return i}return _(t)?t.map((t=>MT(t,e))):t}function wT(t,e){if(!t)return t;if(m(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(y(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=wT(t[s],e)}return i}return _(t)?t.map((t=>wT(t,e))):t}function ET(t,...e){return d(t)?t(...e):t}const BT=(t,e,i,s)=>((t,e,i)=>WA(t,e,i,{fontFamily:iT.fontFamily,fontSize:iT.fontSize}))(e,i,s).measure(t),PT="__VCHART",RT=500,OT=500,IT=`${PT}_MEASURE_CANVAS_ID`,LT=`${PT}_DEFAULT_DATA_INDEX`,DT=`${PT}_DEFAULT_DATA_KEY`,FT=`${PT}_DEFAULT_DATA_SERIES_FIELD`,zT=`${PT}_DEFAULT_SERIES_STYLE_NAME`,HT=`${PT}_STACK_KEY`,jT=`${PT}_STACK_START`,NT=`${PT}_STACK_END`,UT=`${PT}_STACK_START_PERCENT`,VT=`${PT}_STACK_END_PERCENT`,WT=`${PT}_STACK_START_OffsetSilhouette`,GT=`${PT}_STACK_END_OffsetSilhouette`,YT=`${PT}_STACK_TOTAL`,XT=`${PT}_STACK_TOTAL_PERCENT`,KT=`${PT}_STACK_TOTAL_TOP`,$T=`${PT}_STACK_TOTAL_BOTTOM`,qT=`${PT}_MOSAIC_VALUE_START_PERCENT`,ZT=`${PT}_MOSAIC_VALUE_END_PERCENT`,JT=`${PT}_MOSAIC_CAT_START_PERCENT`,QT=`${PT}_MOSAIC_CAT_END_PERCENT`,tM=`${PT}_SEGMENT_START`,eM=`${PT}_SEGMENT_END`,iM=`${PT}_KEY`,sM=`${PT}_MAP_LOOK_UP_KEY`;function nM(t,e){for(let i=0;it.key===e))}function aM(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function oM(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},uM(t,a,n[o],l,e,r))})),s?lM(n):n}function lM(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):lM(t[e].nodes);return t}function hM(t,e){if("values"in t&&t.values.length){const i=gk(t.values,e),s=pk(t.values,VT);t.values.forEach((t=>{t[YT]=i,t[XT]=s}))}else for(const i in t.nodes)hM(t.nodes[i],e)}function cM(t){if(!t.values.length)return;const e=t.values[t.values.length-1][NT]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)dM(t.nodes[r],e,i,s,n)}function uM(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[NT]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),uM(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const pM=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=fM(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function mM(t){return!d(t)&&!P(t)&&Object.keys(t).some((e=>d(t[e])))}function vM(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(d(t))return xM(t(r,i,s,n));if(mM(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{d(e[t])&&(e[t]=e[t](r,i,s,n))})),xM(e)}return xM(t)}function yM(t={}){const e=Object.assign({},t);if(d(t.style)||mM(t.style)?e.style=(e,i,s,n)=>vM(t.style,e,i,s,n):P(t.style)||(e.style=xM(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])||mM(t.state[e])?i[e]=(i,s,n,r)=>vM(t.state[e],i,s,n,r):P(t.state[e])||(i[e]=xM(t.state[e]))})),e.state=i}return e}function _M(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>xM(t[i](e,s,n,r)):P(t[i])||(e[i]=xM(t[i]))})),e}function bM(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),xM(i)}function xM(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const SM=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},AM=t=>"line"===t||"area"===t,kM=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return AM(i)?e:null==e?void 0:e[0]},CM=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let TM=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=oT.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(oT.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var MM;!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"}(MM||(MM={}));const wM=["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 EM,BM,PM;t.ChartEvent=void 0,(EM=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",EM.rendered="rendered",EM.renderFinished="renderFinished",EM.animationFinished="animationFinished",EM.regionSeriesDataFilterOver="regionSeriesDataFilterOver",EM.afterInitData="afterInitData",EM.afterInitEvent="afterInitEvent",EM.afterInitMark="afterInitMark",EM.rawDataUpdate="rawDataUpdate",EM.viewDataFilterOver="viewDataFilterOver",EM.viewDataUpdate="viewDataUpdate",EM.viewDataStatisticsUpdate="viewDataStatisticsUpdate",EM.markDeltaYUpdate="markDeltaYUpdate",EM.viewDataLabelUpdate="viewDataLabelUpdate",EM.scaleDomainUpdate="scaleDomainUpdate",EM.scaleRawDomainUpdate="scaleRawDomainUpdate",EM.scaleUpdate="scaleUpdate",EM.dataZoomChange="dataZoomChange",EM.drill="drill",EM.layoutStart="layoutStart",EM.layoutEnd="layoutEnd",EM.layoutRectUpdate="layoutRectUpdate",EM.playerPlay="playerPlay",EM.playerPause="playerPause",EM.playerEnd="playerEnd",EM.playerChange="playerChange",EM.playerForward="playerForward",EM.playerBackward="playerBackward",EM.scrollBarChange="scrollBarChange",EM.brushStart="brushStart",EM.brushChange="brushChange",EM.brushEnd="brushEnd",EM.brushClear="brushClear",EM.brushActive="brushActive",EM.legendSelectedDataChange="legendSelectedDataChange",EM.legendFilter="legendFilter",EM.legendItemClick="legendItemClick",EM.legendItemHover="legendItemHover",EM.legendItemUnHover="legendItemUnHover",EM.tooltipShow="tooltipShow",EM.tooltipHide="tooltipHide",EM.tooltipRelease="tooltipRelease",EM.afterResize="afterResize",EM.afterRender="afterRender",EM.afterLayout="afterLayout",EM.afterMarkLayoutEnd="afterMarkLayoutEnd",EM.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(BM||(BM={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(PM||(PM={}));const RM=[PM.mark,PM.model,PM.chart,PM.vchart];class OM{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(PM.vchart,[]),this._levelNodes.set(PM.chart,[]),this._levelNodes.set(PM.model,[]),this._levelNodes.set(PM.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const IM={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class LM{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>kM(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||BM.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||BM.chart);o.get(t)||o.set(t,new OM);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||BM.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||BM.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||BM.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||BM.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?RM.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[BM.chart,BM.window,BM.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return IM[a]&&(a=IM[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?PM.model:PM.vchart:PM.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=BM.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==PM.model&&s!==PM.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=PM.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case BM.chart:return this._viewBubbles;case BM.window:return this._windowBubbles;case BM.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case BM.chart:return this._viewListeners;case BM.window:return this._windowListeners;case BM.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return wM.includes(t)||Object.values(MM).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&oT.hasInteractionTrigger(e)}}function DM(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function FM(t,e,i){t.getParser(e)||t.registerParser(e,i)}const zM=new Map;let HM;function jM(){HM||(HM=new Ra,FM(HM,"geojson",Ta),FM(HM,"topojson",wa),DM(HM,"simplify",Xr))}function NM(t,e,i={type:"geojson",centroid:!0}){zM.has(t)&&hA(`map type of '${t}' already exists, will be overwritten.`),jM();const s=new Oa(HM),n=H({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),zM.set(t,s)}function UM(t){zM.has(t)?zM.delete(t):hA(`map type of '${t}' does not exists.`)}function VM(t,e=!1){let i=e;return t.latestData instanceof Oa&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const WM=(t,e)=>0===t.length?[]:1===t.length?VM(t[0],null==e?void 0:e.deep):t.map((t=>VM(t,null==e?void 0:e.deep)));function GM(e,i,s){DM(i=i instanceof Ra?i:e.dataSet,"copyDataView",WM);const n=new Oa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function YM(t,e,i=[]){var s;if(t instanceof Oa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Oa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return hA(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return hA(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),hA("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function XM(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var KM,$M,qM,ZM;t.TransformLevel=void 0,(KM=t.TransformLevel||(t.TransformLevel={}))[KM.copyDataView=-10]="copyDataView",KM[KM.treemapFilter=-8]="treemapFilter",KM[KM.treemapFlatten=-7]="treemapFlatten",KM[KM.dotObjFlat=-7]="dotObjFlat",KM[KM.linkDotInfo=-7]="linkDotInfo",KM[KM.sankeyLayout=-7]="sankeyLayout",KM[KM.dataZoomFilter=-6]="dataZoomFilter",KM[KM.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}($M||($M={})),function(t){t.data="data",t.mark="mark"}(qM||(qM={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(ZM||(ZM={}));const JM=["line","area","trail"];function QM(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(iM,i?t.slice().sort(i):t.slice()),{keys:[iM],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const tw=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function ew(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{ew(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function sw(t,e,i,s){const n=QM(t,(t=>i(t))),r=QM(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const nw=`${PT}_BuiltIn_CallBack_Disappear`;var rw;!function(t){t.render="render",t.disappear="disappear"}(rw||(rw={}));const aw=[0,0,0];class ow{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Fl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Hl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},jl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ge(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ge(1,0,0,1,0,0),this._clearMatrix=new Ge(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ge(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Au.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&&(Au.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Au.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Ut;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=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:jl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:jl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(vu(aw,[e,i,s],this.modelMatrix),e=aw[0],i=aw[1],s=aw[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=au(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:ru(this,a,this.dpr),r.strokeStyle=au(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Au.free(t))),this.stack.length=0}}ow.env="browser";class lw extends Eu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ua.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ow(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}}function hw(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,Cd,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Td,e.env));r||i.bind(Cd).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(Td).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}lw.env="browser";const cw=hw(lw,ow);class dw extends ow{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}dw.env="feishu";class uw extends Eu{constructor(t){super(t)}init(){this._context=new dw(this,this._dpr)}release(...t){}}uw.env="feishu";const pw=hw(uw,dw);class gw extends ow{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:ru(this,l,this.dpr),r.strokeStyle=au(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=Ua.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Ua.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}gw.env="harmony";class fw extends Eu{constructor(t){super(t)}init(){this._context=new gw(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}fw.env="harmony";const mw=hw(fw,gw);class vw extends ow{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:ru(this,l,this.dpr),r.strokeStyle=au(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=Ua.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Ua.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}vw.env="lynx";class yw extends Eu{constructor(t){super(t)}init(){this._context=new vw(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}yw.env="lynx";const _w=hw(yw,vw);class bw extends ow{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}bw.env="node";class xw extends Eu{constructor(t){super(t)}init(){this._context=new bw(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}}xw.env="node";const Sw=hw(xw,bw);class Aw extends ow{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,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(au(this,l,t,i,s)))}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:ru(this,l,this.dpr)),r.setStrokeStyle(au(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}Aw.env="taro";class kw extends Eu{constructor(t){super(t)}init(){this._context=new Aw(this,this._dpr)}release(...t){}}kw.env="taro";const Cw=hw(kw,Aw);class Tw extends dw{}Tw.env="tt";class Mw extends Eu{constructor(t){super(t)}init(){this._context=new Tw(this,this._dpr)}release(...t){}}Mw.env="tt";const ww=hw(Mw,Tw);class Ew extends ow{draw(){}createPattern(t,e){return null}}Ew.env="wx";class Bw extends Eu{constructor(t){super(t)}init(){this._context=new Ew(this,this._dpr)}release(...t){}}Bw.env="wx";const Pw=hw(Bw,Ew);function Rw(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function Ow(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}class Iw extends Q_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=dm.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:ru(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class vE extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ed}}let yE=!1;function _E(t){yE||(yE=!0,t.bind(Kw).toDynamicValue((()=>new vE(Rw(t,jf)))).inSingletonScope(),t.bind(pE).toService(Kw))}class bE extends h_{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ku.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class xE extends bE{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=id,this.themeType="arc"}}let SE=!1;function AE(t){var e;SE||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Nf))&&(SE=!0,t.bind($w).toDynamicValue((()=>new xE(Rw(t,Nf)))).inSingletonScope(),t.bind(pE).toService($w))}class kE extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=sd}}let CE=!1;function TE(t){CE||(CE=!0,t.bind(qw).toDynamicValue((()=>new kE(Rw(t,Uf)))).inSingletonScope(),t.bind(pE).toService(qw))}class ME extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=nd}}let wE=!1;function EE(t){wE||(wE=!0,t.bind(Zw).toDynamicValue((()=>new ME(Rw(t,Vf)))).inSingletonScope(),t.bind(pE).toService(Zw))}class BE{constructor(){this.type="glyph",this.numberType=rd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}class PE extends BE{constructor(t){super(),this.canvasRenderer=t}}let RE=!1;function OE(t){RE||(RE=!0,t.bind(cE).toDynamicValue((()=>new PE(Rw(t,em)))).inSingletonScope(),t.bind(pE).toService(cE))}class IE extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=od}}let LE=!1;function DE(t){LE||(LE=!0,t.bind(Jw).toDynamicValue((()=>new IE(Rw(t,im)))).inSingletonScope(),t.bind(pE).toService(Jw))}class FE extends h_{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:ru(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ku.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class zE extends FE{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ld}}let HE=!1;function jE(t){HE||(HE=!0,t.bind(tE).toDynamicValue((()=>new zE(Rw(t,Yf)))).inSingletonScope(),t.bind(pE).toService(tE))}const NE=new Ve;class UE{constructor(){this.type="rect",this.numberType=ud}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:ru(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;NE.setValue(i.x1,i.y1,i.x2,i.y2),NE.expand(-r/2),h=!NE.containsPoint(e)}}return s.highPerformanceRestore(),h}}class VE extends UE{constructor(t){super(),this.canvasRenderer=t}}let WE=!1;class GE extends FE{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=hd}}let YE=!1;function XE(t){YE||(YE=!0,t.bind(iE).toDynamicValue((()=>new GE(Rw(t,Xf)))).inSingletonScope(),t.bind(pE).toService(iE))}class KE extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=cd}}let $E=!1;function qE(t){$E||($E=!0,t.bind(oE).toDynamicValue((()=>new KE(Rw(t,Kf)))).inSingletonScope(),t.bind(pE).toService(oE))}class ZE extends bE{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=dd,this.themeType="polygon"}}let JE=!1;function QE(t){var e;JE||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,tm))&&(JE=!0,t.bind(lE).toDynamicValue((()=>new ZE(Rw(t,tm)))).inSingletonScope(),t.bind(pE).toService(lE))}class tB extends UE{constructor(t){super(),this.canvasRenderer=t}}let eB=!1;function iB(t){eB||(eB=!0,t.bind(sE).toDynamicValue((()=>new tB(Rw(t,$f)))).inSingletonScope(),t.bind(pE).toService(sE))}class sB extends bE{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=pd,this.themeType="rect"}}let nB=!1;function rB(t){var e;nB||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,qf))&&(nB=!0,t.bind(nE).toDynamicValue((()=>new sB(Rw(t,qf)))).inSingletonScope(),t.bind(pE).toService(nE))}class aB{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=gd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let oB=!1;function lB(t){oB||(oB=!0,t.bind(hE).toDynamicValue((()=>new aB(Rw(t,Qf)))).inSingletonScope(),t.bind(pE).toService(hE))}class hB extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=fd}}let cB=!1;function dB(t){var e;cB||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,rm))&&(cB=!0,t.bind(uE).toDynamicValue((()=>new hB(Rw(t,rm)))).inSingletonScope(),t.bind(pE).toService(uE))}class uB extends bE{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=md}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:ru(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ku.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let pB=!1;function gB(t){pB||(pB=!0,t.bind(rE).toDynamicValue((()=>new uB(Rw(t,Zf)))).inSingletonScope(),t.bind(pE).toService(rE))}class fB extends bE{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=vd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Vp(a,u,n),v=Up(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&ku.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let mB=!1;function vB(t){mB||(mB=!0,t.bind(aE).toDynamicValue((()=>new fB(Rw(t,Jf)))).inSingletonScope(),t.bind(pE).toService(aE))}const yB=Kc();Kc();class _B{constructor(){this.type="gif-image",this.numberType=yB}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let bB=!1;function xB(t){bB||(bB=!0,t.bind(Qw).toDynamicValue((()=>new _B)).inSingletonScope(),t.bind(pE).toService(Qw))}function SB(t){t.isBound(Iw)||t.bind(Iw).toDynamicValue((()=>new Iw(Ow(pE,t),Rw(t,nm),Ow(Ff,t),Ow(zf,t)))).inSingletonScope(),t.isBound(If)?t.rebind(If).toService(Iw):t.bind(If).toService(Iw)}function AB(t){(function(t){fE||(fE=!0,t.bind(dE).toDynamicValue((()=>new gE)).inSingletonScope(),t.bind(pE).toService(dE),gv(t.bind.bind(t),pE))})(t),_E(t),AE(t),TE(t),EE(t),OE(t),DE(t),jE(t),function(t){WE||(WE=!0,t.bind(eE).toDynamicValue((()=>new VE(Rw(t,$f)))).inSingletonScope(),t.bind(pE).toService(eE))}(t),XE(t),qE(t),QE(t),iB(t),rB(t),lB(t),dB(t),gB(t),vB(t),xB(t),SB(t)}class kB extends Y_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${kB.idprefix}_${kB.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ua.global,this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:kB.GenerateCanvasId(),canvasControled:!0};this.canvas=new lw(s)}createWindowByCanvas(t){var e,i;let s;if("string"==typeof t.canvas){if(s=this.global.getElementById(t.canvas),s||"undefined"==typeof document||(s=document.getElementById(t.canvas)),!s)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else s=t.canvas;if(!s)throw new Error("发生错误,传入的canvas不正确");let n=t.width,r=t.height;if(null==n||null==r||!t.canvasControled){const t=s.getBoundingClientRect();n=t.width,r=t.height}let a=t.dpr;null==a&&(a=null!==(e=s.getContext("2d").pixelRatio)&&void 0!==e?e:s.width/n),this.canvas=new lw({width:n,height:r,dpr:a,nativeCanvas:s,canvasControled:null!==(i=t.canvasControled)&&void 0!==i&&i})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}}function CB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,kB))||t.bind(kB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,kB.env))||t.bind(om).toService(kB).whenTargetNamed(kB.env)}kB.env="browser",kB.idprefix="visactor_window",kB.prefix_count=0;var TB=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class MB{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function wB(t,e=!1){const i=document.createElement("img");if(Ua.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class EB extends G_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new MB(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return wB(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return wB(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ja.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return TB(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function BB(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,EB))||(t.bind(EB).toSelf().inSingletonScope(),t.bind(pg).toService(EB))}function PB(t=Zy(),e=!0){PB.__loaded||(PB.__loaded=!0,BB(t),cw(t),CB(t),e&&AB(t))}PB.__loaded=!1;class RB extends Y_{get container(){return null}constructor(t=Ua.global){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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new uw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new uw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function OB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,RB))||t.bind(RB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,RB.env))||t.bind(om).toService(RB).whenTargetNamed(RB.env)}RB.env="feishu";class IB extends Q_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Mu(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}}let LB=!1;class DB extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ed}}let FB=!1;function zB(t){FB||(FB=!0,t.bind(Dw).toDynamicValue((()=>new DB(Rw(t,jf)))).inSingletonScope(),t.bind(Lw).toService(Dw))}class HB extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=sd}}let jB=!1;function NB(t){jB||(jB=!0,t.bind(Fw).toDynamicValue((()=>new HB(Rw(t,Uf)))).inSingletonScope(),t.bind(Lw).toService(Fw))}class UB extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=nd}}let VB=!1;function WB(t){VB||(VB=!0,t.bind(zw).toDynamicValue((()=>new UB(Rw(t,Vf)))).inSingletonScope(),t.bind(Lw).toService(zw))}class GB extends BE{constructor(t){super(),this.canvasRenderer=t}}let YB=!1;function XB(t){YB||(YB=!0,t.bind(Yw).toDynamicValue((()=>new GB(Rw(t,em)))).inSingletonScope(),t.bind(Lw).toService(Yw))}class KB{constructor(){this.type="image",this.numberType=od}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let $B=!1;function qB(t){$B||($B=!0,t.bind(Hw).toDynamicValue((()=>new KB)).inSingletonScope(),t.bind(Lw).toService(Hw))}class ZB extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ld}}let JB=!1;function QB(t){JB||(JB=!0,t.bind(jw).toDynamicValue((()=>new ZB(Rw(t,Yf)))).inSingletonScope(),t.bind(Lw).toService(jw))}class tP extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=cd}}let eP=!1;function iP(t){eP||(eP=!0,t.bind(Gw).toDynamicValue((()=>new tP(Rw(t,Kf)))).inSingletonScope(),t.bind(Lw).toService(Gw))}class sP extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=hd}}let nP=!1;function rP(t){nP||(nP=!0,t.bind(Nw).toDynamicValue((()=>new sP(Rw(t,Xf)))).inSingletonScope(),t.bind(Lw).toService(Nw))}class aP extends UE{constructor(t){super(),this.canvasRenderer=t}}let oP=!1;function lP(t){oP||(oP=!0,t.bind(Uw).toDynamicValue((()=>new aP(Rw(t,$f)))).inSingletonScope(),t.bind(Lw).toService(Uw))}class hP{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=gd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let cP=!1;function dP(t){cP||(cP=!0,t.bind(Xw).toDynamicValue((()=>new hP(Rw(t,Qf)))).inSingletonScope(),t.bind(Lw).toService(Xw))}class uP extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=md}}let pP=!1;function gP(t){pP||(pP=!0,t.bind(Vw).toDynamicValue((()=>new uP(Rw(t,Zf)))).inSingletonScope(),t.bind(Lw).toService(Vw))}class fP{constructor(){this.type="text",this.numberType=vd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let mP=!1;function vP(t){mP||(mP=!0,t.bind(Ww).toDynamicValue((()=>new fP)).inSingletonScope(),t.bind(Lw).toService(Ww))}function yP(t){(function(t){LB||(LB=!0,gv(t.bind.bind(t),Lw))})(t),function(t){t.isBound(IB)||t.bind(IB).toDynamicValue((()=>new IB(Ow(Lw,t),Ow(Ff,t),Ow(zf,t)))).inSingletonScope(),t.isBound(If)?t.rebind(If).toService(IB):t.bind(If).toService(IB)}(t),zB(t),NB(t),WB(t),XB(t),qB(t),QB(t),iP(t),rP(t),lP(t),dP(t),gP(t),vP(t)}class _P{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class bP{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function xP(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function SP(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new _P(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function AP(t,e,i,s){const n=xP(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new bP(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function kP(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function CP(t,e=kP(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class TP extends G_{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},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 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=kP(i),n=null!==(e=t.dpr)&&void 0!==e?e:CP(i,s),r=AP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=xP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=SP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return CP(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function MP(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,TP))||(t.bind(TP).toSelf().inSingletonScope(),t.bind(pg).toService(TP))}function wP(t=Zy(),e=!0){wP.__loaded||(wP.__loaded=!0,MP(t),pw(t),OB(t),e&&yP(t))}wP.__loaded=!1;function EP(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function BP(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new fw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new fw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return EP(t,"target",s),EP(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=BP(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=BP(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&PP(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),PP(t,"x",_),PP(t,"y",b),PP(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),PP(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),PP(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),PP(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),PP(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),PP(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function OP(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,RP))||t.bind(RP).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,RP.env))||t.bind(om).toService(RP).whenTargetNamed(RP.env)}RP.env="harmony";const IP="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function LP(t){return"number"==typeof t&&Number.isFinite(t)}function DP(...t){for(let e=0;e({width:i,height:s})),new bP(t,l,n,i,s,e)}function NP(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=HP(e*s,i*s);if(t)return t}throw new Error(IP)}class UP extends G_{constructor(){super(),this.type="harmony",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,this.rafSTO=new Sh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=FP(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=FP(s),r=null!==(i=t.dpr)&&void 0!==i?i:zP(s),a=function(t,e){if(!LP(t)||!LP(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=jP(NP(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=jP(NP(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return zP(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=DP(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=DP(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function VP(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,UP))||(t.bind(UP).toSelf().inSingletonScope(),t.bind(pg).toService(UP))}function WP(t=Zy(),e=!0){WP.__loaded||(WP.__loaded=!0,VP(t),mw(t),OP(t),e&&yP(t))}WP.__loaded=!1;function GP(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function YP(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new yw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new yw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return GP(t,"target",s),GP(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=YP(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=YP(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&XP(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),XP(t,"x",_),XP(t,"y",b),XP(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),XP(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),XP(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),XP(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),XP(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),XP(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function $P(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,KP))||t.bind(KP).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,KP.env))||t.bind(om).toService(KP).whenTargetNamed(KP.env)}KP.env="lynx";function qP(t){return"number"==typeof t&&Number.isFinite(t)}function ZP(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=QP(r),o=null!==(i=t.dpr)&&void 0!==i?i:tR(r,a),l=iR(t.width,t.height),h=sR(nR(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=QP(a),l=null!==(n=t.dpr)&&void 0!==n?n:tR(a,o),h=iR(t.width,t.height),c=Math.random().toString(),d=sR(nR(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tR(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=ZP(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=ZP(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function aR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,rR))||(t.bind(rR).toSelf().inSingletonScope(),t.bind(pg).toService(rR))}function oR(t=Zy(),e=!0){oR.__loaded||(oR.__loaded=!0,aR(t),_w(t),$P(t),e&&yP(t))}oR.__loaded=!1;class lR extends Y_{get container(){return null}constructor(t=Ua.global){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:ja.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new xw(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new xw({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function hR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,lR))||t.bind(lR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,lR.env))||t.bind(om).toService(lR).whenTargetNamed(lR.env)}lR.env="node";class cR extends G_{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function dR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,cR))||(t.bind(cR).toSelf().inSingletonScope(),t.bind(pg).toService(cR))}function uR(t=Zy(),e=!0){uR.__loaded||(uR.__loaded=!0,dR(t),Sw(t),hR(t))}uR.__loaded=!1;class pR extends Y_{get container(){return null}constructor(t=Ua.global){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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new kw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new kw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.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){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function gR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,pR))||t.bind(pR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,pR.env))||t.bind(om).toService(pR).whenTargetNamed(pR.env)}pR.env="taro";class fR extends G_{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},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 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=AP(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=xP(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=SP(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}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(...t){}}function mR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,fR))||(t.bind(fR).toSelf().inSingletonScope(),t.bind(pg).toService(fR))}function vR(t=Zy(),e=!0){vR.__loaded||(vR.__loaded=!0,mR(t),Cw(t),gR(t),e&&yP(t))}vR.__loaded=!1;class yR extends Y_{get container(){return null}constructor(t=Ua.global){super(),this.global=t,this.type="tt",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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Mw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Mw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function _R(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,yR))||t.bind(yR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,yR.env))||t.bind(om).toService(yR).whenTargetNamed(yR.env)}yR.env="tt";function bR(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function xR(t,e=bR(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class SR extends G_{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=bR(i),n=null!==(e=t.dpr)&&void 0!==e?e:xR(i,s),r=AP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=xP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=SP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return xR(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function AR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,SR))||(t.bind(SR).toSelf().inSingletonScope(),t.bind(pg).toService(SR))}function kR(t=Zy(),e=!0){kR.__loaded||(kR.__loaded=!0,AR(t),ww(t),_R(t),e&&yP(t))}kR.__loaded=!1;class CR{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={}}}function TR(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class MR extends Y_{get container(){return null}constructor(t=Ua.global){super(),this.global=t,this.type="wx",this.eventManager=new CR}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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Bw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Bw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,s,n,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return TR(t,"target",o),TR(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s: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!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function wR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,MR))||t.bind(MR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,MR.env))||t.bind(om).toService(MR).whenTargetNamed(MR.env)}MR.env="wx";function ER(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function BR(t,e=ER(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class PR extends G_{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=ER(i),n=null!==(e=t.dpr)&&void 0!==e?e:BR(i,s),r=AP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=xP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=SP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return BR(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function RR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,PR))||(t.bind(PR).toSelf().inSingletonScope(),t.bind(pg).toService(PR))}function OR(t=Zy(),e=!0){OR.__loaded||(OR.__loaded=!0,RR(t),Pw(t),wR(t),e&&yP(t))}OR.__loaded=!1;var IR={},LR={},DR={};Object.defineProperty(DR,"__esModule",{value:!0}),DR.loop=DR.conditional=DR.parse=void 0;DR.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};DR.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};DR.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var FR={};Object.defineProperty(FR,"__esModule",{value:!0}),FR.readBits=FR.readArray=FR.readUnsigned=FR.readString=FR.peekBytes=FR.readBytes=FR.peekByte=FR.readByte=FR.buildStream=void 0;FR.buildStream=function(t){return{data:t,pos:0}};var zR=function(){return function(t){return t.data[t.pos++]}};FR.readByte=zR;FR.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var HR=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};FR.readBytes=HR;FR.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};FR.readString=function(t){return function(e){return Array.from(HR(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};FR.readUnsigned=function(t){return function(e){var i=HR(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};FR.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=HR(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=$R(t),i=VR(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=$R(this.attribute.gifImage),e=VR(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=Ua.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=Ua.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function JR(t){return new ZR(t)}class QR extends V_{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=yB,this._renderContribitions=void 0,this.builtinContributions=[tO],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=Dp(t).image;this._draw(t,n,!1,i)}}const tO=new class extends iy{constructor(){super(...arguments),this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let eO=!1;function iO(t){eO||(eO=!0,t.bind(QR).toDynamicValue((()=>new QR(Ow(Dy,t)))).inSingletonScope(),t.bind(Wf).toService(QR))}function sO(){pf.RegisterGraphicCreator("gif",JR)}function nO(){if(nO.__loaded)return;nO.__loaded=!0;const t=Zy();sO(),iO(t),xB(t)}nO.__loaded=!1;const rO=nO,aO=[{register:PS,bindModule:Rx},{register:RS,bindModule:TS},{register:OS,bindModule:Nx},{register:IS,bindModule:Xx},{register:LS,bindModule:cS},{register:DS},{register:FS,bindModule:vS},{register:zS,bindModule:zx},{register:HS,bindModule:Qx},{register:jS,bindModule:iS},{register:US,bindModule:BS},{register:VS,bindModule:Lx},{register:WS,bindModule:SS},{register:GS,bindModule:gS},{register:KS},{register:NS,bindModule:aS},{register:YS,bindModule:Wx},{register:XS,bindModule:qx},{register:$S},{register:sO}];let oO=!1;const lO=[_E,AE,TE,EE,OE,DE,jE,XE,qE,QE,iB,rB,lB,dB,gB,vB,xB];function hO(t){return{getContributions:t}}function cO(t,{envParams:e,force:i=!1}={}){_b().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function dO(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){bb(t);const a=vb();i(a),s(a),n(a),yb(),cO(e,{envParams:r,force:!0})}function uO(t,e){dO(t,"browser",{bindEnv:BB,bindCanvasModules:cw,bindWindowContribution:CB},e)}function pO(t,e){dO(t,"node",{bindEnv:dR,bindCanvasModules:Sw,bindWindowContribution:hR},e)}function gO(t){bb(t),function(){if(oO)return;const t=vb();oO=!0,aO.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),iO(t),yb()}(),Sb(t),xb(t)}function fO(t){bb(t);const e=vb();lO.forEach((t=>t(e))),SB(e),Ab(t,pE),function(t){const e=vb(),i=hO((()=>t.registry.picker.getAll())),s=hO((()=>e.isBound(Ff)?e.getAll(Ff):[])),n=hO((()=>e.isBound(zf)?e.getAll(zf):[])),r=_b();Ua.pickerServiceFactory=()=>new Iw(i,{},s,n),Ua.global=r}(t)}function mO(t){bb(t);yP(vb()),Ab(t,Lw),function(t){const e=vb(),i=hO((()=>t.registry.picker.getAll())),s=hO((()=>e.isBound(Ff)?e.getAll(Ff):[])),n=hO((()=>e.isBound(zf)?e.getAll(zf):[]));Ua.pickerServiceFactory=()=>new IB(i,s,n)}(t)}const vO=iv();function yO(){if(yO.__loaded)return;yO.__loaded=!0;const t=Zy();PS(),Rx({bind:t.bind}),vO?_E(t):zB(t)}yO.__loaded=!1;const _O=yO;function bO(){if(bO.__loaded)return;bO.__loaded=!0;const t=Zy();RS(),K_(),q_(),TS({bind:t.bind}),AE(t)}bO.__loaded=!1;const xO=bO;function SO(){if(SO.__loaded)return;SO.__loaded=!0;const t=Zy();OS(),Nx({bind:t.bind}),vO?TE(t):NB(t)}SO.__loaded=!1;const AO=SO;function kO(){if(kO.__loaded)return;kO.__loaded=!0;const t=Zy();IS(),Xx({bind:t.bind}),vO?EE(t):WB(t)}kO.__loaded=!1;const CO=kO;function TO(){if(TO.__loaded)return;TO.__loaded=!0;const t=Zy();LS(),cS({bind:t.bind}),vO?OE(t):XB(t)}TO.__loaded=!1;const MO=TO;function wO(){wO.__loaded||(wO.__loaded=!0,DS())}wO.__loaded=!1;const EO=wO;function BO(){if(BO.__loaded)return;BO.__loaded=!0;const t=Zy();FS(),vS({bind:t.bind}),vO?DE(t):qB(t)}BO.__loaded=!1;const PO=BO;function RO(){if(RO.__loaded)return;RO.__loaded=!0;const t=Zy();zS(),zx({bind:t.bind}),vO?jE(t):QB(t)}RO.__loaded=!1;const OO=RO;function IO(){if(IO.__loaded)return;IO.__loaded=!0;const t=Zy();HS(),Qx({bind:t.bind}),vO?XE(t):rP(t)}IO.__loaded=!1;const LO=IO;function DO(){if(DO.__loaded)return;DO.__loaded=!0;const t=Zy();jS(),iS({bind:t.bind}),vO?qE(t):iP(t)}DO.__loaded=!1;const FO=DO;function zO(){if(zO.__loaded)return;zO.__loaded=!0;const t=Zy();US(),K_(),q_(),BS({bind:t.bind}),QE(t)}zO.__loaded=!1;const HO=zO;function jO(){if(jO.__loaded)return;jO.__loaded=!0;const t=Zy();VS(),Lx({bind:t.bind}),vO?iB(t):lP(t)}jO.__loaded=!1;const NO=jO;function UO(){if(UO.__loaded)return;UO.__loaded=!0;const t=Zy();WS(),SS({bind:t.bind}),rB(t)}UO.__loaded=!1;const VO=UO;function WO(){if(WO.__loaded)return;WO.__loaded=!0;const t=Zy();GS(),gS({bind:t.bind}),vO?lB(t):dP(t)}WO.__loaded=!1;const GO=WO;function YO(){YO.__loaded||(YO.__loaded=!0,KS())}YO.__loaded=!1;const XO=YO;function KO(){if(KO.__loaded)return;KO.__loaded=!0;const t=Zy();NS(),aS({bind:t.bind}),dB(t)}KO.__loaded=!1;const $O=KO;function qO(){if(qO.__loaded)return;qO.__loaded=!0;const t=Zy();YS(),Wx({bind:t.bind}),vO?gB(t):gP(t)}qO.__loaded=!1;const ZO=qO;function JO(){if(JO.__loaded)return;JO.__loaded=!0;const t=Zy();XS(),qx({bind:t.bind}),vO?vB(t):vP(t)}JO.__loaded=!1;const QO=JO;function tI(){tI.__loaded||(tI.__loaded=!0,$S())}tI.__loaded=!1;const eI=tI;function iI(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}class sI{static registerBuiltInAnimate(t,e){sI.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._activeConfigList=null,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:sI.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=iI(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:sI.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=iI(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:T,customType:M,controlOptions:w}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),E.startAt(b);const O=i*x+B;O>0&&E.wait(O);let I=null,L=t.to,D=t.from;const F=this.shouldCommitAttrOutChannel(p);L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(E,T,M,D,L,_,m,f,w,C,p,e);let z=0;x&&(z=x*(s-i-1));const H=d(y)?y(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&E.wait(z),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,y,_,b;if(e&&i){i=iI(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:sI.builtInAnimateMap[r],m=t.custom?t.customType:iI(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Il.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}sI.builtInAnimateMap={};class nI{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-nI.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*nI.bounceIn(2*t):.5*nI.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ut/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ut*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ut/e)*.5+1}}static registerFunc(t,e){nI[t]=e}}function rI(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}nI.quadIn=nI.getPowIn(2),nI.quadOut=nI.getPowOut(2),nI.quadInOut=nI.getPowInOut(2),nI.cubicIn=nI.getPowIn(3),nI.cubicOut=nI.getPowOut(3),nI.cubicInOut=nI.getPowInOut(3),nI.quartIn=nI.getPowIn(4),nI.quartOut=nI.getPowOut(4),nI.quartInOut=nI.getPowInOut(4),nI.quintIn=nI.getPowIn(5),nI.quintOut=nI.getPowOut(5),nI.quintInOut=nI.getPowInOut(5),nI.backIn=nI.getBackIn(1.7),nI.backOut=nI.getBackOut(1.7),nI.backInOut=nI.getBackInOut(1.7),nI.elasticIn=nI.getElasticIn(1,.3),nI.elasticOut=nI.getElasticOut(1,.3),nI.elasticInOut=nI.getElasticInOut(1,.3*1.5),nI.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),nI.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},nI.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)nI[`flicker${t}`]=e=>rI(e,t);for(let t=2;t<10;t++)nI[`aIn${t}`]=e=>t*e*e+(1-t)*e;function aI(t,e,i){return t+(e-t)*i}const oI=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=aI(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=aI(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=aI(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=aI(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=aI(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=aI(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=aI(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=aI(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=aI(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Ou(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?Hu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Ou(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?Hu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=aI(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=aI(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=aI(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=aI(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=aI(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=aI(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=aI(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=aI(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=aI(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=bh(e,i,s),r.addUpdateBoundTag()}}};function lI(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:Ao.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=nI[s])&&void 0!==n?n:nI.linear:nI.linear,"wait"===t&&(this.onUpdate=yI),this.id=ja.GenAutoIncrementId(),this.syncAttributeUpdate=yI}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Pu.Get(i,Bu.Color255),r=Pu.Get(s,Bu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(oI["fill"===e?"fillPure":"strokePure"])}else oI[e]?t.push(oI[e]):t.push(lI)}else oI[e]?t.push(oI[e]):t.push(lI)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class xI extends bI{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();mI(this.target,t,Ao.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class SI extends bI{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class AI extends SI{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class kI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Il.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class CI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class TI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,mI(this.target,i,Ao.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class MI extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class wI extends TI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class EI extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class BI extends TI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}class PI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){mI(this.target,this.from,Ao.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const RI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class OI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){gI(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){gI(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class II extends OI{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=RI(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,r),this.determineUpdateFunction()}}class LI extends OI{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class DI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class FI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const zI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class HI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=zI(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){fI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class jI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){fI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const NI=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class UI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(gI(this.target,{points:r.map(((t,i)=>_h(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class VI extends UI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:NI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&vI(this.target,e)}else this.valid=!1}}class WI extends UI{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:NI(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const GI=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class YI extends UI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:GI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&vI(this.target,e)}else this.valid=!1}}class XI extends UI{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:GI(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const KI=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class $I extends UI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:KI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&vI(this.target,e)}else this.valid=!1}}class qI extends UI{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:KI(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const ZI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class JI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class QI extends JI{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=ZI(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,r)}}class tL extends JI{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const eL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class iL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=eL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){fI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){fI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rL extends nL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?y:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&vI(this.target,e)}}class aL extends nL{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,y=v&&k(v.x)?v.x:f,_=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class oL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,mI(this.target,{text:n})}}class lL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class hL extends lL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&vI(this.target,e)}}class cL extends lL{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class dL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),T=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,w=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,E=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,B=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(w){case"x":A={scaleX:null!==(g=null!=E?E:T.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=B?B:T.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=E?E:T.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=B?B:T.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&vI(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),gI(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class uL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class pL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function gL(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;tfL[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&gL(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(gI(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class yL{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new sI(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function _L(t){return new yL(t)}class bL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;mI(this.target,{text:o})}}class xL extends AI{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(vI(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),vI(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),vI(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),vI(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;vI(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:bL});const i=s._titleBottom.attribute.text;vI(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:bL})}else vI(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),vI(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;vI(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());vI(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class SL extends AI{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class AL extends AI{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if(vI(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:bL}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:bL}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class kL extends AI{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class CL extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=e_.createCanvas({width:t.width,height:t.height,dpr:e_.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=e_.createCanvas({width:t.width,height:t.height,dpr:e_.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==CL.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class TL extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class ML extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==ML.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==ML.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class wL{static createTempCanvas(t,e,i){return e_.createCanvas({width:t,height:e,dpr:i||e_.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=wL.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(wL.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(wL.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(wL.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(wL.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(wL.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(wL.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(wL.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class PL extends ML{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class LL extends ML{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=wL.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class DL extends CL{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=e_.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=e_.createCanvas({width:i,height:s,dpr:e_.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class FL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}mI(this.target,{textConfig:o})}}class zL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),mI(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),mI(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class HL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),mI(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),mI(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function VL(t,e){gI(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class WL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,vI(this.target,m)}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class GL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,vI(this.target,d)}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class YL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,vI(this.target,p)}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class XL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,vI(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),mI(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class KL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,vI(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),mI(this.target,n)}}class $L extends SI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new sI(this.target);a.execute({type:"custom",custom:WL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:GL,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class qL extends SI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new sI(this.target);a.execute({type:"custom",custom:WL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:YL,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class ZL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class JL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class QL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class tD extends SI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new sI(this.target);n.execute({type:"custom",custom:JL,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:ZL,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class eD extends SI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new sI(this.target);n.execute({type:"custom",custom:QL,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:ZL,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class iD extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),gI(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Ou(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Ou(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class sD extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Ua.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Ml,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Ua.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Ao.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Ao.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=No(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=No(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}nD.getInstance();const rD="appear",aD="disappear",oD="update",lD="highlight",hD="unhighlight";class cD{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class dD{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new sI(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new sI(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([rD],[{name:rD,animation:t}],e)}applyDisappearState(t,e){this.applyState([aD],[{name:aD,animation:t}],e)}applyUpdateState(t,e){this.applyState([oD],[{name:oD,animation:t}],e)}applyHighlightState(t,e){this.applyState([lD],[{name:lD,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([hD],[{name:hD,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class uD{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new dD(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new cD(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class pD extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=ja.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Il.END?this.removeAnimate(t,!0):t.status!==Il.RUNNING&&t.status!==Il.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const gD=new pD;function fD(t,e){for(let i=0;i{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new bI(Ol.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new xI(Ol.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new PI(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Il.RUNNING&&(this.status=Il.PAUSED)}resume(){this.status===Il.PAUSED&&(this.status=Il.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Il.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Il.END,this.target.restoreStaticAttribute(),void(this.__skipRestoreStaticAttributeOnRemove=!0);this.status=Il.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&mI(this.target,this._startProps,Ao.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const yD=new Wa;class _D{constructor(){this.released=!1}tick(t,e){yD.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class bD extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Rl.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Rl.INITIAL,Ua.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Ua.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new _D;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Rl.INITIAL&&(this.status=Rl.PAUSE,!0)}resume(){return this.status!==Rl.INITIAL&&(this.status=Rl.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Rl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Rl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Rl.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Rl.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Rl.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Rl.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Ua.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function SD(){G(Mp,uD),G(Mp,xD)}const AD=Symbol.for("vrender.bootstrap.state"),kD=new WeakMap;function CD(t,e){var i;const s=null!==(i=t[AD])&&void 0!==i?i:new Set;return t[AD]=s,!s.has(e)&&(s.add(e),!0)}function TD(t,e){var i,s,n,r;const a=null!==(i=null==t?void 0:t.type)&&void 0!==i?i:"unknown",o=null!==(s=null==t?void 0:t.numberType)&&void 0!==s?s:"unknown",l=null!==(r=null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)&&void 0!==r?r:"anonymous";return`${e}:${String(o)}:${String(a)}:${l}`}function MD(t,e){let i=kD.get(t);i||(i=new Map,kD.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function wD(t,e,i){const s=MD(t,e);i&&s.forEach((t=>i(t))),s.clear()}function ED(t){var e,i;const s=null!==(e=Zy().getAll(Wf))&&void 0!==e?e:[],n=MD(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;wD(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=TD(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function BD(t,e){var i,s;const n=null!==(i=Zy().getAll(e))&&void 0!==i?i:[],r=MD(t.registry.picker,"vrender:legacy-picker"),a=new Set;wD(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=TD(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const PD=uO,RD=pO,OD={taro:{installEnv:function(t,e){dO(t,"taro",{bindEnv:mR,bindCanvasModules:Cw,bindWindowContribution:gR},e)},loadEnv:vR},feishu:{installEnv:function(t,e){dO(t,"feishu",{bindEnv:MP,bindCanvasModules:pw,bindWindowContribution:OB},e)},loadEnv:wP},tt:{installEnv:function(t,e){dO(t,"tt",{bindEnv:AR,bindCanvasModules:ww,bindWindowContribution:_R},e)},loadEnv:kR},wx:{installEnv:function(t,e){dO(t,"wx",{bindEnv:RR,bindCanvasModules:Pw,bindWindowContribution:wR},e)},loadEnv:OR},lynx:{installEnv:function(t,e){dO(t,"lynx",{bindEnv:aR,bindCanvasModules:_w,bindWindowContribution:$P},e)},loadEnv:oR},harmony:{installEnv:function(t,e){dO(t,"harmony",{bindEnv:VP,bindCanvasModules:mw,bindWindowContribution:OP},e)},loadEnv:WP}},ID=[nA,eA,ZS,QS,K_,q_],LD=[()=>{sI.registerBuiltInAnimate("increaseCount",oL),sI.registerBuiltInAnimate("fromTo",PI),sI.registerBuiltInAnimate("scaleIn",dL),sI.registerBuiltInAnimate("scaleOut",uL),sI.registerBuiltInAnimate("growHeightIn",HI),sI.registerBuiltInAnimate("growHeightOut",jI),sI.registerBuiltInAnimate("growWidthIn",iL),sI.registerBuiltInAnimate("growWidthOut",sL),sI.registerBuiltInAnimate("growCenterIn",DI),sI.registerBuiltInAnimate("growCenterOut",FI),sI.registerBuiltInAnimate("clipIn",MI),sI.registerBuiltInAnimate("clipOut",wI),sI.registerBuiltInAnimate("fadeIn",EI),sI.registerBuiltInAnimate("fadeOut",BI),sI.registerBuiltInAnimate("growPointsIn",VI),sI.registerBuiltInAnimate("growPointsOut",WI),sI.registerBuiltInAnimate("growPointsXIn",YI),sI.registerBuiltInAnimate("growPointsXOut",XI),sI.registerBuiltInAnimate("growPointsYIn",$I),sI.registerBuiltInAnimate("growPointsYOut",qI),sI.registerBuiltInAnimate("growAngleIn",II),sI.registerBuiltInAnimate("growAngleOut",LI),sI.registerBuiltInAnimate("growRadiusIn",QI),sI.registerBuiltInAnimate("growRadiusOut",tL),sI.registerBuiltInAnimate("moveIn",rL),sI.registerBuiltInAnimate("moveOut",aL),sI.registerBuiltInAnimate("rotateIn",hL),sI.registerBuiltInAnimate("rotateOut",cL),sI.registerBuiltInAnimate("update",vL),sI.registerBuiltInAnimate("state",pL),sI.registerBuiltInAnimate("labelItemAppear",xL),sI.registerBuiltInAnimate("labelItemDisappear",SL),sI.registerBuiltInAnimate("poptipAppear",AL),sI.registerBuiltInAnimate("poptipDisappear",kL),sI.registerBuiltInAnimate("inputText",bL),sI.registerBuiltInAnimate("inputRichText",FL),sI.registerBuiltInAnimate("outputRichText",zL),sI.registerBuiltInAnimate("slideRichText",jL),sI.registerBuiltInAnimate("slideOutRichText",HL),sI.registerBuiltInAnimate("slideIn",WL),sI.registerBuiltInAnimate("growIn",GL),sI.registerBuiltInAnimate("spinIn",YL),sI.registerBuiltInAnimate("moveScaleIn",$L),sI.registerBuiltInAnimate("moveRotateIn",qL),sI.registerBuiltInAnimate("strokeIn",XL),sI.registerBuiltInAnimate("slideOut",ZL),sI.registerBuiltInAnimate("growOut",JL),sI.registerBuiltInAnimate("spinOut",QL),sI.registerBuiltInAnimate("moveScaleOut",tD),sI.registerBuiltInAnimate("moveRotateOut",eD),sI.registerBuiltInAnimate("strokeOut",KL),sI.registerBuiltInAnimate("pulse",iD),sI.registerBuiltInAnimate("MotionPath",NL),sI.registerBuiltInAnimate("streamLight",sD),sI.registerBuiltInAnimate("dissolve",BL),sI.registerBuiltInAnimate("grayscale",IL),sI.registerBuiltInAnimate("distortion",PL),sI.registerBuiltInAnimate("particle",LL),sI.registerBuiltInAnimate("glitch",OL),sI.registerBuiltInAnimate("gaussianBlur",RL),sI.registerBuiltInAnimate("pixelation",DL)},SD],DD=[_O,xO,AO,CO,MO,rO,EO,PO,OO,LO,FO,HO,NO,VO,GO,XO,ZO,QO,eI,$O];function FD(){ID.forEach((t=>t())),LD.forEach((t=>t()))}function zD(t,e){if(!CD(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==e_?void 0:e_.env)?e_.envParams:void 0}(e);return void 0===i?pO(t):RD(t,i),gO(t),mO(t),uR(),DD.forEach((t=>t())),ED(t),BD(t,Lw),FD(),t}function HD(t,e,i){if(!CD(t,e))return t;const s=OD[e];return s.installEnv(t,i),gO(t),function(t){mO(t)}(t),s.loadEnv(),DD.forEach((t=>t())),ED(t),BD(t,Lw),FD(),t}var jD=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt())),ED(t),BD(t,pE),FD(),t):t}(ib(jD(t,["envParams"])),e)}var UD=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nqD(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=$D(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&qD(t,i,s))}}}(t,s,r,o)}function JD(t){const{env:e}=t,i=Object.assign({},t);return delete i.env,delete i.key,"browser"===e?ND(i):"node"===e?function(t={}){const{envParams:e}=t,i=GD(t,["envParams"]);return zD(YD(i),e)}(i):"taro"===e?function(t={}){return WD("taro",t)}(i):"feishu"===e?function(t={}){return WD("feishu",t)}(i):"tt"===e?function(t={}){return WD("tt",t)}(i):"wx"===e?function(t={}){return WD("wx",t)}(i):"lynx"===e?function(t={}){return WD("lynx",t)}(i):function(t={}){return WD("harmony",t)}(i)}const QD=e=>{switch(e){case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony";case t.RenderModeEnum.lynx:return"lynx";default:return"browser"}},tF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},eF=(t,e)=>{const i=QD(t),s=tF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},iF=(t,e)=>{const i=ZD((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,JD,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}};class sF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option,m=eF(o,l);e_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=m?m:{});const v=this._option.stage;if(this._isExternalStage=!!v,this._releaseVRenderAppRef=void 0,this._stage=v,!this._stage){const t=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=QD(i.mode),n=eF(i.mode,i.modeParams);return iF(s,n)})({app:this._option.app,mode:o,modeParams:l});this._releaseVRenderAppRef=t.releaseAppRef;try{this._stage=(y=t.app,_=Object.assign({background:f,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(s=this._option.renderHooks)&&void 0!==s?s:{}),y.createStage(_))}catch(t){throw null===(n=this._releaseVRenderAppRef)||void 0===n||n.call(this),this._releaseVRenderAppRef=void 0,t}}var y,_;this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const b=sf({x:0,y:0,width:this._width,height:this._height});b.name="root",this._stage.defaultLayer.appendChild(b),this._rootGroup=b;const x=(p(h)?h:fA(o))&&!1!==c&&oT.getStageEventPlugin("gesture");x&&(this._gestureController=new x(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=ZM.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!_(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!gA(this._option.mode))return!1;return!1===(p(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:e_.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(e_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=e_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>ew(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>ew(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{ew(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===ZM.before;(e||i)&&(lA(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=ZM.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=ZM.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),lA(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=iw(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=sw(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=sw(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=QM(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=QM(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:nw,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{ew(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===$M.appear))?$M.appear:e.every((t=>t===$M.disappear))?$M.disappear:$M.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===BM.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=SM(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=SM(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:kM(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===BM.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===BM.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===BM.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===BM.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===BM.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{ew(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=iw(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return gA(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&Gc(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{ew(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=e_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){e_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function nF(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:cA)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const rF={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}},aF={poptip:H({},rF)};function oF(t){t.crosshair=Y(t.crosshair||{}).map((e=>aT({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function lF(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=li(l,i.width,i.height);a=t,o=e}else if(h&&gA(e.mode)){let t;t=y(h)?e_.getElementById(h):h;const{width:e,height:s}=li(t,i.width,i.height);a=e,o=s}else if(mA(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}const hF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function cF(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function dF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function uF(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;hF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function pF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var gF,fF,mF,vF,yF,_F;t.LayoutZIndex=void 0,(gF=t.LayoutZIndex||(t.LayoutZIndex={}))[gF.SeriesGroup=0]="SeriesGroup",gF[gF.Axis_Grid=50]="Axis_Grid",gF[gF.CrossHair_Grid=100]="CrossHair_Grid",gF[gF.Region=450]="Region",gF[gF.Mark=300]="Mark",gF[gF.Node=400]="Node",gF[gF.Axis=100]="Axis",gF[gF.MarkLine=500]="MarkLine",gF[gF.MarkArea=100]="MarkArea",gF[gF.MarkPoint=500]="MarkPoint",gF[gF.DataZoom=500]="DataZoom",gF[gF.ScrollBar=500]="ScrollBar",gF[gF.Player=500]="Player",gF[gF.Legend=500]="Legend",gF[gF.CrossHair=500]="CrossHair",gF[gF.Indicator=500]="Indicator",gF[gF.Title=500]="Title",gF[gF.Label=500]="Label",gF[gF.Brush=500]="Brush",gF[gF.CustomMark=500]="CustomMark",gF[gF.Interaction=700]="Interaction",t.LayoutLevel=void 0,(fF=t.LayoutLevel||(t.LayoutLevel={}))[fF.Indicator=10]="Indicator",fF[fF.Region=20]="Region",fF[fF.Axis=30]="Axis",fF[fF.DataZoom=40]="DataZoom",fF[fF.Player=40]="Player",fF[fF.ScrollBar=40]="ScrollBar",fF[fF.Legend=50]="Legend",fF[fF.Title=70]="Title",fF[fF.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(mF=t.AttributeLevel||(t.AttributeLevel={}))[mF.Default=0]="Default",mF[mF.Theme=1]="Theme",mF[mF.Chart=2]="Chart",mF[mF.Base_Series=3]="Base_Series",mF[mF.Series=4]="Series",mF[mF.Mark=5]="Mark",mF[mF.User_Chart=6]="User_Chart",mF[mF.User_Series=7]="User_Series",mF[mF.User_Mark=8]="User_Mark",mF[mF.User_SeriesStyle=9]="User_SeriesStyle",mF[mF.Built_In=99]="Built_In";class bF{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,H({},bF.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}bF.defaultMarkInfo={};class xF{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class SF{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>aT({},i,s,t);return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class AF extends xF{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=SF,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new bF,this._lastLayoutRect=null,this.id=yA(),this.userId=t.id,this._spec=t,this.effect={},this.event=new TM(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${PT}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=oT.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class kF{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=KC(qC(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:XC(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:XC(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:XC(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:XC(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:XC(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:XC(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=XC(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=XC(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=XC(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec($C(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class CF extends AF{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new kF(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=H(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=H(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class TF extends SF{_initTheme(t,e){return{spec:t,theme:this._theme}}}class MF extends CF{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=TF,this.modelType="region",this.specKey="region",this.type=MF.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function wF(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function EF(t,e,i){e?t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function BF(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function PF(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=LF(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),BF(d,!0,p,l),s&&EF(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function RF(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=LF(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=LF(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),BF(d,!1,p,o),s&&EF(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function IF(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=LF(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=LF(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=wF(t);n.length&&PF(n,e,i,!1,"left",s),r.length&&PF(r,e,i,!0,"left",s),a.length&&RF(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=wF(t);n.length&&OF(n,e,i,!1,"top",s),r.length&&OF(r,e,i,!0,"top",s),a.length&&IF(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=wF(t);n.length&&PF(n,e,i,!1,"right",s),r.length&&PF(r,e,i,!0,"right",s),a.length&&RF(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=wF(t);n.length&&OF(n,e,i,!1,"bottom",s),r.length&&OF(r,e,i,!0,"bottom",s),a.length&&IF(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=LF(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=LF(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:cA)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}DF.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(vF||(vF={})),t.STATE_VALUE_ENUM=void 0,(yF=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",yF.STATE_HOVER="hover",yF.STATE_HOVER_REVERSE="hover_reverse",yF.STATE_DIMENSION_HOVER="dimension_hover",yF.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",yF.STATE_SELECTED="selected",yF.STATE_SELECTED_REVERSE="selected_reverse",yF.STATE_SANKEY_EMPHASIS="selected",yF.STATE_SANKEY_EMPHASIS_REVERSE="blur",yF.STATE_HIGHLIGHT="highlight",yF.STATE_BLUR="blur",yF.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(_F||(_F={}));const FF=["linear","radial","conical"],zF={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const HF={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{HF[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class jF extends xF{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(H(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class NF extends jF{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,JM.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!HF[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(PT)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(PT))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(Mk(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class UF extends xF{constructor(){super(...arguments),this.id=yA(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=oT.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class VF extends UF{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const WF=1e3,GF="quadInOut",YF=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],XF=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=Ou(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},KF=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Ib(t):[],n=Ib(e);i&&s&&(i.fromTransform&&Lb(s,i.fromTransform.clone().getInverse()),Lb(s,i.toTransfrom));const[r,a]=Ob(s,n);return t?Rb(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},qF=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],ZF=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!qF.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Pu.Get(t,Bu.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class JF extends SI{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;KF(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&XF(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):mI(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const QF=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=$F(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=ZF(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new JF({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:WF,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:GF);return c.play(d),c};class tz extends SI{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;KF(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&XF(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const ez=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>YF.includes(t))(i)||(e[i]=t[i])})),e},iz=(t,e,i)=>{const s=ez(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=Ua.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},sz=(t,e,i)=>{const s=[],n=i?null:ez(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:ez(t.attribute);if("rect"===t.type)zb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)Hb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)jb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=Vb(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ua.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?Kb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?Ub(t,e).forEach((t=>{s.push(Ua.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&$b(t,e).forEach((t=>{"path"in t?s.push(Ua.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ua.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&iz(t,s,e),s},rz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,az=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=rz(l.delay,n,a,o),d=rz(l.duration,n,a,o),u=rz(l.oneByOne,n,a,o),p=rz(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?sz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:nz)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);QF(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?sz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:nz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>$F(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>ZF(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Ao.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new JF({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:WF,null!==(l=i.easing)&&void 0!==l?l:GF))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Ao.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new tz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:WF,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:GF))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):QF(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},oz=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},lz=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},hz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},cz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];hz(t,a,s)},dz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));hz(t,r,i)},uz=Symbol("statesClearedBeforeReInit");class pz extends UF{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new VF(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=sf("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Ml)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===vF.enter||t.context.diffState===vF.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&hz(t,r,e)},this.name=e,this.model=i.model,this.key=i.key,this.state=new NF(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&aT(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(wk(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return y(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=jC(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):FF.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):wk(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=PC(BC(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},zF[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=si.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)FF.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=PC(BC(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return QM(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return oT.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[DT],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=QM(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===$M.appear))?$M.appear:t.every((t=>t===$M.disappear))?$M.disappear:t[0];return null!=e?e:$M.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{lz(t),s.push(...t.getGraphics())})),e.forEach((t=>{lz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);az([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=oz(e,n),r=oz(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===$M.exit?$M.exit:i===$M.update?$M.update:$M.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===vF.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===vF.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=vF.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=vF.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=vF.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=$M.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=$M.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return tw(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=tw(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||d(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!d(r)&&(!FF.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!wk(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);u(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,CM(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=oT.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=oT.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===ZM.before||(this._product||this._initProduct(),lA(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[uz],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?cz(i,t,!0,a):dz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[uz]=e:delete s[uz]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===vF.exit&&!e.isExiting)if(e.context.animationState===vF.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===vF.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:vF.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=sf({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[uz]=t.currentStates.slice())}))}}var gz;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(gz||(gz={}));class fz extends pz{constructor(){super(...arguments),this.type=fz.type,this._marks=[],this._diffState=vF.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(hA("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?(hA("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return ew(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===vF.update){const t=this.hasAnimation(),e=CM(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=vF.update}render(){this._isCommited&&(lA(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}fz.type="group";const mz={measureText:BT};class vz{static instance(){return vz.instance_||(vz.instance_=new vz),vz.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class yz{constructor(){this.id=yA(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?hA("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class _z extends yz{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const bz=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},xz=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class Sz extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=eo.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=eo.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||bz(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=xz(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=eo.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=xz(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=bz(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=eo.now()-i>this.config.press.time&&xz(s[0],t){Ua.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:Ao.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class kz extends Az{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},y=null!==(o=v.width)&&void 0!==o?o:0,_=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const C=Ua.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:y/2,y:null!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:_/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(y+_)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,M;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},M={startAngle:x}):(T={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?T:M,"in"===b?M:T,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class Cz extends Az{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",y=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",_=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Ua.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===y?0:f,height:"in"===v&&"y"===y?0:m,fill:!0});let x={},S={};"y"===y?"negative"===_?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===_?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Tz extends SI{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=yt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&gL(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(gI(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=_h(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));mI(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const Mz={type:"fadeIn"};function wz(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return Mz;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const Ez={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},Bz={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},Pz={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},Rz=()=>{oT.registerAnimation("scaleInOut",(()=>Bz))},Oz=()=>{oT.registerAnimation("fadeInOut",(()=>Pz))},Iz=(t,e)=>({appear:wz(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Tz,duration:Ez.update.duration,easing:Ez.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),Lz=()=>{oT.registerAnimation("line",Iz)},Dz=()=>{sI.registerBuiltInAnimate("growPointsIn",VI),sI.registerBuiltInAnimate("growPointsOut",WI),sI.registerBuiltInAnimate("growPointsXIn",YI),sI.registerBuiltInAnimate("growPointsXOut",XI),sI.registerBuiltInAnimate("growPointsYIn",$I),sI.registerBuiltInAnimate("growPointsYOut",qI),sI.registerBuiltInAnimate("clipIn",MI),sI.registerBuiltInAnimate("clipOut",wI)},Fz=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class zz{constructor(t){this._markSet=new bF,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const Hz={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class jz extends zz{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},Hz,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&dz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}jz.type="element-highlight",jz.defaultOptions=Hz;const Nz=()=>{oT.registerInteractionTrigger(jz.type,jz)},Uz={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class Vz extends zz{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},Uz,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),cz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&dz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}Vz.type="element-select",Vz.defaultOptions=Uz;const Wz=()=>{oT.registerInteractionTrigger(Vz.type,Vz)};class Gz extends yz{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const Yz=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},Xz=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...Xz(t))})),s},Kz=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(Yz(t,r),!1)};class $z{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>oT.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>oT.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>oT.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return oT.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>oT.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){oT.registerTransform(t,e)}static registerFunction(t,e){t&&e&&vz.instance().registerFunction(t,e)}static unregisterFunction(t){t&&vz.instance().unregisterFunction(t)}static getFunction(t){return t?vz.instance().getFunction(t):null}static getFunctionList(){return vz.instance().getFunctionNameList()}static registerMap(t,e,i){const s=oT.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=oT.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,zM.get(e);var e}static registerSVG(t,e,i){const s=oT.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=oT.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){ST.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 ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=yA(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=rw.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=uF(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?oT.getSeriesBuiltInTheme(e):oT.getComponentBuiltInTheme(e);i=i?aT({},s,i[e]):s}s===t.length-1&&p(i)&&(i=TT({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},kk(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=gA(v);if(S?PB(i_):"node"===v&&uR(i_),S&&f&&(this._container=y(f)?e_.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=AT.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new sF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new LM(this,this._compiler),this._event=new TM(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),ST.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=aT({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=MT(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;$z.getFunctionList()&&$z.getFunctionList().length&&(t=wT(t,$z)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=oT.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=oT.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=oT.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return lF(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:RT,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:OT})}_initDataSet(t){this._dataSet=t instanceof Ra?t:new Ra,FM(this._dataSet,"dataview",Ea),FM(this._dataSet,"array",s),DM(this._dataSet,"copyDataView",WM);for(const t in oT.transforms)DM(this._dataSet,t,oT.transforms[t]);for(const t in oT.dataParser)FM(this._dataSet,t,oT.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),cF(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?$M.none:$M.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,ST.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{Yz(t)})),this._exitingVRenderComponents.clear())}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Oa?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=YM(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?aT({},t[n][e.index],i):i):t[n]=s?aT({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?aT({},t[n][r],i):i)}else t.id===e&&(t[n]=s?aT({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=aT({},t.getSpec(),e));const r=t.updateSpec(e),a=cF(r),o=dF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=lT({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=kT(this._currentThemeName),this._currentTheme=o(a,l);else{const t=lT({},kT(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),kT(n),kT(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),H(aF.poptip,rF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!gA(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return kT(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!AT.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield nF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!gA(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=y(this._canvas)?e_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?ZC(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return hA("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?ZC(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(hA("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return vz.instance().getFunction(t)}registerFunction(t,e){t&&e&&vz.instance().registerFunction(t,e)}unregisterFunction(t){t&&vz.instance().unregisterFunction(t)}getFunctionList(){return vz.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=oT.getChartPlugins();t.length>0&&(this._chartPlugin=new _z(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=oT.getVChartPlugins();e.length>0&&(this._vChartPlugin=new Gz(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=rw.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;this._renderState=rw.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent()}}$z.InstanceManager=ST,$z.ThemeManager=AT,$z.globalConfig={uniqueTooltip:!0},$z.Utils=mz,$z.vglobal=e_;oT.registerRegion("region",MF),oT.registerLayout("base",DF),XO(),EO(),oT.registerMark(fz.type,fz),oT.registerStageEventPlugin("gesture",Sz),Nz(),Wz(),vT(nT.name,nT);const qz="monotone",Zz="linear",Jz="bevel";t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));class Qz{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}function tH(t,e){return e("component",t)}function eH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=oT.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const iH=(t,e,i,s)=>{if(u(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},sH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,d(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],c=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(d(e.set))g=function(t){const i=c.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=c.get(`${e[a]}`);if(u(i))for(let i=0;i(g(t),t)))},nH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},rH=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=eH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},aH=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const oH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function lH(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=cH(rH(h,r,a,c),d,g),o.value=cH(rH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=rH(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function hH(t,e,i,s,n,r,a){if(d(e)){lH(t,e(n,a),i,s,r,a)}else e&&lH(t,e,i,s,r,a)}const cH=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=yi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class dH{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{hH(a,t,e,i,s,n,r)})):d(t)?hH(a,t,e,i,s,n,r):t&&lH(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:rH(r.visible,t,n),value:cH(rH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:rH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=rH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&oH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const uH={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?K(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?K(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},pH=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=nM([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return gH(a,n,o)},gH=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{_A(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{_A(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=uH[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},fH=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{_A(t[e])||(t[e]=0)}))})),t},mH=`${PT}_HIERARCHY_DEPTH`,vH=`${PT}_HIERARCHY_ROOT`,yH=`${PT}_HIERARCHY_ROOT_INDEX`;function _H(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function bH(t,e,i){t&&(i.needDefaultSeriesField&&(t[FT]=i.defaultSeriesField),t[LT]=e,t[DT]=i.getKey(t,e,i))}function xH(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function SH(t,e,i,s=0,n,r){void 0===r&&(r=e),bH(t,e,i),t[mH]=s,t[vH]=n||t[i.categoryField],t[yH]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>SH(e,s,i,t[mH]+1,t[vH],r)))}const AH={label:{name:"label",type:"text"}},kH=`${PT}_rect_x`,CH=`${PT}_rect_x1`,TH=`${PT}_rect_y`,MH=`${PT}_rect_y1`,wH={data:!0},EH={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},BH=[...Object.keys(Ez),"normal"];function PH(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var s;let n=t;return DH(n)&&delete n.type,n.oneByOne&&(n=OH(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:IH,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=aT({},o[e],a);return DH(n)&&delete n.type,n.oneByOne&&(n=OH(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:IH,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function RH(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=L(t,null,i),FH(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function OH(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function IH(t,e){var i;return null!==(i=null==t?void 0:t[LT])&&void 0!==i?i:e.context.graphicIndex}function LH(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function DH(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function FH(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),FH(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),FH(t[s],e,i))}function zH(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class HH extends SF{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=MC(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=oT.getSeriesMarkMap(o)?function(t,e,i){const s=oT.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=aT({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return aT({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=aT({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>aT({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const jH=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(EH[e]||(t[e]=!0),t)),{}),NH={compileOnlyKeys:EH,dataRelatedKeys:jH,seriesOnlyKeys:{tooltip:!0}},UH={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},VH=t=>(t=>g(t)&&!_(t)&&!d(t))(t)?t:u(t)?{}:null,WH=(t,e,i)=>{const s=VH(t),n=VH(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function GH(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class YH extends AF{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${PT}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=HH,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=zH(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(DM(this._rawData.dataSet,"invalidTravel",fH),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=YM(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=GM(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=GM(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new VF(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=K(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=gH(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=H(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){DM(this._dataSet,"dimensionStatistics",pH);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Oa(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&nM(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){DM(this._dataSet,"dimensionStatistics",pH);const s=new Oa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=nM(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&nM(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Oa(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:y(t)?e=>e[t]:_(t)&&t.every((t=>y(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(DM(this._rawData.dataSet,"addVChartProperty",nH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:_H.bind(this),call:bH}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:y(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=PH({},RH(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:fA(s)||mA(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=aT(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=aT(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=Fz(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=Fz(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=Fz(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:FT;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:zT,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,zT,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(oT.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new dH(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,GH(i))}_getSpecUpdatePolicy(){return NH}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},wH),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),l),!l.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>WH(t[i],e[i],UH)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&WH(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?GH(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&GH(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Oa||XM(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();zH(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:FT,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new zC).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return BC(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:FT}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),u(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),u(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,p=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${p}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,aT({},d,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:DT}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${u(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==NT&&t!==VT&&t!==jT&&t!==UT||(t=this.getStackValueField()),null!==(e=aM(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>_A(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:FT]}}function XH(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Mk(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function KH(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}YH.mark=AH,YH.transformerConstructor=HH;class $H extends YH{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);Mk(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${PT}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(NT),this.setFieldX2(jT)):(this.setFieldY(NT),this.setFieldY2(jT))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(VT),this.setFieldX2(UT)):(this.setFieldY(VT),this.setFieldY2(UT))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(GT),this.setFieldX2(WT)):(this.setFieldY(GT),this.setFieldY2(WT))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(XH("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function qH(t){return"bottom"===t||"top"===t}function ZH(t){return"left"===t||"right"===t}function JH(t){return"z"===t}function QH(t,e){return WC(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function tj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function ej(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?qH(t)?"linear":"band":qH(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const ij=(t,e,i)=>{var s;const n=null!==(s="band"===e?tH("axisBand",i):["linear","log","symlog"].includes(e)?tH("axisLinear",i):{})&&void 0!==s?s:{},r=qH(t)?tH("axisX",i):ZH(t)?tH("axisY",i):tH("axisZ",i);return aT({},tH("axis",i),n,r)};class sj{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:cA)("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:cA)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>Ek(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return qH(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class nj extends sj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:BM.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const rj=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},aj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},oj=(t,e,i,s)=>{var n;const r=e.getScale(),a=Ek(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:lj(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,hj=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class cj extends sj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!rj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:BM.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:BM.canvas}),callback:this.onMouseOut}),fA(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:BM.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),fA(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var dj;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(dj||(dj={}));const uj={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},pj={sampling:!0,samplingFactor:!0};class gj{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(uj.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:Jz,curveType:Zz,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===qz?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(uj.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:LH(this._spec,uj.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Oa(this._option.dataSet,{name:`${PT}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(dj.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[uj.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(dj.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,aT({},this._spec[uj.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const fj=Object.assign(Object.assign({},AH),uj),mj=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>mj(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},vj=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class yj extends pz{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return vj}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(wk(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?mj(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:vF.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[DT]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const _j=new Uint32Array(33),bj=new Uint32Array(33);bj[0]=0,_j[0]=~bj[0];for(let t=1;t<=32;++t)bj[t]=bj[t-1]<<1|1,_j[t]=~bj[t];function xj(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&_j[31&o]&bj[1+(31&l)])return!0}else{if(i[h]&_j[31&o])return!0;if(i[c]&bj[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,_j[31&o]&bj[1+(31&l)]);else for(s(h,_j[31&o]),s(c,bj[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,bj[31&a]|_j[1+(31&o)]);else for(n(l,bj[31&a]),n(h,_j[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function Sj(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=yt(i,-o,t.width+l),d=yt(s,-o,t.width+l),u=yt(n,-a,t.height+h),p=yt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function Aj(t,e,i=!1){return i?Sj(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function kj(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=Aj(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=Sj(t,r)),e.getRange(r)))}function Cj(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return Cj(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return Cj(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return Cj(t,e,n,s,h,c)}return!1}const Mj=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],wj=["top","inside-top","inside"];function Ej(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const Bj={mode:"same-time",duration:300,easing:"linear"};function Pj(t){return 3===t||4===t}function Rj(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const Oj=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function Ij(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}class Lj extends AI{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class Dj extends AI{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const Fj=(t,e)=>Math.ceil(t)>Math.floor(e),zj=([t,e],[i,s])=>s>t&&e>i;function Hj(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const jj=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Nj extends ef{constructor(t,e){super(t),this._skipRenderAttributes=jj,(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?H(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{Wj(t,e,i)})),e}function Gj(t,e){e&&(null==t||t.onComplete.push(e))}function Yj(t){t.forEach((t=>{t()}))}function Xj(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var Kj=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(jA.hover,!0),xA(this,(t=>{t===e||P(t.states)||t.addState(jA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(xA(this,(t=>{P(t.states)||(t.removeState(jA.hoverReverse),t.removeState(jA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void xA(this,(t=>{P(t.states)||(t.removeState(jA.selectedReverse),t.removeState(jA.selected))}));P(e.states)||(e.addState(jA.selected,!0),xA(this,(t=>{t===e||P(t.states)||t.addState(jA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===Ao.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Ao.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[Ij(g,f,c,d,a,o),Ij(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=DA.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Ml)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),Yj(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Gj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(Bj),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=Wj(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=Wj(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},Xj(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(d(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(a);const o=[],l=a;if(!c(t)&&d(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}d(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return KA(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&Fj(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&Fj(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(Hj([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!zj([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(Aj(i,e,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(Aj(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(Aj(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;Vj(i,null==n?void 0:n.attribute),Vj(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{qj[t]=e};var Jj=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};Qj.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const tN=()=>{Zj("line",Qj),Zj("area",Qj)};var eN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}iN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const sN=()=>{Zj("symbol",iN),Zj("line-data",iN)};class nN extends yj{constructor(){super(...arguments),this.type=nN.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)===CC.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}nN.type="line";const rN=()=>{oT.registerMark(nN.type,nN),XO(),OO(),tN(),sN(),Dz(),oT.registerGraphicComponent("line",sg)};class aN extends pz{constructor(){super(...arguments),this.type=aN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}aN.type="symbol";const oN=()=>{oT.registerMark(aN.type,aN),XO(),ZO(),sN(),oT.registerGraphicComponent("symbol",tg)};class lN extends HH{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function hN(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function cN(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function dN(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function uN(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function pN(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function gN(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const fN=t=>t.map(((t,e)=>({index:e,value:t}))),mN=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},vN=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=WA(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return fN(v)};class bN{constructor(t){this.id=yA(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class xN extends bN{constructor(){super(xN.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Mk(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&hN(c)&&hN(d)))return;const u=cN(t,c),p=cN(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=u,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!uN(u,p))return}else if(0===_&&0===b){if(!uN(p,u))return}else if(y||A)if(y&&!A){if(!dN(u,p))return}else if(A&&!y){if(!dN(p,u))return}else{if(f===b)return;if(f>b){if(!pN(u,p))return}else if(!pN(p,u))return}else{if(0===f&&0===_){if(!gN(u,p))return}else if(0===b&&0===g&&!gN(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){DM(e.getOption().dataSet,"tickAlign",_N);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}xN.pluginType="component",xN.type="AxisSyncPlugin";const SN={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function AN(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function kN(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function CN(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const TN=t=>"band"===t||"ordinal"===t||"point"===t;function MN(t,e){return{id:t,label:t,value:e,rawValue:t}}function wN(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class EN extends yz{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const BN=`${PT}_ARC_TRANSFORM_VALUE`,PN=`${PT}_ARC_RATIO`,RN=`${PT}_ARC_START_ANGLE`,ON=`${PT}_ARC_END_ANGLE`,IN=`${PT}_ARC_K`,LN=`${PT}_ARC_MIDDLE_ANGLE`,DN=`${PT}_ARC_QUADRANT`,FN=`${PT}_ARC_RADIAN`,zN=-Math.PI/2,HN=3*Math.PI/2,jN=.6,NN=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},UN=(t,e,i)=>{var s;const n=null!==(s="band"===e?tH("axisBand",i):"linear"===e?tH("axisLinear",i):{})&&void 0!==s?s:{},r=tH("angle"===t?"axisAngle":"axisRadius",i);return aT({},tH("axis",i),n,r)};function VN(t,e,i,s){switch(t){case r.cartesianBandAxis:return ij(QH(i,["z"]),"band",e);case r.cartesianLinearAxis:return ij(QH(i,["z"]),"linear",e);case r.cartesianLogAxis:return ij(QH(i,["z"]),"log",e);case r.cartesianSymlogAxis:return ij(QH(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return ij(QH(i),void 0,e);case r.polarBandAxis:return UN(i.orient,"band",e);case r.polarLinearAxis:return UN(i.orient,"linear",e);case r.polarAxis:return UN(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=tH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>qH(t.orient)));let g;g=p(u)?aT({},TN(u.type)?a:o,l):l;const f=n.find((t=>ZH(t.orient)));let m;return m=p(f)?aT({},Ek(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=tH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?aT({},TN(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?aT({},Ek(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return WN(i,tH(t,e));default:return tH(t,e)}}const WN=(t,e)=>{var i;const s=aT({},e,e[tj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class GN extends SF{getTheme(t,e){return VN(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},qC(e)),{[s]:0}))}}class YN extends CF{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=GN,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof to||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:BM.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new EN(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;Yz(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=Xz(t),s=Kz(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}Yz(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var XN,KN;YN.transformerConstructor=GN,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(XN||(XN={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(KN||(KN={}));class $N extends pz{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=Kz(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?Yz(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(Yz(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=oT.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(MM.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}$N.type="component";const qN=()=>{oT.registerMark($N.type,$N)};var ZN,JN;!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.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(ZN||(ZN={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(JN||(JN={}));const QN={[JN.selectedReverse]:{},[JN.selected]:{},[JN.hover]:{},[JN.hoverReverse]:{}},tU=t=>t,eU={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class iU extends YN{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?XN.circleAxis:XN.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?KN.circleAxisGrid:KN.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=PH(null===(h=oT.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new VF(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&bk(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?Mk(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!Mk(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return bk(this._regions,(e=>{var i;_(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=xk(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),bk(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):bk(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(bk(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=K(t.map((t=>t.fields.length)));for(let t=1;tV(null==e?void 0:e[i],null==t?void 0:t[i])||eU[i]))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=yM(s=t.domainLine)).startSymbol=yM(s.startSymbol),s.endSymbol=yM(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=j(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return xM(aT({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:xM(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>xM(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=xM(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return xM(aT({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:xM(t.tick.style)),t.tick.state&&(i.tick.state=_M(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return xM(aT({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:xM(t.subTick.style)),t.subTick.state&&(i.subTick.state=_M(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=SN[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:aT({},d,xM(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:xM(h.style)}),h.state&&(i.title.state.shape=_M(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:xM(o.style)}),o.state&&(i.title.state.background=_M(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=_M(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=xM(t.background.style)),t.background.state&&(i.panel.state=_M(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:ET(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return xM(aT({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:xM(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:ET(t.subGrid.alternateColor),style:xM(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=eH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){FM(this._option.dataSet,"scale",tU);const i=this.registerTicksTransform();return new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===ZN.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}iU.specKey="axes";const sU=()=>{qN(),oT.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},nU=[xN];class rU extends iU{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),bk(this._regions,(t=>{const e=this.getOrient();qH(e)?wN(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):ZH(e)?wN(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):JH(e)&&wN(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=aT({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(aT({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=qH(this.getOrient()),n=t=>{var e;return(s?!qH(t.getOrient()):qH(t.getOrient()))&&Mk(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=QH(i,["z"]),JH(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!CN(e))return null;const{axisType:t,componentName:s}=ej(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>ZH(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!CN(t))return;const{axisType:s,componentName:n}=ej(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=oT.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return qH(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):JH(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(nU.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){qH(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!qH(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!JH(this.getOrient())&&this._spec.innerOffset){const t=this._spec;ZH(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=XC(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=XC(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=qH(this.getOrient())?t.fieldX:JH(this.getOrient())?t.fieldZ:t.fieldY,Mk(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:Mk(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(MM.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(qH(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=qH(this._orient)?{x:K(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return bk(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:qH(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:JH(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();bk(this._regions,(e=>{qH(t)?wN(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):ZH(t)?wN(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):JH(t)&&wN(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=qH(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&_(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=qH(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=aT(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ue).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=qH(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?yt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):yt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return MN(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:Mk(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}rU.type=r.cartesianAxis,rU.specKey="axes";class aU{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new VF(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=MN(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>MN(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const oU=(t,e,i,s)=>{const n=yN(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},lU=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,hU=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?fN([s[s.length-1]]):fN([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(g),a=K(g);if(s.length<=f/n){const i=oU(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=dU(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=oU(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!lU(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?hU(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function pU(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=lk(t,!!n),o=lk(r,!!n);const h=ae.distancePP(s,l),c=ae.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=uU(e,t,!1,!!n),o=uU(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=lk(t,!!n),o=lk(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class gU extends Nj{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&nk(this._innerView),this.removeAllChild(!0),this._innerView=DA.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return rk(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=H({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${ZN.grid}-sub`:`${ZN.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=lk(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=uU(t,o,!1,!!a)}const u=DA.path(Object.assign({path:c,z:l},d(r)?H({},this.skipDefault?null:gU.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=lk(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=DA.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ht/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?H({},this.skipDefault?null:gU.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}gU.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class fU{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=OA(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return RA([n[1],-1*n[0]],t*(e?1:-1)*s)}}class mU extends AI{onBind(){var t;const e=_L(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;Vj(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class vU extends AI{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;Vj(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function yU(){EO(),OO(),GO(),QO(),sI.registerBuiltInAnimate("axisEnter",mU),sI.registerBuiltInAnimate("axisUpdate",vU)}EO(),LO();class _U extends gU{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},gU.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=FA,endAngle:r=zA}=this.attribute;i=ok(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=H({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function bU(){EO(),OO(),FO(),ZO()}function xU(){EO(),OO(),_O(),ZO()}G(_U,fU),bU();class SU extends Nj{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},SU.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=DA.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=DA.line;Y(i)[0].cornerRadius&&(t=DA.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=DA.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}SU.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}}},xU();class AU extends SU{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},SU.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=DA.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function kU(){EO(),NO(),ZO(),GO(),QO()}var CU=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-E)):j>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-E/2));const N="right"===_||"end"===_,U="left"===_||"start"===_,V=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:Y(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=T-b[1]-b[3],e=I+E,i=1===j?(t-e)/2+E+I/2:b[0]+E-(T/2+e/2-E)+I/2;if(V(i,"center"),A){const t=i-I/2-E+F/2;A.setAttributes({x:t})}}if(U&&1!==j){const t=T-b[1]-b[3],e=0===j?-t/2+E/2:-T+b[3]+b[1]+E;if(V(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=T-b[1]-b[3],e=0===j?t/2+E/2:t;if(V(e,"right"),A){const t=e-I-E+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===H&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(O.states=m.text);const{visible:W}=a,G=CU(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:M,x:k,y:C}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Ml)}this._bgRect=t}this._textShape=O,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:H({},TU.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}TU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const MU=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(jA.hover,!0),xA(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(jA.hoverReverse,!0)})),s):i},wU=(t,e,i)=>i?(xA(e,(t=>{t.name&&!P(t.states)&&(t.removeState(jA.hoverReverse),t.removeState(jA.hover))})),null):i,EU=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(jA.selected)?(xA(e,(t=>{t.name&&!P(t.states)&&(t.removeState(jA.selectedReverse),t.removeState(jA.selected))})),null):s.name&&!P(s.states)?(s.addState(jA.selected,!0),xA(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(jA.selectedReverse,!0)})),s):i},BU={type:"default",duration:300,easing:"linear"};class PU extends Uj{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=MU(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=wU(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=EU(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=DA.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),Yj(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Gj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(xA(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=Wj(this),{delay:a=0,duration:o=BU.duration,easing:l=BU.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};Vj(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=Wj(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},Xj(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&nk(this._innerView),this.removeAllChild(!0),this._innerView=DA.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(BU)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=DA.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=ZN.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=DA.group({x:0,y:0,pickable:!1});t.name=ZN.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=DA.group({x:0,y:0,pickable:!1});i.name=ZN.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=DA.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=ZN.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=NA;else{const t=this.data[s],e=H({},NA,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=DA.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=ZN.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=NA;else{const i=H({},NA,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=DA.group({x:0,y:0,pickable:!1});return r.name=`${ZN.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=KA(this._getLabelAttribute(t,e,n,i));if(a.name=ZN.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=NA;else{const s=H({},NA,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new TU(Object.assign({},e));i.name=ZN.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return rk(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=Ht/2*(l.x>e.x?1:-1):h=Ht/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=d(y)?H({},QA.label.style,y(t,e,i,s)):y;y=H(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return d(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},xA(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=L(r.attribute),a=L(e.attribute),o=Cb(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},Vj(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const RU={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&hk(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function OU(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function IU(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:RU[n]||RU.parity;if(s.length>=3&&ck(s,r)){do{s=a(s,r)}while(s.length>=3&&ck(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);hk(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),IU(l,s,n,(t=>hk(t,l,r))),IU(h,s,o,(t=>hk(t,h,r)||!(!n||t===l)&&hk(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function DU(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},HU(t,e.attribute.angle)),{angle:zU(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({},jU(t,e.attribute.angle)),{angle:zU(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function zU(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function HU(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=zU(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function jU(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=zU(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function NU(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=sk(h),m=ik(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function UU(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var VU=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=DA.group({zIndex:999});e.name=ZN.axisBreak,e.id=this._getNodeId(`${ZN.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=H({},tk,s),a=null!==(e=r.size)&&void 0!==e?e:tk.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=DA.symbol(Object.assign({x:s.x,y:s.y},o));l.name=ZN.axisBreakSymbol;const h=DA.symbol(Object.assign({x:n.x,y:n.y},o));h.name=ZN.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=DA.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=ZN.background,n.id=this._getNodeId("background"),n.states=H({},QN,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new TU(Object.assign({},t));e.name=ZN.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=VU(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:H({},QN,l),symbol:H({},QN,l)});const d=new SU(c);d.name=ZN.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=VU(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let T,M,{angle:w}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=IA(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else T=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(w&&0!==w){const t=Math.abs(Math.sin(w));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:M},a),state:{text:H({},QN,c.text),shape:H({},QN,c.shape),panel:H({},QN,c.background)}});return B.angle=w,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=VU(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(u(b)&&a){b=IA(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return HU(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return jU(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),FU(i,t),!DU(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=sk(a),l=ik(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=UU(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Xt(c,i))}}else{if(l){const i=UU(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Xt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);NU(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&LU(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=DA.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=ZN.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=GA(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=oi(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}WU.defaultAttributes=QA,G(WU,fU);const GU={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},YU={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},XU={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},KU={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}};class $U extends rU{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new qk}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,cU),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Nk(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),sU(),oT.registerComponent($U.type,$U,!1)},ZU=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function JU(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,tV=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function eV(t,e,i="count"){const s=tV(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const iV=Math.sqrt(50),sV=Math.sqrt(10),nV=Math.sqrt(2);class rV{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=kN(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=qH(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!d(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(X(e)-e[0]);i<=1||k(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(QU),e.sort(QU),{domain:JU(t,e),scope:eV(t,e,i)}}(r,aA(t),this._spec.breaks[0].scopeType);e=aA(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=kN(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-K(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=iV?10:n>=sV?5:n>=nV?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function aV(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function oV(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!Mk(t.type))return fN(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return fN([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=aV(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=aV(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=aV(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=yN(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=yN(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?hV.greedy:hV.parity;for(;l.length>=3&&ck(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;hk(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),oV(t,l,a,(e=>hk(e,t,i))),oV(n,l,o,(e=>hk(e,n,i)||!(!a||e===t)&&hk(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return fN(m)},hV={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&hk(i,t,e)||(i=t,0))))}},cV={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class dV extends rU{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new vC}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!JH(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=qH(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=GC(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=aA(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,lV),t}}dV.type=r.cartesianLinearAxis,dV.specKey="axes",dV.builtInTheme={axis:YU,axisLinear:cV,axisX:XU,axisY:KU},G(dV,rV);const uV=()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),sU(),oT.registerComponent(dV.type,dV)},pV=`${PT}_hide_`;function gV(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const fV=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[pV]&&(gV(t,!0),t[pV]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[pV]=!0,gV(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},mV=()=>{oT.registerGrammarTransform("symbolOverlap",{transform:fV,runType:"afterEncode"})},vV={min:$,max:K,average:fk,sum:gk};function yV(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function _V(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function bV(t,e,i,s){return _V(t,e,i,"min",s)}function xV(t,e,i,s){return _V(t,e,i,"max",s)}function SV(t,e,i,s){return _V(t,e,i,"average",s)}function AV(t,e,i,s){return _V(t,e,i,"sum",s)}const kV=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=yV;if("min"===n?l=bV:"max"===n?l=xV:"average"===n?l=SV:"sum"===n&&(l=AV),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},CV=()=>{oT.registerGrammarTransform("dataSampling",{transform:kV})};class TV extends $H{constructor(){super(...arguments),this.type=CC.line,this.transformerConstructor=lN,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),pj)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),RH("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=KH(this);this._symbolMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),RH("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}TV.type=CC.line,TV.mark=fj,TV.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},TV.transformerConstructor=lN,G(TV,gj);class MV{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{XM(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Oa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];hA(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];hA(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class wV{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{bA(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{nM(e,[{key:t,operations:Mk(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&nM(e,[{key:i.field,operations:Mk(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?jC("colorOrdinal"):jC(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(bA(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),bA(s.domain)?e.reRender=!0:V(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!bA(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Mk(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Mk(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;Mk(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(Mk(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Mk(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Mk(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class EV{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");cz(t,s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");dz(t,s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");dz(t,s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");cz(t,s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&cz(t,i,!0,l):a&&cz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&cz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{dz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&dz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const BV={[r.markPoint]:!0,[r.markLine]:!0,[r.markArea]:!0},PV={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class RV extends xF{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=yA(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:RT,height:OT},this._viewRect={width:RT,height:OT},this._viewBox={x1:0,y1:0,x2:RT,y2:OT},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(PV).some((t=>!u(e[t])))},this._paddingSpec=qC(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new TM(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new MV(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new EV;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=oT.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(PH({},RH("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=j(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=oT.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=oT.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof AF)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof pz))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof pz)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&XM(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=lF(this._spec,this._option,{width:RT,height:OT})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=BC(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new wV(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){uF(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=BC(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=qC(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{uF(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},n={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===r.label||l.type===r.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));n[l.type]&&(n[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(_(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);dF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),uF(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);dF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),uF(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(n).forEach((e=>{if(n[e]){const i=this._spec[e];(_(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(BV[t]&&_(e)&&_(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return BV[t]&&_(e)&&e.length>0&&_(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!BV[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;BV[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];uF(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=KC(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(MM.AFTER_MARK_RENDER_END,e)};this._event.on(MM.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:kM;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(AM(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===dj.dimensionHover||s===dj.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>Ek(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>Ek(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const OV=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)},IV={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class LV{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},IV),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):rT(t,a,c.spec),rT(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=OV(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=OV(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(oT.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(oT.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=oT.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=oT.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=oT.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):iH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=iH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class DV extends LV{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&aT(i,pF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class FV extends DV{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),oF(t)}}const zV=(t,e)=>{const i={nodes:{}},{fields:s}=d(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=oM(t,!0);for(const e in o)for(const i in o[e].nodes)dM(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)cM(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&hM(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class jV{_beforeInit(){this._dataSet&&DM(this._dataSet,"stackSplit",zV)}_initStack(){this._stack=new HV(this),this._stack.init()}}const NV={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:dj.dimensionHover};class UV extends zz{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},NV,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=kM(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}UV.type="dimension-hover",UV.defaultOptions=NV;const VV=()=>{oT.registerInteractionTrigger(UV.type,UV)},WV=()=>{oT.registerComposedEvent(dj.dimensionHover,cj),oT.registerComposedEvent(dj.dimensionClick,nj)},GV=t=>t.fieldX[0],YV=t=>t.fieldY[0],XV=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},KV=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},$V=(t,e)=>t?e?GV:XV:e?YV:KV,qV=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=hj(t,(t=>qH(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=hj(t,(t=>ZH(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Ek(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=ZV(t,i,$V(e,Ek(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=ZV(t,i,$V(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},ZV=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:JV(t,s,i)},JV=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=oj(e,t,"cartesian",null!=i?i:qH(t.getOrient())?GV:YV);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},QV=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(Ek(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(Mk(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=AN(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};eW(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&tW(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),tW=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=eH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},eW=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},iW=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=sW(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},sW=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},nW=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return QV(c,r,e),c.xField.cacheInfo?iW(c.xField):c.yField.cacheInfo?iW(c.yField):void 0},rW=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],aW=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&rW.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(oW(s).every((t=>{var e;return!oH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},oW=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},lW={dom:`${PT}_TOOLTIP_HANDLER_DOM`,canvas:`${PT}_TOOLTIP_HANDLER_CANVAS`},hW={key:"其他",value:"..."};var cW;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(cW||(cW={}));class dW{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=aW(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},hW),t):hW;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&oH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class uW extends dW{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Ek(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const pW=()=>{oT.registerTooltipProcessor("dimension",uW)};class gW extends dW{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,So.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(kM(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const fW=()=>{oT.registerTooltipProcessor("mark",gW)};class mW extends dW{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const vW=()=>{oT.registerTooltipProcessor("group",mW)};class yW extends RV{constructor(){super(...arguments),this.transformerConstructor=FV,this.type="line",this.seriesType=CC.line}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}yW.type="line",yW.seriesType=CC.line,yW.transformerConstructor=FV,G(yW,jV);const _W=[...vj,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class bW extends yj{constructor(){super(...arguments),this.type=bW.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return _W}_getIgnoreAttributes(){return[]}}bW.type="area";const xW=()=>{oT.registerMark(bW.type,bW),XO(),AO(),tN(),sN(),Dz(),oT.registerGraphicComponent("area",Gg)};class SW extends dH{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const AW=Object.assign(Object.assign(Object.assign({},AH),uj),{area:{name:"area",type:"area"}}),kW=()=>{oT.registerAnimation("area",Iz),Lz(),Rz()};class CW extends lN{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=aT({},f.style,g.style),l.state=aT({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function TW(){EO(),NO()}function MW(){return"browser"===e_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const wW={debounce:St,throttle:At};TW();let EW=class t extends Nj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=yt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=yt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=MW(),a="browser"===e_.env?e_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=yt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:wW[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(VA,{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",wW[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===e_.env?e_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:oi(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=oi(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=yt(t[0],0,1),c=yt(t[1],0,1),d=yt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=MW(),e="browser"===e_.env?e_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===e_.env?e_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};EW.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class BW{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ue).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=BW.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(VA,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new EW(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Xt(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Xt(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ht/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ht/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ht,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}HW.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class jW{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};H(s,HW.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new HW(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,H(e,aF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class NW{constructor(){this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class UW extends NW{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class VW extends NW{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function WW(t){t.isBound(jW)||(t.bind(jW).toSelf().inSingletonScope(),t.bind(Wy).toService(jW)),t.isBound(UW)||(t.bind(UW).toSelf(),t.bind(Pf).toService(UW)),t.isBound(VW)||(t.bind(VW).toSelf(),t.bind(Pf).toService(VW))}class GW extends Nj{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}EO(),OO();class YW extends GW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},YW.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}YW.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},EO(),NO();class XW extends GW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},XW.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}XW.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},EO(),_O();class KW extends GW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},KW.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}KW.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},EO(),_O();class $W extends GW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},$W.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=FA,endAngle:s=zA}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}$W.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},EO(),LO();class qW extends GW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},qW.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ce(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}qW.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class ZW{isInValidValue(t){const{startAngle:e=FA,endAngle:i=zA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=FA,endAngle:i=zA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return ak(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function JW(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=JW(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var eG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=ok(n,l,c,e,i);h=DA.path(Object.assign(Object.assign({},a.style),{path:lk(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=DA.circle(t)}h.name=ZN.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=H({},QN,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=eG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;u(_)&&(_=0===r?"end":"middle"),"start"===_?(y="bottom",g={x:s.x,y:s.y-v}):"end"===_&&(y="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:y,textAlign:"center"},l),state:{text:H({},QN,d.text),shape:H({},QN,d.shape),panel:H({},QN,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=JW(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&QW(e,c,i)}else e.AABBBounds.width()>r&&QW(e,r,i)}else o>a.x&&h.x2>n.x2?(QW(e,n.x2-o,i),r&&tG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}iG.defaultAttributes=QA,G(iG,ZW);const sG=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=WA(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=rk(r,ak(s,r,e,n));return o=a,l=ak(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(gt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return fN(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=sG(t,i,e),r=$(s),l=K(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=rG(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return fN(c)},rG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&mN(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var aG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new hG(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):Pj(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=Pj(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=Pj(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=Pj(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?Pj(t.quadrant)?"left":"right":Pj(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(Pj(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),Yj(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Gj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}uG.defaultAttributes={pickable:!1};var pG,gG,fG,mG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(vG,ZW),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(pG||(pG={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(gG||(gG={})),function(t){t.dataZoomChange="dataZoomChange"}(fG||(fG={}));const yG="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",_G={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:yG,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:yG,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},bG={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}},xG=0,SG=1,AG=2,kG=3,CG=4,TG=5,MG=5,wG=999,EG=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var BG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:AG},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:AG},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:xG},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,T;const{orient:M,middleHandlerStyle:w={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(w.visible){const t=(null===(i=w.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t,zIndex:TG},null===(s=w.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=w.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=w.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:TG},w.icon),{pickable:!P&&(null===(h=w.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},bG.horizontal),{zIndex:TG}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},bG.horizontal),{zIndex:TG}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:wG},bG.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:wG},bG.horizontal),{pickable:!P}),"rect")}else{if(w.visible){const t=(null===(g=w.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D,zIndex:TG},null===(f=w.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=w.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=w.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:TG},w.icon),{pickable:!P&&(null===(S=null===(x=w.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},bG.vertical),{zIndex:TG}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(C=B.symbolType)&&void 0!==C?C:"square",zIndex:TG},bG.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:wG},bG.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:wG},bG.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:kG},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:kG},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:SG},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:CG},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return kb(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ue).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=BG(c,["formatMethod"]),{formatMethod:g}=d,f=BG(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,T,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},T={textAlign:EG(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:EG(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:EG(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:EG(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),H({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:MG}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),H({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:MG}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new TU(e),s.name=i,t.add(s)),s}}const RG={debounce:St,throttle:At};class OG extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=pG.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=pG.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=pG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=pG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=pG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===e_.env?e_:this.stage,s=MW();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===pG.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===pG.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===pG.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===pG.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(gG.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(gG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(gG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===pG.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(gG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(gG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:RG[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===e_.env?e_:this.stage,e=MW();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===e_.env?e_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===e_.env?e_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:yt(e+t,0,1),end:yt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=pG.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}kU(),NO(),ZO(),AO(),OO();let IG=class t extends Nj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,y;h.visible?this._isHorizontal?(m=p,v=g-f,y={x:a.x,y:a.y+f}):(m=p-f,v=g,y={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,y=a);const _=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(_+b)/2,y={x:y.x+_/2,y:y.y}):(v-=(_+b)/2,y={x:y.x,y:y.y+_/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new PG(this._getRendererAttrs()),this._interaction=new OG(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(gG.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(gG.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(fG.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(gG.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(fG.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var LG,DG,FG,zG;function HG(){EO(),kU(),SD()}IG.defaultAttributes=_G,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(LG||(LG={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(DG||(DG={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(FG||(FG={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(zG||(zG={}));class jG extends Nj{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=MU(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=wU(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=EU(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:H({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:H({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:H({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=DA.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=DA.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=DA.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),Yj(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Gj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=Wj(this);this.markerAnimate("exit");const n=Wj(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},Xj(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function NG(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function UG(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;Vj(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function VG(t,e,i,s){t&&(UG(t.startSymbol,e,i,s),NG(t).forEach((t=>UG(t,e,i,s))),UG(t.endSymbol,e,i,s))}function WG(t,e,i,s){t&&(UG(t.getTextShape(),e,i,s),UG(t.getBgRect(),e,i,s))}function GG(t,e,i,s){var n,r,a,o;t&&(Vj(t,{fillOpacity:0,strokeOpacity:0},{fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function YG(t,e,i,s){t&&(GG(t.startSymbol,e,i,s),NG(t).forEach((t=>GG(t,e,i,s))),GG(t.endSymbol,e,i,s))}function XG(t,e,i,s){t&&(GG(t.getTextShape(),e,i,s),GG(t.getBgRect(),e,i,s))}function KG(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;UG(t.startSymbol,s,r,n);const h=NG(t);h.forEach((t=>Vj(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),UG(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;UG(t.getTextShape(),e,l,n),UG(t.getBgRect(),e,l,n)}))}function $G(t,e,i,s,n){VG(t,s,i,n),Y(e).forEach((t=>{WG(t,s,i,n)}))}function qG(t,e,i,s,n){UG(t,s,i,n),Y(e).forEach((t=>{WG(t,s,i,n)}))}function ZG(t,e,i,s,n){UG(t,s,i,n),Y(e).forEach((t=>{WG(t,s,i,n)}))}function JG(t,e,i,s,n,r){var a;VG(t,n,s,r),UG(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?WG(i,n,s,r):UG(i,n,s,r)}function QG(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;UG(t.startSymbol,n,o,r);const u=NG(t);u.forEach((t=>Vj(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),UG(e,n+o+l,h,r),UG(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(UG(i.getTextShape(),n+o+l+h+c,d,r),UG(i.getBgRect(),n+o+l+c,d,r)):UG(i,n+o+l+c,d,r)}function tY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?KG(t,e,s,r,a):"fadeIn"===i&&$G(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?KG(t,e,s,n,a):"fadeIn"===i&&$G(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){YG(t,s,i,n),Y(e).forEach((t=>{XG(t,s,i,n)}))}(t,e,i,s,n)}}function eY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&qG(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&qG(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){GG(t,s,i,n),Y(e).forEach((t=>{XG(t,s,i,n)}))}(t,e,i,s,n)}}function iY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&ZG(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&ZG(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){GG(t,s,i,n),Y(e).forEach((t=>{XG(t,s,i,n)}))}(t,e,i,s,n)}}function sY(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?JG(n,r,e,i,s,o):"callIn"===t&&QG(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?JG(n,r,e,i,s,a):"callIn"===t&&QG(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;YG(t,n,s,r),GG(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?XG(i,n,s,r):GG(i,n,s,r)}(n,r,e,t,i,s)}}const nY={type:"clipIn",duration:500,easing:"linear",delay:0},rY={type:"fadeIn",duration:500,easing:"linear",delay:0},aY={type:"callIn",duration:500,easing:"linear",delay:0},oY={type:"fadeOut",duration:500,easing:"linear",delay:0};class lY{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=H({},i,s),c=new TU(Object.assign(Object.assign({},h),{state:{panel:H({},NA,null!==(o=a[n])&&void 0!==o?o:X(a)),text:H({},NA,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=H({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:H({},NA,null!==(a=r[s])&&void 0!==a?a:X(r)),text:H({},NA,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class hY extends jG{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=nY,this.defaultExitAnimation=oY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;JA(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(hY,lY);const cY=.001,dY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:LG.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]}},uY={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},pY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:FG.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},gY={interactive:!0,label:{position:DG.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}},fY={interactive:!0,label:{autoRotate:!0,position:FG.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},mY={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},yY={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function _Y(){bY._animate=tY}HG(),bU(),SD();class bY extends hY{markerAnimate(t){bY._animate&&this._animationConfig&&bY._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},bY.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(AA(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return kA(Math.abs(e),Math.PI/2,cY)||kA(Math.abs(e),3*Math.PI/2,cY)?CA(i,e,t):AA(e)?uY.postiveXAxis[t]:uY.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new SU({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:H({},NA,null==a?void 0:a.line),startSymbol:H({},NA,null==a?void 0:a.lineStartSymbol),endSymbol:H({},NA,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:H({},NA,null==a?void 0:a.line),startSymbol:H({},NA,null==a?void 0:a.lineStartSymbol),endSymbol:H({},NA,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",bY.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(bY.defaultAttributes.label)}}function xY(){SY._animate=eY}bY.defaultAttributes=dY,HG(),FO(),SD();class SY extends jG{markerAnimate(t){SY._animate&&this._animationConfig&&SY._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},SY.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=rY,this.defaultExitAnimation=oY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},vY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;JA(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=DA.polygon(Object.assign({points:e},i));n.states=H({},NA,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",SY.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=H({},NA,null==i?void 0:i.area)),this._updateMarkLabels(SY.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}SY.defaultAttributes=gY,G(SY,lY),HG(),xU(),SD();class AY extends hY{markerAnimate(t){AY._animate&&this._animationConfig&&AY._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},AY.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case FG.arcInnerStart:l=n;case FG.arcOuterStart:l=n;break;case FG.arcInnerEnd:l=r;case FG.arcOuterEnd:l=r;break;case FG.center:case FG.arcInnerMiddle:case FG.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return mY[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new AU({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},NA,null==o?void 0:o.line),startSymbol:H({},NA,null==o?void 0:o.lineStartSymbol),endSymbol:H({},NA,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},NA,null==o?void 0:o.line),startSymbol:H({},NA,null==o?void 0:o.lineStartSymbol),endSymbol:H({},NA,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",AY.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(AY.defaultAttributes.label)}}AY.defaultAttributes=pY,HG(),_O(),SD();class kY extends jG{markerAnimate(t){kY._animate&&this._animationConfig&&kY._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},kY.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=rY,this.defaultExitAnimation=oY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case FG.center:h=(s+n)/2,c=(r+a)/2;break;case FG.arcInnerStart:h=s,c=r;break;case FG.arcOuterStart:h=n,c=r;break;case FG.arcInnerEnd:h=s,c=a;break;case FG.arcOuterEnd:h=n,c=a;break;case FG.arcInnerMiddle:h=s,c=(r+a)/2;break;case FG.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},mY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;JA(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=DA.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=H({},NA,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",kY.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=H({},NA,null==o?void 0:o.area)),this._updateMarkLabels(kY.defaultAttributes.label)}isValidPoints(){return!0}}function CY(){TY._animate=sY}kY.defaultAttributes=fY,G(kY,lY),HG(),bU(),xU(),ZO(),PO(),OO(),SD();class TY extends jG{markerAnimate(t){TY._animate&&this._animationConfig&&TY._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},TY.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=aY,this.defaultExitAnimation=oY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return kA(Math.abs(s),Math.PI/2,cY)||kA(Math.abs(s),3*Math.PI/2,cY)?CA(t,s,n):AA(s)?yY.postiveXAxis[n]:yY.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=zG.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:H({},NA,null==p?void 0:p.textBackground),text:H({},NA,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=H({},NA,null==p?void 0:p.itemContent));const v=AA(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=DA.symbol(Object.assign(Object.assign({},i),r)),o.states=H({},NA,null==s?void 0:s.itemContent)):"text"===n?o=new TU(Object.assign(Object.assign({},i),{state:{panel:H({},NA,null==s?void 0:s.textBackground),text:H({},NA,null==s?void 0:s.itemContent)}})):"richText"===n?(o=DA.richtext(Object.assign(Object.assign({},i),r)),o.states=H({},NA,null==s?void 0:s.itemContent)):"image"===n?(o=DA.image(Object.assign(Object.assign({},i),r)),o.states=H({},NA,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=H({},NA,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=kA(c,0,cY)||kA(d,0,cY),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=qA(e-u,t-d),o=qA(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(LY.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(LY.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===LY.focus||"focus"===o){const s=a.hasState(OY.focus);a.toggleState(OY.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[OY.unSelected,OY.unSelectedHover,OY.focus],t),this._setLegendItemState(e,OY.selected,t)})):(this._setLegendItemState(a,OY.selected,t),this._removeLegendItemState(a,[OY.unSelected,OY.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[OY.selected,OY.selectedHover,OY.focus],t),this._setLegendItemState(e,OY.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(OY.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(OY.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(IY.legendItemClick,a,t);i?(this._removeLegendItemState(a,[OY.selected,OY.selectedHover],t),this._setLegendItemState(a,OY.unSelected,t)):(this._setLegendItemState(a,OY.selected,t),this._removeLegendItemState(a,[OY.unSelected,OY.unSelectedHover],t))}else this._setLegendItemState(a,OY.selected,t),this._removeLegendItemState(a,[OY.unSelected,OY.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[OY.selected,OY.selectedHover],t),this._setLegendItemState(e,OY.unSelected,t))}))}this._dispatchLegendEvent(IY.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,OY.selected),this._removeLegendItemState(e,[OY.unSelected,OY.unSelectedHover])):(this._removeLegendItemState(e,[OY.selected,OY.selectedHover]),this._setLegendItemState(e,OY.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=BY,spaceRow:l=PY,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,T=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),M.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=DA.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(y,t,e,i,s),k=this._handleStyle(b,t,e,i,s),C=this._handleStyle(x,t,e,i,s),T=oi(c);let M;!1===x.visible?(M=DA.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,LY.item,t,M)):(M=DA.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,LY.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?OY.selected:OY.unSelected);const w=DA.group({x:0,y:0,pickable:!1});M.add(w);let E,B=0,P=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);P=_(i)?i[0]||0:i,O=R(v,"space",8);const s=DA.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,LY.itemShape,t,M,S.state),s.addState(e?OY.selected:OY.unSelected),w.add(s)}let I=0;if(d){const e=R(g,"size",10);E=DA.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,LY.focus,t,M),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=KA(Object.assign(Object.assign({x:P/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,LY.itemLabel,t,M,A.state),D.addState(e?OY.selected:OY.unSelected),w.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=KA(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,LY.itemValue,t,M,k.state),r.addState(e?OY.selected:OY.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),w.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-O-I),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),w.add(E));const z=w.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;w.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const j=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:H+T[1]+T[3],U=this._itemHeightByUser||j+T[0]+T[2];return M.setAttributes({width:N,height:U}),E&&E.setAttribute("visible",!1),w.translateTo(-z.x1+T[3],-z.y1+T[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new EY(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},H({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new EY(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new EW(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new EW(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=BY,spaceRow:o=PY}=n,l=this._itemsContainer,{space:h=RY,defaultCurrent:c=1}=r,d=HY(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=DA.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=BY,spaceRow:a=PY}=s,o=this._itemsContainer,{space:l=RY,defaultCurrent:h=1}=n,c=HY(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=DA.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=DA.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(yt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(yt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(OY.selected)?this._setLegendItemState(t,OY.selectedHover,e):this._setLegendItemState(t,OY.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===LY.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(IY.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(OY.unSelectedHover)||t.hasState(OY.selectedHover))&&(i=!0),t.removeState(OY.unSelectedHover),t.removeState(OY.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(OY.unSelectedHover)&&!t.hasState(OY.selectedHover)||(i=!0),t.removeState(OY.unSelectedHover),t.removeState(OY.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===LY.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(IY.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(IY.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==LY.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(IY.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==LY.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(IY.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(OY.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=H({},jY,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(OY.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var UY;function VY(t){return _(t)?t:[t,t]}function WY(t){return t?"ew-resize":"ns-resize"}NY.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:BY,spaceRow:PY,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:RY,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"}(UY||(UY={})),FY();class GY extends Nj{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},GY.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=yt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=MW(),n="browser"===e_.env?e_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=yt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=MW(),n="browser"===e_.env?e_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?yt(t+p,h,c):yt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?yt(t+p,0,c-h):yt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:VY(d)[0],endValue:VY(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=DA.group({x:0,y:0});f.name=UY.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=DA.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=UY.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=DA.group({x:g?v:0,y:g?0:v});f.add(y);const _=DA.group({x:0,y:0});let b;if(_.name=UY.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=DA.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=UY.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=DA.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=UY.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=VY(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":WY(p)},r));if(v.name=UY.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=UY.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":WY(p)},r));if(i.name=UY.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=UY.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=yt(h,i,s);const p=this._isHorizontal;e||(c=i);const f=DA.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=UY.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":WY(p);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(d,e?"end":"start"),b=DA.rect(Object.assign({x:p?Math.min(y,_):0,y:p?0:Math.min(y,_),width:p?Math.abs(_-y):r,height:p?n:Math.abs(_-y),cursor:v},a));b.name=UY.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return DA.symbol(t)}_renderHandlerText(t,e){return DA.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":WY(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=DA.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=DA.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===e_.env?e_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=MW(),e="browser"===e_.env?e_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===UY.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===UY.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===UY.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===UY.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===e_.env?e_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}GY.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},zY(),FY();class YY extends DY{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},YY.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip:y,inverse:_,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function XY(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}YY.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},zY(),FY(),LO();class KY extends DY{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},KY.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,sizeBackground:y,disableTriggerEvent:_,inverse:b}=this.attribute,x=DA.group({x:0,y:0});this._innerView.add(x);const S=new GY({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:XY(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:_,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const C=DA.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);const T=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}KY.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)"}},EO(),QO(),GO();let $Y=class t extends Nj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:T,subtextStyle:M={},width:w,height:E,minWidth:B,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=oi(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||p(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:w)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},UA),C),x:h,y:c,width:null!==(s=null!=t?t:w)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:w,heightLimit:null!==(a=C.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,O-j);if("rich"===k||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:T},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},UA),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(T)?T:[T],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const U=this._subTitle?this._subTitle.AABBBounds.height():0,V=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,V),G=j+(null!==(f=M.height)&&void 0!==f?f:U);if(p(w)&&(W=w),p(E)&&(G=E),p(B)&&WP&&(W=P),p(R)&&GO&&(G=O),z.setAttributes({width:W,height:G,boundsPadding:F}),this._mainTitle){if(p(I)||p(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:L,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(I)||p(M.align)){const t=M.align?M.align:I,e=null!==(y=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==y?y:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=this._mainTitle?p(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};$Y.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 qY={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"}}};EO(),QO(),GO();let ZY=class extends Nj{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=H({},R(qY,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=KA(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=GA(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;k(_)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class JY extends Qp{constructor(t){super(t)}}var QY,tX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(QY||(QY={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(tX||(tX={}));class eX extends Nj{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},eX.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"},eX.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"},eX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},eX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},eX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new JY(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new JY(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new JY(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(QY.OnPlay)},this.pause=()=>{this._dispatchEvent(QY.OnPause)},this.forward=()=>{this._dispatchEvent(QY.OnForward)},this.backward=()=>{this._dispatchEvent(QY.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}eX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},eX.defaultAttributes={[tX.Start]:{},[tX.Pause]:{},[tX.Backward]:{},[tX.Forward]:{}};const iX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},sX=[200,10];var nX,rX;!function(t){t.Default="default",t.Reverse="reverse"}(nX||(nX={})),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"}(rX||(rX={}));const aX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===nX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===nX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),oX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===nX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===nX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),lX=t=>"top"===t||"bottom"===t;class hX extends Nj{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},hX.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Yt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(lX(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:sX[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:sX[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new GY(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=lX(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new eX(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=lX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:sX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(lX(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:lX(this._orient)?t+s:(this._size.width-r)/2,y:lX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:lX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:lX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:lX(this._orient)?t+s:(this._size.width-r)/2,y:lX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function cX(){FY(),EO(),ZO()}hX.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({},iX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},iX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},iX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},iX),{key:"backward",position:"start"})}},cX();class dX extends hX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:nX.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(QY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(QY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(QY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(QY.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(rX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(aX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||oX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===nX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(rX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=e_.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(rX.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(rX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=e_.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(),e_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(rX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,e_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(rX.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(rX.change),this.dispatchCustomEvent(rX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var uX,pX=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};cX();class gX extends hX{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(QY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(QY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(QY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(QY.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(rX.change))},this.play=()=>pX(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(rX.play),this._rafId=e_.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=e_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,e_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(rX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,e_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(rX.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(rX.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(rX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}(uX||(uX={}));const fX={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},mX=5;const vX={debounce:St,throttle:At};EO(),FO();let yX=class t extends Nj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=fX.updateTrigger,endTrigger:i=fX.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(Y(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:vX[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(uX.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=fX.trigger,resetTrigger:i=fX.resetTrigger}=this.attribute;Y(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),Y(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(uX.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(uX.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=mX}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(uX.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(uX.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent(uX.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=mX}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(uX.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(uX.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),Y(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=fX.updateTrigger,endTrigger:s=fX.endTrigger}=this.attribute;Y(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),Y(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=DA.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Re(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};yX.defaultAttributes=fX;const _X=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return H(t,...e,{shape:i.every(u)?void 0:H({},...i),key:s.every(u)?void 0:H({},...s),value:n.every(u)?void 0:H({},...n)})},bX=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},xX={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:HA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:HA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:HA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},SX=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];EO(),NO(),ZO(),QO(),GO();let AX=class t extends Nj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=oi(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",H({symbolType:"circle"},u.shape,{visible:SA(u)&&SA(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:SA(u)&&SA(u.value)},bX(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:SA(u)&&SA(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:SA(u)&&SA(u.value)},bX(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},UA),u.value),visible:SA(u)&&SA(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=SA(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=SA(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!SA(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(SA(n.key)?r+n.key.spacing:0)+(SA(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&($A(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:SA(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),$A(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(SA(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Ch(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(SA(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},bX(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},bX(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},UA),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(SA(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},bX(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},bX(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>SX.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&SA(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=SA(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=WA(d),y=WA(u);let _=0;if(SA(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(SA(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return _X({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return _X({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};AX.defaultAttributes=xX;class kX extends dV{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),bk(this._regions,(t=>{qH(this.getOrient())?wN(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):wN(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=aT({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new VF(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=yi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>MN(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>MN(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,lV),t}transformScaleDomain(){}}kX.type=r.cartesianTimeAxis,kX.specKey="axes",kX.builtInTheme={axis:YU,axisX:XU,axisY:KU};class CX extends dV{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new xC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,lV),t}transformScaleDomain(){}}CX.type=r.cartesianLogAxis,CX.specKey="axes",CX.builtInTheme={axis:YU,axisLinear:cV,axisX:XU,axisY:KU},G(CX,rV);class TX extends dV{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new SC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,lV),t}transformScaleDomain(){}}TX.type=r.cartesianSymlogAxis,TX.specKey="axes",TX.builtInTheme={axis:YU,axisLinear:cV,axisX:XU,axisY:KU},G(TX,rV);class MX extends $H{constructor(){super(...arguments),this.type=CC.area,this.transformerConstructor=CW,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),pj)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(MX.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===qz?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return NC(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return NC(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[NT]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),RH("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),RH("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=KH(this);this._symbolMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),RH("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new SW(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}MX.type=CC.area,MX.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},MX.mark=AW,MX.transformerConstructor=CW,G(MX,gj);class wX extends DV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),oF(t)}}class EX extends RV{constructor(){super(...arguments),this.transformerConstructor=wX,this.type="area",this.seriesType=CC.area}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}EX.type="area",EX.seriesType=CC.area,EX.transformerConstructor=wX,G(EX,jV);function BX(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const PX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:BX(t,e)}),RX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:BX(t,e)}),OX={type:"fadeIn"},IX={type:"growCenterIn"};function LX(t,e){if(!1===e)return{};switch(e){case"fadeIn":return OX;case"scaleIn":return IX;default:return PX(t)}}class DX extends pz{constructor(){super(...arguments),this.type=DX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}DX.type="rect";const FX=()=>{XO(),NO(),Zj("rect",oG),oT.registerMark(DX.type,DX),sI.registerBuiltInAnimate("growHeightIn",HI),sI.registerBuiltInAnimate("growHeightOut",jI),sI.registerBuiltInAnimate("growWidthIn",iL),sI.registerBuiltInAnimate("growWidthOut",sL),sI.registerBuiltInAnimate("growCenterIn",DI),sI.registerBuiltInAnimate("growCenterOut",FI),oT.registerGraphicComponent("rect",og)},zX=Object.assign(Object.assign({},AH),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function HX(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=JC(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[kH]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):NC(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[CH]):NC(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=NC(this._dataToPosX(t),e,i),n=NC(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[TH]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):NC(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[MH]):NC(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=NC(this._dataToPosY(t),e,i),n=NC(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),UX)})}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},VX.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:LH(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(VX.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(DM(this._option.dataSet,"addVChartProperty",nH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};DM(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Oa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:_H.bind(this),call:bH}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new VF(this._option,n)}init(t){super.init(t),this.initRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=MH,s=TH,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=CH,s=kH,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=oM(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)HX(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=NC(this[r](t),l,i),u=NC(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!UC(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&u(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[jT],n=e[NT],r=e[UT],d=e[VT];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?TH:kH],i=e[a?MH:CH];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[jT]:s,[NT]:o}),c?{[UT]:u,[VT]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(og(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>NC(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>NC(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=K(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=KH(this);this._barMark.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),RH(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=JC(this._spec.barWidth,a)),l&&(c=Math.max(c,JC(this._spec.barMinWidth,a))),h&&(c=Math.min(c,JC(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=JC(null!==(l=i[r-1])&&void 0!==l?l:X(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*y+(u-1)*p,n+=g*(y+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const _=Mk(g.type||"band");return d(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}VX.type=CC.bar,VX.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},VX.mark=zX,VX.transformerConstructor=NX;const WX=()=>{CV(),FX(),oT.registerAnimation("bar",((t,e)=>({appear:LX(t,e),enter:PX(t,!1),exit:RX(t,!1),disappear:{duration:Ez.disappear.duration}}))),qU(),uV(),oT.registerSeries(VX.type,VX)};class GX extends DV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),oF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class YX extends RV{constructor(){super(...arguments),this.transformerConstructor=GX,this.type="bar",this.seriesType=CC.bar}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}YX.type="bar",YX.seriesType=CC.bar,YX.transformerConstructor=GX,G(YX,jV);const XX=[10,20],KX=Ck.Linear,$X="circle",qX=Ck.Ordinal,ZX=["circle","square","triangle","diamond","star"],JX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},QX=Object.assign(Object.assign({},AH),{point:{name:"point",type:"symbol"}});class tK extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const eK={sizeField:!0};class iK extends $H{constructor(){super(...arguments),this.type=CC.scatter,this.transformerConstructor=tK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),eK)})}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(_(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${PT}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${PT}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:y(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:KX,defaultRange:XX},"size")}getShapeAttribute(t,e){return u(e)?$X:y(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:qX,defaultRange:ZX},"shape")}initMark(){this._symbolMark=this._createMark(iK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:LH(this._spec,iK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=KH(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),RH("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:y(this._shape)||d(this._shape)?this._shape:$X},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ge});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}iK.type=CC.scatter,iK.mark=QX,iK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},iK.transformerConstructor=tK;const sK=()=>{oN(),oT.registerAnimation("scatter",((t,e)=>Object.assign({appear:JX(0,e)},Bz))),qU(),uV(),oT.registerSeries(iK.type,iK)};class nK extends DV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class rK extends RV{constructor(){super(...arguments),this.transformerConstructor=nK,this.type="scatter",this.seriesType=CC.scatter}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}rK.type="scatter",rK.seriesType=CC.scatter,rK.transformerConstructor=nK,G(rK,jV);class aK extends YH{constructor(){super(...arguments),this.type=CC.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${PT}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const oK=(t,e)=>{const i=d(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[LT]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[sM]=a||r})),s};class lK extends dH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class hK extends pz{constructor(){super(...arguments),this.type=hK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}hK.type="path";const cK=()=>{oT.registerMark(hK.type,hK),XO(),LO(),oT.registerGraphicComponent("path",Ug)},dK=Object.assign(Object.assign({},AH),{area:{name:"area",type:"path"}});class uK{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Fa(i,e):La[i]?(Ia[i]||(Ia[i]=Fa(i,La[i])),Ia[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class pK{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class gK{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function fK(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:pK}:fA(e)||mA(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:gK}:null}const mK={debounce:St,throttle:At};class vK{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=fA(this._renderMode)||mA(this._renderMode),fK(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return fK(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:PM.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:PM.chart,consume:!1}];l.on(...c,mK[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,mK[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||fK(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||fK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:PM.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:PM.chart,consume:!1}];l.on(...c,mK[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,mK[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){fK(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||fK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:PM.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:PM.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||fK(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:PM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||fK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:PM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:PM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:PM.chart,source:BM.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:PM.chart,source:BM.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=mK[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=mK[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:PM.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:PM.chart,source:BM.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:PM.chart,source:BM.chart},this._handleDragMouseUp)}))}}class yK extends YN{constructor(){var e,i;super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:(e=this.type,i=this.id,`${PT}_${i}_${e}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=aT(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new uK(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===CC.map||e.type===CC.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),bk(this._regions,(t=>{var e;if(t.type===CC.map||t.type===CC.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==CC.map&&e.type!==CC.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[sM],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}yK.type=r.geoCoordinate,G(yK,vK);const _K=()=>{oT.registerComponent(yK.type,yK)};class bK extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class xK extends aK{constructor(){super(...arguments),this.type=CC.map,this.transformerConstructor=bK,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),zM.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),DM(this._dataSet,"copyDataView",WM),DM(this._dataSet,"map",oK),DM(this._dataSet,"lookup",sH);const s=zM.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Oa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:()=>({nameMap:this._nameMap,nameProperty:this._nameProperty})}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:sM,fields:()=>this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new VF(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(xK.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:LH(this._spec,xK.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:FT])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:FT]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(PH(null===(t=oT.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),RH("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new lK(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[LT]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[LT],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ge}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ge}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return LT}getActiveMarks(){return[this._pathMark]}}xK.type=CC.map,xK.mark=dK,xK.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},xK.transformerConstructor=bK;const SK=`${PT}_waterfall_default_seriesField`,AK=(t,e)=>{if(!t||0===t.length)return t;const i=d(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let c=Array.from(l[s]);"decrease"===a&&(c=c.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return c.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[KT]=!0:delete t[KT]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===c.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=kK([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const f=g[0];let{start:m,end:v}=CK(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=se(y,e)):(t[c]=+_,_=se(_,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,c,e,i,a),void o.push(s)}u=kK(r,t,s,o,u,c,e,i),o.push(s)})),o};function kK(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=CK(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===SK)&&(t[SK]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function CK(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?hA("total.collectCountField error"):n=e[a].start;o<0?hA("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=se(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const TK=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=d(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},MK={type:"fadeIn"},wK={type:"growCenterIn"};function EK(t,e){switch(e){case"fadeIn":return MK;case"scaleIn":return wK;default:return PX(t,!1)}}class BK extends pz{constructor(){super(...arguments),this.type=BK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return sg(t)}}BK.type="rule";const PK=()=>{oT.registerMark(BK.type,BK),XO(),OO(),oT.registerGraphicComponent("line",sg)},RK=Object.assign(Object.assign({},zX),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),OK=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:IK(t.map((t=>t.latestData)).flat(),e.fields,i)}};function IK(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>IK(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class LK{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new Oa(e instanceof Ra?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),DM(e,"dimensionTree",OK),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class DK extends NX{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const FK={rect:VK,symbol:NK,arc:GK,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=NK(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:YK,line:XK,area:XK,rect3d:VK,arc3d:GK,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function zK(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=FK[t])&&void 0!==i?i:FK.point;return e.series.type===CC.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=jK(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:KK(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function HK(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==CC.sankey){const{formatFunc:t,args:n}=eH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function jK(t){return d(t)?e=>t(e.data):t}function NK(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=jK(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:UK(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function UK(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function VK(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=jK(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:WK(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function WK(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function GK(t){var e;const{labelSpec:i}=t,s=null!==(e=jK(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:y(s)&&s.includes("inside"),{position:n,smartInvert:r}}function YK(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=HK(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Kp(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function XK(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[FT]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function KK(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const $K={calculationMode:!0};class qK extends VX{constructor(){super(...arguments),this.type=CC.waterfall,this.transformerConstructor=DK,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&hM(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),$K)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new LK(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=SK)}getSeriesKeys(){return this._seriesField===SK?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),DM(this._dataSet,"waterfallFillTotal",TK),DM(this._dataSet,"waterfall",AK),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=GM(this.getViewData(),this._dataSet,{name:`${PT}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new VF(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:jT,endAs:NT,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=KH(this);this._barMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),RH("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),RH("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(qK.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return YK(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?NC(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):NC(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,y1:t=>this.totalPositionY(t,"index",this._getLeaderLineCategoryPos(!1,e))},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,x1:t=>this.totalPositionX(t,"index",this._getLeaderLineCategoryPos(!1,e)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&UC([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}qK.type=CC.waterfall,qK.mark=RK,qK.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},qK.transformerConstructor=DK;const ZK=()=>{PK(),FX(),oT.registerAnimation("waterfall",((t,e)=>({appear:EK(t,e),enter:PX(t,!1),exit:RX(t,!1),disappear:{duration:Ez.disappear.duration}}))),Oz(),qU(),uV(),oT.registerSeries(qK.type,qK)},JK=`${PT}_BOX_PLOT_OUTLIER_VALUE`;var QK;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(QK||(QK={}));const t$=(t,e)=>{const i=[],s=d(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=_(e)?e:[e];i.push(...s.map((e=>{const i={[JK]:e};return r.forEach((e=>{i[e]=t[e]})),p(a)&&(i[a]=t[a]),i})))})),i};class e$ extends dH{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===QK.OUTLIER)return this.series.getOutliersField();if(t===QK.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case QK.MIN:return this.series.getMinField();case QK.MAX:return this.series.getMaxField();case QK.MEDIAN:return this.series.getMedianField();case QK.Q1:return this.series.getQ1Field();case QK.Q3:return this.series.getQ3Field();case QK.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===QK.OUTLIER)return e[JK];if(t===QK.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case QK.MIN:return e[this.series.getMinField()];case QK.MAX:return e[this.series.getMaxField()];case QK.MEDIAN:return e[this.series.getMedianField()];case QK.Q1:return e[this.series.getQ1Field()];case QK.Q3:return e[this.series.getQ3Field()];case QK.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[JK])}getDefaultContentList(t){return[{key:this.getContentKey(QK.OUTLIER),value:this.getContentValue(QK.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(QK.MAX),value:this.getContentValue(QK.MAX)},{key:this.getContentKey(QK.Q3),value:this.getContentValue(QK.Q3)},{key:this.getContentKey(QK.MEDIAN),value:this.getContentValue(QK.MEDIAN)},{key:this.getContentKey(QK.Q1),value:this.getContentValue(QK.Q1)},{key:this.getContentKey(QK.MIN),value:this.getContentValue(QK.MIN)},{key:this.getContentKey(QK.SERIES_FIELD),value:this.getContentValue(QK.SERIES_FIELD)}]}}const i$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class s$ extends pz{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.context.diffState!==vF.enter&&t.context.diffState!==vF.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{i$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?H(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?H(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=ug(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e),e.addEventListener("afterAttributeUpdate",(t=>{var i;2===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.type)&&this._syncInheritedStyleAttrs(e,e.attribute)}));const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=oT.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const n$=()=>{oT.registerGraphicComponent("glyph",ug),XO(),MO()},r$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],a$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class o$ extends s${constructor(){super(...arguments),this.type=o$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=r$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=a$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}o$.type="boxPlot";const l$=Object.assign(Object.assign({},AH),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),h$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},c$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},d$=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),u$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,C;if(i&&k(i.center))return i.center;let T,M,w,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=d$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=d$(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,w=null===(p=null===(u=null===(d=null===(c=d$(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=d$(t,"box").attribute.width,i=d$(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=d$(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=d$(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,w=null===(C=null===(A=null===(S=null===(x=d$(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===C?void 0:C.y;const e=d$(t,"box").attribute.height,i=d$(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(M)&&k(w)?(M+w)/2:k(w)?w:k(M)?M:NaN},p$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=d$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=d$(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=d$(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=d$(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=d$(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=d$(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=d$(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=d$(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=d$(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=d$(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(y)&&k(_)?(y+_)/2:k(_)?_:k(y)?y:NaN};class g$ extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return h$(u$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class f$ extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return c$(u$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class m$ extends g${computeAttribute(){return h$(p$)(this.target,this.params,this.params.options)}}class v$ extends f${computeAttribute(){return c$(p$)(this.target,this.params,this.params.options)}}class y$ extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const _$={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class b$ extends $H{constructor(){super(...arguments),this.type=CC.boxPlot,this.transformerConstructor=y$,this._bandPosition=0}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}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),_$)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(b$.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(b$.mark.outlier,{key:LT,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.initBoxPlotMarkStyle()}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>NC(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>NC(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>NC(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>NC(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>NC(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>NC(e(this.getDatumPositionValues(t,JK),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>NC(e(this.getDatumPositionValues(t,JK),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;DM(this._dataSet,"foldOutlierData",t$),DM(this._dataSet,"addVChartProperty",nH);const t=new Oa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${PT}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:_H.bind(this),call:bH}},!1),this._outlierData=new VF(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=JC(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,JC(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,JC(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=JC(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=Mk(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=H({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=KH(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=oT.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(RH("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(PH(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(PH(null===(a=oT.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new e$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}b$.type=CC.boxPlot,b$.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},b$.mark=l$,b$.transformerConstructor=y$;const x$=()=>{n$(),OO(),NO(),oT.registerGraphicComponent("line",(t=>sg(t))),oT.registerGraphicComponent("rect",(t=>og(t))),oT.registerMark(o$.type,o$),oN(),Rz(),qU(),uV(),sI.registerBuiltInAnimate("boxplotScaleIn",g$),sI.registerBuiltInAnimate("boxplotScaleOut",f$),sI.registerBuiltInAnimate("barBoxplotScaleIn",m$),sI.registerBuiltInAnimate("barBoxplotScaleOut",v$),oT.registerSeries(b$.type,b$)};class S$ extends pz{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=S$.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Hg(t):Kp(t)}}S$.type="text";const A$=()=>{oT.registerMark(S$.type,S$),XO(),QO(),GO(),oT.registerGraphicComponent("text",Kp),oT.registerGraphicComponent("richtext",Hg)};class k$ extends dH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const C$=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),T$={type:"fadeIn"},M$=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function w$(t,e){return"fadeIn"===e?T$:C$(t)}const E$=Object.assign(Object.assign({},zX),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class B$ extends NX{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class P$ extends VX{constructor(){super(...arguments),this.type=CC.rangeColumn,this._barMarkType="rect",this._barName=CC.bar,this.transformerConstructor=B$}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(P$.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:LH(this._spec,P$.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(P$.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(P$.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=KH(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),RH("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),RH("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(PH(null===(n=oT.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),RH("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new k$(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}P$.type=CC.rangeColumn,P$.mark=E$,P$.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},P$.transformerConstructor=B$;const R$=()=>{FX(),A$(),oT.registerAnimation("rangeColumn",((t,e)=>({appear:w$(t,e),enter:C$(t),exit:M$(t),disappear:{duration:Ez.disappear.duration}}))),Oz(),qU(),uV(),oT.registerSeries(P$.type,P$)};var O$,I$;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(O$||(O$={})),function(t){t.middle="middle",t.start="start",t.end="end"}(I$||(I$={}));class L$ extends dH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const D$=Object.assign({},AW);class F$ extends MX{constructor(){super(...arguments),this.type=CC.rangeArea}initMark(){this._areaMark=this._createMark(F$.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new L$(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}F$.type=CC.rangeArea,F$.mark=D$;class z$ extends YH{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=jN,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Mk(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:[]};Mk(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&XH(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function H$(t){return _A(t)?Number.parseFloat(t):0}const j$=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&N$(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[BN],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[BN]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},N$=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===H$(t[e])))||!i&&0===t.reduce(((t,i)=>t+H$(i[e])),0)));function U$(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const V$=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:U$(t,!0,$M.appear)}),W$={type:"fadeIn"},G$=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:U$(t,!0,$M.enter)}),Y$=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:U$(t,!0,$M.exit)});function X$(t,e){if(!1===e)return{};switch(e){case"fadeIn":return W$;case"growRadius":return V$(Object.assign(Object.assign({},t),{growField:"radius"}));default:return V$(Object.assign(Object.assign({},t),{growField:"angle"}))}}class K$ extends pz{constructor(t,e){super(t,e),this.type=$$.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[LN])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class $$ extends K${constructor(){super(...arguments),this.type=$$.type}}$$.type="arc";const q$=()=>{XO(),_O(),Zj("arc",cG),sI.registerBuiltInAnimate("growRadiusIn",QI),sI.registerBuiltInAnimate("growRadiusOut",tL),sI.registerBuiltInAnimate("growAngleIn",II),sI.registerBuiltInAnimate("growAngleOut",LI),oT.registerGraphicComponent("arc",Kg),oT.registerMark($$.type,$$)},Z$=Object.assign(Object.assign({},AH),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class J$ extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=aT({},this._theme,i,t);const n=(t,e)=>aT({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const Q$=`${PT}_LABEL_VISIBLE`,tq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},eq={outerRadius:!0};class iq extends z${constructor(){super(...arguments),this.transformerConstructor=J$,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:XC(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:XC(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=zN,this._endAngle=HN,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[LN];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;DM(this._dataSet,"pie",j$),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:RN,asEndAngle:ON,asRatio:PN,asMiddleAngle:LN,asRadian:FN,asQuadrant:DN,asK:IN,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Oa(this._dataSet,{name:`${PT}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new VF(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},iq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:DT,groupKey:this._seriesField,isSeriesMark:!0},{morph:LH(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Ak(RN)(t)}endAngleScale(t){return Ak(ON)(t)}_computeLayoutRadius(){return NN((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:VC(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:VC(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Ak(Q$).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),eq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),tq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[LN];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===$M.appear)return this._startAngle;if(i===$M.disappear)return this._endAngle;const r=[$M.disappear,$M.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[LT];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[LT]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[LT])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[LT])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[LN]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[LN]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[LN]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[LN]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=PH(null===(i=oT.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}iq.transformerConstructor=J$,iq.mark=Z$,iq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class sq extends iq{constructor(){super(...arguments),this.type=CC.pie}}sq.type=CC.pie;const nq=()=>{q$(),oT.registerAnimation("pie",((t,e)=>({appear:X$(t,e),enter:G$(t),exit:Y$(t),disappear:{duration:Ez.disappear.duration}}))),oT.registerAnimation("emptyCircle",((t,e)=>({appear:X$(t,e)}))),oT.registerSeries(sq.type,sq)};function rq(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const aq=t=>({type:rq(t.growField),options:{overall:!0}}),oq={type:"fadeIn"},lq=t=>({type:rq(t.growField)}),hq=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function cq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return oq;case"growAngle":return aq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return aq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const dq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class uq extends z${_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),dq)})}getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(NT),this.setInnerRadiusField(jT)}setValueFieldToPercent(){this.setRadiusField(VT),this.setInnerRadiusField(UT)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const pq=Object.assign(Object.assign({},AH),{rose:{name:"rose",type:"arc"}});class gq extends HH{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class fq extends iU{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=oT.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=zN,this._endAngle=HN,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),bk(this._regions,(t=>{"radius"===this.getOrient()?wN(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):wN(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:XC(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:XC(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:AN(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){bk(this._regions,(t=>{"radius"===this.getOrient()?wN(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):wN(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Mk(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Mk(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>MN(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ae.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return NN((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=jN,e=0;const i=this.getChart().getSpec();return bk(this.getRegions(),(s=>{const n=s;if(r=n.type,[CC.rose,CC.radar,CC.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(aT({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(aT({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}fq.type=r.polarAxis,fq.specKey="axes";const mq={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},vq={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class yq extends fq{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new vC}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,lV),t}}yq.type=r.polarLinearAxis,yq.specKey="axes",yq.builtInTheme={axis:YU,axisLinear:cV,axisAngle:vq,axisRadius:mq},G(yq,rV);const _q=()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),oT.registerGraphicComponent(XN.circleAxis,((t,e)=>new iG(t,e))),oT.registerGraphicComponent(KN.circleAxisGrid,((t,e)=>new vG(t,e))),sU(),oT.registerComponent(yq.type,yq)};class bq extends fq{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new qk}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,nG),t}transformScaleDomain(){}}bq.type=r.polarBandAxis,bq.specKey="axes",bq.builtInTheme={axis:YU,axisBand:GU,axisAngle:vq,axisRadius:mq},G(bq,aU);const xq=()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),oT.registerGraphicComponent(XN.circleAxis,((t,e)=>new iG(t,e))),oT.registerGraphicComponent(KN.circleAxisGrid,((t,e)=>new vG(t,e))),sU(),oT.registerComponent(bq.type,bq)};class Sq extends uq{constructor(){super(...arguments),this.type=CC.rose,this.transformerConstructor=gq,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(Sq.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:LH(this._spec,Sq.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>NC(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=NC(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),RH("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}Sq.type=CC.rose,Sq.mark=pq,Sq.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},Sq.transformerConstructor=gq;const Aq=()=>{oT.registerSeries(Sq.type,Sq),q$(),oT.registerAnimation("rose",((t,e)=>({appear:cq(t,e),enter:lq(t),exit:hq(t),disappear:{duration:Ez.disappear.duration}}))),xq(),_q()};class kq extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,dk(this._fromAngle,this._toAngle)&&dk(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Cq extends Tz{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!_k(t)&&!_k(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const Tq=t=>({type:"in"===t?"fadeIn":"fadeOut"});function Mq(t,e,i){return"fadeIn"===e?Tq(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function wq(t,e,i){return"fadeIn"===e?Tq(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const Eq=(t,e)=>({custom:kz,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),Bq=Object.assign(Object.assign(Object.assign({},AH),uj),{area:{name:"area",type:"area"}});class Pq extends uq{constructor(){super(...arguments),this.type=CC.radar,this.transformerConstructor=lN,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(Pq.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:Zz,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?oe(this._spec.startAngle):zN},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(PH(null===(s=oT.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),RH("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=oT.getAnimationInKey(e);t.setAnimationConfig(PH(null==i?void 0:i(n,r),RH(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&_(a)?a[0]:a}}}Pq.type=CC.radar,Pq.mark=Bq,Pq.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Pq.transformerConstructor=lN,G(Pq,gj);const Rq=()=>{oT.registerSeries(Pq.type,Pq),xW(),rN(),oN(),oT.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:Mq(t,e,"in"),enter:Mq(t,e,"in"),exit:Mq(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:Ez.disappear.duration},update:[{channel:["points","center"],custom:Cq,customParameters:t,duration:Ez.update.duration,easing:Ez.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),oT.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:wq(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:Ez.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:kq,customParameters:t,duration:Ez.update.duration,easing:Ez.update.easing}]}))),oT.registerAnimation("radarGroup",((t,e)=>({appear:Eq(t,"in"),disappear:{duration:Ez.disappear.duration}}))),_O(),xq(),_q()};class Oq extends dH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>yi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const Iq=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(PT)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[LT]:r,[DT]:`${s}_${e}`})),r++}))})),n},Lq={fill:"#bbb",fillOpacity:.2},Dq=Object.assign(Object.assign({},AH),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),Fq={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},zq={grid:{background:!0}};class Hq extends $H{constructor(){super(...arguments),this.type=CC.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Fq),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),zq)})}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),DM(this._option.dataSet,"objFlat",Iq),DM(this._option.dataSet,"copyDataView",WM),FM(this._option.dataSet,"dataview",Ea),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(aT(Lq,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(Hq.mark.group),this._containerMark=this._createMark(Hq.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(Hq.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(Hq.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(Hq.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(Hq.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(Hq.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(Hq.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!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",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:FT}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new zC).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:FT}}initTooltip(){this._tooltipHelper=new Oq(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}Hq.type=CC.dot,Hq.mark=Dq,Hq.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class jq extends dH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>yi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const Nq=Object.assign(Object.assign({},AH),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),Uq=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class Vq extends $H{constructor(){super(...arguments),this.type=CC.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),DM(this._option.dataSet,"linkDotInfo",Uq),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(Vq.mark.group),this._containerMark=this._createMark(Vq.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(Vq.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(Vq.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:FT}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new jq(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}Vq.type=CC.link,Vq.mark=Nq,Vq.builtInTheme={link:{arrow:{style:{size:10}}}};const Wq=Object.assign(Object.assign({},AH),{group:{name:"group",type:"group"}}),Gq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class Yq extends z${constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?jT:tM],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?NT:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Gq)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?oe(n):zN;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):HN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=NC(this.angleAxisHelper.dataToPosition([t[jT]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=NC(this.angleAxisHelper.dataToPosition([t[NT]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?NC(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(Yq.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return Kg(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[og({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const qq=()=>{oT.registerAnimation("circularProgress",((t,e)=>({appear:$q(t,e),enter:{type:"growAngleIn"},disappear:{duration:Ez.disappear.duration}})))};class Zq extends HH{constructor(){super(...arguments),this._supportStack=!0}}const Jq={cornerRadius:!0,roundCap:!0};class Qq extends Yq{constructor(){super(...arguments),this.type=CC.circularProgress,this.transformerConstructor=Zq,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Jq)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(Qq.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:LH(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(Qq.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?jT:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?NT:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),RH("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),RH("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}Qq.type=CC.circularProgress,Qq.mark=Xq,Qq.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},Qq.transformerConstructor=Zq;const tZ=()=>{oT.registerSeries(Qq.type,Qq),q$(),qq(),Oz(),xq(),_q()};function eZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const iZ={type:"fadeIn"};function sZ(t,e="grow"){return!1===e?{}:"fadeIn"===e?iZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:eZ(t)}))(t)}class nZ extends dH{enableByType(t){return"dimension"!==t}}const rZ=Object.assign(Object.assign({},AH),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),aZ={bandWidth:!0,cornerRadius:!0,clamp:!0},oZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class lZ extends $H{constructor(){super(...arguments),this.type=CC.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),aZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),oZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(lZ.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return NC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return NC(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?NC(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return NC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return NC(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?NC(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(lZ.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return NC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return NC(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),RH("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),RH("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new nZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}lZ.type=CC.linearProgress,lZ.mark=rZ,lZ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const hZ=()=>{FX(),oT.registerAnimation("linearProgress",((t,e)=>({appear:sZ(t,e),enter:sZ(t),disappear:{duration:Ez.disappear.duration}}))),Oz(),oT.registerSeries(lZ.type,lZ)},cZ=[0],dZ=[20,40],uZ=[200,500],pZ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},gZ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class fZ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const mZ=`${PT}_WORD_CLOUD_TEXT`,vZ=Object.assign(Object.assign({},AH),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),yZ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class _Z extends YH{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=dZ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:uZ,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:cZ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?mZ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:pZ},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||gA(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:cZ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!gZ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new fZ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(_Z.mark.word,{key:DT,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(_Z.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(PH(oT.getAnimationInKey("wordCloud")(n,s),RH("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new zC).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:FT])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new vC).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new vC).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[LT])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:DT,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:e_.createCanvas.bind(e_),getTextBounds:xf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Rg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}_Z.mark=vZ,_Z.builtInTheme={wordCloud:yZ};function bZ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||Ez.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=xZ(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},SZ=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=SZ(t.children,e,t,n))})),s},AZ=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=AZ(t.children,e,t,n)),n=e(t,s,i,n)})),n},kZ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):kZ(t.children,e,i)))})),e};function CZ(t,e){let i,s;if(wZ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function wZ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*T*w))/(2*T):w/M);return{x:s+S+A*E,y:n+k+C*E,radius:E}}function RZ(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function OZ(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function IZ(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function LZ(t){return{_:t,next:null,prev:null}}function DZ(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];RZ(n,s,r);let a,o,l,h,c,d,u,p=LZ(s),g=LZ(n),f=LZ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=xZ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:jZ.defaultOpionts.nodeSort;SZ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)SZ([o],FZ(h)),AZ([o],zZ(this._getPadding,.5,a)),SZ([o],HZ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);SZ([o],FZ(jZ.defaultOpionts.setRadius)),AZ([o],zZ(Ot,1,a)),c&&AZ([o],zZ(this._getPadding,o.radius/t,a)),SZ([o],HZ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}jZ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const NZ=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=NZ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function UZ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){NZ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function VZ(t){return t.depth}function WZ(t,e){return e-1-t.endDepth}const GZ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),YZ=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},XZ={left:VZ,right:WZ,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:VZ,end:WZ},KZ=bt(0,1);class $Z{constructor(t){this._ascendingSourceBreadth=(t,e)=>GZ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>GZ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},$Z.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):XZ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return UZ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[YZ(s[t.source]),YZ(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=$(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(y(e)){const t=yt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*KZ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(GZ),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(GZ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];qZ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),ZZ);const s=_(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},JZ.defaultOpionts,t):Object.assign({},JZ.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Rt(this.options.center[0],t.width),s=t.y0+Rt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Rt(t,n))):Rt(r,n),h=_(a),c=this.options.gapRadius,d=h?a.map((t=>Rt(t,n))):Rt(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Rt(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(_(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=xZ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ce({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function QZ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,y=Math.max(v/x,x/m),y>_){f-=h;break}_=y}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:qZ,slice:QZ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?QZ:qZ)(t,e,i,s,n)}};class iJ{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},iJ.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?tJ(this.options.aspectRatio):null!==(e=eJ[this.options.splitType])&&void 0!==e?e:eJ.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=xZ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function sJ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ui?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=sJ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=nJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function dJ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*uJ({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},gJ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||aJ,s=e.lossFunction||rJ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];pi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:pJ(f),arcs:f})}))},fJ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:mJ,triangle:mJ,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 mJ(){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 vJ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const yJ=t=>fJ[t]?fJ[t]():fJ.circle(),_J=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function bJ(t){return d(t)?t:function(){return t}}class xJ{constructor(t){var e,i;switch(this.options=H({},xJ.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=yJ(this.options.shape),this.getText=null!==(e=bJ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=bJ(this.options.fontWeight),this.getTextFontSize=bJ(this.options.fontSize),this.getTextFontStyle=bJ(this.options.fontStyle),this.getTextFontFamily=bJ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>_J(10,50);break;case"random-light":this.getTextColor=()=>_J(50,90);break;default:this.getTextColor=bJ(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return oe(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():Mt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class AJ extends xJ{constructor(t){var e;super(H({},AJ.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<=AJ.defaultOptions.minFontSize&&(this.options.minFontSize=AJ.defaultOptions.minFontSize),this.spiral=y(this.options.spiral)?null!==(e=SJ[this.options.spiral])&&void 0!==e?e:SJ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=bJ(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=vJ(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,y=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;y[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(MJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(TJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}MJ(p,this._size)&&(p=wJ(p,this._size))}else if(MJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||CJ(p,i))&&(!i||!kJ(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function kJ(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function CJ(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,MJ=(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 wJ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},BJ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},PJ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},RJ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=vJ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=yJ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)PJ(n,BJ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)PJ(n,BJ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)PJ(n,BJ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)PJ(n,BJ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)PJ(n,BJ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=BJ({x:l,y:h},o,-Math.PI/2,5),e=BJ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);PJ(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let YG=class t extends OG{constructor(e){super(j({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)B(C,w,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?NG(t,o,l.width,l.height,h):"geometric"===t.type&&GG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=BG(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};YG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class XG extends OG{constructor(t){super(j({},XG.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}XG.defaultOptions={enlarge:!1};const KG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},qG=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.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?ZG(t.fontFamily):"sans-serif",d=t.fontStyle?ZG(t.fontStyle):"normal",u=t.fontWeight?ZG(t.fontWeight):"normal",p=t.rotate?ZG(t.rotate):0,g=ZG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?ZG(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},KG),t.as):KG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?ZG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=QG(tY(t,l),C);w=i=>e(t(i))}let E=DG;"fast"===t.layoutType?E=XG:"grid"===t.layoutType&&(E=YG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},ZG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],JG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),QG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=JG(t[0]),n=JG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(JG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},tY=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function eY(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{sO.registerGrammarTransform("wordcloud",{transform:qG}),GN(),sO.registerAnimation("wordCloud",((t,e)=>({appear:RW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:$D.disappear.duration}}))),sO.registerSeries(iY.type,iY)},nY=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:f=!1,isCone:m=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(y*v)&&0!==v?y/v:0,S=k(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},rY=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},aY=`${wO}_FUNNEL_TRANSFORM_RATIO`,oY=`${wO}_FUNNEL_REACH_RATIO`,lY=`${wO}_FUNNEL_HEIGHT_RATIO`,hY=`${wO}_FUNNEL_VALUE_RATIO`,cY=`${wO}_FUNNEL_LAST_VALUE_RATIO`,dY=`${wO}_FUNNEL_NEXT_VALUE_RATIO`,uY=`${wO}_FUNNEL_LAST_VALUE`,pY=`${wO}_FUNNEL_CURRENT_VALUE`,gY=`${wO}_FUNNEL_NEXT_VALUE`,fY=`${wO}_FUNNEL_TRANSFORM_LEVEL`;class mY extends TF{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[oY])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class vY extends jD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class _Y extends vY{constructor(){super(...arguments),this.type=_Y.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}_Y.type="polygon";const yY=()=>{sO.registerMark(_Y.type,_Y),hM(),sM(),kw.registerBuiltInAnimate("growPointsOut",xC),sO.registerGraphicComponent("polygon",cf)},bY=Object.assign(Object.assign({},zF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class xY extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class SY extends ez{constructor(){super(...arguments),this.type=xR.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=xY,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;EI(this._dataSet,"funnel",nY),EI(this._dataSet,"funnelTransform",rY);const t=new Pa(this._dataSet,{name:`${wO}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new OD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:pY,asTransformRatio:aY,asReachRatio:oY,asHeightRatio:lY,asValueRatio:hY,asNextValueRatio:dY,asLastValueRatio:cY,asLastValue:uY,asNextValue:gY,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:fY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},SY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:qF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},SY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(SY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(SY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new mY(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&qy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&qy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*_R(oY).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),XF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(YF(sO.getAnimationInKey("fadeInOut")(),XF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(YF(sO.getAnimationInKey("funnel")({},o),XF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(YF(null===(a=sO.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),XF("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[cY])/2:this._getSecondaryAxisLength(t[hY])/2,n=this._getSecondaryAxisLength(t[hY])/2):(s=this._getSecondaryAxisLength(t[hY])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[dY])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[fY])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[LO]===t[LO]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{yY(),GN(),iN(),sO.registerSeries(SY.type,SY),sO.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},qD))),sO.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:sC,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),JD()},kY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},MY=t=>{const e=t.filter((t=>t.context.diffState===lD.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},TY=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=$(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},wY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MY(i.parent.children),a=TY(r,s,n);return kY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MY(i.parent.children),a=TY(r,s,n);return kY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),CY=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=$(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},EY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MY(i.parent.children),a=CY(r);return kY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MY(i.parent.children),a=CY(r);return kY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),BY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},PY=(t,e={})=>{if(!t)return[];const i=[];return FW(t,i,e),i},LY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new dG(i).layout(t,{width:s,height:n})};class RY extends TF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var OY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(OY||(OY={}));const IY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===OY.DrillDown){return Y(hI(t,n,s,"children"))}if(i.type===OY.DrillUp){const e=cI(t,n,s,"children");if(e)return Y(e)}return t};class DY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=jV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;EI(t,"drillFilter",IY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:OY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:OY.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:OY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:OY.DrillUp},model:this}),r}}const FY=Object.assign(Object.assign({},zF),{sunburst:{name:"sunburst",type:"arc"}}),zY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:PF,operations:["max","min","values"]}),t.push({key:LF,operations:["values"]}),t),jY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class HY extends aU{constructor(){super(...arguments),this.type=xR.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:LF),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:LO},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),EI(this._dataSet,"sunburstLayout",LY),EI(this._dataSet,"flatten",PY),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return zY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(EI(t.dataSet,"addVChartProperty",yF),t.transform({type:"addVChartProperty",options:{beforeCall:DF.bind(this),call:FF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(HY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(HY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new RY(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),XF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),XF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}HY.type=xR.sunburst,HY.mark=FY,HY.builtInTheme={sunburst:jY},G(HY,DY);const VY=()=>{sO.registerSeries(HY.type,HY),_U(),GN(),JD(),sO.registerAnimation("sunburst",((t,e)=>({appear:BY(0,e),enter:wY(t),exit:EY(t),disappear:{duration:$D.disappear.duration}})))},NY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new QW(i).layout(t,{width:s,height:n})};class UY extends TF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const WY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},GY=Object.assign(Object.assign({},zF),{circlePacking:{name:"circlePacking",type:"arc"}});class YY extends nz{constructor(){super(...arguments),this.type=xR.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:LF),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:LO},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),EI(this._dataSet,"circlePackingLayout",NY),EI(this._dataSet,"flatten",PY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(EI(t.dataSet,"addVChartProperty",yF),t.transform({type:"addVChartProperty",options:{beforeCall:DF.bind(this),call:FF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(YY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(YY.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return zY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new UY(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),XF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),XF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}YY.type=xR.circlePacking,YY.mark=GY,YY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(YY,DY);const XY=()=>{sO.registerSeries(YY.type,YY),_U(),GN(),ZD(),sO.registerAnimation("circlePacking",((t,e)=>({appear:WY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:$D.disappear.duration}})))},$Y=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&$Y(t,e.children,i)}))},KY=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},qY=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new lG(e),r=[];return r.push(n.layout(s,i)),r},ZY=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},JY=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class QY extends TF{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const tX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),eX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:tX(t),iX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class sX extends Iw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class nX extends Iw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const rX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},aX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class oX extends TN{constructor(){super(...arguments),this.type=oX.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?aX:rX,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}oX.type="linkPath";const lX=Object.assign(Object.assign({},zF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class hX extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const cX=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class dX extends nz{constructor(){super(...arguments),this.type=xR.sankey,this.transformerConstructor=hX,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ve,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=vI(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=vI(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=vI(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),cX(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=vI(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=vI(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=vI(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=vI(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=vI(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void cX(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void cX(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(vI(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=vI(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=vI(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void cX(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void cX(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void cX(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){EI(this._dataSet,"sankeyLayout",qY),EI(this._dataSet,"sankeyFormat",KY),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;EI(o,"sankeyNodes",ZY),EI(o,"flatten",PY);const l=new Pa(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:OF.bind(this),call:IF}},!1),this._nodesSeriesData=l,EI(o,"sankeyLinks",JY);const h=new Pa(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:OF.bind(this),call:IF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(dX.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(dX.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=mF(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),XF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),XF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:kI.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(vI(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new QY(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new OR;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return $Y(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}dX.type=xR.sankey,dX.transformerConstructor=hX,dX.mark=lX,dX.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const uX=()=>{hV(),wN(),eM(),sO.registerGraphicComponent("path",(t=>tf(t))),sO.registerMark(oX.type,oX),GN(),sO.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:eX(t,e)},qD))),sO.registerAnimation("sankeyLinkPath",((t,e)=>({appear:iX(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:$D.disappear.duration}}))),kw.registerBuiltInAnimate("linkPathGrowOut",nX),kw.registerBuiltInAnimate("linkPathGrowIn",sX),JD(),sO.registerSeries(dX.type,dX)},pX=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=PY(n);return i=CF([{latestData:r}],e),i};class gX extends TF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const fX=Object.assign(Object.assign({},zF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),mX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class vX extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const _X=(t,e)=>{if(e.getViewBox()){const i=new fG(e).layout(t,e.getViewBox()),s=[];return FW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[LF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class yX extends nz{constructor(){super(...arguments),this.type=xR.treemap,this.transformerConstructor=vX,this._categoryField="name",this._valueField="value",this._viewBox=new Ve,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:LF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new We),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:LO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),EI(this._dataSet,"treemap",_X),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(EI(this._rawData.dataSet,"addVChartProperty",yF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:DF.bind(this),call:FF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=pX([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){EI(this._dataSet,"hierarchyDimensionStatistics",pX),EI(this._dataSet,"flatten",PY);const i=new Pa(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 zY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(yX.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(yX.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("treemap"))||void 0===e?void 0:e(),XF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new gX(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(bI.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(bI.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}yX.type=xR.treemap,yX.mark=fX,yX.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},yX.transformerConstructor=vX,G(yX,DY),G(yX,VV);const bX=()=>{sO.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),sO.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),hV(),GN(),sO.registerAnimation("treemap",((t,e)=>({appear:mX(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:$D.disappear.duration}}))),JD(),sO.registerSeries(yX.type,yX)},xX=Object.assign(Object.assign({},oW),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),SX=Object.assign(Object.assign({},zF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),AX={type:"fadeIn"};function kX(t,e){return"fadeIn"===e?AX:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class MX extends tz{constructor(){super(...arguments),this._supportStack=!1}}class TX extends TF{enableByType(t){return"dimension"!==t}}const wX="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",CX={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:wX,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:wX,fill:"#ddd"}}};class EX extends lW{constructor(){super(...arguments),this.type=xR.gaugePointer,this.transformerConstructor=MX,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(EX.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},EX.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(EX.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new TX(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=$(e),s=K(e),n=_t(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),XF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}EX.type=xR.gaugePointer,EX.mark=SX,EX.builtInTheme={gaugePointer:CX},EX.transformerConstructor=MX;const BX=()=>{sO.registerSeries(EX.type,EX),OV(),hV(),sO.registerAnimation("gaugePointer",((t,e)=>{const i=kX(t,e);return{appear:i,enter:i,disappear:{duration:$D.disappear.duration}}})),HU(),zU()};class PX extends tz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class LX extends lW{constructor(){super(...arguments),this.type=xR.gauge,this.transformerConstructor=PX,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();EI(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[ZO]=t[this._angleField[0]],t[qO]=e>0?i[e-1][ZO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(LX.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(LX.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?FR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?FR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[qO])?this.angleAxisHelper.dataToPosition([t[qO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[ZO]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),XF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}LX.type=xR.gauge,LX.mark=xX,LX.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},LX.transformerConstructor=PX;class RX extends jD{constructor(){super(...arguments),this.type=RX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Eg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}RX.type="cell";function OX(t){return!1===t?{}:{type:"fadeIn"}}class IX extends TF{enableByType(t){return"dimension"!==t}}const DX=Object.assign(Object.assign({},zF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class FX extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class zX extends nz{constructor(){super(...arguments),this.type=xR.heatmap,this.transformerConstructor=FX}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(zX.mark.cell,{isSeriesMark:!0},{morph:qF(this._spec,zX.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(zX.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ai(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=sz(this);this._cellMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),XF("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new IX(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}zX.type=xR.heatmap,zX.mark=DX,zX.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},zX.transformerConstructor=FX;const jX=()=>{GN(),sO.registerMark(RX.type,RX),sO.registerGraphicComponent("symbol",Eg),hM(),dM(),IB(),sO.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},qD),{appear:OX(e)}))),jj(),Ij(),sO.registerSeries(zX.type,zX)},HX=Object.assign(Object.assign({},zF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),VX=`${wO}_CORRELATION_X`,NX=`${wO}_CORRELATION_Y`,UX=`${wO}_CORRELATION_SIZE`,WX=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=oe(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=oe(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Lt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Lt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Lt(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+Lt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Pt(e.field),C=t.map(w),[E,B]=Ot(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Pt(e.radiusField),R=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>R;if(L){const[i,s]=L!==w?Ot(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=GX(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),YX({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,a>D?a=I:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},YX=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[PO]:null==n?void 0:n[PO],[RO]:null==n?void 0:n[RO]}};class $X extends TN{constructor(){super(...arguments),this.type=$X.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=_t(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}$X.type="ripple";const KX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class qX extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class ZX extends aU{constructor(){super(...arguments),this.type=xR.correlation,this.transformerConstructor=qX,this._viewBox=new Ve}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;EI(this._dataSet,"correlation",WX);const s=new Ba;BI(s,"dataview",wa),EI(s,"correlationCenter",XX);const n=new Pa(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new OD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const e=this._createMark(ZX.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:PO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(ZX.mark.ripplePoint,{key:PO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(ZX.mark.centerPoint,{key:PO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[VX],y:t=>t[NX],size:t=>t[UX],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),XF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}ZX.type=xR.correlation,ZX.mark=HX,ZX.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},ZX.transformerConstructor=qX;const JX=()=>{Bz(),wN(),dM(),sO.registerMark($X.type,$X),sO.registerGraphicComponent("symbol",(t=>Eg(t))),sO.registerSeries(ZX.type,ZX),sO.registerAnimation("correlation",((t,e)=>Object.assign({appear:KX(0,e)},KD)))},QX=Object.assign(Object.assign({},zF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class t$ extends TN{constructor(){super(...arguments),this.type=t$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}t$.type="liquid";const e$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class i$ extends TF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class s$ extends ez{constructor(){super(...arguments),this.type=xR.liquid,this.transformerConstructor=Pz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Dg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Eg({x:s,y:n,size:r,symbolType:e$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=YR(this._spec.outlineMargin),this._paddingSpec=YR(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(s$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(s$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(s$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(s$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new i$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),XF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),XF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=IM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}s$.type=xR.liquid,s$.mark=QX,s$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},s$.transformerConstructor=Pz;const n$=t=>Y(t).join(",");class r$ extends TF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>n$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>n$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const a$=Object.assign(Object.assign({},zF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class o$ extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const l$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?wG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class h$ extends ez{constructor(){super(...arguments),this.type=xR.venn,this.transformerConstructor=o$,this._viewBox=new Ve}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:LO)}initData(){var t;super.initData(),EI(this._dataSet,"venn",l$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(h$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(h$.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>n$(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>n$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new r$(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:n$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return n$(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[n$(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(n$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),XF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),XF(t.name,this._spec,this._markAttributeContext)))}))}}h$.type=xR.venn,h$.mark=a$,h$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},h$.transformerConstructor=o$;class c$ extends gV{constructor(){super(...arguments),this.type=xR.mosaic,this.transformerConstructor=pV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(XO),this.setFieldX2(YO)),this.setFieldY(KO),this.setFieldY2($O)):(t&&(this.setFieldY(XO),this.setFieldY2(YO)),this.setFieldX(KO),this.setFieldX2($O)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}c$.type=xR.mosaic,c$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},c$.transformerConstructor=pV;class d$ extends lH{_isValidSeries(t){return t===xR.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class u$ extends aH{constructor(){super(...arguments),this.transformerConstructor=d$,this.type="map",this.seriesType=xR.map}}u$.type="map",u$.seriesType=xR.map,u$.transformerConstructor=d$;class p$ extends lH{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class g$ extends p${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=Uz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,iO({},s,l)),n&&Object.assign(o,iO({},n,o))}}class f$ extends p${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class m$ extends p${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class v$ extends aH{constructor(){super(...arguments),this.transformerConstructor=m$}}v$.transformerConstructor=m$;class _$ extends v${constructor(){super(...arguments),this.transformerConstructor=m$,this.type="pie",this.seriesType=xR.pie}}_$.type="pie",_$.seriesType=xR.pie,_$.transformerConstructor=m$;class y$ extends f${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:rj,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:rj,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>iO({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const b$=(t,e)=>{if(!t)return null;const i=_z(t,(t=>"angle"===t.getOrient()),e),s=_z(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&tE(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=uR({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=$(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=pR(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=mz(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&tE(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=uR({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=pR(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=mz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class x$ extends aH{constructor(){super(...arguments),this.transformerConstructor=y$,this.type="rose",this.seriesType=xR.rose}_setModelOption(){this._modelOption.getDimensionInfo=b$}}x$.type="rose",x$.seriesType=xR.rose,x$.transformerConstructor=y$,G(x$,pH);class S$ extends f${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=iO({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>iO({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class A$ extends aH{constructor(){super(...arguments),this.transformerConstructor=S$,this.type="radar",this.seriesType=xR.radar}_setModelOption(){this._modelOption.getDimensionInfo=b$}}A$.type="radar",A$.seriesType=xR.radar,A$.transformerConstructor=S$,G(A$,pH);class k$ extends lH{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{L(e,"trimPadding")&&iO(e,nD(this.type,t))})),this._transformAxisSpec(t)}}class M$ extends aH{constructor(){super(...arguments),this.transformerConstructor=k$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=AH(t,e,i))&&void 0!==s?s:[],...null!==(n=b$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}M$.type="common",M$.transformerConstructor=k$,G(M$,pH);class T$ extends hH{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class w$ extends aH{constructor(){super(...arguments),this.transformerConstructor=T$}}w$.transformerConstructor=T$,G(w$,pH);class C$ extends T${transformSpec(t){super.transformSpec(t),eD(t)}}class E$ extends w${constructor(){super(...arguments),this.transformerConstructor=C$,this.type="histogram",this.seriesType=xR.bar}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}E$.type="histogram",E$.seriesType=xR.bar,E$.transformerConstructor=C$;class B$ extends g${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class P$ extends aH{constructor(){super(...arguments),this.transformerConstructor=B$,this.type="circularProgress",this.seriesType=xR.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=b$}}P$.type="circularProgress",P$.seriesType=xR.circularProgress,P$.transformerConstructor=B$,G(P$,pH);class L$ extends g${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=xR.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===xR.gauge||t.type===xR.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===xR.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class R$ extends aH{constructor(){super(...arguments),this.transformerConstructor=L$,this.type="gauge",this.seriesType=xR.gaugePointer}}R$.type="gauge",R$.seriesType=xR.gaugePointer,R$.transformerConstructor=L$;class O$ extends lH{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class I$ extends aH{constructor(){super(...arguments),this.transformerConstructor=O$,this.type="wordCloud",this.seriesType=xR.wordCloud}}I$.transformerConstructor=O$;class D$ extends I${constructor(){super(...arguments),this.transformerConstructor=O$,this.type="wordCloud",this.seriesType=xR.wordCloud}}D$.type="wordCloud",D$.seriesType=xR.wordCloud,D$.transformerConstructor=O$;class F$ extends lH{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class z$ extends aH{constructor(){super(...arguments),this.transformerConstructor=F$,this.type="funnel",this.seriesType=xR.funnel}}z$.type="funnel",z$.seriesType=xR.funnel,z$.transformerConstructor=F$;class j$ extends hH{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=Uz(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=Uz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class H$ extends aH{constructor(){super(...arguments),this.transformerConstructor=j$,this.type="linearProgress",this.seriesType=xR.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}H$.type="linearProgress",H$.seriesType=xR.linearProgress,H$.transformerConstructor=j$,G(H$,pH);class V$ extends hH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),eD(t)}}class N$ extends aH{constructor(){super(...arguments),this.transformerConstructor=V$,this.type="rangeColumn",this.seriesType=xR.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}N$.type="rangeColumn",N$.seriesType=xR.rangeColumn,N$.transformerConstructor=V$;class U$ extends lH{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class W$ extends aH{constructor(){super(...arguments),this.transformerConstructor=U$,this.type="sunburst",this.seriesType=xR.sunburst}}W$.type="sunburst",W$.seriesType=xR.sunburst,W$.transformerConstructor=U$;class G$ extends lH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class Y$ extends aH{constructor(){super(...arguments),this.transformerConstructor=G$,this.type="circlePacking",this.seriesType=xR.circlePacking}}Y$.type="circlePacking",Y$.seriesType=xR.circlePacking,Y$.transformerConstructor=G$;class X$ extends lH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class $$ extends aH{constructor(){super(...arguments),this.transformerConstructor=X$,this.type="treemap",this.seriesType=xR.treemap}}$$.type="treemap",$$.seriesType=xR.treemap,$$.transformerConstructor=X$;class K$ extends mV{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),eD(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class q$ extends vV{constructor(){super(...arguments),this.transformerConstructor=K$,this.type="waterfall",this.seriesType=xR.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}q$.type="waterfall",q$.seriesType=xR.waterfall,q$.transformerConstructor=K$;class Z$ extends hH{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),eD(t)}}class J$ extends aH{constructor(){super(...arguments),this.transformerConstructor=Z$,this.type="boxPlot",this.seriesType=xR.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}J$.type="boxPlot",J$.seriesType=xR.boxPlot,J$.transformerConstructor=Z$;class Q$ extends lH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class tK extends aH{constructor(){super(...arguments),this.transformerConstructor=Q$,this.type="sankey",this.seriesType=xR.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=vI(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}tK.type="sankey",tK.seriesType=xR.sankey,tK.transformerConstructor=Q$;class eK extends hH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),eD(t)}}class iK extends aH{constructor(){super(...arguments),this.transformerConstructor=eK,this.type="rangeArea",this.seriesType=xR.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}iK.type="rangeArea",iK.seriesType=xR.rangeArea,iK.transformerConstructor=eK;class sK extends hH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class nK extends aH{constructor(){super(...arguments),this.transformerConstructor=sK,this.type="heatmap",this.seriesType=xR.heatmap}}nK.type="heatmap",nK.seriesType=xR.heatmap,nK.transformerConstructor=sK;class rK extends lH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class aK extends aH{constructor(){super(...arguments),this.transformerConstructor=rK,this.type="correlation",this.seriesType=xR.correlation}}aK.type="correlation",aK.seriesType=xR.correlation,aK.transformerConstructor=rK;function oK(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=fI(t.style)),P(t.textStyle)||iO(s.textStyle,fI(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&fI(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&fI(s.background.style),s}const lK=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},hK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:RO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class cK extends dj{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{fR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),fR(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=HR(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new OD(this._option,e),this._initSelectedData(),fR(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(fR(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(iO({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(iO({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(iO({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}cK.specKey="legends";class dK extends cK{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),fR(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){EI(this._option.dataSet,"discreteLegendFilter",hK),EI(this._option.dataSet,"discreteLegendDataMake",lK);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return fR(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!hb(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=iI(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=oK(n):l.title={visible:!1},P(r.focusIconStyle)||fI(r.focusIconStyle),r.shape&&(r.shape=uI(r.shape)),r.label&&(r.label=uI(r.label)),r.value&&(r.value=uI(r.value)),r.background&&(r.background=uI(r.background)),VR(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),VR(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),VR(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(P(a.railStyle)||fI(a.railStyle),P(a.sliderStyle)||fI(a.sliderStyle)):(P(a.textStyle)||fI(a.textStyle),a.handler&&uI(a.handler)),l.pager=a,o.visible&&!P(o.style)&&(iO(l,o.style),p(o.padding)&&(l.padding=o.padding)),l}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return AL}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(mL.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(mL.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(mL.legendItemUnHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=mF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=mF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}dK.specKey="legends",dK.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},dK.type=r.discreteLegend;const uK=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},pK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?dI(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function gK(t){const i=iO({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:_,data:y,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:M,seriesId:T,padding:w}=i,C=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?C.title=oK(s):C.title={visible:!1},C.showHandler=!1!==n.visible,P(n.style)||(C.handlerStyle=fI(n.style)),p(r.width)&&(C.railWidth=r.width),p(r.height)&&(C.railHeight=r.height),P(r.style)||(C.railStyle=fI(r.style)),P(a.style)||(C.trackStyle=fI(a.style)),C.startText=uI(o),C.endText=uI(l),C.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>fI(i(t,e,s)):P(i)||(e.style=fI(i)),e}(h),P(c)||(C.sizeBackground=fI(c)),u.visible&&!P(u.style)&&(iO(C,u.style),p(u.padding)&&(C.padding=u.padding)),C}const fK={color:CL,size:BL},mK={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},vK=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},mK),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},_K={horizontal:vK(!0),vertical:vK(!1)},yK=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},mK),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},bK={horizontal:yK(!0),vertical:yK(!1)},xK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],SK=[2,10];class AK extends cK{static getSpecInfo(t){const e=vF(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),fR(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){EI(this._option.dataSet,"continuousLegendFilter",pK),EI(this._option.dataSet,"continuousLegendDataMake",uK);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>mR(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=iI(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!hb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=iI(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?xK:SK);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 h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},gK(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return fK[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}AK.specKey="legends",AK.builtInTheme={colorLegend:_K,sizeLegend:bK},AK.type=r.continuousLegend;const kK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,MK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),TK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function wK(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=CK(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>MK(i,s)(t)&&MK(n,r)(t)&&(u(a)||MK([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:AI.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return dF.globalConfig.uniqueTooltip&&dF.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:AI.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return dF.globalConfig.uniqueTooltip&&dF.hideTooltip(a.id),m}return"none"}const CK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=kK(c,t);let _=kK(d,t);const y=TK(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(MK(c,v));if(!y&&(_=kK(d,i),!TK(_)))return;const n=e.type===xR.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=tE(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(MK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=kK(d,o),!TK(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(MK(c,n));if(!y&&(_=kK(d,r),!TK(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===xR.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(MK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=kK(d,i),!TK(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(MK(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=kK(d,a),h=_,!TK(_)&&!a)return;TK(_)||(_=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},EK=t=>p(t)&&!y(t),BK=t=>p(t)&&y(t),PK=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class LK extends cj{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=iO({},...PK.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=iO({},s);PK.forEach((t=>{delete r[t]})),delete r.style;const a=iO({},r,i);return a.style=iO({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:rb(this._option.mode)||!sb(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=I_.getElementById(t.parentElement)):sb(this._option.mode)&&(t.parentElement=null==ib?void 0:ib.body)}}const RK={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class OK extends dj{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=LK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=sb(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&EK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&dF.globalConfig.uniqueTooltip&&l&&dF.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:AI.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:AI.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?IH.canvas:IH.dom,n=sO.getComponentPluginInType(t);n||Qy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=sO.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(nb(s)||rb(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=wK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(BK(t)){if(EK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>gz(t,e[i])))}if(BK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}OK.type=r.tooltip,OK.transformerConstructor=LK,OK.builtInTheme={tooltip:RK},OK.specKey="tooltip";var IK,DK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(IK||(IK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(DK||(DK={}));const FK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class zK extends dj{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{tE(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:kI.chart}:{source:AI.chart};y(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:nb(e)||rb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:AI.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:AI.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:AI.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{FK[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}zK.specKey="crosshair";const jK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class HK extends zK{static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=rz(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){rz(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:az(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=vR(this._regions,"cartesian");e&&(TH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=EH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new yT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new bT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}HK.specKey="crosshair",HK.builtInTheme={crosshair:jK},HK.type=r.cartesianCrosshair;class VK extends zK{static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=vR(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Nz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=mF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=_e([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=_t(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new yT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new ST(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new AT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new xT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}VK.specKey="crosshair",VK.builtInTheme={crosshair:jK},VK.type=r.polarCrosshair;const NK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},UK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},WK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},GK=(t,e,i)=>{const s=e.domain();if(JC(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},YK=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&JC(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},XK=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},$K=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},KK=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),qK=(t,e,i)=>{if(JC(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class ZK{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=_t(this.getState().start+f,0,1),_=_t(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ut(s/n)>=.5:Ut(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===hz(lz(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(ZK,VV);class JK extends dj{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:YK(t,this._stateScale,this._isHorizontal),a="percent"===n?e:YK(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=XK(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=qK(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&$K(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else fR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),fR(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=lz(t),this._isHorizontal="horizontal"===hz(this._orient),this._dataFilterEvent=new ZK(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(JC(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>hz(t._orient)===hz(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!JC(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};fR(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=JC(d.getScale(0).type),p=JC(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else fR(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;BI(r,"dataview",wa),EI(r,"dataFilterComputeDomain",WK);const a=new Pa(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new OD(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(EI(this._option.dataSet,"dataFilterWithNewDomain",UK),EI(this._option.dataSet,"lockStatisticsFilter",NK),fR(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>JC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>JC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(JC(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;KK("start",i,this._spec)&&KK("end",s,this._spec)&&(t="percent"===i?this._spec.start:YK(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:YK(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?YK(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?YK(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=GK(this._start,this._stateScale,XK(i,this._isHorizontal)),this._endValue=GK(this._end,this._stateScale,XK(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,JC(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=qK(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&fR(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new NE:new xE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),$(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=$K(h);if(!this._dataUpdating&&tE(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,tE(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(JK,VV);class QK extends cj{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=iO({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const tq=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),eq={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:tq(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:tq(!0)};class iq extends JK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=QK,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=GK(e,this._stateScale,XK(s,this._isHorizontal)),a=GK(i,this._stateScale,XK(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new NE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(XK(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=XK(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new NE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(XK(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),$(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!JC(t.type)||e[0]!==X(e))&&(!tE(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:XK(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>GK(t,this._stateScale,XK(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new vP(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>GK(t,this._stateScale,XK(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:fI(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:fI(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:fI(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:fI(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:fI(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:fI(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:fI(g.style)},selectedBackgroundStyle:fI(this._spec.selectedBackground.style),dragMaskStyle:fI(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:iO(fI(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},fI(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:iO(fI(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},fI(null===(d=m.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=mF(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(XK(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}iq.type=r.dataZoom,iq.transformerConstructor=QK,iq.builtInTheme={dataZoom:eq},iq.specKey="dataZoom";const sq={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class nq extends JK{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=aR(this._start,e)&&aR(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=XK(n,this._isHorizontal),a=GK(e,this._stateScale,r),o=GK(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new kM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=fI(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=fI(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}nq.type=r.scrollBar,nq.builtInTheme={scrollBar:sq},nq.specKey="scrollBar";const rq=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},aq=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),oq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:aq("l1FontSize","primaryFontColor")},content:{visible:!0,style:aq("l2FontSize","tertiaryFontColor")}};class lq extends dj{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(vI(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(vI(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){EI(this._option.dataSet,"indicatorFilter",rq);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new OD(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=iO({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},gI(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?$R(l,this._computeLayoutRadius()):0,dy:h?$R(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},gI(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new RL(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}lq.type=r.indicator,lq.builtInTheme={indicator:oq},lq.specKey="indicator";const hq=["sum","average","min","max","variance","standardDeviation","median"];function cq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=$(s);return er}function dq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&cq(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=VR(t.x)?fq(t.x,n)+r.x:mq(l.getXAxisHelper(),[t.x])+r.x,h}function uq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&cq(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=VR(t.y)?fq(t.y,n)+r.y:mq(l.getYAxisHelper(),[t.y])+r.y,h}function pq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&cq(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),mq(a.angleAxisHelper,[t.angle])}function gq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&cq(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),mq(a.radiusAxisHelper,[t.radius])}function fq(t,e){return Number(t.substring(0,t.length-1))*e/100}function mq(t,e){const i=t.getScale(0);return JC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function vq(t){return hq.includes(t)}function _q(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=dq(t,_,n,u,c,o),r=uq(t,y,n,u,d,o),yq(s,b,S,g.length),yq(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=dq(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);yq(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=uq(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);yq(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function yq(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=pq(t,l,n,r),i=gq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=pq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=gq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function xq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=VR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=VR(i)?Number(i.substring(0,i.length-1))*f/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&cq(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&cq(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:mq(d.getXAxisHelper(),b)+p.x+m,y:mq(d.getYAxisHelper(),x)+p.y+v})})),n}function Sq(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&cq(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&cq(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:mq(l.angleAxisHelper,d),radius:mq(l.radiusAxisHelper,u)})})),s}function Aq(t,e,i){let{x:s,y:n}=t;return VR(s)&&(s=fq(s,e)),VR(n)&&(n=fq(n,i)),{x:s,y:n}}function kq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=Aq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>Aq(t,n,r)))}function Mq(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function Tq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},fI(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Cq(fI(n.style),i,s)),p(n.padding)&&(t.padding=ai(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Cq(fI(r),i,s)),t}return{visible:!1}}function wq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function Cq(t,e,i){return d(t)?t(e,i):t}function Eq(t,e){return d(t)?t(e):t}function Bq(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function Pq(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function Lq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=Pq(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function Rq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=Pq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function Oq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function Iq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&vq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&vq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&vq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&vq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Fq(i,t,e))):i.x=Fq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Fq(i,t,e))):i.y=Fq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Fq(i,t,e))):i.angle=Fq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Fq(i,t,e))):i.radius=Fq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Fq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const Dq={min:(t,e)=>oR(t[0].latestData,e.field),max:(t,e)=>lR(t[0].latestData,e.field),sum:function(t,e){return hR(t[0].latestData,e.field)},average:function(t,e){return cR(t[0].latestData,e.field)},variance:function(t,e){return dR(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(dR(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Fq(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(m(t)){const{aggrType:i,field:s}=t;return Dq[i](e,{field:s})}return t}function zq(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class jq extends dj{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&vq(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ba;return e.registerParser("array",s),new Pa(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=vR(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=UR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=UR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();EI(this._option.dataSet,"markerAggregation",Iq),EI(this._option.dataSet,"markerFilter",zq);const i=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function Hq(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=oR(t,e),r=lR(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Vq extends jq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=Lq(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Cq(fI(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>Tq(t,this._markerData,this._markAttributeContext))),state:{line:wq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:wq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:wq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return wq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return wq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:Cq(fI(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:Cq(fI(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=Mq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=Lq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;EI(this._option.dataSet,"markerAggregation",Iq),EI(this._option.dataSet,"markerRegression",Hq),EI(this._option.dataSet,"markerFilter",zq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Pa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}Vq.specKey="markLine";const Nq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Uq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},Wq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:Nq(!1),endSymbol:Nq(!0),label:Uq};class Gq extends Vq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new iL(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=Lq(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=_q(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=xq(i,r,d,e.coordinatesOffset):c&&(y=kq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(VR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=Lq(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}Gq.type=r.markLine,Gq.coordinateType="cartesian",Gq.builtInTheme={markLine:Wq};class Yq extends Vq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=Lq(this._spec);return e||i?new rL(t):new iL(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=Lq(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=bq(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=Sq(i,r,a),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=Lq(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}Yq.type=r.polarMarkLine,Yq.coordinateType="polar",Yq.builtInTheme={polarMarkLine:Wq};class Xq extends dj{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=HR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return vF(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=UR(this._spec.width,a.width,null,a.width),l=UR(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new PL(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}Xq.type=r.title,Xq.specKey=r.title,Xq.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class $q extends jq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=Rq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:Cq(fI(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>Tq(t,this._markerData,this._markAttributeContext))),state:{area:wq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>wq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return wq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=Mq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=Rq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}$q.specKey="markArea";const Kq={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class qq extends $q{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new nL(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=Rq(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=_q(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=_q(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=xq(s,a,u,i.coordinatesOffset):d&&(f=kq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=Rq(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}qq.type=r.markArea,qq.coordinateType="cartesian",qq.builtInTheme={markArea:Kq};class Zq extends $q{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=Rq(this._spec);return i||e||s?new aL(t):new nL(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=Rq(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=bq(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=Sq(i,r,c),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=Rq(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Zq.type=r.polarMarkArea,Zq.coordinateType="polar",Zq.builtInTheme={polarMarkArea:Kq};const Jq=t=>fI(Object.assign({},t)),Qq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},fI(t.style))}),tZ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=Jq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Jq(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},fI(Object.assign({},y)));var y;const b=Qq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Qq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Qq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=Qq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},eZ=t=>"left"===t||"right"===t,iZ=t=>"top"===t||"bottom"===t,sZ={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class nZ extends dj{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},tZ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},tZ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new XL(t):this._playerComponent=new qL(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=eZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=eZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(VL.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(VL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(VL.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(VL.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(VL.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(VL.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=eZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=iZ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):eZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):iZ(this._orient)?this._maxSize():t.height}_computeDx(t){return eZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return iZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}nZ.builtInTheme={player:sZ},nZ.specKey="player",nZ.type=r.player;class rZ extends dj{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=ER({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==lD.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}rZ.type=r.label;class aZ extends WN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}aZ.type="text",aZ.constructorType="label";const oZ=()=>{GN(),sO.registerMark(aZ.constructorType,aZ)};class lZ extends cj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class hZ extends rZ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=lZ,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(bI.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(bI.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),fR(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=iO({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},hN(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[GO])):t=>t.filter((t=>t.data[WO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?cN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}hZ.type=r.label,hZ.specKey="label",hZ.transformerConstructor=lZ;class cZ extends rZ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[NO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return iO({textStyle:{pickable:!0===this._spec.interactive},position:dZ(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[GO]:t.data[WO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>cN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function dZ(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}cZ.type=r.totalLabel,cZ.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},cZ.specKey="totalLabel";class uZ extends jq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Oq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R,O;const{itemContent:I={},itemLine:D={},targetSymbol:F={}}=this._spec,z=I,{type:H="text",text:V,symbol:N,image:U,richText:W,customMark:G,textStyle:Y,symbolStyle:X,imageStyle:$,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=z,Q=e(z,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:J,it={dx:0,dy:0},et=Tq(Object.assign(Object.assign({},V),{style:j(it,null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==W?void 0:W.state)&&void 0!==r?r:J,it={width:100,height:100},et=Cq(j(it,null!==(o=null!==(a=null==W?void 0:W.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==N?void 0:N.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=fI(Cq(j(it,null!==(c=null!==(h=null==N?void 0:N.style)&&void 0!==h?h:X)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==U?void 0:U.state)&&void 0!==d?d:J,it={width:80,height:80},et=Cq(j(it,null!==(p=null!==(u=null==U?void 0:U.style)&&void 0!==u?u:$)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=Cq(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:Eq(I.offsetX,this._relativeSeries.getRegion()),offsetY:Eq(I.offsetX,this._relativeSeries.getRegion())},Q),{style:Cq(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(A=F.size)&&void 0!==A?A:20,style:Cq(F.style,this._markerData,this._markAttributeContext)},state:{line:wq(null!==(M=null===(k=this._spec.itemLine.line)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:wq(null!==(w=null===(T=this._spec.itemLine.startSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:wq(null!==(E=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext),itemContent:wq(tt,this._markerData,this._markAttributeContext),textBackground:wq(null===(P=null===(B=this._spec.itemContent.text)||void 0===B?void 0:B.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:wq(null!==(R=null===(L=this._spec.targetSymbol)||void 0===L?void 0:L.state)&&void 0!==R?R:{},this._markerData,this._markAttributeContext)},animation:null!==(O=this._spec.animation)&&void 0!==O&&O,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=e(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:fI(rt.style)}):{visible:!1};return new lL(st)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Mq([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:Bq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:Bq(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=Oq(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}uZ.specKey="markPoint";const pZ={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class gZ extends uZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=_q(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=xq(n,r,h,s.coordinatesOffset)[0]:l&&(c=kq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Oq(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}gZ.type=r.markPoint,gZ.coordinateType="cartesian",gZ.builtInTheme={markPoint:pZ};class fZ extends uZ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=bq(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}fZ.type=r.polarMarkPoint,fZ.coordinateType="polar",fZ.builtInTheme={polarMarkPoint:pZ};class mZ extends uZ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}mZ.type=r.geoMarkPoint,mZ.coordinateType="geo",mZ.builtInTheme={geoMarkPoint:pZ};const vZ="inBrush",_Z="outOfBrush";class yZ extends dj{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),vZ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),_Z,t.AttributeLevel.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new tR(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:fI(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener($L.brushActive,(s=>{this._initMarkBrushState(i,_Z),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener($L.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($L.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($L.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($L.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($L.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener($L.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener($L.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},fI(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(vZ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(vZ),i.addState(_Z,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(vZ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(vZ),i.addState(_Z,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(vZ),s.removeState(_Z),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}yZ.type=r.brush,yZ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},yZ.specKey="brush";class bZ extends dj{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${wO}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=YF({},XF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ve).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ve;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}bZ.type=r.customMark,bZ.specKey="customMark";class xZ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>SZ(t))),a=n.filter((t=>!SZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>SZ(t))),h=o.filter((t=>!SZ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function SZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}xZ.type="grid";const AZ="vchart-tooltip",kZ=`${AZ}-container`,MZ=`${AZ}-title`,TZ=`${AZ}-content-box`,wZ={offsetX:10,offsetY:10},CZ="99999999999999";function EZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const BZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,PZ=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?EZ(t):"",LZ=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},RZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},OZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=RZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class IZ extends jz{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=xF(null==T?void 0:T.position,b,e),C=null!==(r=xF(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:CO,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:EO;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=sb(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=BZ(e,F),V=BZ(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(OZ(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},$=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=LZ(t,_),W.top=LZ(i,_),W.right=LZ(e,_),W.bottom=LZ(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&$.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=LZ(e,_):X(e,t)}));else p(w)&&(X({orient:w,mode:C},"x"),X({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=OZ(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",FZ=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=DZ(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=DZ(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},zZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?UR(e,t.fontSize):0},jZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=ai(r),a.padding=DZ(o)),{panelStyle:a,panelPadding:o}};function HZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class VZ extends IZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(VZ.type),this.type=IH.dom,this._tooltipContainer=null==ib?void 0:ib.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(ib&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=jZ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:DZ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=FZ(h),x=FZ(d),S=FZ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=DZ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=DZ(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=DZ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(zZ(p),zZ(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(MZ))),l=a.find((t=>t.className.includes(TZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(MZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(HZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${AZ}-column`),e.classList.add(`${AZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(TZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];HZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));HZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${AZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=PZ(e.key),e.keyStyle&&FZ(e.keyStyle,l)):"value"===i?(o.innerHTML=PZ(e.value),e.valueStyle&&FZ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?EZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?EZ(c):m,y=p,b=t=>new Cg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ve));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=vh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?EZ(u):"currentColor",`\n \n \n \n `;const w=T?vh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),HZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(TZ))),h=[...o.children].find((t=>t.className.includes(MZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(MZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=UR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,HZ(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},ff||(ff=pf.CreateGraphic("richtext",{})),ff.setAttributes(a),ff.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function WZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:NZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const GZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class YZ extends IZ{constructor(){super(YZ.type),this.type=IH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new rR({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ai(d.padding),b=YR(d.padding),x=WZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=WZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=WZ(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},M={panel:GZ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=iO({},S,WZ(b,void 0,{})),{width:s,height:n,text:r}=UZ(h,i);T.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(m)){const t=iO({},A,WZ(x,void 0,{})),{width:e,height:s,text:n}=UZ(m,t);T.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=iO({},x,WZ(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=UZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-I-L-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}YZ.type=IH.canvas;const XZ=/\{([^}]+)\}/,$Z=/\{([^}]+)\}/g,KZ=/:/;class qZ extends jz{constructor(){super(qZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:mi.getInstance().timeUTCFormat,local:mi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=ki.getInstance().format,this._numericSpecifier=ki.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[qZ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),sO.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=XZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace($Z,((t,i)=>{if(!KZ.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(xi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}qZ.pluginType="chart",qZ.specKey="formatter",qZ.type="formatterPlugin";dF.useRegisters([()=>{HH(),NH(),WH(),vH(),mH(),eH(),Yj(),Cz(),Bz(),tF(),ZD(),jj(),Ij(),sO.registerSeries(iH.type,iH),sO.registerChart(GH.type,GH)},()=>{HH(),NH(),WH(),mH(),eH(),Yj(),Cz(),$H(),Bz(),ZH(),jj(),Ij(),sO.registerSeries(QH.type,QH),vH(),sO.registerChart(eV.type,eV)},()=>{HH(),NH(),WH(),mH(),fV(),vH(),sO.registerChart(vV.type,vV)},()=>{HH(),NH(),vH(),mH(),wV(),sO.registerChart(EV.type,EV)},()=>{NH(),kU(),sO.registerChart(_$.type,_$)},()=>{HH(),NH(),vH(),mH(),NU(),sO.registerChart(x$.type,x$)},()=>{HH(),NH(),WH(),vH(),mH(),ZU(),sO.registerChart(A$.type,A$)},()=>{HH(),NH(),WH(),vH(),mH(),fV(),sO.registerTransform("bin",Kr),sO.registerChart(E$.type,E$)},()=>{NH(),WV(),OV(),sO.registerSeries(YV.type,YV),sO.registerImplement("registerMap",OI),sO.registerImplement("unregisterMap",II),JD(),sO.registerChart(u$.type,u$)},()=>{NH(),BX(),sO.registerSeries(LX.type,LX),_U(),uW(),zU(),fW(),sO.registerChart(R$.type,R$)},()=>{NH(),sY(),sO.registerChart(D$.type,D$)},()=>{NH(),AY(),sO.registerChart(z$.type,z$)},()=>{HH(),NH(),WH(),vH(),mH(),xN(),sO.registerChart(q$.type,q$)},()=>{HH(),NH(),vH(),mH(),UN(),sO.registerTransform("boxplot",qr),sO.registerChart(J$.type,J$)},()=>{HH(),NH(),vH(),mH(),fW(),sO.registerChart(P$.type,P$)},()=>{HH(),NH(),vH(),mH(),SW(),sO.registerChart(H$.type,H$)},()=>{HH(),NH(),vH(),mH(),tU(),sO.registerChart(N$.type,N$)},()=>{HH(),NH(),WH(),vH(),mH(),$H(),jj(),Ij(),sO.registerSeries(rU.type,rU),sO.registerChart(iK.type,iK)},()=>{NH(),VY(),sO.registerChart(W$.type,W$)},()=>{NH(),XY(),sO.registerChart(Y$.type,Y$)},()=>{NH(),bX(),sO.registerChart($$.type,$$)},()=>{NH(),xo.load(CM),uX(),sO.registerChart(tK.type,tK)},()=>{NH(),jX(),sO.registerChart(nK.type,nK)},()=>{NH(),JX(),sO.registerChart(aK.type,aK)},()=>{HH(),NH(),WH(),vH(),sO.registerChart(M$.type,M$),mH()},Ij,jj,()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),_j(),sO.registerComponent(Hj.type,Hj)},()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),_j(),sO.registerComponent(Vj.type,Vj)},()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),_j(),sO.registerComponent(Nj.type,Nj)},HU,zU,()=>{sO.registerComponent(dK.type,dK)},()=>{sO.registerComponent(AK.type,AK)},()=>{sO.registerComponent(OK.type,OK)},()=>{sO.registerComponent(HK.type,HK)},()=>{sO.registerComponent(VK.type,VK)},()=>{sO.registerComponent(iq.type,iq)},()=>{sO.registerComponent(nq.type,nq)},()=>{sO.registerComponent(lq.type,lq)},WV,()=>{sO.registerComponent(Gq.type,Gq),eL()},()=>{sO.registerComponent(qq.type,qq),sL()},()=>{sO.registerComponent(gZ.type,gZ),oL()},()=>{sO.registerComponent(Yq.type,Yq),rL._animate=DP,eL()},()=>{sO.registerComponent(Zq.type,Zq),aL._animate=zP,sL()},()=>{sO.registerComponent(fZ.type,fZ),oL()},()=>{sO.registerComponent(mZ.type,mZ),oL()},()=>{sO.registerComponent(Xq.type,Xq)},()=>{sO.registerComponent(nZ.type,nZ)},()=>{sO.registerGraphicComponent(hZ.type,(t=>new GB(t))),oZ(),fj(),sO.registerComponent(hZ.type,hZ,!0,1/0)},()=>{sO.registerGraphicComponent(cZ.type,(t=>new GB(t))),oZ(),fj(),sO.registerComponent(cZ.type,cZ,!0)},()=>{sO.registerComponent(yZ.type,yZ)},()=>{sO.registerComponent(bZ.type,bZ)},()=>{xo.load(vT)},()=>{sO.registerLayout(xZ.type,xZ)},()=>{var t;t=YZ,sO.registerComponentPlugin(t.type,t)},()=>{var t;t=qZ,sO.registerChartPlugin(t.type,t)},aF,hF]),dF.useRegisters([()=>{iA(xo)}]),t.DEFAULT_CHART_HEIGHT=EO,t.DEFAULT_CHART_WIDTH=CO,t.DEFAULT_CLOSE_STROKE_JOIN=gF,t.DEFAULT_DATA_INDEX=PO,t.DEFAULT_DATA_KEY=LO,t.DEFAULT_DATA_SERIES_FIELD=RO,t.DEFAULT_KEY=JO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=pF,t.DEFAULT_MAP_LOOK_UP_KEY=QO,t.DEFAULT_MEASURE_CANVAS_ID=BO,t.DEFAULT_SERIES_STYLE_NAME=OO,t.DEFAULT_SMOOTH_INTERPOLATE=uF,t.Factory=sO,t.MOSAIC_CAT_END_PERCENT=KO,t.MOSAIC_CAT_START_PERCENT=$O,t.MOSAIC_VALUE_END_PERCENT=XO,t.MOSAIC_VALUE_START_PERCENT=YO,t.ManualTicker=class extends bw{constructor(t){super(t),this.lastFrameTime=0,this.status=Ro.RUNNING}setupTickHandler(){const t=new xw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,!0}},t.PREFIX=wO,t.SEGMENT_FIELD_END=ZO,t.SEGMENT_FIELD_START=qO,t.STACK_FIELD_END=FO,t.STACK_FIELD_END_OffsetSilhouette=VO,t.STACK_FIELD_END_PERCENT=jO,t.STACK_FIELD_KEY=IO,t.STACK_FIELD_START=DO,t.STACK_FIELD_START_OffsetSilhouette=HO,t.STACK_FIELD_START_PERCENT=zO,t.STACK_FIELD_TOTAL=NO,t.STACK_FIELD_TOTAL_BOTTOM=GO,t.STACK_FIELD_TOTAL_PERCENT=UO,t.STACK_FIELD_TOTAL_TOP=WO,t.StreamLight=class extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Ao.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Wl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Ao.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=cl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=cl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),y=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=y*this.gridSize;const _=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,_,b);const C=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let M,w=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;w--;)for(M=x;M--;)B(w,M,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:_,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?EJ(t,o,l.width,l.height,h):"geometric"===t.type&&RJ(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=vJ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};OJ.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class IJ extends xJ{constructor(t){super(H({},IJ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}IJ.defaultOptions={enlarge:!1};const DJ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},FJ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.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?zJ(t.fontFamily):"sans-serif",d=t.fontStyle?zJ(t.fontStyle):"normal",u=t.fontWeight?zJ(t.fontWeight):"normal",p=t.rotate?zJ(t.rotate):0,g=zJ(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?zJ(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",y=null!==(r=t.shrink)&&void 0!==r&&r,_=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},DJ),t.as):DJ,C=t.depth_3d,T=t.postProjection;let M=t.fontSize?zJ(t.fontSize):14;const w=t.fontSizeRange;if(w&&!S(M)){const t=M,e=jJ(NJ(t,l),w);M=i=>e(t(i))}let E=AJ;"fast"===t.layoutType?E=IJ:"grid"===t.layoutType&&(E=OJ);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:M,shrink:y,clip:b,enlarge:_,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},zJ=t=>y(t)||S(t)||d(t)||_(t)?t:e=>e[t.field],HJ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),jJ=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=HJ(t[0]),n=HJ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(HJ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},NJ=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function UJ(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{oT.registerGrammarTransform("wordcloud",{transform:FJ}),A$(),oT.registerAnimation("wordCloud",((t,e)=>({appear:bZ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:Ez.disappear.duration}}))),oT.registerSeries(VJ.type,VJ)},GJ=t=>d(t)?t():t,YJ=(t,e)=>{var i,s,n,r;const a=t.map((t=>Object.assign({},t)));if(!a||0===a.length)return a;const{asTransformRatio:o,asReachRatio:l,asHeightRatio:h,asValueRatio:c,asNextValueRatio:d,asLastValueRatio:u,asLastValue:p,asCurrentValue:g,asNextValue:f}=e,m=GJ(e.valueField),v=null!==(i=GJ(e.heightVisual))&&void 0!==i&&i,y=null===(s=GJ(e.isCone))||void 0===s||s,_=GJ(e.range),b=a.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[m])||-1/0)),-1/0),x=a.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[m])||1/0)),1/0),S=[null!==(n=null==_?void 0:_.min)&&void 0!==n?n:x,null!==(r=null==_?void 0:_.max)&&void 0!==r?r:b];return a.forEach(((t,e)=>{var i,s;const n=Number.parseFloat(t[m]),r=Number.parseFloat(null===(i=a[e-1])||void 0===i?void 0:i[m]),_=Number.parseFloat(null===(s=a[e+1])||void 0===s?void 0:s[m]),b=k(_*n)&&0!==n?_/n:0,x=k(n*r)&&0!==r?n/r:0;p&&(t[p]=r),f&&(t[f]=_),o&&(t[o]=b),l&&(t[l]=0===e?1:x),h&&(t[h]=!0===v?b:1/a.length),c&&(t[c]=n/S[1]),d&&(t[d]=e===a.length-1?y?0:t[c]:_/S[1]),u&&(t[u]=0===e?1:r/S[1]),g&&(t[g]=n)})),a},XJ=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},KJ=`${PT}_FUNNEL_TRANSFORM_RATIO`,$J=`${PT}_FUNNEL_REACH_RATIO`,qJ=`${PT}_FUNNEL_HEIGHT_RATIO`,ZJ=`${PT}_FUNNEL_VALUE_RATIO`,JJ=`${PT}_FUNNEL_LAST_VALUE_RATIO`,QJ=`${PT}_FUNNEL_NEXT_VALUE_RATIO`,tQ=`${PT}_FUNNEL_LAST_VALUE`,eQ=`${PT}_FUNNEL_CURRENT_VALUE`,iQ=`${PT}_FUNNEL_NEXT_VALUE`,sQ=`${PT}_FUNNEL_TRANSFORM_LEVEL`;class nQ extends dH{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[$J])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class rQ extends pz{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class aQ extends rQ{constructor(){super(...arguments),this.type=aQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}aQ.type="polygon";const oQ=()=>{oT.registerMark(aQ.type,aQ),XO(),FO(),sI.registerBuiltInAnimate("growPointsOut",WI),oT.registerGraphicComponent("polygon",af)},lQ=Object.assign(Object.assign({},AH),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class hQ extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class cQ extends YH{constructor(){super(...arguments),this.type=CC.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=hQ,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;DM(this._dataSet,"funnel",YJ),DM(this._dataSet,"funnelTransform",XJ);const t=new Oa(this._dataSet,{name:`${PT}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new VF(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:()=>this.getValueField(),isCone:()=>this._spec.isCone,asCurrentValue:eQ,asTransformRatio:KJ,asReachRatio:$J,asHeightRatio:qJ,asValueRatio:ZJ,asNextValueRatio:QJ,asLastValueRatio:JJ,asLastValue:tQ,asNextValue:iQ,range:()=>this._spec.range}}),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.transform({type:"funnelTransform",options:{asIsTransformLevel:sQ}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},cQ.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:LH(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},cQ.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(cQ.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(cQ.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new nQ(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&oA(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&oA(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*Ak($J).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),RH("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(PH(oT.getAnimationInKey("fadeInOut")(),RH(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(PH(oT.getAnimationInKey("funnel")({},o),RH(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(PH(null===(a=oT.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),RH("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[JJ])/2:this._getSecondaryAxisLength(t[ZJ])/2,n=this._getSecondaryAxisLength(t[ZJ])/2):(s=this._getSecondaryAxisLength(t[ZJ])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[QJ])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[sQ])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[DT]===t[DT]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_{oQ(),A$(),PK(),oT.registerSeries(cQ.type,cQ),oT.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},Pz))),oT.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Cz,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),Oz()},uQ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},pQ=t=>{const e=t.filter((t=>t.context.diffState===vF.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},gQ=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},fQ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pQ(i.parent.children),a=gQ(r,s,n);return uQ(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pQ(i.parent.children),a=gQ(r,s,n);return uQ(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),mQ=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},vQ=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pQ(i.parent.children),a=mQ(r);return uQ(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pQ(i.parent.children),a=mQ(r);return uQ(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),yQ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},_Q=(t,e={})=>{if(!t)return[];const i=[];return kZ(t,i,e),i},bQ=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new JZ(i).layout(t,{width:s,height:n})};class xQ extends dH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var SQ;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(SQ||(SQ={}));const AQ=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===SQ.DrillDown){return Y(pM(t,n,s,"children"))}if(i.type===SQ.DrillUp){const e=gM(t,n,s,"children");if(e)return Y(e)}return t};class kQ{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=fK(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;DM(t,"drillFilter",AQ),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!_(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:SQ.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:SQ.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!_(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:SQ.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:SQ.DrillUp},model:this}),r}}const CQ=Object.assign(Object.assign({},AH),{sunburst:{name:"sunburst",type:"arc"}}),TQ=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:mH,operations:["max","min","values"]}),t.push({key:vH,operations:["values"]}),t),MQ={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class wQ extends z${constructor(){super(...arguments),this.type=CC.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:vH),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:DT},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(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),DM(this._dataSet,"sunburstLayout",bQ),DM(this._dataSet,"flatten",_Q),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return TQ(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(DM(t.dataSet,"addVChartProperty",nH),t.transform({type:"addVChartProperty",options:{beforeCall:xH.bind(this),call:SH}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(wQ.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(wQ.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new xQ(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),RH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),RH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}wQ.type=CC.sunburst,wQ.mark=CQ,wQ.builtInTheme={sunburst:MQ},G(wQ,kQ);const EQ=()=>{oT.registerSeries(wQ.type,wQ),q$(),A$(),Oz(),oT.registerAnimation("sunburst",((t,e)=>({appear:yQ(0,e),enter:fQ(t),exit:vQ(t),disappear:{duration:Ez.disappear.duration}})))},BQ=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new jZ(i).layout(t,{width:s,height:n})};class PQ extends dH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const RQ=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},OQ=Object.assign(Object.assign({},AH),{circlePacking:{name:"circlePacking",type:"arc"}});class IQ extends $H{constructor(){super(...arguments),this.type=CC.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:vH),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:DT},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),DM(this._dataSet,"circlePackingLayout",BQ),DM(this._dataSet,"flatten",_Q),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(DM(t.dataSet,"addVChartProperty",nH),t.transform({type:"addVChartProperty",options:{beforeCall:xH.bind(this),call:SH}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(IQ.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(IQ.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return TQ(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new PQ(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),RH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),RH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}IQ.type=CC.circlePacking,IQ.mark=OQ,IQ.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(IQ,kQ);const LQ=()=>{oT.registerSeries(IQ.type,IQ),q$(),A$(),Rz(),oT.registerAnimation("circlePacking",((t,e)=>({appear:RQ(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:Ez.disappear.duration}})))},DQ=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&DQ(t,e.children,i)}))},FQ=t=>{var e;if(!t||!_(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},zQ=(t,e)=>{const i=d(e)?e():e;if(!t||!(null==i?void 0:i.view)||!t.length)return[];const s=i.view();if(s.x1-s.x0==0||s.y1-s.y0==0||s.x1-s.x0==-1/0||s.x1-s.x0==1/0||s.y1-s.y0==-1/0||s.y1-s.y0==1/0)return[];const n=t[0],r=HQ(n,i),a=new $Z(i),o=[];return o.push(a.layout(r,s)),o},HQ=(t,e)=>{if("source"===e.sourceField&&"target"===e.targetField&&"value"===e.valueField)return t;const i=t.links;return i?Object.assign(Object.assign({},t),{links:i.map((t=>{const i={};return Object.keys(t).forEach((s=>{s===e.sourceField?i.source=t[e.sourceField]:s===e.targetField?i.target=t[e.targetField]:s===e.valueField?i.value=t[e.valueField]:i[s]=t[s]})),i}))}):t},jQ=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},NQ=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class UQ extends dH{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const VQ=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),WQ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:VQ(t),GQ=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class YQ extends SI{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class XQ extends SI{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const KQ=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},$Q=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class qQ extends s${constructor(){super(...arguments),this.type=qQ.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?$Q:KQ,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}qQ.type="linkPath";const ZQ=Object.assign(Object.assign({},AH),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class JQ extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const QQ=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&dz(t,e),cz(t,e,s,n)};class t0 extends $H{constructor(){super(...arguments),this.type=CC.sankey,this.transformerConstructor=JQ,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ue,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{dz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),n.forEach((e=>{dz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=kM(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=kM(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=kM(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(dz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),QQ(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(dz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),cz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=kM(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=kM(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=kM(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=kM(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=kM(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return dz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QQ(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),dz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QQ(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});dz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),cz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(kM(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{dz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._nodeMark&&i.forEach((e=>{dz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])}));else{const n=kM(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=kM(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QQ(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QQ(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QQ(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){super.initData();const e=this.getViewData(),i=this.getRawData();if(i&&e){DM(this._dataSet,"sankeyLayout",zQ),DM(this._dataSet,"sankeyFormat",FQ),i.transform({type:"sankeyFormat"},!1),e.transform({type:"sankeyLayout",options:()=>{var t,e,i,s;return{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse}},level:t.TransformLevel.sankeyLayout});const{dataSet:s}=this._option;DM(s,"sankeyNodes",jQ),DM(s,"flatten",_Q);const n=new Oa(s,{name:`sankey-node-${this.id}-data`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyNodes"}),n.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),n.transform({type:"addVChartProperty",options:{beforeCall:_H.bind(this),call:bH}},!1),this._nodesSeriesData=n,DM(s,"sankeyLinks",NQ);const r=new Oa(s,{name:`sankey-link-${this.id}-data`});r.parse([this.getViewData()],{type:"dataview"}),r.transform({type:"sankeyLinks"}),r.transform({type:"addVChartProperty",options:{beforeCall:_H.bind(this),call:bH}},!1),this._linksSeriesData=r}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(t0.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(t0.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=eH(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),RH("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),RH("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:PM.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{dz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(kM(e).key)?cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new UQ(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new zC;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return DQ(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}t0.type=CC.sankey,t0.transformerConstructor=JQ,t0.mark=ZQ,t0.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const e0=()=>{FX(),n$(),LO(),oT.registerGraphicComponent("path",(t=>Ug(t))),oT.registerMark(qQ.type,qQ),A$(),oT.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:WQ(t,e)},Pz))),oT.registerAnimation("sankeyLinkPath",((t,e)=>({appear:GQ(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:Ez.disappear.duration}}))),sI.registerBuiltInAnimate("linkPathGrowOut",XQ),sI.registerBuiltInAnimate("linkPathGrowIn",YQ),Oz(),oT.registerSeries(t0.type,t0)},i0=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=_Q(n);return i=pH([{latestData:r}],e),i};class s0 extends dH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const n0=Object.assign(Object.assign({},AH),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),r0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class a0 extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const o0=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();if(s){const e=new iJ(i).layout(t,s),n=[];return kZ(e,n,{maxDepth:null==i?void 0:i.maxDepth}),n.forEach((t=>{t&&[vH,"name"].forEach((e=>{t[e]=t.datum[t.depth][i.nameField]}))})),n}return[]};class l0 extends $H{constructor(){super(...arguments),this.type=CC.treemap,this.transformerConstructor=a0,this._categoryField="name",this._valueField="value",this._viewBox=new Ue,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:vH),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ge),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:DT},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t;super.initData(),DM(this._dataSet,"treemap",o0),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:()=>{var t,e,i,s;return{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(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!==(s=this._spec.minVisibleArea)&&void 0!==s?s:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(DM(this._rawData.dataSet,"addVChartProperty",nH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:xH.bind(this),call:SH}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=i0([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=H(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){DM(this._dataSet,"hierarchyDimensionStatistics",i0),DM(this._dataSet,"flatten",_Q);const i=new Oa(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 TQ(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(l0.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(l0.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("treemap"))||void 0===e?void 0:e(),RH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new s0(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(MM.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(MM.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}l0.type=CC.treemap,l0.mark=n0,l0.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},l0.transformerConstructor=a0,G(l0,kQ),G(l0,vK);const h0=()=>{oT.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),oT.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),FX(),A$(),oT.registerAnimation("treemap",((t,e)=>({appear:r0(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:Ez.disappear.duration}}))),Oz(),oT.registerSeries(l0.type,l0)},c0=Object.assign(Object.assign({},Wq),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),d0=Object.assign(Object.assign({},AH),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),u0={type:"fadeIn"};function p0(t,e){return"fadeIn"===e?u0:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class g0 extends HH{constructor(){super(...arguments),this._supportStack=!1}}class f0 extends dH{enableByType(t){return"dimension"!==t}}const m0="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",v0={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:m0,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:m0,fill:"#ddd"}}};class y0 extends Yq{constructor(){super(...arguments),this.type=CC.gaugePointer,this.transformerConstructor=g0,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(y0.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},y0.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(y0.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new f0(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=K(e),s=$(e),n=yt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),RH("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}y0.type=CC.gaugePointer,y0.mark=d0,y0.builtInTheme={gaugePointer:v0},y0.transformerConstructor=g0;const _0=()=>{oT.registerSeries(y0.type,y0),cK(),FX(),oT.registerAnimation("gaugePointer",((t,e)=>{const i=p0(t,e);return{appear:i,enter:i,disappear:{duration:Ez.disappear.duration}}})),xq(),_q()};class b0 extends HH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class x0 extends Yq{constructor(){super(...arguments),this.type=CC.gauge,this.transformerConstructor=b0,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();DM(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[eM]=t[this._angleField[0]],t[tM]=e>0?i[e-1][eM]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(x0.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(x0.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?NC(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?NC(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[tM])?this.angleAxisHelper.dataToPosition([t[tM]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[eM]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),RH("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}x0.type=CC.gauge,x0.mark=c0,x0.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},x0.transformerConstructor=b0;class S0 extends pz{constructor(){super(...arguments),this.type=S0.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return tg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}S0.type="cell";function A0(t){return!1===t?{}:{type:"fadeIn"}}class k0 extends dH{enableByType(t){return"dimension"!==t}}const C0=Object.assign(Object.assign({},AH),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class T0 extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}const M0={valueField:!0};class w0 extends $H{constructor(){super(...arguments),this.type=CC.heatmap,this.transformerConstructor=T0}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),M0)})}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(w0.mark.cell,{isSeriesMark:!0},{morph:LH(this._spec,w0.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(w0.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=oi(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=KH(this);this._cellMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),RH("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new k0(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}w0.type=CC.heatmap,w0.mark=C0,w0.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},w0.transformerConstructor=T0;const E0=()=>{A$(),oT.registerMark(S0.type,S0),oT.registerGraphicComponent("symbol",tg),XO(),ZO(),sN(),oT.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},Pz),{appear:A0(e)}))),qU(),uV(),oT.registerSeries(w0.type,w0)},B0=Object.assign(Object.assign({},AH),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),P0=`${PT}_CORRELATION_X`,R0=`${PT}_CORRELATION_Y`,O0=`${PT}_CORRELATION_SIZE`,I0=t=>d(t)?t():t,L0=(t,e)=>{var i,s,n,r,a,o,l,h;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const c=t,d=e.view();if(d.x1-d.x0==0||d.y1-d.y0==0||d.x1-d.x0==-1/0||d.x1-d.x0==1/0||d.y1-d.y0==-1/0||d.y1-d.y0==1/0)return t;const p=oe(null!==(i=I0(e.startAngle))&&void 0!==i?i:-90),g=oe(null!==(s=I0(e.endAngle))&&void 0!==s?s:270),f=Math.max((d.x1-d.x0)/2,(d.y1-d.y0)/2),m=Rt(null!==(n=I0(e.innerRadius))&&void 0!==n?n:0,f),v=Rt(I0(e.outerRadius),f),y=I0(e.center),b=[S(null==y?void 0:y[0])?y[0]:d.x0+Rt(null!==(r=null==y?void 0:y[0])&&void 0!==r?r:"50%",d.x1-d.x0),S(null==y?void 0:y[1])?y[1]:d.y0+Rt(null!==(a=null==y?void 0:y[1])&&void 0!==a?a:"50%",d.y1-d.y0)],x=Pt(I0(e.field)),A=c.map(x),[k,C]=It(A),T=k===C?t=>(m+v)/2:t=>m+(v-m)*(t-k)/(C-k),M=I0(e.radiusField),w=I0(e.radiusRange),E=u(M)?x:Pt(M),B=null!==(o=null==w?void 0:w[1])&&void 0!==o?o:5;let P=t=>B;if(E){const[t,e]=E!==x?It(c.map(E)):[k,C],i=null!==(l=null==w?void 0:w[0])&&void 0!==l?l:5,s=null!==(h=null==w?void 0:w[1])&&void 0!==h?h:5;t!==e&&(P=n=>i+(s-i)*(E(n)-t)/(e-t))}const R=Math.min(p,g),O=Math.max(p,g),I=D0(R,O,c.length),L=[],D=(O-R)/60;return c.forEach(((t,e)=>{const i=T(A[e]),s=P(t);let n,r,a=I[e];for(let t=0;t<60&&(n=b[0]+i*Math.cos(a),r=b[1]+i*Math.sin(a),F0({x:n,y:r,size:s},L)||n-sd.x1||r-sd.y1);t++)t<59&&(a+=D,a>O?a=R:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},F0=(t,e)=>!(!e||!e.length)&&e.some((e=>{const i=e.x,s=e.y,n=e.size;return Math.pow(t.x-i,2)+Math.pow(t.y-s,2)d(t)?t():t,H0=(t,e)=>{if(!t||!_(t))return[];const i=z0(e.keyword),s=z0(e.categoryField),n=t[0].latestData[0];return{[s]:i,[LT]:null==n?void 0:n[LT],[FT]:null==n?void 0:n[FT]}};class j0 extends s${constructor(){super(...arguments),this.type=j0.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=yt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}j0.type="ripple";const N0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class U0 extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class V0 extends z${constructor(){super(...arguments),this.type=CC.correlation,this.transformerConstructor=U0,this._viewBox=new Ue}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){if(super.initData(),!this._data)return;DM(this._dataSet,"correlation",L0);const t=new Ra;FM(t,"dataview",Ea),DM(t,"correlationCenter",H0);const e=new Oa(t,{name:`${this.type}_${this.id}_center`});e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"correlationCenter",options:{keyword:()=>{var t,e,i;return null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:""},categoryField:()=>this._spec.categoryField}}),this._centerSeriesData=new VF(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:()=>this._spec.valueField,radiusRange:()=>this._spec.sizeRange,radiusField:()=>this._spec.sizeField,center:()=>[this._spec.centerX,this._spec.centerY],innerRadius:()=>this._spec.innerRadius,outerRadius:()=>this._spec.outerRadius,startAngle:()=>this._spec.startAngle,endAngle:()=>this._spec.endAngle}})}initMark(){const e=this._createMark(V0.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:LT});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(V0.mark.ripplePoint,{key:LT,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(V0.mark.centerPoint,{key:LT,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[P0],y:t=>t[R0],size:t=>t[O0],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),RH("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}V0.type=CC.correlation,V0.mark=B0,V0.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},V0.transformerConstructor=U0;const W0=()=>{oN(),n$(),ZO(),oT.registerMark(j0.type,j0),oT.registerGraphicComponent("symbol",(t=>tg(t))),oT.registerSeries(V0.type,V0),oT.registerAnimation("correlation",((t,e)=>Object.assign({appear:N0(0,e)},Bz)))},G0=Object.assign(Object.assign({},AH),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class Y0 extends s${constructor(){super(...arguments),this.type=Y0.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}Y0.type="liquid";const X0=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class K0 extends dH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class $0 extends YH{constructor(){super(...arguments),this.type=CC.liquid,this.transformerConstructor=lN,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=og({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=tg({x:s,y:n,size:r,symbolType:X0(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=qC(this._spec.outlineMargin),this._paddingSpec=qC(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark($0.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark($0.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark($0.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark($0.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new K0(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),RH("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),RH("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=MA(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}$0.type=CC.liquid,$0.mark=G0,$0.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},$0.transformerConstructor=lN;const q0=t=>Y(t).join(",");class Z0 extends dH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>q0(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>q0(null==t?void 0:t[this.series.getDimensionField()[0]])}}const J0=Object.assign(Object.assign({},AH),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class Q0 extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const t1=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();return s&&(null==t?void 0:t.length)?gJ(Object.assign({setField:i.setField,valueField:i.valueField},s),t):[]};class e1 extends YH{constructor(){super(...arguments),this.type=CC.venn,this.transformerConstructor=Q0,this._viewBox=new Ue}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:DT)}initData(){var t;super.initData(),DM(this._dataSet,"venn",t1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:()=>({getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField})})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(e1.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(e1.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>q0(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>q0(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Z0(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:q0(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return q0(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[q0(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(q0(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),RH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),RH(t.name,this._spec,this._markAttributeContext)))}))}}e1.type=CC.venn,e1.mark=J0,e1.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},e1.transformerConstructor=Q0;class i1 extends VX{constructor(){super(...arguments),this.type=CC.mosaic,this.transformerConstructor=NX}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(ZT),this.setFieldX2(qT)),this.setFieldY(QT),this.setFieldY2(JT)):(t&&(this.setFieldY(ZT),this.setFieldY2(qT)),this.setFieldX(QT),this.setFieldX2(JT)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}i1.type=CC.mosaic,i1.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},i1.transformerConstructor=NX;class s1 extends LV{_isValidSeries(t){return t===CC.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class n1 extends RV{constructor(){super(...arguments),this.transformerConstructor=s1,this.type="map",this.seriesType=CC.map}}n1.type="map",n1.seriesType=CC.map,n1.transformerConstructor=s1;class r1 extends LV{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class a1 extends r1{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY","clamp"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=kN(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,aT({},s,l)),n&&Object.assign(o,aT({},n,o))}}class o1 extends r1{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class l1 extends r1{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class h1 extends RV{constructor(){super(...arguments),this.transformerConstructor=l1}}h1.transformerConstructor=l1;class c1 extends h1{constructor(){super(...arguments),this.transformerConstructor=l1,this.type="pie",this.seriesType=CC.pie}}c1.type="pie",c1.seriesType=CC.pie,c1.transformerConstructor=l1;class d1 extends o1{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["radius","outerRadius","innerRadius"]),n.radius=null!==(e=t.radius)&&void 0!==e?e:jN,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:jN,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>aT({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const u1=(t,e)=>{if(!t)return null;const i=hj(t,(t=>"angle"===t.getOrient()),e),s=hj(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Ek(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=vk({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=K(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=yk(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=oj(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Ek(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=vk({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=yk(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=oj(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class p1 extends RV{constructor(){super(...arguments),this.transformerConstructor=d1,this.type="rose",this.seriesType=CC.rose}_setModelOption(){this._modelOption.getDimensionInfo=u1}}p1.type="rose",p1.seriesType=CC.rose,p1.transformerConstructor=d1,G(p1,jV);class g1 extends o1{_getDefaultSeriesSpec(t){var e,i,s,n;const r=super._getDefaultSeriesSpec(t),a=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e,"series","radar","area");return this._addSeriesRelatedSpecKeys(["line","point","area"]),r.line=t.line,r.point=t.point,r.stack=t.stack,r.percent=t.percent,r.area=aT({visible:null!==(s=null==a?void 0:a.visible)&&void 0!==s&&s},t.area),r.seriesMark=null!==(n=t.seriesMark)&&void 0!==n?n:"area",r.activePoint=t.activePoint,r.pointDis=t.pointDis,r.pointDisMul=t.pointDisMul,r.markOverlap=t.markOverlap,r}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>aT({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class f1 extends RV{constructor(){super(...arguments),this.transformerConstructor=g1,this.type="radar",this.seriesType=CC.radar}_setModelOption(){this._modelOption.getDimensionInfo=u1}}f1.type="radar",f1.seriesType=CC.radar,f1.transformerConstructor=g1,G(f1,jV);class m1 extends LV{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&aT(e,pF(this.type,t))})),this._transformAxisSpec(t)}}class v1 extends RV{constructor(){super(...arguments),this.transformerConstructor=m1,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=qV(t,e,i))&&void 0!==s?s:[],...null!==(n=u1(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}v1.type="common",v1.transformerConstructor=m1,G(v1,jV);class y1 extends DV{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class _1 extends RV{constructor(){super(...arguments),this.transformerConstructor=y1}}_1.transformerConstructor=y1,G(_1,jV);class b1 extends y1{transformSpec(t){super.transformSpec(t),oF(t)}}class x1 extends _1{constructor(){super(...arguments),this.transformerConstructor=b1,this.type="histogram",this.seriesType=CC.bar}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}x1.type="histogram",x1.seriesType=CC.bar,x1.transformerConstructor=b1;class S1 extends a1{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["cornerRadius","progress","track","roundCap"]),s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class A1 extends RV{constructor(){super(...arguments),this.transformerConstructor=S1,this.type="circularProgress",this.seriesType=CC.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=u1}}A1.type="circularProgress",A1.seriesType=CC.circularProgress,A1.transformerConstructor=S1,G(A1,jV);class k1 extends a1{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["pin","pinBackground","pointer"]),e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=CC.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===CC.gauge||t.type===CC.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===CC.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class C1 extends RV{constructor(){super(...arguments),this.transformerConstructor=k1,this.type="gauge",this.seriesType=CC.gaugePointer}}C1.type="gauge",C1.seriesType=CC.gaugePointer,C1.transformerConstructor=k1;class T1 extends LV{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class M1 extends RV{constructor(){super(...arguments),this.transformerConstructor=T1,this.type="wordCloud",this.seriesType=CC.wordCloud}}M1.transformerConstructor=T1;class w1 extends M1{constructor(){super(...arguments),this.transformerConstructor=T1,this.type="wordCloud",this.seriesType=CC.wordCloud}}w1.type="wordCloud",w1.seriesType=CC.wordCloud,w1.transformerConstructor=T1;class E1 extends LV{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class B1 extends RV{constructor(){super(...arguments),this.transformerConstructor=E1,this.type="funnel",this.seriesType=CC.funnel}}B1.type="funnel",B1.seriesType=CC.funnel,B1.transformerConstructor=E1;class P1 extends DV{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",this._addSeriesRelatedSpecKeys(["cornerRadius"]),s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=kN(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=kN(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class R1 extends RV{constructor(){super(...arguments),this.transformerConstructor=P1,this.type="linearProgress",this.seriesType=CC.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}R1.type="linearProgress",R1.seriesType=CC.linearProgress,R1.transformerConstructor=P1,G(R1,jV);class O1 extends DV{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),oF(t)}}class I1 extends RV{constructor(){super(...arguments),this.transformerConstructor=O1,this.type="rangeColumn",this.seriesType=CC.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}I1.type="rangeColumn",I1.seriesType=CC.rangeColumn,I1.transformerConstructor=O1;class L1 extends LV{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class D1 extends RV{constructor(){super(...arguments),this.transformerConstructor=L1,this.type="sunburst",this.seriesType=CC.sunburst}}D1.type="sunburst",D1.seriesType=CC.sunburst,D1.transformerConstructor=L1;class F1 extends LV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class z1 extends RV{constructor(){super(...arguments),this.transformerConstructor=F1,this.type="circlePacking",this.seriesType=CC.circlePacking}}z1.type="circlePacking",z1.seriesType=CC.circlePacking,z1.transformerConstructor=F1;class H1 extends LV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class j1 extends RV{constructor(){super(...arguments),this.transformerConstructor=H1,this.type="treemap",this.seriesType=CC.treemap}}j1.type="treemap",j1.seriesType=CC.treemap,j1.transformerConstructor=H1;class N1 extends GX{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),oF(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["bar","stackLabel","leaderLine","total","calculationMode"]),e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class U1 extends YX{constructor(){super(...arguments),this.transformerConstructor=N1,this.type="waterfall",this.seriesType=CC.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}U1.type="waterfall",U1.seriesType=CC.waterfall,U1.transformerConstructor=N1;class V1 extends DV{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),oF(t)}}class W1 extends RV{constructor(){super(...arguments),this.transformerConstructor=V1,this.type="boxPlot",this.seriesType=CC.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}W1.type="boxPlot",W1.seriesType=CC.boxPlot,W1.transformerConstructor=V1;class G1 extends LV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class Y1 extends RV{constructor(){super(...arguments),this.transformerConstructor=G1,this.type="sankey",this.seriesType=CC.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=kM(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}Y1.type="sankey",Y1.seriesType=CC.sankey,Y1.transformerConstructor=G1;class X1 extends DV{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["area","point","line"]),s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),oF(t)}}class K1 extends RV{constructor(){super(...arguments),this.transformerConstructor=X1,this.type="rangeArea",this.seriesType=CC.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}K1.type="rangeArea",K1.seriesType=CC.rangeArea,K1.transformerConstructor=X1;class $1 extends DV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class q1 extends RV{constructor(){super(...arguments),this.transformerConstructor=$1,this.type="heatmap",this.seriesType=CC.heatmap}}q1.type="heatmap",q1.seriesType=CC.heatmap,q1.transformerConstructor=$1;class Z1 extends LV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class J1 extends RV{constructor(){super(...arguments),this.transformerConstructor=Z1,this.type="correlation",this.seriesType=CC.correlation}}J1.type="correlation",J1.seriesType=CC.correlation,J1.transformerConstructor=Z1;function Q1(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=xM(t.style)),P(t.textStyle)||aT(s.textStyle,xM(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&xM(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&xM(s.background.style),s}function t2(t){const e=t=>function(t){return p(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:p(t.texturePadding)?t.texturePadding:1,textureSize:p(t.textureSize)?t.textureSize:4}):t}(t);if(d(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else P(t.style)||(t.style=e(t.style));return P(t.state)||Object.keys(t.state).forEach((i=>{if(d(t.state[i])){const s=t.state[i];t.state[i]=(...t)=>e(s(...t))}else P(t.state[i])||(t.state[i]=e(t.state[i]))})),t}const e2=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},i2=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:FT;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)},s2={position:!0,item:!0,title:!0,pager:!0,background:!0};class n2 extends YN{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{bk(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),bk(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=WC(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const s=!V(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):s&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(s&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,s=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>V(null==i?void 0:i[t],null==s?void 0:s[t])||s2[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new VF(this._option,e),this._initSelectedData(),bk(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(bk(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(aT({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(aT({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(aT({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}n2.specKey="legends";class r2 extends n2{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),bk(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){DM(this._option.dataSet,"discreteLegendFilter",i2),DM(this._option.dataSet,"discreteLegendDataMake",e2);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return bk(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!bA(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=aM(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i,s){const{title:n={},item:r={},pager:a={},background:o={},type:l,id:h,visible:c,orient:u,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=t,S=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:k={},pager:C={},background:T={}}=t;A=L(A),k=L(k),C=L(C),T=L(T);const M=S;if(d(M.maxRow)||d(M.maxCol)){const t=WC(s)?s:WC(u)?u:"left";d(M.maxRow)&&(M.maxRow=M.maxRow({rect:i,orient:t,id:h})),d(M.maxCol)&&(M.maxCol=M.maxCol({rect:i,orient:t,id:h}))}return A.visible?M.title=Q1(A):M.title={visible:!1},P(k.focusIconStyle)||xM(k.focusIconStyle),k.shape&&(k.shape=t2(yM(k.shape))),k.label&&(k.label=yM(k.label)),k.value&&(k.value=yM(k.value)),k.background&&(k.background=yM(k.background)),GC(k.maxWidth)&&(k.maxWidth=Number(k.maxWidth.substring(0,k.maxWidth.length-1))*i.width/100),GC(k.width)&&(k.width=Number(k.width.substring(0,k.width.length-1))*i.width/100),GC(k.height)&&(k.height=Number(k.height.substring(0,k.height.length-1))*i.width/100),M.item=k,"scrollbar"===C.type?(P(C.railStyle)||xM(C.railStyle),P(C.sliderStyle)||xM(C.sliderStyle)):(P(C.textStyle)||xM(C.textStyle),C.handler&&yM(C.handler)),M.pager=C,T.visible&&!P(T.style)&&(aT(M,T.style),p(T.padding)&&(M.padding=T.padding)),M}(this._spec,t,this.layoutOrient)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return NY}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(IY.legendItemClick,(i=>{const s=R(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(IY.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(IY.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,datum:t.datum,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=eH(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=eH(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}r2.specKey="legends",r2.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},r2.type=r.discreteLegend;const a2=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},o2=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?fM(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function l2(t){const i=aT({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:y,data:_,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:C,seriesId:T,padding:M}=i,w=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?w.title=Q1(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=xM(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=xM(r.style)),P(a.style)||(w.trackStyle=xM(a.style)),w.startText=yM(o),w.endText=yM(l),w.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>xM(i(t,e,s)):P(i)||(e.style=xM(i)),e}(h),P(c)||(w.sizeBackground=xM(c)),u.visible&&!P(u.style)&&(aT(w,u.style),p(u.padding)&&(w.padding=u.padding)),w}const h2={color:YY,size:KY},c2={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},d2=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},c2),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},u2={horizontal:d2(!0),vertical:d2(!1)},p2=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},c2),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},g2={horizontal:p2(!0),vertical:p2(!1)},f2=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],m2=[2,10];class v2 extends n2{static getSpecInfo(t){const e=iH(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),bk(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){DM(this._option.dataSet,"continuousLegendFilter",o2),DM(this._option.dataSet,"continuousLegendDataMake",a2);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>xk(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=aM(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!bA(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=aM(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?f2:m2);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 h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},l2(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return h2[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}v2.specKey="legends",v2.builtInTheme={colorLegend:u2,sizeLegend:g2},v2.type=r.continuousLegend;const y2=(t,e)=>p(e)?t.map((t=>e[t])):void 0,_2=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),b2=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function x2(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=S2(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>_2(i,s)(t)&&_2(n,r)(t)&&(u(a)||_2([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:BM.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return $z.globalConfig.uniqueTooltip&&$z.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:BM.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return $z.globalConfig.uniqueTooltip&&$z.hideTooltip(a.id),m}return"none"}const S2=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=y2(c,t);let y=y2(d,t);const _=b2(y),b=!_&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(_2(c,v));if(!_&&(y=y2(d,i),!b2(y)))return;const n=e.type===CC.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=Ek(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(_2(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=y2(d,o),!b2(y))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(_2(c,n));if(!_&&(y=y2(d,r),!b2(y)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===CC.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(_2(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=y2(d,i),!b2(y))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(_2(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=y2(d,a),h=y,!b2(y)&&!a)return;b2(y)||(y=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},A2=t=>p(t)&&!_(t),k2=t=>p(t)&&_(t),C2=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class T2 extends GN{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=aT({},...C2.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=aT({},s);C2.forEach((t=>{delete r[t]})),delete r.style;const a=aT({},r,i);return a.style=aT({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:mA(this._option.mode)||!gA(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=e_.getElementById(t.parentElement)):gA(this._option.mode)&&(t.parentElement=null==pA?void 0:pA.body)}}const M2={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class w2 extends YN{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=T2,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=gA(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&A2(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&$z.globalConfig.uniqueTooltip&&l&&$z.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:BM.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:BM.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?lW.canvas:lW.dom,n=oT.getComponentPluginInType(t);n||cA("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=oT.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(fA(s)||mA(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=x2(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(k2(t)){if(A2(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>rj(t,e[i])))}if(k2(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}w2.type=r.tooltip,w2.transformerConstructor=T2,w2.builtInTheme={tooltip:M2},w2.specKey="tooltip";var E2,B2;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(E2||(E2={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(B2||(B2={}));const P2={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},R2={labelZIndex:!0,gridZIndex:!0},O2={xField:!0,yField:!0,categoryField:!0,valueField:!0},I2={visible:!0,width:!0,style:!0};class L2 extends YN{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Ek(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!V(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||R2[i]||O2[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||I2[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:PM.chart}:{source:BM.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:fA(e)||mA(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:BM.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:BM.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:BM.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{P2[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}L2.specKey="crosshair";const D2={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class F2 extends L2{static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=qH(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){qH(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:ZH(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=Sk(this._regions,"cartesian");e&&(QV(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=iW(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new YW(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new XW(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}F2.specKey="crosshair",F2.builtInTheme={crosshair:D2},F2.type=r.cartesianCrosshair;class z2 extends L2{static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=Sk(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=AN(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=eH(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=ye([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=yt(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new YW(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new $W(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new qW(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new KW(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}z2.specKey="crosshair",z2.builtInTheme={crosshair:D2},z2.type=r.polarCrosshair;const H2=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},j2=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},N2=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},U2=(t,e,i)=>{const s=e.domain();if(Mk(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},V2=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&Mk(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},W2=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},G2=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},Y2=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),X2=(t,e,i)=>{if(Mk(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class K2{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=yt(this.getState().start+f,0,1),y=yt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===tj(QH(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=H({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=H({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=H({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(K2,vK);class $2 extends YN{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:V2(t,this._stateScale,this._isHorizontal),a="percent"===n?e:V2(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=W2(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=X2(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&G2(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else bk(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),bk(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=QH(t),this._isHorizontal="horizontal"===tj(this._orient),this._dataFilterEvent=new K2(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.change=!0,i.reRender=!0,!i.reCompile&&this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0),i}_getComponentOnlySpecKeys(){return null}_isComponentOnlySpecChange(t,e){const i=this._getComponentOnlySpecKeys();if(!i)return!1;return Object.keys(Object.assign(Object.assign({},e),t)).every((s=>V(null==e?void 0:e[s],null==t?void 0:t[s])||i[s]))}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(Mk(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>tj(t._orient)===tj(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Mk(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};bk(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=Mk(d.getScale(0).type),p=Mk(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else bk(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;FM(r,"dataview",Ea),DM(r,"dataFilterComputeDomain",N2);const a=new Oa(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new VF(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(DM(this._option.dataSet,"dataFilterWithNewDomain",j2),DM(this._option.dataSet,"lockStatisticsFilter",H2),bk(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Mk(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Mk(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(Mk(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!V(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;Y2("start",i,this._spec)&&Y2("end",s,this._spec)&&(t="percent"===i?this._spec.start:V2(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:V2(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?V2(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?V2(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=U2(this._start,this._stateScale,W2(i,this._isHorizontal)),this._endValue=U2(this._end,this._stateScale,W2(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Mk(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=X2(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&bk(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new vC:new qk,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),K(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=G2(h);if(!this._dataUpdating&&Ek(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,Ek(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G($2,vK);class q2 extends GN{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=aT({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const Z2=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),J2={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:Z2(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:Z2(!0)},Q2={width:!0,height:!0,showDetail:!0,middleHandler:!0,background:!0,startHandler:!0,endHandler:!0,startText:!0,endText:!0,dragMask:!0,selectedBackground:!0,backgroundChart:!0,selectedBackgroundChart:!0,showBackgroundChart:!0};class t5 extends $2{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=q2,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=U2(e,this._stateScale,W2(s,this._isHorizontal)),a=U2(i,this._stateScale,W2(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new vC),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(W2(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=W2(t,this._isHorizontal),this.effect.onZoomChange())}_getComponentOnlySpecKeys(){return Q2}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new vC;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(W2(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),K(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Mk(t.type)||e[0]!==X(e))&&(!Ek(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:W2(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>U2(t,this._stateScale,W2(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new IG(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>U2(t,this._stateScale,W2(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:xM(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:xM(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:xM(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:xM(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:xM(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:xM(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:xM(g.style)},selectedBackgroundStyle:xM(this._spec.selectedBackground.style),dragMaskStyle:xM(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:aT(xM(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},xM(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:aT(xM(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},xM(null===(d=m.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=eH(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(W2(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}t5.type=r.dataZoom,t5.transformerConstructor=q2,t5.builtInTheme={dataZoom:J2},t5.specKey="dataZoom";const e5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},i5={width:!0,height:!0,rail:!0,slider:!0,round:!0,innerPadding:!0,minSliderSize:!0};class s5 extends $2{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=dk(this._start,e)&&dk(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=W2(n,this._isHorizontal),a=U2(e,this._stateScale,r),o=U2(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentOnlySpecKeys(){return i5}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new EW(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=xM(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=xM(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}s5.type=r.scrollBar,s5.builtInTheme={scrollBar:e5},s5.specKey="scrollBar";const n5=(t,e)=>{const{datum:i,title:s,content:n}=d(e)?e():e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},r5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),a5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:r5("l1FontSize","primaryFontColor")},content:{visible:!0,style:r5("l2FontSize","tertiaryFontColor")}};class o5 extends YN{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(kM(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(kM(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){DM(this._option.dataSet,"indicatorFilter",n5);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:()=>({title:this._title,content:this._content,datum:()=>this._activeDatum})}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new VF(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=aT({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},bM(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?JC(l,this._computeLayoutRadius()):0,dy:h?JC(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},bM(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)V(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new ZY(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}o5.type=r.indicator,o5.builtInTheme={indicator:a5},o5.specKey="indicator";const l5=["sum","average","min","max","variance","standardDeviation","median"];function h5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=K(s);return er}function c5(t,e){return t?`${t}_${e}_extend`:`marker_${e}_extend`}function d5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.x)&&h5(e,t.x,i)&&(null===(l=null==h?void 0:(o=h.getXAxisHelper()).setExtendDomain)||void 0===l||l.call(o,c5(a,"xAxis"),t.x)),c=GC(t.x)?f5(t.x,n)+r.x:m5(h.getXAxisHelper(),[t.x])+r.x,c}function u5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.y)&&h5(e,t.y,i)&&(null===(l=null===(o=h.getYAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,c5(a,"yAxis"),t.y)),c=GC(t.y)?f5(t.y,n)+r.y:m5(h.getYAxisHelper(),[t.y])+r.y,c}function p5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.angle)&&h5(e,t.angle,i)&&(null===(a=null===(r=o.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,c5(n,"angleAxis"),t.angle)),m5(o.angleAxisHelper,[t.angle])}function g5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.radius)&&h5(e,t.radius,i)&&(null===(a=null===(r=o.radiusAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,c5(n,"radiusAxis"),t.radius)),m5(o.radiusAxisHelper,[t.radius])}function f5(t,e){return Number(t.substring(0,t.length-1))*e/100}function m5(t,e){const i=t.getScale(0);return Mk(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function v5(t){return l5.includes(t)}function y5(t,e,i,s,n,r=!1,a){const o=e.getRegion(),l=o.getLayoutStartPoint(),h=i.getRegion(),c=h.getLayoutStartPoint(),d=Math.abs(Math.min(l.x,c.x)-Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width)),u=Math.abs(Math.min(l.y,c.y)-Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height)),g={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},f=[],m=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,v=s.getXAxisHelper(),y=s.getYAxisHelper(),_=v.getScale(0).domain(),b=y.getScale(0).domain(),x=r&&!v.isContinuous&&!!v.getBandwidth,S=r&&!y.isContinuous&&!!y.getBandwidth,A={min:null,max:null},k={min:null,max:null};return m.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=d5(t,_,n,g,d,l,a),r=u5(t,b,n,g,u,l,a),_5(s,x,A,f.length),_5(r,S,k,f.length),f.push([{x:s,y:r}]);else if(e){s=d5(t,_,n,g,d,l,a),r=Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height);const e=Math.min(l.y,c.y);_5(s,x,A,f.length),f.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(l.x,c.x),r=u5(t,b,n,g,u,l,a);const e=Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width);_5(r,S,k,f.length),f.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(f,v,y,A,k),f}function _5(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=p5(t,h,n,a,r),i=g5(t,c,n,a,r);o.push([{angle:e,radius:i}])}else if(e){const e=p5(t,h,n,a,r);o.push([{angle:e,radius:-d},{angle:e,radius:d}])}else if(i){const e=g5(t,c,n,a,r);o.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),o}function x5(t,e){return(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e}function S5(t,e,i,s,n){const r=[],a=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,o=_(s);return i&&a.forEach((t=>{!function(t,e,i,s){var n,r,a,o;const l=e.getXAxisHelper().getScale(0).domain(),h=e.getYAxisHelper().getScale(0).domain(),c=Y(t.x),d=Y(t.y);1===c.length&&S(c[0])&&h5(l,c[0],i)&&(null===(r=null===(n=e.getXAxisHelper())||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,c5(s,"xAxis"),c[0])),1===d.length&&S(d[0])&&h5(h,d[0],i)&&(null===(o=null===(a=e.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,c5(s,"yAxis"),d[0]))}(t,x5(t,e),i,n)})),a.forEach(((t,i)=>{const n=x5(t,e),a=n.getRegion(),l=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();let d=0,u=0;if(s){const t=o?s[i]:s,e=t.x,n=t.y;e&&(d=GC(e)?Number(e.substring(0,e.length-1))*h/100:e),n&&(u=GC(n)?Number(n.substring(0,n.length-1))*c/100:n)}const p=Y(t.x),g=Y(t.y);r.push({x:m5(n.getXAxisHelper(),p)+l.x+d,y:m5(n.getYAxisHelper(),g)+l.y+u})})),r}function A5(t,e,i,s){const n=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var r,a,o,l;const h=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,c=h.angleAxisHelper.getScale(0).domain(),d=h.radiusAxisHelper.getScale(0).domain(),u=Y(t.angle),p=Y(t.radius);1===u.length&&S(u[0])&&h5(c,u[0],i)&&(null===(a=null===(r=h.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,c5(s,"angleAxis"),u[0])),1===p.length&&S(p[0])&&h5(d,p[0],i)&&(null===(l=null===(o=h.radiusAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,c5(s,"radiusAxis"),p[0])),n.push({angle:m5(h.angleAxisHelper,u),radius:m5(h.radiusAxisHelper,p)})})),n}function k5(t,e,i){let{x:s,y:n}=t;return GC(s)&&(s=f5(s,e)),GC(n)&&(n=f5(n,i)),{x:s,y:n}}function C5(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=k5(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>k5(t,n,r)))}function T5(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function M5(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},xM(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},E5(xM(n.style),i,s)),p(n.padding)&&(t.padding=oi(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=E5(xM(r),i,s)),t}return{visible:!1}}function w5(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function E5(t,e,i){return d(t)?t(e,i):t}function B5(t,e){return d(t)?t(e):t}function P5(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function R5(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function O5(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=R5(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function I5(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=R5(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function L5(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function D5(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),y(t[c])&&v5(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),y(t[d])&&v5(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),y(t[a])&&v5(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),y(t[l])&&v5(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;_(s)?i.x=s.map((i=>z5(i,t,e))):i.x=z5(s,t,e)}if(p(e.y)){const s=e.y;_(s)?i.y=s.map((i=>z5(i,t,e))):i.y=z5(s,t,e)}if(p(e.angle)){const s=e.angle;_(s)?i.angle=s.map((i=>z5(i,t,e))):i.angle=z5(s,t,e)}if(p(e.radius)){const s=e.radius;_(s)?i.radius=s.map((i=>z5(i,t,e))):i.radius=z5(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=z5(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const F5={min:(t,e)=>uk(t[0].latestData,e.field),max:(t,e)=>pk(t[0].latestData,e.field),sum:function(t,e){return gk(t[0].latestData,e.field)},average:function(t,e){return fk(t[0].latestData,e.field)},variance:function(t,e){return mk(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(mk(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function z5(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(m(t)){const{aggrType:i,field:s}=t;return F5[i](e,{field:s})}return t}function H5(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}const j5=t=>{var e;const i=null===(e=null==t?void 0:t.dataSet)||void 0===e?void 0:e.dataViewMap;return i?Object.values(i).filter(Boolean):[]},N5=(t,e)=>{var i,s;null===(i=null==t?void 0:t.target)||void 0===i||i.removeListener("change",e.reRunAllTransform),null===(s=null==t?void 0:t.target)||void 0===s||s.removeListener("markRunning",e.markRunning)},U5=t=>{if(!t)return;j5(t).forEach((e=>{N5(e,t)}));const e=null==t?void 0:t.rawData;Array.isArray(e)&&e.forEach((e=>{N5(e,t)}))},V5=(t,e)=>{if(!t)return;const i=new Set(j5(t)),s=[],n=t=>{const r=null==t?void 0:t.rawData;Array.isArray(r)&&r.forEach((t=>{i.has(t)&&e(t)&&!s.includes(t)&&(s.push(t),n(t))}))};n(t),(t=>{const e=Array.from(new Set(t.filter(Boolean)));e.length&&(e.forEach(U5),e.forEach((t=>{var e;null===(e=t.destroy)||void 0===e||e.call(t)})))})([t,...s])},W5="__vchart_marker_coordinate__",G5=["coordinate","coordinates","x","y","x1","y1","angle","angle1","radius","radius1"],Y5=["position","positions","coordinatesOffset","regionRelative"],X5=["offsetX","offsetY","confine"],K5=t=>Array.isArray(t)?t.map(K5):t&&"object"==typeof t?"function"!=typeof t.formatMethod?t:Object.assign(Object.assign({},t),{formatMethod:"__vchart_marker_format_method__"}):t,$5=t=>{if(Array.isArray(t))return t.map($5);if(!t||"object"!=typeof t)return t;const e=Object.assign({},t);return Object.keys(e).forEach((t=>{"style"===t||t.endsWith("Style")?e[t]="__vchart_marker_style__":e[t]=$5(e[t])})),e},q5=(t,e)=>{if(!t||"object"!=typeof t)return t;const i=Object.assign({},t);e.normalizeDomainPosition&&G5.forEach((t=>{i[t]=W5})),e.normalizeAutoRange&&"autoRange"in i&&(i.autoRange="__vchart_marker_auto_range__"),Y5.forEach((t=>{t in i&&(i[t]=W5)})),"label"in i&&(i.label=K5(i.label)),Object.keys(i).forEach((t=>{i[t]=$5(i[t])}));const s=i.itemContent;if(s&&"object"==typeof s){i.itemContent=Object.assign({},s),X5.forEach((t=>{t in i.itemContent&&(i.itemContent[t]=W5)}));const t=i.itemContent.text;t&&"object"==typeof t&&(i.itemContent.text=Object.assign(Object.assign({},K5(t)),{text:"__vchart_marker_text__"}))}return i};class Z5 extends YN{constructor(){super(...arguments),this.layoutType="none",this._markerDataChangeHandler=null,this._markerDataOwned=!1,this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getAutoRangeExtendDomainKeyPrefix(){return`marker_${this.type}_${this.id}`}_getAutoRangeExtendDomainKey(t){return`${this._getAutoRangeExtendDomainKeyPrefix()}_${t}_extend`}_clearAutoRangeExtendDomain(){var t,e;Y(null===(e=(t=this._option).getAllSeries)||void 0===e?void 0:e.call(t)).forEach((t=>{var e,i,s,n,r,a,o,l,h,c;null===(s=null===(i=null===(e=null==t?void 0:t.getXAxisHelper)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.setExtendDomain)||void 0===s||s.call(i,this._getAutoRangeExtendDomainKey("xAxis"),void 0),null===(a=null===(r=null===(n=null==t?void 0:t.getYAxisHelper)||void 0===n?void 0:n.call(t))||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,this._getAutoRangeExtendDomainKey("yAxis"),void 0),null===(l=null===(o=null==t?void 0:t.angleAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,this._getAutoRangeExtendDomainKey("angleAxis"),void 0),null===(c=null===(h=null==t?void 0:t.radiusAxisHelper)||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,this._getAutoRangeExtendDomainKey("radiusAxis"),void 0)}))}_updateMarkerLayout(){this._clearAutoRangeExtendDomain(),this._markerLayout()}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return y(e)&&v5(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ra;return e.registerParser("array",s),new Oa(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}_setMarkerData(t,e=!1){this._releaseMarkerData(),this._markerData=t,this._markerDataOwned=e}_bindMarkerDataChange(){var t;(null===(t=this._markerData)||void 0===t?void 0:t.target)&&(this._markerDataChangeHandler=()=>{this._updateMarkerLayout()},this._markerData.target.on("change",this._markerDataChangeHandler))}_releaseMarkerData(){const t=this._markerData;(null==t?void 0:t.target)&&this._markerDataChangeHandler&&t.target.removeListener("change",this._markerDataChangeHandler),this._markerDataChangeHandler=null,this._markerDataOwned&&V5(t,(t=>t.name===`${this.type}_${this.id}_data`)),this._markerData=null,this._markerDataOwned=!1}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._updateMarkerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._updateMarkerLayout.bind(this)))}clear(){super.clear(),this._markerComponent=null,this._firstSeries=null}release(){this._releaseMarkerData(),super.release()}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=Sk(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=XC(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=XC(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reRender=!0,i.change=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake||i.reCompile||!this._isAutoRangeSpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,scaleDomain:!0,layout:!0,render:!0}):i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){const i=!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange);return V(q5(e,{normalizeDomainPosition:i}),q5(t,{normalizeDomainPosition:i}))}_isAutoRangeSpecChange(t,e){return!(!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange))&&V(q5(e,{normalizeDomainPosition:!0,normalizeAutoRange:!0}),q5(t,{normalizeDomainPosition:!0,normalizeAutoRange:!0}))}reInit(t){super.reInit(t),this._releaseMarkerData(),this._bindSeries(),this._initDataView(),this._buildMarkerAttributeContext(),this._markerComponent&&this._updateMarkerLayout()}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();DM(this._option.dataSet,"markerAggregation",D5),DM(this._option.dataSet,"markerFilter",H5),this._releaseMarkerData();const i=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(i,!0),this._bindMarkerDataChange()}}function J5(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=uk(t,e),r=pk(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Q5 extends Z5{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=O5(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:E5(xM(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>M5(t,this._markerData,this._markAttributeContext))),state:{line:w5(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:w5(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:w5(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return w5(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return w5(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:E5(xM(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:E5(xM(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=T5([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=O5(t);if(this._setMarkerData(this._getRelativeDataView()),!(i||s||n||r||a||o||l||h||c||d||e))return;DM(this._option.dataSet,"markerAggregation",D5),DM(this._option.dataSet,"markerRegression",J5),DM(this._option.dataSet,"markerFilter",H5);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Oa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(m,!0),this._bindMarkerDataChange()}}Q5.specKey="markLine";const t3=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),e3={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},i3={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:t3(!1),endSymbol:t3(!0),label:e3};class s3 extends Q5{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new bY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:y}=O5(e);let _=[];if(u||f||g||m||v||a&&l||a&&h){const t=y5(i,s,n,r,d,!1,this._getAutoRangeExtendDomainKeyPrefix());_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=S5(i,r,d,e.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):c&&(_=C5(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n,r,a,o,l;const h=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const l=this._startRelativeSeries,c=this._endRelativeSeries,{multiSegment:u,mainSegmentIndex:g}=this._spec.line||{},{connectDirection:f}=this._spec;let{expandDistance:m=0}=this._spec;const{points:v,limitRect:y}=h,_=Y(v).filter(Boolean);if(d(m)){const n=null===(t=null==l?void 0:l.getRegion)||void 0===t?void 0:t.call(l),r=null===(e=null==c?void 0:c.getRegion)||void 0===e?void 0:e.call(c);m=m(this._markerData,Object.assign(Object.assign({},this.getMarkAttributeContext()),{region:null===(s=null===(i=this._relativeSeries)||void 0===i?void 0:i.getRegion)||void 0===s?void 0:s.call(i),startRegion:n,endRegion:r,coordinatePoints:_}))}let b;if(GC(m)){const t=l.getRegion(),e=t.getLayoutStartPoint(),i=c.getRegion(),s=i.getLayoutStartPoint();if("bottom"===f||"top"===f){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));b=Number(m.substring(0,m.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));b=Number(m.substring(0,m.length-1))*n/100}}else b=m;if(!v||v.length<2)return void(null===(n=this._markerComponent)||void 0===n||n.setAttributes(h));const x=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(v[0],v[1],f,b);let S;S=u&&p(g)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(v[0],v[1],f,b));const A=Y((null!==(a=null===(r=this._markerComponent)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{}).label),C=Y(h.label),T=Y(this._spec.label);null===(o=this._markerComponent)||void 0===o||o.setAttributes({points:u?[[x[0],x[1]],[x[1],x[2]],[x[2],x[3]]]:x,label:C.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=S.dx)&&void 0!==i?i:0,h=null!==(s=S.dy)&&void 0!==s?s:0;const c=null!==(n=T[e])&&void 0!==n?n:T[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),S),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=A[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:y,multiSegment:u,mainSegmentIndex:g,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(l=this._markerComponent)||void 0===l||l.setAttributes(h)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=O5(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}s3.type=r.markLine,s3.coordinateType="cartesian",s3.builtInTheme={markLine:i3};class n3 extends Q5{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=O5(this._spec);return e||i?new AY(t):new bY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=O5(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=b5(i,s,n,r,a,this._getAutoRangeExtendDomainKeyPrefix());p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=A5(i,r,a,this._getAutoRangeExtendDomainKeyPrefix()),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=O5(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}n3.type=r.polarMarkLine,n3.coordinateType="polar",n3.builtInTheme={polarMarkLine:i3};class r3 extends YN{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=WC(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return iH(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,s&&!i.reMake&&(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=XC(this._spec.width,a.width,null,a.width),l=XC(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)V(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new $Y(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}r3.type=r.title,r3.specKey=r.title,r3.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class a3 extends Z5{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=I5(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:E5(xM(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>M5(t,this._markerData,this._markAttributeContext))),state:{area:w5(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>w5(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return w5(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=T5([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=I5(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}a3.specKey="markArea";const o3={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class l3 extends a3{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new SY(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=I5(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=y5(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=y5(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=S5(s,a,u,i.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):d&&(f=C5(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=I5(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}l3.type=r.markArea,l3.coordinateType="cartesian",l3.builtInTheme={markArea:o3};class h3 extends a3{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=I5(this._spec);return i||e||s?new kY(t):new SY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=I5(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=b5(i,s,n,r,c,this._getAutoRangeExtendDomainKeyPrefix());l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=A5(i,r,c,this._getAutoRangeExtendDomainKeyPrefix()),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=I5(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}h3.type=r.polarMarkArea,h3.coordinateType="polar",h3.builtInTheme={polarMarkArea:o3};const c3=t=>xM(Object.assign({},t)),d3=t=>Object.assign(Object.assign({},t),{style:Object.assign({},xM(t.style))}),u3=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=c3(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=c3(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),y=(_=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},xM(Object.assign({},_)));var _;const b=d3(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=d3(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=d3(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=d3(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:y}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},p3=t=>"left"===t||"right"===t,g3=t=>"top"===t||"bottom"===t,f3={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class m3 extends YN{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},u3(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},u3(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?V(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new dX(t):this._playerComponent=new gX(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=p3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=p3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(rX.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(rX.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(rX.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(rX.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(rX.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(rX.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.type)!==(null==t?void 0:t.type)?(i.reMake=!0,i):(!s||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i)}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=p3(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=g3(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):p3(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):g3(this._orient)?this._maxSize():t.height}_computeDx(t){return p3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return g3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}m3.builtInTheme={player:f3},m3.specKey="player",m3.type=r.player;class v3 extends YN{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,V(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=OC({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==vF.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}v3.type=r.label;class y3 extends S${constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}y3.type="text",y3.constructorType="label";const _3=()=>{A$(),oT.registerMark(y3.constructorType,y3)};class b3 extends GN{_initTheme(t,e){return{spec:t,theme:this._theme}}}class x3 extends v3{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=b3,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(MM.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(MM.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),bk(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=aT({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},zK(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[$T])):t=>t.filter((t=>t.data[KT]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?HK(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}x3.type=r.label,x3.specKey="label",x3.transformerConstructor=b3;class S3 extends v3{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[YT]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return aT({textStyle:{pickable:!0===this._spec.interactive},position:A3(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[$T]:t.data[KT]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>HK({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function A3(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}S3.type=r.totalLabel,S3.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},S3.specKey="totalLabel";class k3 extends Z5{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=L5(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b,x,S,A,k,C,T,M,w,E,B,P,R,O,I,L;const{itemContent:D={},itemLine:F={},targetSymbol:z={}}=this._spec,j=this._relativeSeries.getRegion(),N=D,{type:U="text",text:V,symbol:W,image:G,richText:Y,customMark:X,textStyle:K,symbolStyle:$,imageStyle:q,richTextStyle:Z,customMarkStyle:J,style:Q={},state:tt={}}=N,et=e(N,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let it=null,st=null,nt=U,rt={};if("text"===U){it=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:tt;const r=null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:K)&&void 0!==n?n:Q;(t=>"rich"===(null==t?void 0:t.type))(r)?(nt="richText",rt={width:100,height:100},st=E5(H(rt,(t=>{if(!t)return t;const{type:i,text:s,textConfig:n}=t,r=e(t,["type","text","textConfig"]),a=Object.assign({},r),o=p(n)?n:s;return p(o)&&(a.textConfig=o),a})(r)),this._markerData,this._markAttributeContext)):(rt={dx:0,dy:0},st=M5(Object.assign(Object.assign({},V),{style:H(rt,r)}),this._markerData,this._markAttributeContext))}else"richText"===U?(it=null!==(r=null==Y?void 0:Y.state)&&void 0!==r?r:tt,rt={width:100,height:100},st=E5(H(rt,null!==(o=null!==(a=null==Y?void 0:Y.style)&&void 0!==a?a:Z)&&void 0!==o?o:Q),this._markerData,this._markAttributeContext)):"symbol"===U?(it=null!==(l=null==W?void 0:W.state)&&void 0!==l?l:tt,rt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},st=xM(E5(H(rt,null!==(c=null!==(h=null==W?void 0:W.style)&&void 0!==h?h:$)&&void 0!==c?c:Q),this._markerData,this._markAttributeContext))):"image"===U?(it=null!==(d=null==G?void 0:G.state)&&void 0!==d?d:tt,rt={width:80,height:80},st=E5(H(rt,null!==(g=null!==(u=null==G?void 0:G.style)&&void 0!==u?u:q)&&void 0!==g?g:Q),this._markerData,this._markAttributeContext)):"custom"===U&&(it=null!==(f=null==X?void 0:X.state)&&void 0!==f?f:tt,st=E5(null!==(v=null!==(m=null==X?void 0:X.style)&&void 0!==m?m:J)&&void 0!==v?v:Q,this._markerData,this._markAttributeContext));const at={zIndex:this.layoutZIndex,interactive:null===(y=this._spec.interactive)||void 0===y||y,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(b=this._spec.interactive)||void 0===b||b,position:{x:0,y:0},clipInRange:null!==(x=this._spec.clip)&&void 0!==x&&x,itemContent:Object.assign(Object.assign({type:nt,offsetX:B5(D.offsetX,j),offsetY:B5(D.offsetY,j)},et),{style:E5(st,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(S=z.offset)&&void 0!==S?S:0,visible:null!==(A=z.visible)&&void 0!==A&&A,size:null!==(k=z.size)&&void 0!==k?k:20,style:E5(z.style,this._markerData,this._markAttributeContext)},state:{line:w5(null!==(T=null===(C=this._spec.itemLine.line)||void 0===C?void 0:C.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineStartSymbol:w5(null!==(w=null===(M=this._spec.itemLine.startSymbol)||void 0===M?void 0:M.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:w5(null!==(B=null===(E=this._spec.itemLine.endSymbol)||void 0===E?void 0:E.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:w5(it,this._markerData,this._markAttributeContext),textBackground:w5(null===(R=null===(P=this._spec.itemContent.text)||void 0===P?void 0:P.labelBackground)||void 0===R?void 0:R.state,this._markerData,this._markAttributeContext),targetItem:w5(null!==(I=null===(O=this._spec.targetSymbol)||void 0===O?void 0:O.state)&&void 0!==I?I:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:ot,line:lt={}}=F,ht=e(F,["visible","line"]);at.itemLine=!1!==ot?Object.assign(Object.assign({},ht),{visible:!0,lineStyle:xM(lt.style)}):{visible:!1};return new TY(at)}_markerLayout(){var t,i,s,n,r,a,o,l,h,c,d,u,g;const f=this._spec,m=this._markerData,v=this._relativeSeries,{point:y}=this._computePointsAttr(),_=this._getRelativeDataView().latestData,b=m?m.latestData[0]&&m.latestData[0].latestData?m.latestData[0].latestData:m.latestData:_,{itemLine:x={},itemContent:S={}}=this._spec,A=this._relativeSeries.getRegion(),{visible:k,line:C={}}=x,T=e(x,["visible","line"]),M=!1!==k?Object.assign(Object.assign({},T),{visible:!0,lineStyle:xM(C.style)}):{visible:!1},w=M5(Object.assign(Object.assign({},S.text),{style:H({dx:0,dy:0},null!==(i=null===(t=S.text)||void 0===t?void 0:t.style)&&void 0!==i?i:S.style)}),m,this._markAttributeContext);let E;if(f.clip||(null===(s=f.itemContent)||void 0===s?void 0:s.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=T5([v.getRegion()]);E={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(n=this._markerComponent.attribute)&&void 0!==n?n:{},e=null!==(a=null===(r=t.itemContent)||void 0===r?void 0:r.textStyle)&&void 0!==a?a:{},i=null===(o=this._spec.itemContent.text)||void 0===o?void 0:o.text,s=B5(S.offsetX,A),f=B5(S.offsetY,A);this._markerComponent.setAttributes({position:void 0===y?{x:null,y:null}:y,itemContent:Object.assign(Object.assign({},t.itemContent),{panel:null!==(l=w.panel)&&void 0!==l?l:null===(h=t.itemContent)||void 0===h?void 0:h.panel,padding:null!==(c=w.padding)&&void 0!==c?c:null===(d=t.itemContent)||void 0===d?void 0:d.padding,textStyle:Object.assign(Object.assign(Object.assign({},e),null!==(u=w.textStyle)&&void 0!==u?u:{}),{text:(null===(g=this._spec.itemContent.text)||void 0===g?void 0:g.formatMethod)?this._spec.itemContent.text.formatMethod(b,_):p(i)?i:e.text}),offsetX:P5(y,s,A),offsetY:P5(y,f,A)}),itemLine:M,limitRect:E,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=L5(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}k3.specKey="markPoint";const C3={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class T3 extends k3{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=y5(n,r,r,r,h,!1,this._getAutoRangeExtendDomainKeyPrefix()))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=S5(n,r,h,s.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix())[0]:l&&(c=C5(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=L5(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}T3.type=r.markPoint,T3.coordinateType="cartesian",T3.builtInTheme={markPoint:C3};class M3 extends k3{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=b5(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e,this._getAutoRangeExtendDomainKeyPrefix())[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}M3.type=r.polarMarkPoint,M3.coordinateType="polar",M3.builtInTheme={polarMarkPoint:C3};class w3 extends k3{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}w3.type=r.geoMarkPoint,w3.coordinateType="geo",w3.builtInTheme={geoMarkPoint:C3};const E3="inBrush",B3="outOfBrush",P3={style:!0,inBrush:!0,outOfBrush:!0};class R3 extends YN{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),E3,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),B3,t.AttributeLevel.Series))}))}))}reInit(t){super.reInit(t),this.init()}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return V(e,t)||(i.change=!0,i.reRender=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||P3[i]))}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){var i;const s=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(Object.assign({brushStyle:xM(null===(i=this._spec)||void 0===i?void 0:i.style)},s)),this._initMarkBrushState(e,""),n.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new yX(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:xM(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(uX.brushActive,(s=>{this._initMarkBrushState(i,B3),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(uX.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(uX.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(uX.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(uX.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(uX.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(uX.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(a&&this._handleBrushChange(e,s),null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(uX.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec;n&&this._handleBrushChange(e,i);const r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},xM(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_setBrushState(t,e){var i;const s=null!==(i=t.currentStates)&&void 0!==i?i:[];hz(t,[...s.filter((t=>t!==E3&&t!==B3)),e])}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(this._setBrushState(i,E3),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(this._setBrushState(i,B3),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(this._setBrushState(i,E3),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(this._setBrushState(i,B3),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;dz(s,[E3,B3]),i&&cz(s,i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}R3.type=r.brush,R3.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},R3.specKey="brush";const O3={style:!0,state:!0};class I3 extends YN{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${PT}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=PH({},RH(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i.change=!0,i.reRender=!0,i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||O3[i]))}reInit(t){super.reInit(t),this._updateMarkStyleWithSpec(this._spec,this.getMarks()[0]),this.getMarks().forEach((t=>{t.commit(!1,!0)}))}_updateMarkStyleWithSpec(t,e){var i,s,n,r;if(t&&e&&(this.initMarkStyleWithSpec(e,t),"group"===t.type)){const a=null!==(n=null===(s=(i=e).getMarks)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[];null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._updateMarkStyleWithSpec(t,a[e])}))}}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ue).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ue;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}I3.type=r.customMark,I3.specKey="customMark";class L3{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>D3(t))),a=n.filter((t=>!D3(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>D3(t))),h=o.filter((t=>!D3(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function D3(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}L3.type="grid";const F3="vchart-tooltip",z3=`${F3}-container`,H3=`${F3}-title`,j3=`${F3}-content-box`,N3={offsetX:10,offsetY:10},U3="99999999999999";function V3(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const W3=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,G3=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?V3(t):"",Y3=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},X3={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},K3=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=X3[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class $3 extends bN{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:C}=this._option,T=m[_],M=aH(null==T?void 0:T.position,b,e),w=null!==(r=aH(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:RT,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:OT;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},H={x:0,y:0},j=1,N=1;const U=gA(this._env);if(U&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),U&&!P){const t=this._getParentElement(m);H=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-H.x,y:F.y-H.y},j=W3(e,F),N=W3(t,H)}const V=N/j,W={},G={x:M,y:M},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:C;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?E:B;switch(K3(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},K=["x","y"];if(g(M))if((t=>g(t)&&(p(t.left)||p(t.right)||p(t.top)||p(t.bottom)))(M)){const{left:t,right:e,top:i,bottom:s}=M;W.left=Y3(t,y),W.top=Y3(i,y),W.right=Y3(e,y),W.bottom=Y3(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(M)&&K.forEach((t=>{const e=M[t];S(e)||d(e)?W[Y[t][0]]=Y3(e,y):X(e,t)}));else p(M)&&(X({orient:M,mode:w},"x"),X({orient:M,mode:w},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?O:I,n="x"===t?A:C,r=K3(G[t],t);if(k(W[Y[t][0]]))$[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))$[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}$[t]*=j,U&&($[t]+=z[t]),$[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(H[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/N:-H[t]/N,l=a/N+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(L?$[t]=l:($[t]-=0===r?n+i/2:2*n+i,$[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",Z3=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=q3(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=q3(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},J3=(t={})=>{const{lineHeight:e}=t;return t.fontSize?XC(e,t.fontSize):0},Q3=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=oi(r),a.padding=q3(o)),{panelStyle:a,panelPadding:o}};function t4(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class e4 extends $3{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(e4.type),this.type=lW.dom,this._tooltipContainer=null==pA?void 0:pA.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(pA&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=Q3(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(y.marginBottom=`${g}px`);const _={width:q3(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=Z3(h),x=Z3(d),S=Z3(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[A]=q3(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=q3(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=q3(null!==(n=p.spacing)&&void 0!==n?n:0);const C=Math.max(J3(p),J3(d));return y.lineHeight=C>0?`${C}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(H3))),l=a.find((t=>t.className.includes(j3)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(H3),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(t4(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${F3}-column`),e.classList.add(`${F3}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(j3),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];t4(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));t4(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${F3}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=G3(e.key),e.keyStyle&&Z3(e.keyStyle,l)):"value"===i?(o.innerHTML=G3(e.value),e.valueStyle&&Z3(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?V3(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?V3(c):m,_=p,b=t=>new Qp({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ue));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=nu.IsGradientStr(u);if(!u||y(u)&&!T||d)return m=d?"none":u?V3(u):"currentColor",`\n \n \n \n `;const M=T?nu.Parse(u):g(u)?u:null;if(M){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=M.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===M.gradient?t=`\n ${i}\n `:"linear"===M.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),t4(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(j3))),h=[...o.children].find((t=>t.className.includes(H3)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(H3)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=XC(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,t4(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=Sf({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n});return{width:r.width(),height:r.height(),text:s}};function n4(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:i4),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const r4=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class a4 extends $3{constructor(){super(a4.type),this.type=lW.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new AX({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=oi(d.padding),b=qC(d.padding),x=n4(Object.assign({textAlign:"right"===y?"right":"left"},u),i),S=n4(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=n4(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},C={panel:r4(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:M=[]}=t;let w=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!M.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;C.content=M.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:C}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=aT({},S,n4(b,void 0,{})),{width:s,height:n,text:r}=s4(h,i);T.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),y?e.push(s):t.push(s),o=Math.max(o,n)}if(p(m)){const t=aT({},A,n4(x,void 0,{})),{width:e,height:s,text:n}=s4(m,t);T.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};C?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(H){V=aT({},x,n4(N,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=s4(j,V);C.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=C.title.value.width,F=C.title.value.height,z=F+(P?C.title.spaceRow:0)}return E+=z,C.title.width=D,C.title.height=F,W()?w+=B||D:w+=Math.max(D,B),P&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=w-b.left-b.right-L-R-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=w,C.panel.height=E,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}a4.type=lW.canvas;const o4=/\{([^}]+)\}/,l4=/\{([^}]+)\}/g,h4=/:/;class c4 extends bN{constructor(){super(c4.type),this.type="formatterPlugin",this._timeModeFormat={utc:yi.getInstance().timeUTCFormat,local:yi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ti.getInstance().format,this._numericSpecifier=Ti.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[c4.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),oT.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=o4.test(i),this._isNumericFormatterCache.set(i,s))),s){return i.replace(l4,((t,i)=>{if(!h4.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}))}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ai.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}c4.pluginType="chart",c4.specKey="formatter",c4.type="formatterPlugin";$z.useRegisters([()=>{pW(),fW(),vW(),WV(),VV(),CV(),mV(),rN(),oN(),Lz(),Rz(),qU(),uV(),oT.registerSeries(TV.type,TV),oT.registerChart(yW.type,yW)},()=>{pW(),fW(),vW(),VV(),CV(),mV(),rN(),xW(),oN(),kW(),qU(),uV(),oT.registerSeries(MX.type,MX),WV(),oT.registerChart(EX.type,EX)},()=>{pW(),fW(),vW(),VV(),WX(),WV(),oT.registerChart(YX.type,YX)},()=>{pW(),fW(),WV(),VV(),sK(),oT.registerChart(rK.type,rK)},()=>{fW(),nq(),oT.registerChart(c1.type,c1)},()=>{pW(),fW(),WV(),VV(),Aq(),oT.registerChart(p1.type,p1)},()=>{pW(),fW(),vW(),WV(),VV(),Rq(),oT.registerChart(f1.type,f1)},()=>{pW(),fW(),vW(),WV(),VV(),WX(),oT.registerTransform("bin",Zr),oT.registerChart(x1.type,x1)},()=>{fW(),_K(),cK(),oT.registerSeries(xK.type,xK),oT.registerImplement("registerMap",NM),oT.registerImplement("unregisterMap",UM),Oz(),oT.registerChart(n1.type,n1)},()=>{fW(),_0(),oT.registerSeries(x0.type,x0),q$(),qq(),_q(),tZ(),oT.registerChart(C1.type,C1)},()=>{fW(),WJ(),oT.registerChart(w1.type,w1)},()=>{fW(),dQ(),oT.registerChart(B1.type,B1)},()=>{pW(),fW(),vW(),WV(),VV(),ZK(),oT.registerChart(U1.type,U1)},()=>{pW(),fW(),WV(),VV(),x$(),oT.registerTransform("boxplot",Jr),oT.registerChart(W1.type,W1)},()=>{pW(),fW(),WV(),VV(),tZ(),oT.registerChart(A1.type,A1)},()=>{pW(),fW(),WV(),VV(),hZ(),oT.registerChart(R1.type,R1)},()=>{pW(),fW(),WV(),VV(),R$(),oT.registerChart(I1.type,I1)},()=>{pW(),fW(),vW(),WV(),VV(),xW(),qU(),uV(),oT.registerSeries(F$.type,F$),oT.registerChart(K1.type,K1)},()=>{fW(),EQ(),oT.registerChart(D1.type,D1)},()=>{fW(),LQ(),oT.registerChart(z1.type,z1)},()=>{fW(),h0(),oT.registerChart(j1.type,j1)},()=>{fW(),PW(),e0(),oT.registerChart(Y1.type,Y1)},()=>{fW(),E0(),oT.registerChart(q1.type,q1)},()=>{fW(),W0(),oT.registerChart(J1.type,J1)},()=>{pW(),fW(),vW(),WV(),oT.registerChart(v1.type,v1),VV()},uV,qU,()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),sU(),oT.registerComponent(kX.type,kX)},()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),sU(),oT.registerComponent(CX.type,CX)},()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),sU(),oT.registerComponent(TX.type,TX)},xq,_q,()=>{oT.registerComponent(r2.type,r2)},()=>{oT.registerComponent(v2.type,v2)},()=>{oT.registerComponent(w2.type,w2)},()=>{oT.registerComponent(F2.type,F2)},()=>{oT.registerComponent(z2.type,z2)},()=>{oT.registerComponent(t5.type,t5)},()=>{oT.registerComponent(s5.type,s5)},()=>{oT.registerComponent(o5.type,o5)},_K,()=>{oT.registerComponent(s3.type,s3),_Y()},()=>{oT.registerComponent(l3.type,l3),xY()},()=>{oT.registerComponent(T3.type,T3),CY()},()=>{oT.registerComponent(n3.type,n3),AY._animate=tY,_Y()},()=>{oT.registerComponent(h3.type,h3),kY._animate=iY,xY()},()=>{oT.registerComponent(M3.type,M3),CY()},()=>{oT.registerComponent(w3.type,w3),CY()},()=>{oT.registerComponent(r3.type,r3)},()=>{oT.registerComponent(m3.type,m3)},()=>{oT.registerGraphicComponent(x3.type,(t=>new uG(t))),_3(),qN(),oT.registerComponent(x3.type,x3,!0,1/0)},()=>{oT.registerGraphicComponent(S3.type,(t=>new uG(t))),_3(),qN(),oT.registerComponent(S3.type,S3,!0)},()=>{oT.registerComponent(R3.type,R3)},()=>{oT.registerComponent(I3.type,I3)},()=>{WW(Zy()),WW(vb()),yb()},()=>{oT.registerLayout(L3.type,L3)},()=>{var t;t=a4,oT.registerComponentPlugin(t.type,t)},()=>{var t;t=c4,oT.registerChartPlugin(t.type,t)},Nz,Wz]),$z.useRegisters([()=>{wP(i_)}]),t.DEFAULT_CHART_HEIGHT=OT,t.DEFAULT_CHART_WIDTH=RT,t.DEFAULT_CLOSE_STROKE_JOIN=Jz,t.DEFAULT_DATA_INDEX=LT,t.DEFAULT_DATA_KEY=DT,t.DEFAULT_DATA_SERIES_FIELD=FT,t.DEFAULT_KEY=iM,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=Zz,t.DEFAULT_MAP_LOOK_UP_KEY=sM,t.DEFAULT_MEASURE_CANVAS_ID=IT,t.DEFAULT_SERIES_STYLE_NAME=zT,t.DEFAULT_SMOOTH_INTERPOLATE=qz,t.Factory=oT,t.MOSAIC_CAT_END_PERCENT=QT,t.MOSAIC_CAT_START_PERCENT=JT,t.MOSAIC_VALUE_END_PERCENT=ZT,t.MOSAIC_VALUE_START_PERCENT=qT,t.ManualTicker=class extends bD{constructor(t){super(t),this.lastFrameTime=0,this.status=Rl.RUNNING}setupTickHandler(){const t=new Qz;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Rl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Rl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Rl.RUNNING,!0}},t.PREFIX=PT,t.SEGMENT_FIELD_END=eM,t.SEGMENT_FIELD_START=tM,t.STACK_FIELD_END=NT,t.STACK_FIELD_END_OffsetSilhouette=GT,t.STACK_FIELD_END_PERCENT=VT,t.STACK_FIELD_KEY=HT,t.STACK_FIELD_START=jT,t.STACK_FIELD_START_OffsetSilhouette=WT,t.STACK_FIELD_START_PERCENT=UT,t.STACK_FIELD_TOTAL=YT,t.STACK_FIELD_TOTAL_BOTTOM=$T,t.STACK_FIELD_TOTAL_PERCENT=XT,t.STACK_FIELD_TOTAL_TOP=KT,t.StreamLight=sD,t.ThemeManager=AT,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=$z,t.boundsInRect=$C,t.builtinThemes=uT,t.calcLayoutNumber=XC,t.calcPadding=KC,t.computeActualDataScheme=PC,t.convertPoint=ZC,t.createArc=Kg,t.createArea=Gg,t.createGroup=sf,t.createLine=sg,t.createRect=og,t.createRichText=Hg,t.createSymbol=tg,t.createText=Kp,t.darkTheme=nT,t.dataScheme=QC,t.default=$z,t.defaultThemeName=pT,t.getActualColor=OC,t.getActualNumValue=JC,t.getColorSchemeBySeries=FC,t.getDataScheme=BC,t.getFunnelTheme=cT,t.getMergedTheme=xT,t.getSpecInfo=iH,t.getTheme=yT,t.hasThemeMerged=mT,t.isColorKey=IC,t.isPercent=GC,t.isPercentOffset=YC,t.isProgressiveDataColorScheme=LC,t.isTokenKey=eT,t.isValidOrient=WC,t.lightTheme=sT,t.lookup=sH,t.measureText=BT,t.normalizeLayoutPaddingSpec=qC,t.queryColorFromColorScheme=RC,t.queryToken=tT,t.registerDataSetInstanceParser=FM,t.registerDataSetInstanceTransform=DM,t.registerTheme=vT,t.removeTheme=_T,t.themeExist=bT,t.themes=gT,t.token=iT,t.transformColorSchemeToStandardStruct=DC,t.transformToGraphic=xM,t.version="2.1.0",t.vglobal=e_,t.warn=hA,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/openinula-vchart/package.json b/packages/openinula-vchart/package.json index 0a68ffc0bd..2bd3229541 100644 --- a/packages/openinula-vchart/package.json +++ b/packages/openinula-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/openinula-vchart", - "version": "2.0.22", + "version": "2.1.0", "sideEffects": false, "description": "The openinula version of VChart 4.x", "keywords": [ @@ -28,7 +28,7 @@ "build": "bundle --clean" }, "dependencies": { - "@visactor/vchart": "workspace:2.0.22", + "@visactor/vchart": "workspace:2.1.0", "@visactor/vutils": "~1.0.23", "@visactor/vrender-core": "1.1.0", "@visactor/vrender-kits": "1.1.0", @@ -78,4 +78,4 @@ "access": "public", "registry": "https://registry.npmjs.org/" } -} \ No newline at end of file +} diff --git a/packages/react-vchart/package.json b/packages/react-vchart/package.json index a1b81e89ca..88d513f0bf 100644 --- a/packages/react-vchart/package.json +++ b/packages/react-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vchart", - "version": "2.0.22", + "version": "2.1.0", "sideEffects": false, "description": "The react version of VChart 4.x", "keywords": [ @@ -33,8 +33,8 @@ "build": "bundle --clean" }, "dependencies": { - "@visactor/vchart": "workspace:2.0.22", - "@visactor/vchart-extension": "workspace:2.0.22", + "@visactor/vchart": "workspace:2.1.0", + "@visactor/vchart-extension": "workspace:2.1.0", "@visactor/vutils": "~1.0.23", "@visactor/vrender-core": "1.1.0", "@visactor/vrender-kits": "1.1.0", @@ -88,4 +88,4 @@ "access": "public", "registry": "https://registry.npmjs.org/" } -} \ No newline at end of file +} diff --git a/packages/taro-vchart/package.json b/packages/taro-vchart/package.json index b5f69703e4..fff6b56645 100644 --- a/packages/taro-vchart/package.json +++ b/packages/taro-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/taro-vchart", - "version": "2.0.22", + "version": "2.1.0", "description": "Taro VChart 图表组件", "sideEffects": false, "main": "esm/index.js", @@ -43,8 +43,8 @@ }, "license": "MIT", "dependencies": { - "@visactor/vchart": "workspace:2.0.22", - "@visactor/vchart-extension": "workspace:2.0.22" + "@visactor/vchart": "workspace:2.1.0", + "@visactor/vchart-extension": "workspace:2.1.0" }, "devDependencies": { "@internal/bundler": "workspace:*", diff --git a/packages/tt-vchart/src/vchart/index.js b/packages/tt-vchart/src/vchart/index.js index 049c93c048..5b19d37a5a 100644 --- a/packages/tt-vchart/src/vchart/index.js +++ b/packages/tt-vchart/src/vchart/index.js @@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function V(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function U(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(V(t)!==V(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=N(t),n=N(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!U(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=it){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var _t=function(t,e,i){return ti?i:t};var yt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=m(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Mt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function wt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const Ct=4294967296;const Et=t=>e=>L(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(y(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Lt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Rt=t=>0,Ot=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=It(f.min,f);for(let r=0;r=1?Ht:t<=-1?-Ht:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ae{static distancePP(t,e){return Kt(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Kt(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return Kt(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Vt;)t+=Vt;else if(t>0)for(;t>Vt;)t-=Vt;return t};function ce(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=pe(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(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 me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ye(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Me(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function we(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ce(t,e){const i=e?oe(t.angle):t.angle,s=we(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=Ce(t,i),n=Ce(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(we(t),we(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+Ht;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+Ht;u>Nt&&(u-=Nt),g>Nt&&(g-=Nt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Me(n,i)+Me(n,s))/2>Me(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Oe(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Fe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(_(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return He(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ne extends Ve{}class Ue extends Ve{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ue(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class We{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new We,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new We;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new We(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=le(r.rotateDeg),r}}class Ge{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Ye(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Xe(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const $e=/^#([0-9a-f]{3,8})$/,Ke={transparent:4294967040},qe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ze(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Je(t){return S(t)?new si(t>>16,t>>8&255,255&t,1):y(t)?new si(t[0],t[1],t[2]):new si(255,255,255)}function Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ei=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new si((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Je(t):8===e?new si(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ii{static Brighter(t,e=1){return 1===e?t:new ii(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ii(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ii?t:new ii(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Ke[t]))return function(t){return S(t)?new si(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new si(t[0],t[1],t[2],t[3]):new si(255,255,255,1)}(Ke[t]);if(p(qe[t]))return Je(qe[t]);const e=`${t}`.trim().toLowerCase(),i=ei(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new si(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new si(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ii.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new si(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Xe(this.color.r,this.color.g,this.color.b),r=Ye(u(t)?n.h:_t(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new si(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ei(e,!0);return null!=i?i:this}setColorName(t){const e=qe[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ii(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class si{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Ze(this.r)+Ze(this.g)+Ze(this.b)+(1===this.opacity?"":Ze(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Xe(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ni(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new si(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Xe});function ai(t){if(k(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function oi(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function li(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function hi(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const ci=1e-10;function di(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ci)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=fi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ui(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ci,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ui(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function pi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ui(t,t-(i*i-e*e+t*t)/(2*i))+ui(e,s)}function gi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function fi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let _i;function yi(t,e){const i=vi(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class bi{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const xi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Si(t){let e;if(e=xi.exec(t))return new bi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});ot.getInstance().error("invalid format: "+t)}const Ai=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class ki{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return ki.instance||(ki.instance=new ki),ki.instance}newFormat(t){const e=Si(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Mi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?m:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?Ai[8+_i/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Si(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=vi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ai[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>yi(100*t,e),r:yi,s:function(t,e){const i=vi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(_i=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+vi(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function Ti(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Bi(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Bi(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Ri(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ei(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},ts=Math.sqrt,es=Math.tan;function is(t){return t>1?0:t<-1?ji:Math.acos(t)}function ss(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function ns(){}function rs(t,e){t&&os.hasOwnProperty(t.type)&&os[t.type](t,e)}var as={Feature:function(t,e){rs(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sji?t+Math.round(-t/Ni)*Ni:t,e]}function bs(t,e,i){return(t%=Ni)?e||i?_s(Ss(t),As(e,i)):Ss(t):e||i?As(e,i):ys}function xs(t){return function(e,i){return[(e+=t)>ji?e-Ni:e<-ji?e+Ni:e,i]}}function Ss(t){var e=xs(t);return e.invert=xs(-t),e}function As(t,e){var i=$i(t),s=Ji(t),n=$i(e),r=Ji(e);function a(t,e){var a=$i(e),o=$i(t)*a,l=Ji(t)*a,h=Ji(e),c=h*i+o*s;return[Xi(l*n-c*r,o*i-h*s),ss(c*n+l*r)]}return a.invert=function(t,e){var a=$i(e),o=$i(t)*a,l=Ji(t)*a,h=Ji(e),c=h*n-l*r;return[Xi(l*n+h*r,o*i+c*s),ss(c*i-o*s)]},a}function ks(t,e){(e=us(e))[0]-=t,vs(e);var i=is(-e[1]);return((-e[2]<0?-i:i)+Ni-zi)%Ni}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ns,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ts(t,e){return Gi(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function Es(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Is(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function Ds(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Is(a);var t=function(t,e){var i=Rs(e),s=e[1],n=Ji(s),r=[Ji(i),-$i(i),0],a=0,o=0;Ls.reset(),1===n?s=Hi+zi:-1===n&&(s=-Hi-zi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>ji,w=f*x;if(Ls.add(Xi(w*k*Ji(M),m*S+w*$i(M))),a+=T?A+k*Ni:A,T^p>=i^y>=i){var C=gs(us(u),us(_));vs(C);var E=gs(r,C);vs(E);var B=(T^A>=0?-1:1)*ss(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-zi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Fs))}return u}}function Fs(t){return t.length>1}function zs(t,e){return((t=t.x)[0]<0?t[1]-Hi-zi:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-zi:Hi-e[1])}1===(Bs=Os).length&&(Ps=Bs,Bs=function(t,e){return Os(Ps(t),e)});var js=Ds((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?ji:-ji,l=Gi(r-i);Gi(l-ji)0?Hi:-Hi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=ji&&(Gi(i-n)zi?Yi((Ji(e)*(r=$i(s))*Ji(i)-Ji(s)*(n=$i(e))*Ji(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*Hi,s.point(-ji,n),s.point(0,n),s.point(ji,n),s.point(ji,0),s.point(ji,-n),s.point(0,-n),s.point(-ji,-n),s.point(-ji,0),s.point(-ji,n);else if(Gi(t[0]-e[0])>zi){var r=t[0]0,n=Gi(e)>zi;function r(t,i){return $i(t)*$i(i)>e}function a(t,i,s){var n=[1,0,0],r=gs(us(t),us(i)),a=ps(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=gs(n,r),u=ms(n,h);fs(u,ms(r,c));var p=d,g=ps(u,p),f=ps(p,p),m=g*g-f*(ps(u,u)-1);if(!(m<0)){var v=ts(m),_=ms(p,(-g-v)/f);if(fs(_,u),_=ds(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Gi(_[0]-b)ji^(b<=_[0]&&_[0]<=x)){var T=ms(p,(-g+v)/f);return fs(T,u),[_,ds(T)]}}}function o(e,i){var n=s?t:ji-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Ds(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?ji:-ji),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ts(e,p)||Ts(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&Ts(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=$i(e),o=Ji(e),l=s*i;null==n?(n=e+s*Ni,r=e-l/2):(n=ks(a,n),r=ks(a,r),(s>0?nr)&&(n+=s*Ni));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Gi(s[0]-t)0?0:3:Gi(s[0]-i)0?2:1:Gi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,_,y=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=Is(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Cs(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&m)y.point(r,a);else{var l=[g=Math.max(Ns,Math.min(Vs,g)),f=Math.max(Ns,Math.min(Vs,f))],b=[r=Math.max(Ns,Math.min(Vs,r)),a=Math.max(Ns,Math.min(Vs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ws(t){return t}var Gs,Ys,Xs,$s,Ks=Oi(),qs=Oi(),Zs={point:ns,lineStart:ns,lineEnd:ns,polygonStart:function(){Zs.lineStart=Js,Zs.lineEnd=en},polygonEnd:function(){Zs.lineStart=Zs.lineEnd=Zs.point=ns,Ks.add(Gi(qs)),qs.reset()},result:function(){var t=Ks/2;return Ks.reset(),t}};function Js(){Zs.point=Qs}function Qs(t,e){Zs.point=tn,Gs=Xs=t,Ys=$s=e}function tn(t,e){qs.add($s*t-Xs*e),Xs=t,$s=e}function en(){tn(Gs,Ys)}var sn=Zs,nn=1/0,rn=nn,an=-nn,on=an;var ln,hn,cn,dn,un={point:function(t,e){tan&&(an=t);eon&&(on=e)},lineStart:ns,lineEnd:ns,polygonStart:ns,polygonEnd:ns,result:function(){var t=[[nn,rn],[an,on]];return an=on=-(rn=nn=1/0),t}},pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn=0,Sn={point:An,lineStart:kn,lineEnd:wn,polygonStart:function(){Sn.lineStart=Cn,Sn.lineEnd=En},polygonEnd:function(){Sn.point=An,Sn.lineStart=kn,Sn.lineEnd=wn},result:function(){var t=xn?[yn/xn,bn/xn]:_n?[mn/_n,vn/_n]:fn?[pn/fn,gn/fn]:[NaN,NaN];return pn=gn=fn=mn=vn=_n=yn=bn=xn=0,t}};function An(t,e){pn+=t,gn+=e,++fn}function kn(){Sn.point=Mn}function Mn(t,e){Sn.point=Tn,An(cn=t,dn=e)}function Tn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,An(cn=t,dn=e)}function wn(){Sn.point=An}function Cn(){Sn.point=Bn}function En(){Pn(ln,hn)}function Bn(t,e){Sn.point=Pn,An(ln=cn=t,hn=dn=e)}function Pn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,yn+=(n=dn*t-cn*e)*(cn+t),bn+=n*(dn+e),xn+=3*n,An(cn=t,dn=e)}var Ln=Sn;function Rn(t){this._context=t}Rn.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,Ni)}},result:ns};var On,In,Dn,Fn,zn,jn=Oi(),Hn={point:ns,lineStart:function(){Hn.point=Vn},lineEnd:function(){On&&Nn(In,Dn),Hn.point=ns},polygonStart:function(){On=!0},polygonEnd:function(){On=null},result:function(){var t=+jn;return jn.reset(),t}};function Vn(t,e){Hn.point=Nn,In=Fn=t,Dn=zn=e}function Nn(t,e){Fn-=t,zn-=e,jn.add(ts(Fn*Fn+zn*zn)),Fn=t,zn=e}var Un=Hn;function Wn(){this._string=[]}function Gn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Yn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),cs(t,i(s))),s.result()}return r.area=function(t){return cs(t,i(sn)),sn.result()},r.measure=function(t){return cs(t,i(Un)),Un.result()},r.bounds=function(t){return cs(t,i(un)),un.result()},r.centroid=function(t){return cs(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ws):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Wn):new Rn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Xn(t){return function(e){var i=new $n;for(var s in t)i[s]=t[s];return i.stream=e,i}}function $n(){}function Kn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),cs(i,t.stream(un)),e(un.result()),null!=s&&t.clipExtent(s),t}function qn(t,e,i){return Kn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Zn(t,e,i){return qn(t,[[0,0],e],i)}function Jn(t,e,i){return Kn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Qn(t,e,i){return Kn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Wn.prototype={_radius:4.5,_circle:Gn(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=Gn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},$n.prototype={constructor:$n,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var tr=16,er=$i(30*Wi);function ir(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=ts(b*b+x*x+S*S),k=ss(S/=A),M=Gi(Gi(S)-1)e||Gi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Wi:0,E()):[m*Ui,v*Ui,_*Ui]},w.angle=function(t){return arguments.length?(y=t%360*Wi,E()):y*Ui},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=ir(o,T=t*t),B()):ts(T)},w.fitExtent=function(t,e){return qn(w,t,e)},w.fitSize=function(t,e){return Zn(w,t,e)},w.fitWidth=function(t,e){return Jn(w,t,e)},w.fitHeight=function(t,e){return Qn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function lr(t){var e=0,i=ji/3,s=or(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Wi,i=t[1]*Wi):[e*Ui,i*Ui]},n}function hr(t,e){var i=Ji(t),s=(i+Ji(e))/2;if(Gi(s)2?t[2]*Wi:0),e.invert=function(e){return(e=t.invert(e[0]*Wi,e[1]*Wi))[0]*=Ui,e[1]*=Ui,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===mr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function _r(t){return es((Hi+t)/2)}function yr(t,e){var i=$i(t),s=t===e?Ji(t):qi(i/$i(e))/qi(_r(e)/_r(t)),n=i*Zi(_r(t),s)/s;if(!s)return mr;function r(t,e){n>0?e<-Hi+zi&&(e=-Hi+zi):e>Hi-zi&&(e=Hi-zi);var i=n/Zi(_r(e),s);return[i*Ji(s*t),n-i*$i(s*t)]}return r.invert=function(t,e){var i=n-e,r=Qi(s)*ts(t*t+i*i),a=Xi(t,Gi(i))*Qi(i);return i*s<0&&(a-=ji*Qi(t)*Qi(i)),[a/s,2*Yi(Zi(n/r,1/s))-Hi]},r}function br(t,e){return[t,e]}function xr(t,e){var i=$i(t),s=t===e?Ji(t):(i-$i(e))/(e-t),n=i/s+t;if(Gi(s)zi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Br.invert=pr(ss),Pr.invert=pr((function(t){return 2*Yi(t)})),Lr.invert=function(t,e){return[-e,2*Yi(Ki(t))-Hi]};var Ir={exports:{}},Dr=function(t,e){this.p1=t,this.p2=e};Dr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Dr.prototype.run=function(){return this.p2[0]-this.p1[0]},Dr.prototype.slope=function(){return this.rise()/this.run()},Dr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Dr.prototype.isVertical=function(){return!isFinite(this.slope())},Dr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Dr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Dr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Dr.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)},Dr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Fr=Dr,zr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Fr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=zr(t.slice(0,s),e),o=zr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},jr=zr;!function(t){var e=jr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Vr(Wr,e),{tolerance:s}=i;return Hr(t,s)};var Yr;!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"}(Yr||(Yr={}));const Xr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let M=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/M:0,T.push(_[t])}return T},Kr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],w=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=w.length?w:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:M,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!T.length)return $r(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...w,...T];return $r(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",w=null!==(o=k.mean)&&void 0!==o?o:"mean",C=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",L=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",O=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",I=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,j=new Map,H=new Map,V=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&j.set(r,[]),y(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=j.get(r);t&&t.push(i)}}y(S)&&(S=[_t(Math.min.apply(null,S),0,1),_t(Math.max.apply(null,S),0,1)]);const N=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[w]=o,f[C]=l,f[E]=h,f[B]=c,f[P]=d,f[L]=n,f[R]=r,f[O]=u,f[I]=p,f[D]=g,A&&(f[F]=j.get(t)||[]),N.push(f)}return N};var Zr={},Jr={};function Qr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ta(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ea(t,e){var i=t+"",s=i.length;return s9999?"+"+ea(e,6):ea(e,4))+"-"+ea(t.getUTCMonth()+1,2)+"-"+ea(t.getUTCDate(),2)+(r?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"."+ea(r,3)+"Z":n?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"Z":s||i?"T"+ea(i,2)+":"+ea(s,2)+"Z":"")}function sa(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Jr;if(h)return h=!1,Zr;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a0}function ga(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=oa(t));var r=[];switch(t.type){case"GeometryCollection":return fa(t,(function(t){va(t,s)})),t;case"FeatureCollection":return ga(t,(function(t){ga(va(t,s),(function(t){r.push(t)}))})),hi(r)}return va(t,s)}function va(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return fa(t,(function(t){va(t,e)})),t;case"LineString":return _a(ua(t),e),t;case"Polygon":return ya(ua(t),e),t;case"MultiLineString":return ua(t).forEach((function(t){_a(t,e)})),t;case"MultiPolygon":return ua(t).forEach((function(t){ya(t,e)})),t;case"Point":case"MultiPoint":return t}}function _a(t,e){pa(t)===e&&t.reverse()}function ya(t,e){pa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ba(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ka=(t,e={},i)=>{i.type=Yr.GEO;const s=Vr(Sa,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Aa(t))})):e.push(Aa(t))})),e})(t);let l=t.features;return o&&(l=ma(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=xa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=xa.bounds(t);t.bbox=e}})),t.features=l,t},Ma={},Ta=(t,e,i)=>{i.type=Yr.GEO;const s=Vr(Sa,Ma,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Or(a,t)}))}:Or(a,o));var a,o;return ka(r,s,i)},wa=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Ca=0;function Ea(t="dataset"){return Ca>1e8&&(Ca=0),t+"_"+Ca++}class Ba{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:Ea("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Pa{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ea("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Pa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?j({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Xr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Yn();const La={},Ra={albers:dr,albersusa:function(){var t,e,i,s,n,r,a=dr(),o=cr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=cr().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}},Oa=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ia(t,e){return function i(){const s=e();return s.type=t,s.path=Yn().projection(s),s.copy=s.copy||function(){const t=i();return Oa.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Da{static GenAutoIncrementId(){return Da.auto_increment_id++}}Da.auto_increment_id=0;class Fa{constructor(t){this.id=Da.GenAutoIncrementId(),this.registry=t}}const za="named",ja="inject",Ha="multi_inject",Va="inversify:tagged",Na="inversify:paramtypes";class Ua{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===za?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Wa=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Ga(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Wa.hasOwnMetadata(t,e)&&(r=Wa.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Wa.defineMetadata(t,r,e)}(Va,t,i.toString(),s)}function Ya(t){return(e,i,s)=>{Ga(e,0,s,t)}}function Xa(t){return e=>(i,s,n)=>Ya(new Ua(t,e))(i,s,n)}const $a=Xa(ja),Ka=Xa(Ha);function qa(){return function(t){return Wa.defineMetadata(Na,null,t),t}}function Za(t){return Ya(new Ua(za,t))}const Ja="Singleton",Qa="Transient",to="ConstantValue",eo="DynamicValue",io="Factory",so="Function",no="Instance",ro="Invalid";class ao{constructor(t,e){this.id=Da.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=ro,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new ao(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ja&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class oo{getConstructorMetadata(t){return{compilerGeneratedMetadata:Wa.getMetadata(Na,t),userGeneratedMetadata:Wa.getMetadata(Va,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const lo=(ho=za,t=>{const e=e=>{if(null==e)return!1;if(e.key===ho&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const po=Symbol("ContributionProvider");class go{constructor(t,e){this.serviceIdentifier=t,this.container=e,mo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function fo(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).inSingletonScope().whenTargetNamed(e)}class mo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}mo.store=new Map;class vo{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class _o extends vo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const yo=Symbol.for("EnvContribution"),bo=Symbol.for("VGlobal"),xo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Qa,this.options=e,this.id=Da.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new oo}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,za,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new ao(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new uo(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[ja],multiInject:s[Ha]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case to:case so:e=t.cache;break;case no:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Ja&&(t.cache=e,t.activated=!0)}},So=Symbol.for("RenderService");const Ao=new class{get renderService(){return this._renderService||(this._renderService=xo.get(So)),this._renderService}};let ko=0;class Mo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Ao.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++ko,t),this.tryRunAnimationFrameNextFrame(),ko}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class To{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var wo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Co=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eo=function(t,e){return function(i,s){e(i,s,t)}},Bo=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let Po=class extends To{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Da.GenAutoIncrementId(),this.hooks={onSetEnv:new _o(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Mo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Bo(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Lo,Ro,Oo,Io;Po=wo([qa(),Eo(0,$a(po)),Eo(0,Za(yo)),Co("design:paramtypes",[Object])],Po),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Lo||(Lo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Ro||(Ro={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Oo||(Oo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Io||(Io={}));const Do=Vt-1e-8;class Fo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Do)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Vt)<0&&(s+=Vt),(n%=Vt)<0&&(n+=Vt),nn;++o,a-=Ht)g(a);else for(a=s-s%Ht+Ht,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const jo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ho={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},Vo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let No,Uo,Wo,Go,Yo,Xo;var $o,Ko,qo,Zo,Jo,Qo;function tl(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),f=Math.cos(n),m=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,A=i+m,k=S+y*m,M=A-y*f;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function el(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=oe(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Vt:C>0&&0===r&&(C-=Vt);const E=Math.ceil(Math.abs(C/(Ht+.001))),B=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function sl(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=cl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function ul(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new pl(i,n),new pl(n,s)]}class pl extends nl{constructor(t,e){super(),this.type=Jo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p1.x):t===Zo.COLUMN?Ut(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class gl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new pl(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Zo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ut(t.p0.y-s.y)}if(t===Zo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ut(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class fl extends gl{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function ml(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function vl(t,e,i){const s=null!=e?e:Ut(i[i.length-1].x-i[0].x)>Ut(i[i.length-1].y-i[0].y)?Zo.ROW:Zo.COLUMN;return"monotoneY"===t?new fl(t,s):new gl(t,s)}class _l{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 yl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new _l(n,s),t),n}function bl(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class xl{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&bl(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:bl(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 Sl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("basis",i,t);return function(t,e){ml(t,e,2)}(new xl(n,s),t),n}function Al(t){return t<0?-1:1}function kl(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Al(r)+Al(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ml(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Tl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class wl{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Tl(this,this._t0,Ml(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Tl(this,Ml(this,e=kl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Tl(this,this._t0,e=kl(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class Cl extends wl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function El(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneX",i,t);return function(t,e){ml(t,e,2)}(new wl(n,s),t),n}function Bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneY",i,t);return function(t,e){ml(t,e,2)}(new Cl(n,s),t),n}let Pl=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class Ll extends Pl{lineEnd(){this.context.closePath()}}function Rl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Pl(r,e,n),t),r}function Ol(t,e){return ml(t,e,1)}class Il extends _l{lineEnd(){this.context.closePath()}}function Dl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new Il(n,s),t),n}function Fl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function zl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return yl(i,n);const o=vl(t,r,i);return ml(new e(o,s,a),i,2),o}}const jl=zl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Hl=zl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Vl extends nl{constructor(t,e,i){super(),this.type=Jo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return hl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,rl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p2.x):t===Zo.COLUMN?Ut(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=Xt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=hl(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new Vl(i,a,r),new Vl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Nl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new pl(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new Vl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Ul(t,e,i){var s,n;switch(e){case"linear":default:return yl(t,i);case"basis":return Sl(t,i);case"monotoneX":return El(t,i);case"monotoneY":return Bl(t,i);case"step":return Rl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Ll(r,e,n),t),r}(t,.5,i);case"stepBefore":return Rl(t,0,i);case"stepAfter":return Rl(t,1,i);case"catmullRom":return jl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Hl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Dl(t,i)}}class Wl extends zo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Fo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Vo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Vo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Vo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([Vo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([Vo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([Vo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([Vo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([Vo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Vo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Nl(this);sl(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Vo.M]=t=>`M${t[1]} ${t[2]}`,t[Vo.L]=t=>`L${t[1]} ${t[2]}`,t[Vo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Vo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Vo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Vo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tXo){let t,e=Wo;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),sl(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Zo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.y-e.p1.y)}if(this.direction===Zo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),lh=Object.assign(Object.assign({},th),{points:[],cornerRadius:0,closePath:!0}),hh=Object.assign(Object.assign({},th),{width:100,height:100,spikes:5,thickness:.5}),ch=Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const dh=Object.assign(Object.assign({},th),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),uh=Object.assign(Object.assign(Object.assign({},th),Zl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),ph=Object.assign(Object.assign(Object.assign({},th),Zl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),gh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},th),{fill:!0,cornerRadius:0,cornerType:"round"}),fh=Object.assign(Object.assign({},gh),{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}),mh=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=m("shape",/^(circle)/i,0);return t&&(t.style=f()||h()),t}()||function(){const t=m("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return m("extent-keyword",t.extentKeywords,1)}function c(){if(m("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=m("hex",t.hexColor,1)||m("rgba",t.rgbaColor,1)||m("rgb",t.rgbColor,1)||m("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return m("%",t.percentageValue,1)||m("position-keyword",t.positionKeywords,1)||f()}function f(){return m("px",t.pixelValue,1)||m("em",t.emValue,1)}function m(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class vh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(vh.IsGradientStr(t))try{const e=mh(t)[0];if(e){if("linear"===e.type)return vh.ParseLinear(e);if("radial"===e.type)return vh.ParseRadial(e);if("conic"===e.type)return vh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2,n=parseFloat(e.value)/180*jt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Nt,stops:vh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:vh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2;let n="angular"===e.type?parseFloat(e.value)/180*jt:0;for(;n<0;)n+=Nt;for(;n>=Nt;)n-=Nt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const bh={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"}},xh=!0,Sh=!1,Ah=/\w|\(|\)|-/,kh=/[.?!,;:/,。?!、;:]/,Mh=/\S/,Th=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function wh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Ao.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Ch(t,a)),a}function Ch(t,e,i=!1){let s=e;for(;Ah.test(t[s-1])&&Ah.test(t[s])||kh.test(t[s]);)if(s--,s<=0)return i?Eh(t,e):e;return s}function Eh(t,e){let i=e;for(;Ah.test(t[i+1])&&Ah.test(t[i])||kh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Ao.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Ph=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Lh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=uh.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Ch(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Ch(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};Lh=Ph([qa()],Lh);var Rh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Oh=Symbol.for("TextMeasureContribution");let Ih=class extends Lh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Ih=Rh([qa()],Ih);const Dh=Symbol.for("CanvasFactory"),Fh=Symbol.for("Context2dFactory");function zh(t){return xo.getNamed(Dh,Ao.global.env)(t)}const jh=1e-4,Hh=Math.sqrt(3),Vh=1/3;function Nh(t){return t>-ec&&tec||t<-ec}const Wh=[0,0],Gh=[0,0],Yh=[0,0];function Xh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function $h(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Kh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function qh(t){return(t%=Nt)<0&&(t+=Nt),t}function Zh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Nt);let d=Math.atan2(l,o);return d<0&&(d+=Nt),d>=s&&d<=n||d+Nt>=s&&d+Nt<=n}function tc(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(Nh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const sc=[-1,-1,-1],nc=[-1,-1];function rc(){const t=nc[0];nc[0]=nc[1],nc[1]=t}function ac(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Nh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Vh):Math.pow(i,Vh),s=s<0?-Math.pow(-s,Vh):Math.pow(s,Vh);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+Hh*Math.sin(e)))/(3*a),h=(-o+i*(s-Hh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,sc);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&rc(),p=Kh(e,s,r,o,nc[0]),u>1&&(g=Kh(e,s,r,o,nc[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Nh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,sc);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=$h(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);sc[0]=-l,sc[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Nt-1e-4){s=0,n=Nt;const e=r?1:-1;return a>=sc[0]+t&&a<=sc[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Nt,n+=Nt);let c=0;for(let e=0;e<2;e++){const i=sc[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Nt+t),(t>=s&&t<=n||t+Nt>=s&&t+Nt<=n)&&(t>jt/2&&t<1.5*jt&&(e=-e),c+=e)}}return c}function hc(t){return Math.round(t/jt*1e8)/1e8%2*jt}function cc(t,e){let i=hc(t[0]);i<0&&(i+=Nt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Nt?n=i+Nt:e&&i-n>=Nt?n=i-Nt:!e&&i>n?n=i+(Nt-hc(i-n)):e&&i1&&(i||(h+=Re(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;dc[0]=S,dc[1]=A,cc(dc,Boolean(a[6])),S=dc[0],A=dc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Vo.M:u=m,p=v,c=u,d=p;break;case Vo.L:if(i){if(tc(c,d,m,v,e,s,n))return!0}else h+=Re(c,d,m,v,s,n)||0;c=m,d=v;break;case Vo.C:if(i){if(Jh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ac(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Vo.Q:if(i){if(Zh(c,d,m,v,_,y,e,s,n))return!0}else h+=oc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Vo.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Re(c,d,o,l,s,n),i){if(Qh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=lc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Vo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(tc(u,p,o,p,e,s,n)||tc(o,p,o,l,e,s,n)||tc(o,l,u,l,e,s,n)||tc(u,l,u,p,e,s,n))return!0}else h+=Re(o,p,o,l,s,n),h+=Re(u,l,u,p,s,n);break;case Vo.Z:if(i){if(tc(c,d,u,p,e,s,n))return!0}else h+=Re(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mc=Symbol.for("VWindow"),vc=Symbol.for("WindowHandlerContribution");let _c=class extends To{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){super(),this.hooks={onChange:new _o(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(xo.getNamed(vc,t.env).configure(this,t),this.actived=!0)},this._uid=Da.GenAutoIncrementId(),this.global=Ao.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&>(this.width,t.width())&>(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};_c=gc([qa(),fc("design:paramtypes",[])],_c);var yc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xc=function(t,e){return function(i,s){e(i,s,t)}};let Sc=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Ao.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=pc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Zl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Zl.fontFamily,fontSize:Zl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=xo.get(mc),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Ac;Sc=yc([qa(),xc(0,$a(po)),xc(0,Za(Oh)),bc("design:paramtypes",[Object])],Sc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Ac||(Ac={}));const kc=new We;let Mc=class{constructor(){this.matrix=new We}init(t){return this.mode=Ac.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Ac.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(kc.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(kc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}scale(t,e,i){return this.mode===Ac.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Ac.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return kc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}translate(t,e){return this.mode===Ac.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Ac.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Mc=yc([qa(),bc("design:paramtypes",[])],Mc);const Tc={arc:eh,area:ih,circle:sh,line:ah,path:oh,symbol:dh,text:uh,rect:ch,polygon:lh,star:hh,richtext:ph,richtextIcon:fh,image:gh,group:nh,glyph:rh},wc=Object.keys(Tc);function Cc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Ec={arc:Object.assign({},Tc.arc),area:Object.assign({},Tc.area),circle:Object.assign({},Tc.circle),line:Object.assign({},Tc.line),path:Object.assign({},Tc.path),symbol:Object.assign({},Tc.symbol),text:Object.assign({},Tc.text),rect:Object.assign({},Tc.rect),polygon:Object.assign({},Tc.polygon),star:Object.assign({},Tc.star),richtext:Object.assign({},Tc.richtext),richtextIcon:Object.assign({},Tc.richtextIcon),image:Object.assign({},Tc.image),group:Object.assign({},Tc.group),glyph:Object.assign({},Tc.glyph)};class Bc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},wc.forEach((t=>{this._defaultTheme[t]=Object.create(Ec[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;wc.forEach((s=>{const n=Object.create(Ec[s]);t&&t[s]&&Cc(n,t[s]),i[s]&&Cc(n,i[s]),e[s]&&Cc(n,e[s]),this.combinedTheme[s]=n})),e.common&&wc.forEach((t=>{Cc(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Pc=new Bc;function Lc(t,e){return t.glyphHost?Lc(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)):Pc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Lc(t.attachedThemeGraphic)||Pc.getTheme()}var Rc=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Oc extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=Da.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Rc(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Vc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Vc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Vc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Vc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Hc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Vc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(Vc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,Vc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Vc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof zc))return void ot.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Hc.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Nc(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Fc,this.rootWheelEvent=new zc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class Yc{static GetImage(t,e){var i;const s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Yc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Yc.cache.set(t,s),s.dataPromise=Ao.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Yc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Yc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ao.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ao.global.loadBlob(t):"json"===e&&(i.dataPromise=Ao.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Yc.isLoading&&Yc.toLoadAueue.length){Yc.isLoading=!0;const t=Yc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Yc.cache.set(i,n),n.dataPromise=Ao.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()})).catch((t=>{console.error(t),Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()}))}}),0)}static loadImage(t,e){const i=Xc(t,Yc.toLoadAueue);if(-1!==i)return Yc.toLoadAueue[i].marks.push(e),void Yc.loading();Yc.toLoadAueue.push({url:t,marks:[e]}),Yc.loading()}static improveImageLoading(t){const e=Xc(t,Yc.toLoadAueue);if(-1!==e){const t=Yc.toLoadAueue.splice(e,1);Yc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Xc(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(qc[0]=t[0],qc[2]=t[0],qc[1]=t[1],qc[3]=t[1],qc):t:t:0,Jc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Qc=[1,2,3,0,1,2,3,0];function td(t,e,i,s){for(;t>=Nt;)t-=Nt;for(;t<0;)t+=Nt;for(;t>e;)e+=Nt;Jc[0].x=i,Jc[1].y=i,Jc[2].x=-i,Jc[3].y=-i;const n=Math.ceil(t/Ht)%4,r=Math.ceil(e/Ht)%4;if(s.add(Gt(t)*i,$t(t)*i),s.add(Gt(e)*i,$t(e)*i),n!==r||e-t>jt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}nd.TimeOut=1e3/60;const rd=new nd,ad=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class od{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function ld(t,e,i,s,n){return n?t.arc(i,s,e,0,Vt,!1,n):t.arc(i,s,e,0,Vt),!1}var hd=new class extends od{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return ld(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ld(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var cd=new class extends od{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function dd(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var ud=new class extends od{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return dd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return dd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return dd(t,this.parseSize(e)/2+n,i,s,r)}};function pd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var gd=new class extends od{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return pd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return pd(t,this.parseSize(e)/2+n,i,s)}};function fd(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class md extends od{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return fd(t,this.parseSize(e)/2,i,s,n)}}var vd=new md;var _d=new class extends md{constructor(){super(...arguments),this.type="triangle"}};const yd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),bd=Math.sin(Vt/10)*yd,xd=-Math.cos(Vt/10)*yd;function Sd(t,e,i,s){const n=bd*e,r=xd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Vt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Ad=new class extends od{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Sd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Sd(t,this.parseSize(e)/2+n,i,s)}};const kd=Kt(3);function Md(t,e,i,s){const n=e,r=n/kd,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Td=new class extends od{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};function wd(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Cd=new class extends od{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return wd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return wd(t,this.parseSize(e)/2+n,i,s)}};function Ed(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Bd=new class extends od{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ed(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/2+n,i,s)}};const Pd=-.5,Ld=Kt(3)/2,Rd=1/Kt(12);function Od(t,e,i,s){const n=e/2,r=e*Rd,a=n,o=e*Rd+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Pd*n-Ld*r+i,Ld*n+Pd*r+s),t.lineTo(Pd*a-Ld*o+i,Ld*a+Pd*o+s),t.lineTo(Pd*l-Ld*h+i,Ld*l+Pd*h+s),t.lineTo(Pd*n+Ld*r+i,Pd*r-Ld*n+s),t.lineTo(Pd*a+Ld*o+i,Pd*o-Ld*a+s),t.lineTo(Pd*l+Ld*h+i,Pd*h-Ld*l+s),t.closePath(),!1}var Id=new class extends od{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Od(t,this.parseSize(e)/2+n,i,s)}};function Dd(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var Fd=new class extends od{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return Dd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};function zd(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var jd=new class extends od{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2,i,s,n)}};function Hd(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var Vd=new class extends od{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return Hd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Hd(t,this.parseSize(e)/2,i,s,n)}};const Nd=Kt(3);function Ud(t,e,i,s){const n=e*Nd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Wd=new class extends od{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Ud(t,this.parseSize(e)/2/Nd,i,s)}drawOffset(t,e,i,s,n){return Ud(t,this.parseSize(e)/2/Nd+n,i,s)}};function Gd(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var Yd=new class extends od{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function Xd(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var $d=new class extends od{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return Xd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Xd(t,this.parseSize(e)/4+n,i,s)}};function Kd(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var qd=new class extends od{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return Kd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Kd(t,this.parseSize(e)/4+n,i,s)}};function Zd(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var Jd=new class extends od{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return Zd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Zd(t,this.parseSize(e)/4+n,i,s)}};function Qd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var tu=new class extends od{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function eu(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var iu=new class extends od{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return eu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return eu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function su(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var nu=new class extends od{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return su(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return su(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function ru(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function au(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ou=new class extends od{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?au(t,e,i,s):ru(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?au(t,e+2*n,i,s):ru(t,[e[0]+2*n,e[1]+2*n],i,s)}};const lu=new Ne;class hu{constructor(t,e,i=!1){this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),sl(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(sl(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{lu.x1=i.bounds.x1*t,lu.y1=i.bounds.y1*t,lu.x2=i.bounds.x2*t,lu.y2=i.bounds.y2*t,e.union(lu)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const cu={};[hd,cd,ud,gd,Wd,_d,Ad,Td,Cd,Bd,Id,Fd,jd,vd,Vd,Yd,$d,qd,Jd,ou,tu,iu,nu].forEach((t=>{cu[t.type]=t}));const du={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class uu{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function pu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function gu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=gu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=pu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=gu(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new uu(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new uu(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function vu(t,e){return _u(t)}function _u(t,e){const i={};for(let e=0;ewu.set(t,!0)));const Cu=new Map;function Eu(t){if(wu.has(t))return!0;if(Cu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Cu.set(t,!0)));const Bu=Mu(),Pu=Mu(),Lu=Mu(),Ru=Mu(),Ou=Mu(),Iu=Mu(),Du=Mu(),Fu=Mu(),zu=Mu(),ju=Mu();Mu();const Hu=Mu();Mu();const Vu=Mu();Mu();const Nu=Mu(),Uu=Mu(),Wu=Symbol.for("GraphicService"),Gu=Symbol.for("GraphicCreator"),Yu={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Xu=Object.keys(Yu),$u={duration:200,easing:"cubicOut"};function Ku(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function qu(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Zu(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 Ju(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*f,t[1]=y*n+b*l+x*u+S*m,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*f,t[5]=y*n+b*l+x*u+S*m,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*f,t[9]=y*n+b*l+x*u+S*m,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Qu(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class tp{constructor(){this.pools=[]}static identity(t){return Ku(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 tp.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},np=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rp=new We(1,0,0,1,0,0),ap={x:0,y:0};let op=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this.path=new Wl,this._clearMatrix=new We(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return ep.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ap),function(t,e,i){return uc(t,0,!1,e,i)}(this.path.commandList,ap.x,ap.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ap);const i=_h(this,this.lineWidth,this.dpr);return function(t,e,i,s){return uc(t,e,!0,i,s)}(this.path.commandList,i,ap.x,ap.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(rp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};op=sp([qa(),np("design:paramtypes",[Object,Number])],op);const lp={WIDTH:500,HEIGHT:500,DPR:1};class hp{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=lp.WIDTH,height:n=lp.HEIGHT,dpr:r=lp.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var cp;hp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(cp||(cp={}));class dp{static Get(t,e=cp.Color1,i=[0,0,0,1]){if(e===cp.Color1){const e=dp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ii.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];dp.store1[t]=e,dp.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=dp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ii.parseColorString(t);return n&&(dp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],dp.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===cp.Color1){if(dp.store1[t])return;dp.store1[t]=i,dp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(dp.store255[t])return;dp.store255[t]=i,dp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function up(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function pp(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return gp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):gp(t,e,i,s,n)}function gp(t,e,i,s,n){if(!t||!e)return t&&up(t)||e&&up(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=dp.Get(t,cp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=dp.Get(e,cp.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:up(a)})))});return o?pp(r,l,i,s,n):pp(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:_p(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:_p(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:_p(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),up(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}function fp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}dp.store255={},dp.store1={};const mp=[0,0,0,0],vp=[0,0,0,0];function _p(t,e,i){return dp.Get(t,cp.Color255,mp),dp.Get(e,cp.Color255,vp),`rgba(${Math.round(mp[0]+(vp[0]-mp[0])*i)},${Math.round(mp[1]+(vp[1]-mp[1])*i)},${Math.round(mp[2]+(vp[2]-mp[2])*i)},${mp[3]+(vp[3]-mp[3])*i})`}class yp{static GetCanvas(){try{return yp.canvas||(yp.canvas=Ao.global.createCanvas({})),yp.canvas}catch(t){return null}}static GetCtx(){if(!yp.ctx){const t=yp.GetCanvas();yp.ctx=t.getContext("2d")}return yp.ctx}}class bp extends Ge{static getInstance(){return bp._instance||(bp._instance=new bp),bp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=yp.GetCanvas(),s=yp.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new bp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class xp{static GetSize(t){for(let e=0;e=t)return xp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=xp.GenKey(t,e,i,s,n),l=xp.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=xp.GenKey(t,e,i,s,n);xp.cache[l]?xp.cache[l].push({width:a,height:o,pattern:r}):xp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}xp.cache={},xp.ImageSize=[20,40,80,160,320,640,1280,2560];const Sp=new Ne,Ap=new We;new Ne;const kp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Mp=["x","y"],Tp=["scaleX","scaleY"],wp=["angle"],Cp=new re,Ep={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Bp extends Oc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=cu[t];if(e)return e;if(e=Bp.userSymbolMap[t],e)return e;if(!0===((i=t=du[t]||t).startsWith("{const e=(new Wl).fromString(t.d),i={};Xu.forEach((e=>{t[e]&&(i[Yu[e]]=t[e])})),n.push({path:e,attribute:i}),Sp.union(e.bounds)}));const r=Sp.width(),a=Sp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new hu(t,n,!0);return Bp.userSymbolMap[t]=l,l}var i;const s=(new Wl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Yt(n,r);s.transform(0,0,a,a);const o=new hu(t,s);return Bp.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Zc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Fo(t);return sl(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new We),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&$o.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&$o.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&$o.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&$o.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&$o.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&$o.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=$o.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Ko.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i))}_setAttributes(t,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:$u;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:qo.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if(this.currentStates){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stateSort&&(t=t.sort(this.stateSort));const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=$o.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=$o.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=$o.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&$o.UPDATE_SHAPE_AND_BOUNDS)===$o.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=$o.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=$o.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=$o.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=$o.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=$o.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=$o.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=$o.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&$o.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Xl.x,y:e=Xl.y,scaleX:i=Xl.scaleX,scaleY:s=Xl.scaleY,angle:n=Xl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Gt(a),f=$t(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+d*v-x*_-A*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),Ao.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Xl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ap.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:qo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Ao.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new Wl).fromString(t):this.pathProxy=new Wl,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),Ao.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new jc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Ao.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new op(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Pp;Bp.userSymbolMap={},Bp.mixin(Uc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Pp||(Pp={}));let Lp=class t extends Bp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Iu,this._childUpdateTag=$o.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 Bc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Bc)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Ko.GLOBAL){const i=new re(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&$o.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Xl.x,y:e=Xl.y,dx:i=Xl.dx,dy:s=Xl.dy,scaleX:n=Xl.scaleX,scaleY:r=Xl.scaleY,angle:a=Xl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Lc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Ao.graphicService.updateTempAABBBounds(i),Ao.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=$o.CLEAR_BOUNDS,this._childUpdateTag&=$o.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=$o.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&$o.UPDATE_BOUNDS||(this._childUpdateTag|=$o.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&$o.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Ao.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Rp(t){return new Lp(t)}Lp.NOWORK_ANIMATE_ATTR=Ep;class Op extends Lp{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Bc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Ao.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Ao.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Ip=Symbol.for("TransformUtil"),Dp=Symbol.for("GraphicUtil"),Fp=Symbol.for("LayerService"),zp=Symbol.for("StaticLayerHandlerContribution"),jp=Symbol.for("DynamicLayerHandlerContribution"),Hp=Symbol.for("VirtualLayerHandlerContribution");var Vp,Np=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Up=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Wp=Vp=class{static GenerateLayerId(){return`${Vp.idprefix}_${Vp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Ao.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?xo.get(zp):"dynamic"===t?xo.get(jp):xo.get(Hp),e}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Op(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Vp.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};Wp.idprefix="visactor_layer",Wp.prefix_count=0,Wp=Vp=Np([qa(),Up("design:paramtypes",[])],Wp);var Gp=new Fa((t=>{t(bo).to(Po).inSingletonScope(),t(mc).to(_c),t(Dp).to(Sc).inSingletonScope(),t(Ip).to(Mc).inSingletonScope(),t(Fp).to(Wp).inSingletonScope()}));function Yp(t,e){return!(!t&&!e)}function Xp(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function $p(t,e,i){return i&&t*e>0}function Kp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function qp(t,e){return t*e>0}function Zp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Jp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Qp(t,e,i,s,n){const r=Ut(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Gt(c),k=n*$t(c),M=s*Gt(u),T=s*$t(u);let w,C,E,B;if((b>zt||_>zt)&&(w=n*Gt(d),C=n*$t(d),E=s*Gt(p),B=s*$t(p),r1?0:P<-1?jt:Math.acos(P))/2),l=Kt(t[0]*t[0]+t[1]*t[1]);S=Xt(b,(s-l)/(o-1)),x=Xt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function tg(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ut(l-o),c=l>o;let d=!1;if(n=Nt-zt)e.moveTo(i+n*Gt(o),s+n*$t(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*$t(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Qp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=Xt(v,m),r=Xt(_,m),o=Jp(g,f,u,p,n,t,Number(c)),l=Jp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*$t(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*$t(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Gt(M),s+n*$t(M));if(!(r>zt)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=Xt(B,T),n=Xt(P,T),o=Jp(S,A,b,x,r,-n,Number(c)),l=Jp(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*$t(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Gt(E),s+r*$t(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*$t(o)):e.closePath(),d}const eg=Symbol.for("ArcRenderContribution"),ig=Symbol.for("AreaRenderContribution"),sg=Symbol.for("CircleRenderContribution"),ng=Symbol.for("GroupRenderContribution"),rg=Symbol.for("ImageRenderContribution"),ag=Symbol.for("PathRenderContribution"),og=Symbol.for("PolygonRenderContribution"),lg=Symbol.for("RectRenderContribution"),hg=Symbol.for("SymbolRenderContribution"),cg=Symbol.for("TextRenderContribution"),dg=Symbol.for("InteractiveSubRenderContribution");function ug(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function pg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var gg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mg=function(t,e){return function(i,s){e(i,s,t)}};function vg(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Ku(t),qu(t,t,[n+o,r+l,a+h]),qu(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),qu(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=ip.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}qu(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,f),qu(i,i,[-s[0],-s[1],0]),Ju(t,t,i)}}let _g=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new _o(["graphic"]),onSetStage:new _o(["graphic","stage"]),onRemove:new _o(["graphic"]),onRelease:new _o(["graphic"]),onAddIncremental:new _o(["graphic","group","stage"]),onClearIncremental:new _o(["graphic","group","stage"]),beforeUpdateAABBBounds:new _o(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new _o(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new _o(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ne,this.tempAABBBounds2=new Ne}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Fo(t);return sl(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=pg(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=ug(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Au(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Au(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&He(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};_g=gg([qa(),mg(0,$a(Gu)),fg("design:paramtypes",[Object])],_g);const yg=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},bg=["radius","startAngle","endAngle",...kp];class xg extends Bp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Ru}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Lc(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Nt-zt?i.set(-r,-r,r,r):td(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,bg)}needUpdateTag(t){return super.needUpdateTag(t,bg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Wl,s.arc(0,0,r,a,o),s}clone(){return new xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xg.NOWORK_ANIMATE_ATTR}}function Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Ep;class Ag{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Lo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Uu,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Lc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Mg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Ao.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Au(n,o/Math.abs(r+a),!0,l),i.union(n)}return Ao.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,He(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Ag(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const M=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new Ag(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=ug(_,a),e=this.cache.verticalList.length*v,i=pg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Tu.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const x=ug(_,a),S=this.cache.verticalList.length*v,A=pg(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=ad(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=kg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=kg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Mg.baselineMapAlign}getAlignMapBaseline(){return Mg.alignMapBaseline}}function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ep),Mg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Mg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const wg=["symbolType","size",...kp];let Cg=class t extends Bp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Nu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Lc(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Au(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,wg)}needUpdateTag(t){return super.needUpdateTag(t,wg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Wl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Wl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Eg(t){return new Cg(t)}Cg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ep);const Bg=["segments","points","curveType","curveTension",...kp];let Pg=class t extends Bp{constructor(t={}){super(t),this.type="line",this.numberType=Fu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}getGraphicTheme(){return Lc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Wl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Lg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const Rg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},Og=["width","x1","y1","height","cornerRadius",...kp];class Ig extends Bp{constructor(t){super(t),this.type="rect",this.numberType=Hu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Lc(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Og)}needUpdateTag(t){return super.needUpdateTag(t,Og)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Rg(e);return t=new Wl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ig.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Ig(t)}Ig.NOWORK_ANIMATE_ATTR=Ep;class Fg extends Bp{constructor(t){super(t),this.type="glyph",this.numberType=Ou,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Lc(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Fg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Fg.NOWORK_ANIMATE_ATTR}}function zg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Ep;class jg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=bh[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Hg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Vg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=ad(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Bh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Hg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=wh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Ng=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...kp];class Ug extends Bp{constructor(t){super(t),this.type="image",this.numberType=Du,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Lc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return gh[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}clone(){return new Ug(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ug.NOWORK_ANIMATE_ATTR}}function Wg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Ep);class Gg extends Ug{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Zc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Zc(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=gh.width,height:e=gh.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Yg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Gg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Vg){const e=Mh.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Gg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bh(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sh;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Th(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?yh(t,s,{AABBBounds:i}):s,Th(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Gg)break;const{width:n}=Bh(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Gg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Xg{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=bh[this.direction]}store(t){if(t instanceof Gg){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 Yg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Gg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=wh(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Vg(i,t.newLine,t.character,t.ascentDescentMode),new Vg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let $g=!1;try{$g=Intl&&"function"==typeof Intl.Segmenter}catch(t){$g=!1}const Kg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...kp];class qg extends Bp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Vu,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Lc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&qg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&qg.splitText(t.text).length>1)))}static splitText(t){if($g){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=qg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Ao.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!qg.AllSingleCharacter(_)&&(_=qg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new jg(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new Xg(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new qg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ep);const Jg=["path","customPath",...kp];class Qg extends Bp{constructor(t){super(t),this.type="path",this.numberType=zu}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Wl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Wl?this.cache:t.path)}getGraphicTheme(){return Lc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new Wl).fromString(t.path):t.customPath&&(this.cache=new Wl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Jg)}needUpdateTag(t){return super.needUpdateTag(t,Jg)}toCustomPath(){return(new Wl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qg.NOWORK_ANIMATE_ATTR}}function tf(t){return new Qg(t)}Qg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ep);const ef=["segments","points","curveType","curveTension",...kp];class sf extends Bp{constructor(t){super(t),this.type="area",this.numberType=Lu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Lc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,ef)}needUpdateTag(t){return super.needUpdateTag(t,ef)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Wl;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new sf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sf.NOWORK_ANIMATE_ATTR}}function nf(t){return new sf(t)}sf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const rf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...kp];class af extends Bp{constructor(t){super(t),this.type="arc",this.numberType=Bu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=he(e),i=e+r,s&&Ut(r)zt&&o>zt)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=Kt(a*a+o*o)}=this.attribute,h=Ut(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*$t(g)),n=Zt(Number(l)/a*$t(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Lc(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Nt-zt?i.set(-s,-s,s,s):(td(l,o,s,i),td(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,rf)}needUpdateTag(t){return super.needUpdateTag(t,rf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Ut(o-a),d=o>a;if(h=Nt-zt)n.moveTo(0+h*Gt(a),0+h*$t(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*$t(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*$t(a),i=l*Gt(o),s=l*$t(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new af(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return af.NOWORK_ANIMATE_ATTR}}function of(t){return new af(t)}af.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ep);const lf=["points","cornerRadius",...kp];class hf extends Bp{constructor(t){super(t),this.type="polygon",this.numberType=ju}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Lc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,lf)}needUpdateTag(t){return super.needUpdateTag(t,lf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Wl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new hf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return hf.NOWORK_ANIMATE_ATTR}}function cf(t){return new hf(t)}hf.NOWORK_ANIMATE_ATTR=Ep;class df extends Lp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function uf(t){return new df(t)}const pf=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let gf,ff;function mf(t){return gf||(gf=pf.CreateGraphic("text",{})),gf.initAttributes(t),gf.AABBBounds}var vf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yf=function(t,e){return function(i,s){e(i,s,t)}};class bf{constructor(){this.time=Qo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(Af(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Lc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){Ef(t,e,i,s)}}const xf=new bf,Sf=new Set(["top","center","bottom"]);function Af(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function kf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Mf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Tf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function wf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:Sf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Tf(s,e,"left","center","right"),y:Tf(n,i,"top","center","bottom")}}function Cf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Ef(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=function(t){if(!t)return null;const e=Cf(t.naturalWidth,t.videoWidth,t.width),i=Cf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}(e),{backgroundRepeatMode:m,backgroundSizing:v}=function({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Mf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:kf({backgroundFit:e,backgroundKeepAspectRatio:i})}}({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let _=p,y=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=wf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(_=i*(g/s),y=g):"repeat-y"===m&&(y=s*(p/i),_=p);const n=t.dpr,r=pc.allocate({width:_,height:y,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,_,y),a.drawImage(e,0,0,_,y),e=r.nativeCanvas),pc.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}let Bf=class{constructor(t){this.subRenderContribitions=t,this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Bf=vf([qa(),yf(0,$a(po)),yf(0,Za(dg)),_f("design:paramtypes",[Object])],Bf);const Pf=new class{constructor(){this.time=Qo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Lf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class Rf{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=pc.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),pc.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Nt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=pc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Eg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:_h(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),tg(t,e,i,s,w+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},Df=Of,Ff=xf;const zf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},jf=Of,Hf=xf;const Vf=new class extends bf{constructor(){super(...arguments),this.time=Qo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:_=l.backgroundScale,backgroundOffsetX:y=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Af(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:_,backgroundOffsetX:y,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Nf=jt/2;function Uf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Ut(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ut(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ut(t[0]),i=Ut(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ut(l[0]),l[1]=Ut(l[1]),l[2]=Ut(l[2]),l[3]=Ut(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Nf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Nf,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Nf,jt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],jt,jt+Nf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Wf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Gf{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:_h(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),Uf(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let Yf=class{constructor(){this.time=Qo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Yf=Wf([qa()],Yf);let Xf=class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return Uf(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Xf=Wf([qa()],Xf);const $f=new Gf,Kf=Of,qf=xf;const Zf=new class extends Gf{constructor(){super(...arguments),this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},Jf=xf;const Qf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},tm=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},em=Of,im=xf;const sm={x:0,y:0,z:0,lastModelMatrix:null};class nm{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Pf),this.builtinContributions.push(Lf),this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Qo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Qo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Lc(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,_=$p(d,u,h),y=qp(d,g),b=Yp(h),x=Xp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return sl(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=$p(o,l,n),p=qp(o,c),g=Yp(n,r),f=Xp(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;sm.x=n,sm.y=r,sm.z=a,sm.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(s,d||s,n),sm.x=0,sm.y=0,sm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ip.free(n)}if(g&&!d){const s=t.getOffsetXY(e);sm.x+=s.x,sm.y+=s.y,sm.z=a,i.setTransformForCurrent()}else if(p)sm.x=0,sm.y=0,sm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);sm.x+=s.x,sm.y+=s.y,this.transformWithoutTranslate(i,sm.x,sm.y,sm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),sm.x=0,sm.y=0,sm.z=0;return sm}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,f,m,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ip.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var rm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},am=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},om=function(t,e){return function(i,s){e(i,s,t)}};let lm=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Bu,this.builtinContributions=[If,Ff,Df],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nzt){const t=Xt(b,y),r=Xt(x,y),a=Jp(v,_,f,m,n,t,Number(u)),o=Jp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>zt){const t=Xt(B,w),n=Xt(P,w),a=Jp(M,T,A,k,r,-n,Number(u)),o=Jp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*$t(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ut(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Kc[s]=t,i&&(i=!(null!==(e=Kc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Kc[e]=!!t[e],i&&(i=!!Kc[e]);else Kc[0]=!1,Kc[1]=!1,Kc[2]=!1,Kc[3]=!1;return{isFullStroke:i,stroke:Kc}})(d);if((_||E)&&(e.beginPath(),tg(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),tg(t,e,i,s,k,M,B),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ut(h-r)>=Nt-zt){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Nt;for(;i>Nt;)i-=Nt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),pp(o.color,l.color,h,!1)}(0,0,h,n);a||$p&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};lm=rm([qa(),om(0,$a(po)),om(0,Za(eg)),am("design:paramtypes",[Object])],lm);var hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dm=function(t,e){return function(i,s){e(i,s,t)}};let um=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[zf,Hf,jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function pm(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=cl(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function gm(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function fm(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=gm(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),pm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Zo.ROW:"y"===s?u=Zo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let vm=class extends nm{constructor(){super(...arguments),this.numberType=Fu}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();fm(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Ul(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Xt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function _m(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),pm(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),pm(t,l,1,s),o=!1):o=!0}t.closePath()}vm=mm([qa()],vm);const ym=new class extends Rf{constructor(){super(...arguments),this.time=Qo.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:sd(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:sd(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:sd(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:sd(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},bm=xf;var xm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Am=function(t,e){return function(i,s){e(i,s,t)}};let km=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[ym,bm],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Lc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Ul(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Ul(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Ul(e,E,{curveTension:b}),n=Ul(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,y,r[u],[g,t.attribute],Xt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Zo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Ut(_.x-b.x),A=Ut(_.y-b.y);x=null==_.x1?Zo.ROW:null==_.y1?Zo.COLUMN:Number.isFinite(S+A)?S>A?Zo.ROW:Zo.COLUMN:Zo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Zo.ROW:Zo.COLUMN,Number.isFinite(c)||(o=Zo.COLUMN),Number.isFinite(d)||(o=Zo.ROW);const u=i*(o===Zo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),fm(t,i[0]?e.top:e.bottom,l,x===Zo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};km=xm([qa(),Am(0,$a(po)),Am(0,Za(ig)),Sm("design:paramtypes",[Object])],km);const Mm=Of,Tm=xf;var wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};let Bm=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[Tm,Mm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Lc(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)sl(t.pathShape.commandList,e,i,s,1,1,f);else{sl((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Bm=wm([qa(),Em(0,$a(po)),Em(0,Za(ag)),Cm("design:paramtypes",[Object])],Bm);var Pm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rm=function(t,e){return function(i,s){e(i,s,t)}};let Om=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Hu,this.builtinContributions=[$f,qf,Kf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Kp(g,f,T,w,h),E=Zp(g,v,T,w,M),B=Yp(h,c),P=Xp(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),Uf(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Om=Pm([qa(),Rm(0,$a(po)),Rm(0,Za(lg)),Lm("design:paramtypes",[Object])],Om);var Im=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fm=function(t,e){return function(i,s){e(i,s,t)}};let zm=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Nu,this.builtinContributions=[Qf,im,em,tm],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Lc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};zm=Im([qa(),Fm(0,$a(po)),Fm(0,Za(hg)),Dm("design:paramtypes",[Object])],zm);const jm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ne)}allocate(t,e,i,s){if(!this.pools.length)return(new Ne).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ne(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const Hm=new class extends bf{constructor(){super(...arguments),this.time=Qo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,_,y,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:M=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:w=l.backgroundKeepAspectRatio,backgroundScale:C=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:L=l.backgroundClip,backgroundCornerRadius:R=l.backgroundCornerRadius}=t.attribute;let O,{background:I}=t.attribute;if(!I)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),O&&e.setTransformFromMatrix(O,!0,1))};let F;"richtext"===t.type&&(O=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(I)&&I.background?I:null,j=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(_=z.height)&&void 0!==_?_:e.height();if(F=jm.allocate(i,s,i+n,s+r),I=z.background,!j){const t=F.width(),e=F.height();F.set((null!==(y=z.x)&&void 0!==y?y:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,j||(F=mf(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const i=t.resources.get(I);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),j&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,L&&(e.beginPath(),R?Uf(e,F.x1,F.y1,F.width(),F.height(),R,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:M,backgroundFit:T,backgroundKeepAspectRatio:w,backgroundScale:C,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=I,R?(Uf(e,F.x1,F.y1,F.width(),F.height(),R,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&jm.free(F),D()}};var Vm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Um=function(t,e){return function(i,s){e(i,s,t)}};let Wm=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Uu,this.builtinContributions=[Hm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Lc(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=ad(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=ep.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),ep.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:ug(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Gm(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jm=function(t,e){return function(i,s){e(i,s,t)}};let Qm=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ju,this.builtinContributions=[Km,$m],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Gm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Gm(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=Ym(d,u),b=Ym(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Xm(h,_,y,d,u),A=Xm(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Ym(k,M),w=Xm(h,Ym(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let B=E-C;B<0&&(C=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Qm=qm([qa(),Jm(0,$a(po)),Jm(0,Za(og)),Zm("design:paramtypes",[Object])],Qm);var tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ev=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iv=function(t,e){return function(i,s){e(i,s,t)}};let sv=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Iu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Vf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Lc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Kp(p,m,g,f,c),C=Zp(p,v,g,f),E=Yp(c,u),B=Xp(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Uf(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Vf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Qo.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Qo.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Ao.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Lc(t,null==s?void 0:s.theme).group,i=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(i,p||i,n),a.modelMatrix=i,ip.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ip.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};sv=tv([qa(),iv(0,$a(po)),iv(0,Za(ng)),ev("design:paramtypes",[Object])],sv);var nv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},av=function(t,e){return function(i,s){e(i,s,t)}};const ov=["","repeat-x","repeat-y","repeat"];function lv({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=function(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?ov[i]:"no-repeat"}(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const hv={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function cv(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=lv({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?function(t){return{backgroundMode:hv[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Ef(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}let dv=class extends nm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[Zf,Jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:_=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:M,doFill:T,doStroke:w}=A;if(!S||!t.resources)return;const C=t.resources.get(S);if("success"!==C.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Uf(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const L=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),cv(e,C.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x})))},R=()=>{w&&(o?o(e,t.attribute,l):M&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},O=function({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0,imagePosition:a="top-left"}){const{repeatMode:o,sizingMode:l}=lv({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===o&&("cover"===l||"auto"===l||1!==s||0!==n||0!==r)}({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x}),I=P||O;g?(R(),I&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),L(),I&&e.restore()):(I&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),L(),I&&e.restore(),R()),this.afterRenderStep(t,e,i,s,T,!1,k,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void Yc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Lc(t).image;this._draw(t,a,!1,i)}};dv=nv([qa(),av(0,$a(po)),av(0,Za(rg)),rv("design:paramtypes",[Object])],dv);const uv=Symbol.for("IncrementalDrawContribution"),pv=Symbol.for("ArcRender"),gv=Symbol.for("AreaRender"),fv=Symbol.for("CircleRender"),mv=Symbol.for("GraphicRender"),vv=Symbol.for("GroupRender"),_v=Symbol.for("LineRender"),yv=Symbol.for("PathRender"),bv=Symbol.for("PolygonRender"),xv=Symbol.for("RectRender"),Sv=Symbol.for("SymbolRender"),Av=Symbol.for("TextRender"),kv=Symbol.for("RichTextRender"),Mv=Symbol.for("GlyphRender"),Tv=Symbol.for("ImageRender"),wv=Symbol.for("DrawContribution"),Cv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Pu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Nt;for(;o<0;)o+=Nt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var Ev=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Pv=Symbol.for("DrawItemInterceptor"),Lv=new Ne,Rv=new Ne;class Ov{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Lv.copy(s.dirtyBounds),Rv.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,ep.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Lv),s.backupDirtyBounds.copy(Rv)),!0}}class Iv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Dv=class{constructor(){this.order=1,this.interceptors=[new Ov,new zv,new Fv,new Iv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ip.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var jv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vv=function(t,e){return function(i,s){e(i,s,t)}};let Nv=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Nv=jv([qa(),Vv(0,$a(wv)),Hv("design:paramtypes",[Object])],Nv);var Uv=new Fa((t=>{t(So).to(Nv)}));const Wv=Symbol.for("PickerService"),Gv=Symbol.for("GlobalPickerService"),Yv=Symbol.for("PickItemInterceptor"),Xv=Symbol.for("PickServiceInterceptor");var $v=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Kv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Kv=$v([qa()],Kv);let qv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Lc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=ep.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};qv=$v([qa()],qv);let Zv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Zv=$v([qa()],Zv);let Jv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=Cv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Jv=$v([qa()],Jv);var Qv=new Fa(((t,e,i)=>{i(Wv)||(t(Gv).toSelf(),t(Wv).toService(Gv)),t(Jv).toSelf().inSingletonScope(),t(Yv).toService(Jv),t(qv).toSelf().inSingletonScope(),t(Yv).toService(qv),t(Zv).toSelf().inSingletonScope(),t(Yv).toService(Zv),fo(t,Yv),t(Kv).toSelf().inSingletonScope(),t(Xv).toService(Kv),fo(t,Xv)})),t_=new Fa((t=>{t(Wu).to(_g),t(Gu).toConstantValue(pf)}));const e_=Symbol.for("AutoEnablePlugins"),i_=Symbol.for("PluginService");var s_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},n_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r_=function(t,e){return function(i,s){e(i,s,t)}};let a_=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&xo.isBound(e_)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};a_=s_([qa(),r_(0,$a(po)),r_(0,Za(e_)),n_("design:paramtypes",[Object])],a_);var o_=new Fa((t=>{t(i_).to(a_),function(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).whenTargetNamed(e)}(t,e_)})),l_=new Fa((t=>{fo(t,yo)})),h_=new Fa((t=>{t(Oh).to(Ih).inSingletonScope(),fo(t,Oh)})),c_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},d_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let u_=class{constructor(){this.type="static",this.offscreen=!1,this.global=Ao.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=zh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};u_=c_([qa(),d_("design:paramtypes",[])],u_);var p_=new Fa((t=>{t(u_).toSelf(),t(zp).toService(u_)}));var g_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function f_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function m_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=f_(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=f_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var y_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},b_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},x_=function(t,e){return function(i,s){e(i,s,t)}};let S_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):m_(e,th.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ve,this.backupDirtyBounds=new Ve,this.global=Ao.global,this.layerService=Ao.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,ep.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=__(e,i,th.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=jm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=ep.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),jm.free(n),ep.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||xo.get(uv);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let k_=class extends vm{constructor(){super(...arguments),this.numberType=Fu}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Lc(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=$p(u,p,c),_=qp(u,g),y=Yp(c),b=Xp(d,f);if(!t.valid||!m)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};k_=A_([qa()],k_);var M_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let T_=class extends km{constructor(){super(...arguments),this.numberType=Lu}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Lc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=$p(u,d,c),f=Yp(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};T_=M_([qa()],T_);var w_,C_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},E_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},B_=function(t,e){return function(i,s){e(i,s,t)}},P_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(w_||(w_={}));let L_=class extends S_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=w_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new _o([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return P_(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return P_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return P_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){if(2!==t.count)yield v_(t,th.zIndex,((i,s)=>{if(this.status===w_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return P_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return P_(this,void 0,void 0,(function*(){this.rendering&&(this.status=w_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=w_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return P_(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){yield v_(t,th.zIndex,(t=>P_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};L_=C_([qa(),B_(0,Ka(mv)),B_(1,$a(k_)),B_(2,$a(T_)),B_(3,$a(po)),B_(3,Za(Pv)),E_("design:paramtypes",[Array,Object,Object,Object])],L_);var R_=new Fa((t=>{t(bf).toSelf().inSingletonScope(),t(Rf).toSelf().inSingletonScope(),t(wv).to(S_),t(uv).to(L_),t(vv).to(sv).inSingletonScope(),t(mv).toService(vv),fo(t,ng),t(Bf).toSelf().inSingletonScope(),fo(t,dg),fo(t,mv),t(Dv).toSelf().inSingletonScope(),t(Pv).toService(Dv),fo(t,Pv)}));function O_(){O_.__loaded||(O_.__loaded=!0,xo.load(Gp),xo.load(t_),xo.load(Uv),xo.load(Qv),xo.load(o_),function(t){t.load(l_),t.load(h_),t.load(p_)}(xo),function(t){t.load(R_)}(xo))}O_.__loaded=!1,O_();const I_=xo.get(bo);Ao.global=I_;const D_=xo.get(Dp);Ao.graphicUtil=D_;const F_=xo.get(Ip);Ao.transformUtil=F_;const z_=xo.get(Wu);Ao.graphicService=z_;const j_=xo.get(Fp);Ao.layerService=j_;class H_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class V_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Ao.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Ao.global.getRequestAnimationFrame();this.rafId=t((()=>{Ao.global.devicePixelRatio!==this.dpr&&(this.dpr=Ao.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Ao.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class N_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ao.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const U_=new Ne;class W_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()}));const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(U_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(U_,t.parent&&t.parent.globalTransMatrix)))})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let G_;function Y_(){!function(){if(null==G_)try{const t=document.createElement("canvas"),e=t.getContext("2d");G_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),G_&&(G_=!!document.createElement)}catch(t){G_=!1}}();const t=Ao.global&&Ao.global.env;return t?"browser"===t:G_}let X_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};X_._pluginClasses={};const $_="white";class K_ extends Lp{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:$_}set background(t){this._background=t,this.syncBackgroundImage(t)}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}syncBackgroundImage(t){var e;const i=null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t;this.backgroundImg=!1,this.isImageBackgroundSource(i)&&this.loadImage(i,!0)}isImageBackgroundSource(t){if(!t)return!1;if("string"==typeof t)return t.startsWith("{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Bc,this.hooks={beforeRender:new _o(["stage"]),afterRender:new _o(["stage"]),afterClearScreen:new _o(["stage"]),afterClearRect:new _o(["stage"])},this.global=Ao.global,!this.global.env&&Y_()&&this.global.setEnv("browser"),this.window=xo.get(mc),this.renderService=xo.get(So),this.pluginService=xo.get(i_),this.layerService=xo.get(Fp),this.graphicService=xo.get(Wu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:$_,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&this.syncBackgroundImage(this._background),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Gc(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1);const k=X_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=X_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=X_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new H_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new V_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new N_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ve;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new W_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=X_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=X_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=X_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=xo.get(mc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=xo.get(Wv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var q_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Z_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let J_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ne}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return Z_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};J_=q_([qa()],J_);var Q_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ty=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ey=class{constructor(){this._uid=Da.GenAutoIncrementId(),this.viewBox=new Ne,this.modelMatrix=new We(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};ey=Q_([qa(),ty("design:paramtypes",[])],ey);var iy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ny=function(t,e){return function(i,s){e(i,s,t)}};let ry=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=Ao.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ne).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new We(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=Lc(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new re(e.x,e.y);l.transformPoint(a,a);const o=Lc(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&ip.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),ep.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function ay(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function oy(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function py(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),_y=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},yy=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Ve;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return _y(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return _y(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);yy(n[0],s,i),yy(n[1],e-s,i)}};let by=!1;const xy=new Fa((t=>{by||(by=!0,t(lm).toSelf().inSingletonScope(),t(pv).to(lm).inSingletonScope(),t(mv).toService(pv),t(eg).toService(Bf),fo(t,eg))}));let Sy=!1;const Ay=new Fa((t=>{Sy||(Sy=!0,t(Om).toSelf().inSingletonScope(),t(xv).to(Om).inSingletonScope(),t(mv).toService(xv),t(Xf).toSelf(),t(Yf).toSelf(),t(lg).toService(Xf),t(lg).toService(Yf),t(lg).toService(Bf),fo(t,lg))}));let ky=!1;const My=new Fa((t=>{ky||(ky=!0,t(vm).toSelf().inSingletonScope(),t(k_).toSelf().inSingletonScope(),t(_v).to(vm).inSingletonScope(),t(mv).toService(_v))}));let Ty=!1;const wy=new Fa((t=>{Ty||(Ty=!0,t(km).toSelf().inSingletonScope(),t(gv).to(km).inSingletonScope(),t(mv).toService(gv),t(ig).toService(Bf),fo(t,ig),t(T_).toSelf().inSingletonScope())}));let Cy=!1;const Ey=new Fa((t=>{Cy||(Cy=!0,t(zm).toSelf().inSingletonScope(),t(Sv).to(zm).inSingletonScope(),t(mv).toService(Sv),t(hg).toService(Bf),fo(t,hg))}));let By=!1;const Py=new Fa((t=>{By||(By=!0,t(um).toSelf().inSingletonScope(),t(fv).to(um).inSingletonScope(),t(mv).toService(fv),t(sg).toService(Bf),fo(t,sg))}));let Ly=!1;const Ry=new Fa((t=>{Ly||(Ly=!0,t(Av).to(Wm).inSingletonScope(),t(mv).toService(Av),t(cg).toService(Bf),fo(t,cg))}));let Oy=!1;const Iy=new Fa((t=>{Oy||(Oy=!0,t(Bm).toSelf().inSingletonScope(),t(yv).to(Bm).inSingletonScope(),t(mv).toService(yv),t(ag).toService(Bf),fo(t,ag))}));let Dy=!1;const Fy=new Fa((t=>{Dy||(Dy=!0,t(bv).to(Qm).inSingletonScope(),t(mv).toService(bv),t(og).toService(Bf),fo(t,og))}));var zy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jy=class{constructor(){this.numberType=Ou}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Lc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};jy=zy([qa()],jy);let Hy=!1;const Vy=new Fa((t=>{Hy||(Hy=!0,t(Mv).to(jy).inSingletonScope(),t(mv).toService(Mv))}));var Ny=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Wy=class extends nm{constructor(){super(),this.numberType=Vu,this.builtinContributions=[Hm],this.init()}drawShape(t,e,i,s,n){const r=Lc(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=$p(o,l,!0),d=$p(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Lc(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Uf(e,i-t,s-n,v,_,f,!0)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Lc(t).richtext;this._draw(t,s,!1,i)}};Wy=Ny([qa(),Uy("design:paramtypes",[])],Wy);let Gy=!1;const Yy=new Fa((t=>{Gy||(Gy=!0,t(kv).to(Wy).inSingletonScope(),t(mv).toService(kv))}));let Xy=!1;const $y=new Fa((t=>{Xy||(Xy=!0,t(Tv).to(dv).inSingletonScope(),t(mv).toService(Tv),t(rg).toService(Bf),fo(t,rg))}));function Ky(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),Jy=(t,e)=>(d(tb.warnHandler)&&tb.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),Qy=(t,e,i)=>{if(!d(tb.errorHandler))throw new Error(t);tb.errorHandler.call(null,t,e)},tb={silent:!1,warnHandler:!1,errorHandler:!1},eb=Y_(),ib=eb&&globalThis?globalThis.document:void 0;function sb(t){return("desktop-browser"===t||"mobile-browser"===t)&&eb}function nb(t){return rb(t)||"mobile-browser"===t}function rb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let ab=0;function ob(){return ab>=9999999&&(ab=0),ab++}function lb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function hb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const cb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class db extends Lp{constructor(t,e){super(t),this._skipRenderAttributes=cb,(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},jb=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class Hb extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=Hc.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=Hc.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||zb(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=jb(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=Hc.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=jb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=zb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Hc.now()-i>this.config.press.time&&jb(s[0],t){Ao.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Ub=[0,0,0];let Wb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},$l),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ql),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Zl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this._clearMatrix=new We(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return ep.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&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Nt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*y),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&xp.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Qu(Ub,[t,e,i],this.modelMatrix),t=Ub[0],e=Ub[1],i=Ub[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(Qu(Ub,[t,e,i],this.modelMatrix),t=Ub[0],e=Ub[1],i=Ub[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Qu(Ub,[e,i,s],this.modelMatrix),e=Ub[0],i=Ub[1],s=Ub[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t,e=Ao.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Ao.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Zl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Zl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Qu(Ub,[e,i,s],this.modelMatrix),e=Ub[0],i=Ub[1],s=Ub[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=yh(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:_h(this,a,this.dpr),r.strokeStyle=yh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};Wb.env="browser",Wb=Vb([qa(),Nb("design:paramtypes",[Object,Number])],Wb);var Gb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Xb=class extends hp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ao.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Wb(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function $b(t,e){return new Fa((i=>{i(Dh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Fh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Xb.env="browser",Xb=Gb([qa(),Yb("design:paramtypes",[Object])],Xb);const Kb=$b(Xb,Wb);var qb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jb=function(t,e){return function(i,s){e(i,s,t)}};let Qb=class extends ry{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=pc.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ex=class{constructor(){this.type="group",this.numberType=Iu}contains(t,e,i){return!1}};ex=tx([qa()],ex);const ix=new Fa(((t,e,i,s)=>{ix.__vloaded||(ix.__vloaded=!0,t(Db).to(ex).inSingletonScope(),t(Fb).toService(Db),fo(t,Fb))}));ix.__vloaded=!1;var sx=ix;const nx=new Fa(((t,e,i,s)=>{i(Qb)||t(Qb).toSelf().inSingletonScope(),i(Wv)?s(Wv).toService(Qb):t(Wv).toService(Qb)}));var rx,ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ox=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lx=rx=class extends ey{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${rx.idprefix}_${rx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ao.global,this.viewBox=new Ne,this.modelMatrix=new We(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:rx.GenerateCanvasId(),canvasControled:!0};this.canvas=new Xb(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new Xb({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};lx.env="browser",lx.idprefix="visactor_window",lx.prefix_count=0,lx=rx=ax([qa(),ox("design:paramtypes",[])],lx);const hx=new Fa((t=>{t(lx).toSelf(),t(vc).toDynamicValue((t=>t.container.get(lx))).whenTargetNamed(lx.env)}));var cx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ux=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class px{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function gx(t,e=!1){const i=document.createElement("img");if(Ao.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let fx=class extends J_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new px(t)}return new Ne}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return gx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return gx(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:Da.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return ux(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};fx=cx([qa(),dx("design:paramtypes",[])],fx);const mx=new Fa((t=>{mx.isBrowserBound||(mx.isBrowserBound=!0,t(fx).toSelf().inSingletonScope(),t(yo).toService(fx))}));function vx(t,e=!0){vx.__loaded||(vx.__loaded=!0,t.load(mx),t.load(Kb),t.load(hx),e&&function(t){t.load(sx),t.load(nx)}(t))}mx.isBrowserBound=!1,vx.__loaded=!1;var _x=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let yx=class extends Wb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};yx.env="feishu",yx=_x([qa()],yx);var bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Sx=class extends hp{constructor(t){super(t)}init(){this._context=new yx(this,this._dpr)}release(...t){}};Sx.env="feishu",Sx=bx([qa(),xx("design:paramtypes",[Object])],Sx);const Ax=$b(Sx,yx);var kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tx=function(t,e){return function(i,s){e(i,s,t)}};class wx{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 Cx=class extends ey{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new wx}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:Da.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Sx(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Sx({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Cx.env="feishu",Cx=kx([qa(),Tx(0,$a(bo)),Mx("design:paramtypes",[Object])],Cx);const Ex=new Fa((t=>{t(Cx).toSelf(),t(vc).toDynamicValue((t=>t.container.get(Cx))).whenTargetNamed(Cx.env)}));var Bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Px=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lx=function(t,e){return function(i,s){e(i,s,t)}};let Rx=class extends ry{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new op(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};Rx=Bx([qa(),Lx(0,$a(po)),Lx(0,Za(ub)),Lx(1,$a(po)),Lx(1,Za(Yv)),Lx(2,$a(po)),Lx(2,Za(Xv)),Px("design:paramtypes",[Object,Object,Object])],Rx);const Ox=new Fa((t=>{Ox.__vloaded||(Ox.__vloaded=!0,fo(t,ub))}));Ox.__vloaded=!1;var Ix=Ox;class Dx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:_h(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var Fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jx=function(t,e){return function(i,s){e(i,s,t)}};let Hx=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};Hx=Fx([qa(),jx(0,$a(pv)),zx("design:paramtypes",[Object])],Hx);let Vx=!1;const Nx=new Fa(((t,e,i,s)=>{Vx||(Vx=!0,t(pb).to(Hx).inSingletonScope(),t(ub).toService(pb))}));var Ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gx=function(t,e){return function(i,s){e(i,s,t)}};let Yx=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};Yx=Ux([qa(),Gx(0,$a(gv)),Wx("design:paramtypes",[Object])],Yx);let Xx=!1;const $x=new Fa(((t,e,i,s)=>{Xx||(Xx=!0,t(gb).to(Yx).inSingletonScope(),t(ub).toService(gb))}));var Kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zx=function(t,e){return function(i,s){e(i,s,t)}};let Jx=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};Jx=Kx([qa(),Zx(0,$a(fv)),qx("design:paramtypes",[Object])],Jx);let Qx=!1;const tS=new Fa(((t,e,i,s)=>{Qx||(Qx=!0,t(fb).to(Jx).inSingletonScope(),t(ub).toService(fb))}));class eS{constructor(){this.type="glyph",this.numberType=Ou}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var iS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nS=function(t,e){return function(i,s){e(i,s,t)}};let rS=class extends eS{constructor(t){super(),this.canvasRenderer=t}};rS=iS([qa(),nS(0,$a(Mv)),sS("design:paramtypes",[Object])],rS);let aS=!1;const oS=new Fa(((t,e,i,s)=>{aS||(aS=!0,t(Ab).to(rS).inSingletonScope(),t(rS).toService(Ab))}));var lS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let hS=class{constructor(){this.type="image",this.numberType=Du}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};hS=lS([qa()],hS);let cS=!1;const dS=new Fa(((t,e,i,s)=>{cS||(cS=!0,t(mb).to(hS).inSingletonScope(),t(hS).toService(mb))}));var uS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gS=function(t,e){return function(i,s){e(i,s,t)}};let fS=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};fS=uS([qa(),gS(0,$a(_v)),pS("design:paramtypes",[Object])],fS);let mS=!1;const vS=new Fa(((t,e,i,s)=>{mS||(mS=!0,t(vb).to(fS).inSingletonScope(),t(ub).toService(vb))}));var _S=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bS=function(t,e){return function(i,s){e(i,s,t)}};let xS=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};xS=_S([qa(),bS(0,$a(bv)),yS("design:paramtypes",[Object])],xS);let SS=!1;const AS=new Fa(((t,e,i,s)=>{SS||(SS=!0,t(Sb).to(xS).inSingletonScope(),t(ub).toService(Sb))}));var kS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TS=function(t,e){return function(i,s){e(i,s,t)}};let wS=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};wS=kS([qa(),TS(0,$a(yv)),MS("design:paramtypes",[Object])],wS);let CS=!1;const ES=new Fa(((t,e,i,s)=>{CS||(CS=!0,t(_b).to(wS).inSingletonScope(),t(ub).toService(_b))})),BS=new Ne;class PS{constructor(){this.type="rect",this.numberType=Hu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:_h(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;BS.setValue(i.x1,i.y1,i.x2,i.y2),BS.expand(-r/2),h=!BS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var LS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OS=function(t,e){return function(i,s){e(i,s,t)}};let IS=class extends PS{constructor(t){super(),this.canvasRenderer=t}};IS=LS([qa(),OS(0,$a(xv)),RS("design:paramtypes",[Object])],IS);let DS=!1;const FS=new Fa(((t,e,i,s)=>{DS||(DS=!0,t(yb).to(IS).inSingletonScope(),t(ub).toService(yb))}));let zS=!1;const jS=new Fa(((t,e,i,s)=>{zS||(zS=!0,t(mb).to(hS).inSingletonScope(),t(hS).toService(mb))}));var HS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NS=function(t,e){return function(i,s){e(i,s,t)}};let US=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nu}};US=HS([qa(),NS(0,$a(Sv)),VS("design:paramtypes",[Object])],US);let WS=!1;const GS=new Fa(((t,e,i,s)=>{WS||(WS=!0,t(bb).to(US).inSingletonScope(),t(ub).toService(bb))}));var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let XS=class{constructor(){this.type="text",this.numberType=Uu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};XS=YS([qa()],XS);let $S=!1;const KS=new Fa(((t,e,i,s)=>{$S||($S=!0,t(xb).to(XS).inSingletonScope(),t(ub).toService(xb))})),qS=new Fa(((t,e,i,s)=>{i(Rx)||t(Rx).toSelf().inSingletonScope(),i(Wv)?s(Wv).toService(Rx):t(Wv).toService(Rx)}));class ZS{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var JS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let tA=class extends J_{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,s,n,r){const a=null!=r?r:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,r)=>{const o=tt.createCanvasContext(e),l=new ZS(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),r>=s&&n.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};tA=JS([qa(),QS("design:paramtypes",[])],tA);const eA=new Fa((t=>{eA.isFeishuBound||(eA.isFeishuBound=!0,t(tA).toSelf().inSingletonScope(),t(yo).toService(tA))}));function iA(t,e=!0){iA.__loaded||(iA.__loaded=!0,t.load(eA),t.load(Ax),t.load(Ex),e&&function(t){t.load(Ix),t.load(qS),t.load(Nx),t.load($x),t.load(tS),t.load(oS),t.load(dS),t.load(vS),t.load(AS),t.load(ES),t.load(FS),t.load(jS),t.load(GS),t.load(KS)}(t))}eA.isFeishuBound=!1,iA.__loaded=!1;var sA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let rA=class extends Wb{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 We(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};rA.env="node",rA=sA([qa(),nA("design:paramtypes",[Object,Number])],rA);var aA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lA=class extends hp{constructor(t){super(t)}init(){this._context=new rA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};lA.env="node",lA=aA([qa(),oA("design:paramtypes",[Object])],lA);const hA=$b(lA,rA);var cA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uA=function(t,e){return function(i,s){e(i,s,t)}};let pA=class extends ey{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:Da.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new lA(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new lA({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};pA.env="node",pA=cA([qa(),uA(0,$a(bo)),dA("design:paramtypes",[Object])],pA);const gA=new Fa((t=>{t(pA).toSelf(),t(vc).toDynamicValue((t=>t.container.get(pA))).whenTargetNamed(pA.env)}));var fA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let mA=class extends J_{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};mA=fA([qa()],mA);const vA=new Fa((t=>{vA.isNodeBound||(vA.isNodeBound=!0,t(mA).toSelf().inSingletonScope(),t(yo).toService(mA))}));function _A(t,e=!0){_A.__loaded||(_A.__loaded=!0,t.load(vA),t.load(hA),t.load(gA))}vA.isNodeBound=!1,_A.__loaded=!1;var yA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xA=function(t,e){return function(i,s){e(i,s,t)}};let SA=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};SA=yA([qa(),xA(0,$a(pv)),bA("design:paramtypes",[Object])],SA);let AA=!1;const kA=new Fa(((t,e,i,s)=>{AA||(AA=!0,t(kb).to(SA).inSingletonScope(),t(Fb).toService(kb))}));var MA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wA=function(t,e){return function(i,s){e(i,s,t)}};let CA=class extends PS{constructor(t){super(),this.canvasRenderer=t}};CA=MA([qa(),wA(0,$a(xv)),TA("design:paramtypes",[Object])],CA);let EA=!1;const BA=new Fa(((t,e,i,s)=>{EA||(EA=!0,t(Bb).to(CA).inSingletonScope(),t(Fb).toService(Bb))}));class PA extends nm{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var LA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OA=function(t,e){return function(i,s){e(i,s,t)}};let IA=class extends PA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};IA=LA([qa(),OA(0,$a(_v)),RA("design:paramtypes",[Object])],IA);let DA=!1;const FA=new Fa(((t,e,i,s)=>{DA||(DA=!0,t(Cb).to(IA).inSingletonScope(),t(Fb).toService(Cb))}));var zA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HA=function(t,e){return function(i,s){e(i,s,t)}};let VA=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};VA=zA([qa(),HA(0,$a(gv)),jA("design:paramtypes",[Object])],VA);let NA=!1;const UA=new Fa(((t,e,i,s)=>{NA||(NA=!0,t(Mb).to(VA).inSingletonScope(),t(Fb).toService(Mb))}));class WA extends nm{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var GA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let $A=class extends WA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ip.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};$A=GA([qa(),XA(0,$a(Sv)),YA("design:paramtypes",[Object])],$A);let KA=!1;const qA=new Fa(((t,e,i,s)=>{KA||(KA=!0,t(Pb).to($A).inSingletonScope(),t(Fb).toService(Pb))}));var ZA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},JA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},QA=function(t,e){return function(i,s){e(i,s,t)}};let tk=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};tk=ZA([qa(),QA(0,$a(fv)),JA("design:paramtypes",[Object])],tk);let ek=!1;const ik=new Fa(((t,e,i,s)=>{ek||(ek=!0,t(Tb).to(tk).inSingletonScope(),t(Fb).toService(Tb))}));var sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rk=function(t,e){return function(i,s){e(i,s,t)}};let ak=class extends WA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Uu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=pg(a,u,n),v=ug(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&ip.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};ak=sk([qa(),rk(0,$a(Av)),nk("design:paramtypes",[Object])],ak);let ok=!1;const lk=new Fa(((t,e,i,s)=>{ok||(ok=!0,t(Lb).to(ak).inSingletonScope(),t(Fb).toService(Lb))}));var hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ck=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dk=function(t,e){return function(i,s){e(i,s,t)}};let uk=class extends PA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};uk=hk([qa(),dk(0,$a(yv)),ck("design:paramtypes",[Object])],uk);let pk=!1;const gk=new Fa(((t,e,i,s)=>{pk||(pk=!0,t(Eb).to(uk).inSingletonScope(),t(Fb).toService(Eb))}));var fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vk=function(t,e){return function(i,s){e(i,s,t)}};let _k=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};_k=fk([qa(),vk(0,$a(bv)),mk("design:paramtypes",[Object])],_k);let yk=!1;const bk=new Fa(((t,e,i,s)=>{yk||(yk=!0,t(Rb).to(_k).inSingletonScope(),t(Fb).toService(Rb))}));var xk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ak=function(t,e){return function(i,s){e(i,s,t)}};let kk=class extends eS{constructor(t){super(),this.canvasRenderer=t}};kk=xk([qa(),Ak(0,$a(Mv)),Sk("design:paramtypes",[Object])],kk);let Mk=!1;const Tk=new Fa(((t,e,i,s)=>{Mk||(Mk=!0,t(Ib).to(kk).inSingletonScope(),t(Fb).toService(Ib))}));var wk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ck=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ek=function(t,e){return function(i,s){e(i,s,t)}};let Bk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Bk=wk([qa(),Ek(0,$a(kv)),Ck("design:paramtypes",[Object])],Bk);let Pk=!1;const Lk=new Fa(((t,e,i,s)=>{Pk||(Pk=!0,t(Ob).to(Bk).inSingletonScope(),t(Fb).toService(Ob))}));var Rk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ik=function(t,e){return function(i,s){e(i,s,t)}};let Dk=class extends Dx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Du}};Dk=Rk([qa(),Ik(0,$a(Tv)),Ok("design:paramtypes",[Object])],Dk);let Fk=!1;const zk=new Fa(((t,e,i,s)=>{Fk||(Fk=!0,t(wb).to(Dk).inSingletonScope(),t(Fb).toService(wb))})),jk=Y_();function Hk(){Hk.__loaded||(Hk.__loaded=!0,pf.RegisterGraphicCreator("arc",of),xo.load(xy),xo.load(jk?kA:Nx))}Hk.__loaded=!1;const Vk=Hk;function Nk(){Nk.__loaded||(Nk.__loaded=!0,pf.RegisterGraphicCreator("area",nf),xo.load(wy),xo.load(jk?UA:$x))}Nk.__loaded=!1;const Uk=Nk;function Wk(){Wk.__loaded||(Wk.__loaded=!0,pf.RegisterGraphicCreator("circle",Sg),xo.load(Py),xo.load(jk?ik:tS))}Wk.__loaded=!1;const Gk=Wk;function Yk(){Yk.__loaded||(Yk.__loaded=!0,pf.RegisterGraphicCreator("glyph",zg),xo.load(Vy),xo.load(jk?Tk:oS))}Yk.__loaded=!1;const Xk=Yk;function $k(){$k.__loaded||($k.__loaded=!0,pf.RegisterGraphicCreator("group",Rp))}$k.__loaded=!1;const Kk=$k;function qk(){qk.__loaded||(qk.__loaded=!0,pf.RegisterGraphicCreator("image",Wg),xo.load($y),xo.load(jk?zk:dS))}qk.__loaded=!1;const Zk=qk;function Jk(){Jk.__loaded||(Jk.__loaded=!0,pf.RegisterGraphicCreator("line",Lg),xo.load(My),xo.load(jk?FA:vS))}Jk.__loaded=!1;const Qk=Jk;function tM(){tM.__loaded||(tM.__loaded=!0,pf.RegisterGraphicCreator("path",tf),xo.load(Iy),xo.load(jk?gk:ES))}tM.__loaded=!1;const eM=tM;function iM(){iM.__loaded||(iM.__loaded=!0,pf.RegisterGraphicCreator("polygon",cf),xo.load(Fy),xo.load(jk?bk:AS))}iM.__loaded=!1;const sM=iM;function nM(){nM.__loaded||(nM.__loaded=!0,pf.RegisterGraphicCreator("rect",Dg),xo.load(Ay),xo.load(jk?BA:FS))}nM.__loaded=!1;const rM=nM;function aM(){aM.__loaded||(aM.__loaded=!0,pf.RegisterGraphicCreator("richtext",Zg),xo.load(Yy),xo.load(jk?Lk:jS))}aM.__loaded=!1;const oM=aM;function lM(){lM.__loaded||(lM.__loaded=!0,pf.RegisterGraphicCreator("shadowRoot",uf))}lM.__loaded=!1;const hM=lM;function cM(){cM.__loaded||(cM.__loaded=!0,pf.RegisterGraphicCreator("symbol",Eg),xo.load(Ey),xo.load(jk?qA:GS))}cM.__loaded=!1;const dM=cM;function uM(){uM.__loaded||(uM.__loaded=!0,pf.RegisterGraphicCreator("text",Tg),xo.load(Ry),xo.load(jk?lk:KS))}uM.__loaded=!1;const pM=uM;function gM(){Kk(),rM()}const fM=-.5*Math.PI,mM=1.5*Math.PI,vM="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var _M;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(_M||(_M={}));const yM={[_M.selectedReverse]:{},[_M.selected]:{},[_M.hover]:{},[_M.hoverReverse]:{}},bM={container:"",width:30,height:30,style:{}},xM="scrollDrag";function SM(){return"browser"===I_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const AM={debounce:St,throttle:At};gM();let kM=class t extends db{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=_t(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=_t(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=SM(),a="browser"===I_.env?I_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=_t(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:AM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:yt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=yt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(xM,{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",AM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===I_.env?I_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(yt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ai(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ai(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=_t(t[0],0,1),c=_t(t[1],0,1),d=_t(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=yt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?yt([a+i*n,a+s*n],a,n-l):yt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=SM(),e="browser"===I_.env?I_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===I_.env?I_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};kM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};var MM,TM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wM=MM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ve).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Ut(t.deltaX)>Ut(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ne,e.addEventListener("wheel",this.scroll),this.params=MM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(xM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new kM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(wM)||(t(wM).toSelf(),t(e_).toService(wM))}));function EM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&EM(t,e)}))}const BM=t=>!u(t)&&!1!==t.visible;function PM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function LM(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const OM=["#ffffff","#000000"];function IM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ii(t).toHex(),o=new ii(e).toHex();return DM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...OM);for(const n of a)if(t!==n&&DM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function DM(t,e,i,s,n){if("lightness"===n){const i=ii.getColorBrightness(new ii(e));return ii.getColorBrightness(new ii(t))<.5?i>=.5:i<.5}return s?FM(t,e)>s:"largeText"===i?FM(t,e)>3:FM(t,e)>4.5}function FM(t,e){const i=zM(t),s=zM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function zM(t){const e=ni(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function jM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function HM(t,e){return[t[0]*e,t[1]*e]}function VM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function NM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const UM=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:vM,fontSize:14},s),getTextBounds:i?void 0:mf,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function WM(t,e,i={}){if(!t)return{width:0,height:0};const s=mf({text:t,fontFamily:e.fontFamily||i.fontFamily||vM,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function GM(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function YM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function XM(t,e="type"){const i=GM(t,e);return"rich"===i?pf.richtext(YM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),pf.text(t))}function $M(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const KM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function qM(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function ZM(t,e){const{dx:i,dy:s}=qM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function JM(){Kk(),rM(),dM(),oM(),pM()}var QM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=QM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Wl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},tT.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}tT.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const eT={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}},iT={poptip:j({},eT)};var sT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",Xt(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",Xt(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:jt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:jt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:jt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}cT.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};var dT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let uT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};j(s,cT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new cT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,iT.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};uT=dT([qa()],uT);var pT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class gT{constructor(){this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let fT=class extends gT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};fT=pT([qa()],fT);let mT=class extends gT{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};mT=pT([qa()],mT);const vT=new Fa(((t,e,i,s)=>{i(uT)||(t(uT).toSelf().inSingletonScope(),t(dg).toService(uT)),i(fT)||(t(fT).toSelf(),t(e_).toService(fT)),i(mT)||(t(mT).toSelf(),t(e_).toService(mT))}));class _T extends db{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}Kk(),Qk();class yT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},yT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}yT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Kk(),rM();class bT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},bT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}bT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},Kk(),Vk();class xT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},xT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}xT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},Kk(),Vk();class ST extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ST.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=fM,endAngle:s=mM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}ST.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},Kk(),eM();class AT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},AT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ce(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}function kT(){Kk(),Qk(),sM(),dM()}function MT(){Kk(),Qk(),Vk(),dM()}AT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},kT();class TT extends db{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TT.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=pf.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=pf.line;Y(i)[0].cornerRadius&&(t=pf.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=pf.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}TT.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}}},MT();class wT extends TT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TT.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=pf.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var CT,ET;!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.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(CT||(CT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(ET||(ET={}));const BT={[ET.selectedReverse]:{},[ET.selected]:{},[ET.hover]:{},[ET.hoverReverse]:{}},PT={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},LT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const RT=Math.sin(Math.PI/10);function OT(t,e=RT){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function IT(t,e=RT){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function DT(t){const e={};return EM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function FT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function zT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return HM(r,(s?-1:1)*(n?-1:1)*t/VM(r))}function jT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function VT(t,e,i){var s;if(IT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>ze(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>ze(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function NT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(_M.hover,!0),EM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(_M.hoverReverse,!0)})),s):i},WT=(t,e,i)=>i?(EM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(_M.hoverReverse),t.removeState(_M.hover))})),null):i,GT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(_M.selected)?(EM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(_M.selectedReverse),t.removeState(_M.selected))})),null):s.name&&!P(s.states)?(s.addState(_M.selected,!0),EM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(_M.selectedReverse,!0)})),s):i};class YT extends db{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const XT={type:"default",duration:300,easing:"linear"};class $T extends YT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=UT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=WT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=GT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=pf.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prepare(),this._prevInnerView=this._innerView&&DT(this._innerView),this.removeAllChild(!0),this._innerView=pf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(XT)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=pf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=CT.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=pf.group({x:0,y:0,pickable:!1});t.name=CT.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=pf.group({x:0,y:0,pickable:!1});i.name=CT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=pf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=CT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=yM;else{const t=this.data[s],e=j({},yM,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=pf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=CT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=yM;else{const i=j({},yM,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=pf.group({x:0,y:0,pickable:!1});return r.name=`${CT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=XM(this._getLabelAttribute(t,e,n,i));if(a.name=CT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=yM;else{const s=j({},yM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new tT(Object.assign({},e));i.name=CT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return FT(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Ut(s[0])>Ut(s[1])?o=jt/2*(l.x>e.x?1:-1):h=jt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?j({},PT.label.style,_(t,e,i,s)):_;_=j(this.getLabelAlign(m,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return d(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},EM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const KT={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&VT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function qT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function ZT(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:KT[n]||KT.parity;if(s.length>=3&&NT(s,r)){do{s=a(s,r)}while(s.length>=3&&NT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);VT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),ZT(l,s,n,(t=>VT(t,l,r))),ZT(h,s,o,(t=>VT(t,h,r)||!(!n||t===l)&&VT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function QT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},iw(t,e.attribute.angle)),{angle:ew(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({},sw(t,e.attribute.angle)),{angle:ew(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function ew(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function iw(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=ew(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function sw(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=ew(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function nw(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=IT(h),m=OT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function rw(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class aw{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=VM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return HM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class ow{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-ow.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*ow.bounceIn(2*t):.5*ow.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Nt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Nt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Nt/e)*.5+1}}static registerFunc(t,e){ow[t]=e}}function lw(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}ow.quadIn=ow.getPowIn(2),ow.quadOut=ow.getPowOut(2),ow.quadInOut=ow.getPowInOut(2),ow.cubicIn=ow.getPowIn(3),ow.cubicOut=ow.getPowOut(3),ow.cubicInOut=ow.getPowInOut(3),ow.quartIn=ow.getPowIn(4),ow.quartOut=ow.getPowOut(4),ow.quartInOut=ow.getPowInOut(4),ow.quintIn=ow.getPowIn(5),ow.quintOut=ow.getPowOut(5),ow.quintInOut=ow.getPowInOut(5),ow.backIn=ow.getBackIn(1.7),ow.backOut=ow.getBackOut(1.7),ow.backInOut=ow.getBackInOut(1.7),ow.elasticIn=ow.getElasticIn(1,.3),ow.elasticOut=ow.getElasticOut(1,.3),ow.elasticInOut=ow.getElasticInOut(1,.3*1.5),ow.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),ow.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},ow.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)ow[`flicker${t}`]=e=>lw(e,t);for(let t=2;t<10;t++)ow[`aIn${t}`]=e=>t*e*e+(1-t)*e;function hw(t,e,i){return t+(e-t)*i}const cw=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=hw(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=hw(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=hw(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=hw(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=hw(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=hw(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=hw(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=hw(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=hw(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=pp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?fp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=pp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?fp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=hw(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=hw(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=hw(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=hw(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=hw(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=hw(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=hw(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=hw(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=hw(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=id(e,i,s),r.addUpdateBoundTag()}}};function dw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=ow[s])&&void 0!==n?n:ow.linear:ow.linear,"wait"===t&&(this.onUpdate=uw),this.id=Da.GenAutoIncrementId(),this.syncAttributeUpdate=uw}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=dp.Get(i,cp.Color255),r=dp.Get(s,cp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(cw["fill"===e?"fillPure":"strokePure"])}else cw[e]?t.push(cw[e]):t.push(dw)}else cw[e]?t.push(cw[e]):t.push(dw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class gw extends pw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class fw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Da.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Io.END?this.removeAnimate(t,!0):t.status!==Io.RUNNING&&t.status!==Io.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const mw=new fw;mw.isGlobal=!0;class vw{constructor(t=Da.GenAutoIncrementId(),e=mw,i){this.id=t,this.status=Io.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new pw(Oo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new gw(Oo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new pw(Oo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Io.RUNNING&&(this.status=Io.PAUSED)}resume(){this.status===Io.PAUSED&&(this.status=Io.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Io.END&&this.onEnd(),this.status=Io.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Io.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Io.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Io.END);this.status=Io.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const _w=new Mo;class yw{constructor(){this.released=!1}tick(t,e){_w.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class bw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Ro.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Ro.INITIAL,Ao.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Ao.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new yw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Ro.INITIAL&&(this.status=Ro.PAUSE,!0)}resume(){return this.status!==Ro.INITIAL&&(this.status=Ro.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Ro.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Ro.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Ro.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Ao.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function Aw(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}Sw.getInstance();class kw{static registerBuiltInAnimate(t,e){kw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:kw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=Aw(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:kw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=Aw(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),O.attrOutChannel&&e.setAttributes(O.attrOutChannel),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_,y,b;if(e&&i){i=Aw(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(_=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:kw.builtInAnimateMap[r],f=t.custom?t.customType:Aw(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Io.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}kw.builtInAnimateMap={};const Mw="appear",Tw="disappear",ww="update",Cw="highlight",Ew="unhighlight";class Bw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class Pw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=Sw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new kw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new kw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([Mw],[{name:Mw,animation:t}],e)}applyDisappearState(t,e){this.applyState([Tw],[{name:Tw,animation:t}],e)}applyUpdateState(t,e){this.applyState([ww],[{name:ww,animation:t}],e)}applyHighlightState(t,e){this.applyState([Cw],[{name:Cw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([Ew],[{name:Ew,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class Lw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new Pw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new Bw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new Lw)._getAnimationStateManager(t),t}}class Rw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new vw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:mw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new fw}createTicker(t){return new bw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new kw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function Ow(){G(Bp,Lw),G(Bp,Rw)}class Iw extends pw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Dw extends Iw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Fw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new kw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function zw(t){return new Fw(t)}class jw extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Hw=1e3,Vw="quadInOut",Nw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Uw=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=pp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Ww=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?uy(t):[],n=uy(e);i&&s&&(i.fromTransform&&py(s,i.fromTransform.clone().getInverse()),py(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Yw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Xw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Yw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?dp.Get(t,cp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class $w extends Iw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Ww(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Uw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Kw=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Gw(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Xw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new $w({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Hw,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Vw);return c.play(d),c};class qw extends Iw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Ww(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&Uw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Zw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Nw.includes(t))(i)||(e[i]=t[i])})),e},Jw=(t,e,i)=>{const s=Zw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=Ao.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Qw=(t,e,i)=>{const s=[],n=i?null:Zw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Zw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Rg(t.attribute),n=fy(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Ao.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=fy(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(Ao.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=fy(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(Ao.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return my(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return my(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ao.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:vy(i)}];const s=[];return yy(i,e,s),s})(t,e).forEach((t=>{s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return yy(l,e,h),h})(t,e).forEach((t=>{s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=uy(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(Ao.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Jw(t,s,e),s};class eC extends Iw{constructor(t,e,i,s,n){super(null,{},i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){super.onBind(),this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:qo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:qo.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:qo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class iC extends eC{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=Ao.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class sC extends eC{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Ao.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class nC extends Iw{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=_t(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=ed(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class oC extends rC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class lC extends aC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const hC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class cC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class dC extends cC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=hC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class uC extends cC{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class pC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class gC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const fC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class mC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=fC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class vC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const _C=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class yC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>ed(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class bC extends yC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:_C(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class xC extends yC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:_C(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const SC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class AC extends yC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:SC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class kC extends yC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:SC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const MC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class TC extends yC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:MC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class wC extends yC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:MC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const CC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class EC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class BC extends EC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=CC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class PC extends EC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const LC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class RC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=LC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class OC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class IC extends Dw{onBind(){var t;const e=zw(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class DC extends Dw{onBind(){const t=zw(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function FC(){Kk(),Qk(),oM(),pM(),kw.registerBuiltInAnimate("axisEnter",IC),kw.registerBuiltInAnimate("axisUpdate",DC)}var zC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=pf.group({zIndex:999});e.name=CT.axisBreak,e.id=this._getNodeId(`${CT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},LT,s),a=null!==(e=r.size)&&void 0!==e?e:LT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=pf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=CT.axisBreakSymbol;const h=pf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=CT.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=pf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=CT.background,n.id=this._getNodeId("background"),n.states=j({},BT,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new tT(Object.assign({},t));e.name=CT.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=zC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:j({},BT,l),symbol:j({},BT,l)});const d=new TT(c);d.name=CT.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=zC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+L(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let T,w,{angle:C}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(C)&&o){C=NM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else T=this.getTextAlign(M),w=this.getTextBaseline(M,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(C!==Math.PI/2){const t=Math.abs(Math.cos(null!=C?C:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(C&&0!==C){const t=Math.abs(Math.sin(C));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:w},a),state:{text:j({},BT,c.text),shape:j({},BT,c.shape),panel:j({},BT,c.background)}});return B.angle=C,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=zC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(u(b)&&a){b=NM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return iw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return sw(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),tw(i,t),!QT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=IT(a),l=OT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=rw(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Xt(c,i))}}else{if(l){const i=rw(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Xt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);nw(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&JT(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=pf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=CT.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=WM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ai(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}jC.defaultAttributes=PT,G(jC,aw);class HC{isInValidValue(t){const{startAngle:e=fM,endAngle:i=mM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=fM,endAngle:i=mM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return zT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function VC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=VC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var WC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=jT(n,l,c,e,i);h=pf.path(Object.assign(Object.assign({},a.style),{path:HT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=pf.circle(t)}h.name=CT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},BT,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=WC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:j({},BT,d.text),shape:j({},BT,d.shape),panel:j({},BT,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=VC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&NC(e,c,i)}else e.AABBBounds.width()>r&&NC(e,r,i)}else o>a.x&&h.x2>n.x2?(NC(e,n.x2-o,i),r&&UC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}GC.defaultAttributes=PT,G(GC,HC);const YC=t=>t.map(((t,e)=>({index:e,value:t}))),XC=(t,e,i=0)=>{const s=new Ne(t).expand(i/2),n=new Ne(e).expand(i/2);return s.intersects(n)},$C=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=UM(a),_=t.range();let y=[];for(let i=0;i{ZC[t]=!0}));const iE=t=>-Math.log(-t),sE=t=>-Math.exp(-t),nE=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,rE=t=>10===t?nE:t===Math.E?Math.exp:e=>Math.pow(t,e),aE=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),oE=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),lE=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function hE(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 cE(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function dE(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function uE(t,e,i,s){return 1===i&&(i=0),dE(t,i,s)*(e/(1-i))}function pE(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function gE(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class mE{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=pE(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=_t(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const vE=Symbol("implicit");class _E extends mE{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=qC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=vE}clone(){const t=(new _E).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==vE)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return yE(t,e,r,n)}class xE extends _E{constructor(t){super(),this.type=qC.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=uE(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:bE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return bE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new xE(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:SE}=ri;function AE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=ii.parseColorString(e)){const e=SE(ii.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof si?SE(t,e):e instanceof ii?SE(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class kE extends mE{constructor(t=eE,e=eE){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=eE,this._piecewise=cE,this._interpolate=AE}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Mt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=bt(i[0],i[r-1])),this._piecewise=r>2?gE:cE,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:eE),this.rescale(i)):this._clamp!==eE}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const ME=Math.sqrt(50),TE=Math.sqrt(10),wE=Math.sqrt(2),CE=[1,2,5,10],EE=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=RE(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?PE(0,-(e-1)/s,s):PE((e-1)/s,0,s)},BE=vt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return EE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return EE(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=PE(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=PE(t,e,l);return n&&r.reverse(),r})),RE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=CE[0];return i>=ME?s=CE[3]:i>=TE?s=CE[2]:i>=wE&&(s=CE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function OE(t,e,i){const s=(e-t)/Math.max(0,i);return RE(s)}function IE(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=OE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function FE(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const zE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),jE=vt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),HE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=LE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?zE(t,e,n):zE(t,e,fE(n)),h=zE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),VE=vt(((t,e,i,s,n)=>IE(s(t),s(e),i).map((t=>fE(n(t))))));class NE extends kE{constructor(){super(...arguments),this.type=qC.Linear}clone(){var t;const e=new NE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return BE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=LE(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return IE(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function WE(t){return e=>-t(-e)}function GE(t=Number.EPSILON){return e=>Math.max(e,t)}class YE extends kE{constructor(){super(aE(10),rE(10)),this.type=qC.Log,this._limit=GE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new YE).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=aE(this._base),s=rE(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=WE(i),this._pows=WE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=iE,this.untransformer=sE):(this._logs=i,this._pows=s,this._limit=GE(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return eE}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return jE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return HE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return VE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return VE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(YE,UE);class XE extends NE{constructor(){super(oE(1),lE(1)),this.type=qC.Symlog,this._const=1}clone(){return(new XE).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=oE(t),this.untransformer=lE(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return jE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return HE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return VE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return VE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(XE,UE);class $E{constructor(){this.type=qC.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[lt(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 $E).domain(this._domain).range(this._range).unknown(this._unknown)}}function KE(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function qE(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!JC(t.type))return YC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return YC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=KE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=KE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=KE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=KC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=KC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?JE.greedy:JE.parity;for(;l.length>=3&&NT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;VT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),qE(t,l,a,(e=>VT(e,t,i))),qE(n,l,o,(e=>VT(e,n,i)||!(!a||e===t)&&VT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return YC(m)},JE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&VT(i,t,e)||(i=t,0))))}},QE=(t,e,i,s)=>{const n=KC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},tB=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,eB=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?YC([s[s.length-1]]):YC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(g),a=$(g);if(s.length<=f/n){const i=QE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=sB(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=QE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!tB(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?eB(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=UM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=FT(r,zT(s,r,e,n));return o=a,l=zT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(gt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return YC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=nB(t,i,e),r=K(s),l=$(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=aB(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return YC(c)},aB=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&XC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},oB=new Uint32Array(33),lB=new Uint32Array(33);lB[0]=0,oB[0]=~lB[0];for(let t=1;t<=32;++t)lB[t]=lB[t-1]<<1|1,oB[t]=~lB[t];function hB(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&oB[31&o]&lB[1+(31&l)])return!0}else{if(i[h]&oB[31&o])return!0;if(i[c]&lB[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,oB[31&o]&lB[1+(31&l)]);else for(s(h,oB[31&o]),s(c,lB[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,lB[31&a]|oB[1+(31&o)]);else for(n(l,lB[31&a]),n(h,oB[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function cB(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=_t(i,-o,t.width+l),d=_t(s,-o,t.width+l),u=_t(n,-a,t.height+h),p=_t(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function dB(t,e,i=!1){return i?cB(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function uB(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=dB(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=cB(t,r)),e.getRange(r)))}function pB(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return pB(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return pB(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return pB(t,e,n,s,h,c)}return!1}const fB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],mB=["top","inside-top","inside"];function vB(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const _B={mode:"same-time",duration:300,easing:"linear"};function yB(t){return 3===t||4===t}function bB(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const xB=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function SB(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}var AB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const TB=(t,e)=>Math.ceil(t)>Math.floor(e),wB=([t,e],[i,s])=>s>t&&e>i;function CB(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var EB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(_M.hover,!0),EM(this,(t=>{t===e||P(t.states)||t.addState(_M.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(EM(this,(t=>{P(t.states)||(t.removeState(_M.hoverReverse),t.removeState(_M.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void EM(this,(t=>{P(t.states)||(t.removeState(_M.selectedReverse),t.removeState(_M.selected))}));P(e.states)||(e.addState(_M.selected,!0),EM(this,(t=>{t===e||P(t.states)||t.addState(_M.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===qo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===qo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[SB(g,f,c,d,a,o),SB(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=pf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Wl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],h=o;if(!c(e)&&d(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?h.push(i):l.push(i)}))}d(r)?o=r(h,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(h).concat(l)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return XM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&TB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&TB(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(CB([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!wB([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(dB(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(dB(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(dB(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{PB[t]=e};var RB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}OB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const IB=()=>{LB("symbol",OB),LB("line-data",OB)};var DB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}FB.tag="rect-label",FB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var zB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};jB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const HB=()=>{LB("line",jB),LB("area",jB)};var VB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new NB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):yB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=yB(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=yB(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=yB(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?yB(t.quadrant)?"left":"right":yB(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(yB(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function YB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ae.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function XB(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=HT(t,!!n),o=HT(r,!!n);const h=ae.distancePP(s,l),c=ae.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=YB(e,t,!1,!!n),o=YB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=HT(t,!!n),o=HT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}GB.defaultAttributes={pickable:!1};class $B extends db{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&DT(this._innerView),this.removeAllChild(!0),this._innerView=pf.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return FT(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=j({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${CT.grid}-sub`:`${CT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=HT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=YB(t,o,!1,!!a)}const u=pf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:$B.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=HT(o,!!a),m=Ut(o[0].x-o[1].x),v=Ut(o[0].y-o[1].y),_=pf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*jt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:$B.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}$B.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},Kk(),eM();class KB extends $B{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},$B.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=fM,endAngle:r=mM}=this.attribute;i=jT(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=j({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}G(KB,aw);var qB,ZB,JB,QB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(tP,HC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(qB||(qB={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(ZB||(ZB={})),function(t){t.dataZoomChange="dataZoomChange"}(JB||(JB={}));const eP="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",iP={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:eP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:eP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},sP={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}},nP=0,rP=1,aP=2,oP=3,lP=4,hP=5,cP=5,dP=999,uP=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var pP=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:aP},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:aP},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:nP},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T;const{orient:w,middleHandlerStyle:C={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:L,end:R}=this._getState(),{position:O,width:I,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:O.x+L*I,y:O.y-t,width:(R-L)*I,height:t,zIndex:hP},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:O.x+(L+R)/2*I,y:O.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:hP},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+L*I,y:O.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},sP.horizontal),{zIndex:hP}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+R*I,y:O.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},sP.horizontal),{zIndex:hP}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+L*I-t/2,y:O.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:dP},sP.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+R*I-g/2,y:O.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:dP},sP.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===w?O.x-t:O.x+I,y:O.y+L*D,width:t,height:(R-L)*D,zIndex:hP},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===w?O.x-t/2:O.x+I+t/2,y:O.y+(L+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:hP},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+L*D,size:I,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},sP.vertical),{zIndex:hP}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+R*D,size:I,symbolType:null!==(M=B.symbolType)&&void 0!==M?M:"square",zIndex:hP},sP.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+I/2+t/2,y:O.y+L*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dP},sP.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+I/2+i/2,y:O.y+R*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dP},sP.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:oP},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:oP},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:rP},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:lP},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ve).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=pP(c,["formatMethod"]),{formatMethod:g}=d,f=pP(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:uP(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},w={textAlign:uP(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:uP(A,t,"start",this._isHorizontal)?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:uP(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:cP}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:cP}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new tT(e),s.name=i,t.add(s)),s}}const fP={debounce:St,throttle:At};class mP extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=qB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=qB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=qB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=qB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=qB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===I_.env?I_:this.stage,s=SM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===qB.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===qB.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===qB.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===qB.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(ZB.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(ZB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(ZB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===qB.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(ZB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(ZB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:fP[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===I_.env?I_:this.stage,e=SM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===I_.env?I_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===I_.env?I_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:_t(e+t,0,1),end:_t(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=qB.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}JM(),rM(),dM(),Uk(),Qk();let vP=class t extends db{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new gP(this._getRendererAttrs()),this._interaction=new mP(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(ZB.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(ZB.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(JB.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(ZB.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(JB.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var _P,yP,bP,xP;function SP(){Kk(),JM(),Ow()}vP.defaultAttributes=iP,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(_P||(_P={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(yP||(yP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(bP||(bP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(xP||(xP={}));class AP extends db{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=UT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=WT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=GT(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=pf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=pf.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=pf.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function kP(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function MP(t,e,i,s){t&&(kP(t.startSymbol,e,i,s),t.lines.forEach((t=>kP(t,e,i,s))),kP(t.line,e,i,s),kP(t.endSymbol,e,i,s))}function TP(t,e,i,s){t&&(kP(t.getTextShape(),e,i,s),kP(t.getBgRect(),e,i,s))}function wP(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function CP(t,e,i,s){t&&(wP(t.startSymbol,e,i,s),t.lines.forEach((t=>wP(t,e,i,s))),wP(t.line,e,i,s),wP(t.endSymbol,e,i,s))}function EP(t,e,i,s){t&&(wP(t.getTextShape(),e,i,s),wP(t.getBgRect(),e,i,s))}function BP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;kP(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),kP(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;kP(t.getTextShape(),e,l,n),kP(t.getBgRect(),e,l,n)}))}function PP(t,e,i,s,n){MP(t,s,i,n),Y(e).forEach((t=>{TP(t,s,i,n)}))}function LP(t,e,i,s,n){kP(t,s,i,n),Y(e).forEach((t=>{TP(t,s,i,n)}))}function RP(t,e,i,s,n){kP(t,s,i,n),Y(e).forEach((t=>{TP(t,s,i,n)}))}function OP(t,e,i,s,n,r){var a;MP(t,n,s,r),kP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?TP(i,n,s,r):kP(i,n,s,r)}function IP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;kP(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),kP(e,n+o+l,h,r),kP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(kP(i.getTextShape(),n+o+l+h+c,d,r),kP(i.getBgRect(),n+o+l+c,d,r)):kP(i,n+o+l+c,d,r)}function DP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?BP(t,e,s,r,a):"fadeIn"===i&&PP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?BP(t,e,s,n,a):"fadeIn"===i&&PP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){CP(t,s,i,n),Y(e).forEach((t=>{EP(t,s,i,n)}))}(t,e,i,s,n)}}function FP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&LP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&LP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wP(t,s,i,n),Y(e).forEach((t=>{EP(t,s,i,n)}))}(t,e,i,s,n)}}function zP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&RP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&RP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wP(t,s,i,n),Y(e).forEach((t=>{EP(t,s,i,n)}))}(t,e,i,s,n)}}function jP(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?OP(n,r,e,i,s,o):"callIn"===t&&IP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?OP(n,r,e,i,s,a):"callIn"===t&&IP(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;CP(t,n,s,r),wP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?EP(i,n,s,r):wP(i,n,s,r)}(n,r,e,t,i,s)}}const HP={type:"clipIn",duration:500,easing:"linear",delay:0},VP={type:"fadeIn",duration:500,easing:"linear",delay:0},NP={type:"callIn",duration:500,easing:"linear",delay:0},UP={type:"fadeOut",duration:500,easing:"linear",delay:0};class WP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new tT(Object.assign(Object.assign({},h),{state:{panel:j({},yM,null!==(o=a[n])&&void 0!==o?o:X(a)),text:j({},yM,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},yM,null!==(a=r[s])&&void 0!==a?a:X(r)),text:j({},yM,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class GP extends AP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=HP,this.defaultExitAnimation=UP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;ZM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(GP,WP);const YP=.001,XP={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:_P.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]}},$P={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},KP={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:bP.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},qP={interactive:!0,label:{position:yP.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}},ZP={interactive:!0,label:{autoRotate:!0,position:bP.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},JP={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},QP={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},tL={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function eL(){iL._animate=DP}SP(),kT(),Ow();class iL extends GP{markerAnimate(t){iL._animate&&this._animationConfig&&iL._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},iL.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(PM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return LM(Math.abs(e),Math.PI/2,YP)||LM(Math.abs(e),3*Math.PI/2,YP)?RM(i,e,t):PM(e)?$P.postiveXAxis[t]:$P.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new TT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},yM,null==a?void 0:a.line),startSymbol:j({},yM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},yM,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:j({},yM,null==a?void 0:a.line),startSymbol:j({},yM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},yM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",iL.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(iL.defaultAttributes.label)}}function sL(){nL._animate=FP}iL.defaultAttributes=XP,SP(),sM(),Ow();class nL extends AP{markerAnimate(t){nL._animate&&this._animationConfig&&nL._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},nL.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=VP,this.defaultExitAnimation=UP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},QP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;ZM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=pf.polygon(Object.assign({points:e},i));n.states=j({},yM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",nL.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},yM,null==i?void 0:i.area)),this._updateMarkLabels(nL.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}nL.defaultAttributes=qP,G(nL,WP),SP(),MT(),Ow();class rL extends GP{markerAnimate(t){rL._animate&&this._animationConfig&&rL._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},rL.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case bP.arcInnerStart:l=n;case bP.arcOuterStart:l=n;break;case bP.arcInnerEnd:l=r;case bP.arcOuterEnd:l=r;break;case bP.center:case bP.arcInnerMiddle:case bP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return JP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new wT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},yM,null==o?void 0:o.line),startSymbol:j({},yM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},yM,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},yM,null==o?void 0:o.line),startSymbol:j({},yM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},yM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",rL.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(rL.defaultAttributes.label)}}rL.defaultAttributes=KP,SP(),Vk(),Ow();class aL extends AP{markerAnimate(t){aL._animate&&this._animationConfig&&aL._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},aL.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=VP,this.defaultExitAnimation=UP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case bP.center:h=(s+n)/2,c=(r+a)/2;break;case bP.arcInnerStart:h=s,c=r;break;case bP.arcOuterStart:h=n,c=r;break;case bP.arcInnerEnd:h=s,c=a;break;case bP.arcOuterEnd:h=n,c=a;break;case bP.arcInnerMiddle:h=s,c=(r+a)/2;break;case bP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},JP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;ZM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=pf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},yM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",aL.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=j({},yM,null==o?void 0:o.area)),this._updateMarkLabels(aL.defaultAttributes.label)}isValidPoints(){return!0}}function oL(){lL._animate=jP}aL.defaultAttributes=ZP,G(aL,WP),SP(),kT(),MT(),dM(),Zk(),Qk(),Ow();class lL extends AP{markerAnimate(t){lL._animate&&this._animationConfig&&lL._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lL.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=NP,this.defaultExitAnimation=UP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return LM(Math.abs(s),Math.PI/2,YP)||LM(Math.abs(s),3*Math.PI/2,YP)?RM(t,s,n):PM(s)?tL.postiveXAxis[n]:tL.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=xP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},yM,null==p?void 0:p.textBackground),text:j({},yM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},yM,null==p?void 0:p.itemContent));const v=PM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=pf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},yM,null==s?void 0:s.itemContent)):"text"===n?o=new tT(Object.assign(Object.assign({},i),{state:{panel:j({},yM,null==s?void 0:s.textBackground),text:j({},yM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=pf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},yM,null==s?void 0:s.itemContent)):"image"===n?(o=pf.image(Object.assign(Object.assign({},i),r)),o.states=j({},yM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},yM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=LM(c,0,YP)||LM(d,0,YP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=KM(e-u,t-d),o=KM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(vL.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(vL.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===vL.focus||"focus"===o){const s=a.hasState(fL.focus);a.toggleState(fL.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[fL.unSelected,fL.unSelectedHover,fL.focus],t),this._setLegendItemState(e,fL.selected,t)})):(this._setLegendItemState(a,fL.selected,t),this._removeLegendItemState(a,[fL.unSelected,fL.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[fL.selected,fL.selectedHover,fL.focus],t),this._setLegendItemState(e,fL.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(fL.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(fL.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(mL.legendItemClick,a,t);i?(this._removeLegendItemState(a,[fL.selected,fL.selectedHover],t),this._setLegendItemState(a,fL.unSelected,t)):(this._setLegendItemState(a,fL.selected,t),this._removeLegendItemState(a,[fL.unSelected,fL.unSelectedHover],t))}else this._setLegendItemState(a,fL.selected,t),this._removeLegendItemState(a,[fL.unSelected,fL.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[fL.selected,fL.selectedHover],t),this._setLegendItemState(e,fL.unSelected,t))}))}this._dispatchLegendEvent(mL.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,fL.selected),this._removeLegendItemState(e,[fL.unSelected,fL.unSelectedHover])):(this._removeLegendItemState(e,[fL.selected,fL.selectedHover]),this._setLegendItemState(e,fL.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=uL,spaceRow:l=pL,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=pf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ai(c);let w;!1===x.visible?(w=pf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,vL.item,t,w)):(w=pf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,vL.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?fL.selected:fL.unSelected);const C=pf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=pf.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,vL.itemShape,t,w,S.state),s.addState(e?fL.selected:fL.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=pf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,vL.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=XM(Object.assign(Object.assign({x:P/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,vL.itemLabel,t,w,A.state),D.addState(e?fL.selected:fL.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=XM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,vL.itemValue,t,w,k.state),r.addState(e?fL.selected:fL.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new dL(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new dL(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new kM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new kM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=uL,spaceRow:o=pL}=n,l=this._itemsContainer,{space:h=gL,defaultCurrent:c=1}=r,d=xL(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=pf.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=uL,spaceRow:a=pL}=s,o=this._itemsContainer,{space:l=gL,defaultCurrent:h=1}=n,c=xL(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=pf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=pf.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(_t(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(_t(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(fL.selected)?this._setLegendItemState(t,fL.selectedHover,e):this._setLegendItemState(t,fL.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===vL.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(mL.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(fL.unSelectedHover)||t.hasState(fL.selectedHover))&&(i=!0),t.removeState(fL.unSelectedHover),t.removeState(fL.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(fL.unSelectedHover)&&!t.hasState(fL.selectedHover)||(i=!0),t.removeState(fL.unSelectedHover),t.removeState(fL.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===vL.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(mL.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(mL.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==vL.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(mL.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==vL.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(mL.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(fL.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},SL,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(fL.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var kL;function ML(t){return y(t)?t:[t,t]}function TL(t){return t?"ew-resize":"ns-resize"}AL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:uL,spaceRow:pL,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:gL,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"}(kL||(kL={})),yL();class wL extends db{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},wL.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=_t(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=SM(),n="browser"===I_.env?I_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=_t(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=SM(),n="browser"===I_.env?I_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?_t(t+p,h,c):_t(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?_t(t+p,0,c-h):_t(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:ML(d)[0],endValue:ML(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=pf.group({x:0,y:0});f.name=kL.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=pf.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=kL.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=pf.group({x:g?v:0,y:g?0:v});f.add(_);const y=pf.group({x:0,y:0});let b;if(y.name=kL.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=pf.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=kL.endText,f.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=pf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=kL.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=ML(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":TL(p)},r));if(v.name=kL.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=kL.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":TL(p)},r));if(i.name=kL.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=kL.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=yt(h,i,s);c=t[0],d=t[1]}else c=i,d=_t(h,i,s);const p=this._isHorizontal;e||(c=i);const f=pf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=kL.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":TL(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=pf.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=kL.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return pf.symbol(t)}_renderHandlerText(t,e){return pf.text(this._getHandlerTextAttributes(t,e))}_getHandlerPosition(t){return this.attribute.range&&t?"start":"end"}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":TL(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=pf.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=pf.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===I_.env?I_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=SM(),e="browser"===I_.env?I_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const n=t.name===kL.startHandler?this._startHandlerText:this._endHandlerText;if(n){const e=this._getHandlerPosition(t.name===kL.startHandler);n.setAttributes(this._getHandlerTextAttributes(i,e))}t.name===kL.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){const s=this._isHorizontal,n=this._getHandlerPosition(t.name===kL.startHandlerText);t.setAttributes(this._getHandlerTextAttributes(i,n));const r=t.name===kL.startHandlerText?this._startHandler:this._endHandler;r&&r.setAttributes({[s?"x":"y"]:e}),t.name===kL.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===I_.env?I_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}wL.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},bL(),yL();class CL extends _L{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},CL.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function EL(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}CL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},bL(),yL(),eM();class BL extends _L{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},BL.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=pf.group({x:0,y:0});this._innerView.add(x);const S=new wL({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:EL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=pf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}BL.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)"}},Kk(),pM(),oM();let PL=class t extends db{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ai(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},bM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},bM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};PL.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 LL={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"}}};Kk(),pM(),oM();let RL=class extends db{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(LL,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=XM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=WM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class OL extends Cg{constructor(t){super(t)}}var IL,DL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(IL||(IL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(DL||(DL={}));class FL extends db{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FL.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"},FL.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"},FL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},FL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},FL.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new OL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new OL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new OL(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(IL.OnPlay)},this.pause=()=>{this._dispatchEvent(IL.OnPause)},this.forward=()=>{this._dispatchEvent(IL.OnForward)},this.backward=()=>{this._dispatchEvent(IL.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}FL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},FL.defaultAttributes={[DL.Start]:{},[DL.Pause]:{},[DL.Backward]:{},[DL.Forward]:{}};const zL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},jL=[200,10];var HL,VL;!function(t){t.Default="default",t.Reverse="reverse"}(HL||(HL={})),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"}(VL||(VL={}));const NL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===HL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===HL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),UL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===HL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===HL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),WL=t=>"top"===t||"bottom"===t;class GL extends db{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},GL.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Yt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(WL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:jL[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:jL[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new wL(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=WL(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new FL(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=WL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:jL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(WL(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:WL(this._orient)?t+s:(this._size.width-r)/2,y:WL(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:WL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:WL(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:WL(this._orient)?t+s:(this._size.width-r)/2,y:WL(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function YL(){yL(),Kk(),dM()}GL.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({},zL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},zL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},zL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},zL),{key:"backward",position:"start"})}},YL();class XL extends GL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:HL.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(IL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(IL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(IL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(IL.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(VL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(NL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||UL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===HL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(VL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=I_.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(VL.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(VL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=I_.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(),I_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(VL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,I_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(VL.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(VL.change),this.dispatchCustomEvent(VL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var $L,KL=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};YL();class qL extends GL{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(IL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(IL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(IL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(IL.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(VL.change))},this.play=()=>KL(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(VL.play),this._rafId=I_.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=I_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,I_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(VL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,I_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(VL.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(VL.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(VL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}($L||($L={}));const ZL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},JL=5;const QL={debounce:St,throttle:At};Kk(),sM();let tR=class t extends db{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=ZL.updateTrigger,endTrigger:i=ZL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:QL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($L.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=ZL.trigger,resetTrigger:e=ZL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent($L.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent($L.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=JL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent($L.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent($L.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent($L.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=JL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($L.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($L.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=ZL.updateTrigger,endTrigger:e=ZL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=pf.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Le(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};tR.defaultAttributes=ZL;const eR=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},iR=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},sR={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:vM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:vM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:vM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ne).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},nR=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];Kk(),rM(),dM(),pM(),oM();let rR=class t extends db{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ai(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",j({symbolType:"circle"},u.shape,{visible:BM(u)&&BM(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},iR(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:BM(u)&&BM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},iR(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},bM),u.value),visible:BM(u)&&BM(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=BM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=BM(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!BM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(BM(n.key)?r+n.key.spacing:0)+(BM(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&($M(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:BM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),$M(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(BM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=ad(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(BM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},iR(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},iR(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},bM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(BM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},iR(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},iR(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>nR.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&BM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=BM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=UM(d),_=UM(u);let y=0;if(BM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(BM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&cu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return eR({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return eR({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};rR.defaultAttributes=sR;const aR=gt;function oR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function lR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function hR(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function cR(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function dR(t,e){const i=cR(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function uR(t,e){const i=pR(t),s=pR(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function pR(t,e={x:0,y:0}){return ae.distancePP(t,e)}function gR(t){return k(t.x)&&k(t.y)}function fR(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function mR(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const vR=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function yR(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&yR(t[i],e)}}var bR,xR,SR;function AR(t){var e,i;const{type:s}=t;return s===xR.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(bR||(bR={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(xR||(xR={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(SR||(SR={}));const kR={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},MR={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function TR(t,e){var i;if(!t)return[];const s=RR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?PR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>BR(i)?CR(t,i,e):i)).filter(p)}))):i.map((i=>BR(i)?CR(t,i,e):i)).filter(p):[]}return[]}function wR(t,e){var i,s;return PR(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function CR(t,e,i){var s;const n=RR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=kR[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=MR[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new ii(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Xe(t,i,s),a=Ye(n,r,e.l),l=new ii(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const ER=(t,e)=>{if(e&&BR(t)){const i=CR(e,t);if(i)return i}return t};function BR(t){return t&&"palette"===t.type&&!!t.key}function PR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function LR(t){return y(t)?{dataScheme:t}:t}function RR(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=AR(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class OR extends _E{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(!PR(this._range))return void super.range(this._range);const t=wR(this._range,this._domain);super.range(t)}}const IR={linear:NE,band:xE,point:class extends xE{constructor(t){super(!1),this.type=qC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:_E,threshold:$E,colorOrdinal:OR};function DR(t){const e=IR[t];return e?new e:null}function FR(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function zR(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function jR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function HR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function VR(t){return!!_(t)&&(!!t.endsWith("%")&&lb(t.substring(0,t.length-1)))}function NR(t){return!!g(t)&&("percent"in t||"offset"in t)}function UR(t,e,i,s=0){var n,r;return S(t)?t:VR(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function WR(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=UR(t[s],e.size,i)}))})),o}function GR(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function YR(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||VR(t)||d(t)||NR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function XR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const $R=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},KR=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function qR(t,e){return t&&e.key in t?t[e.key]:e.default}function ZR(t){return t&&"token"===t.type&&!!t.key}const JR={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},QR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:KR,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:JR,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},tO={name:"dark",colorScheme:{default:{dataScheme:KR,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},eO=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),eO(t[s],e.slice(1),i))};function iO(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=LR(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}sO._charts={},sO._series={},sO._components={},sO._graphicComponents={},sO._marks={},sO._regions={},sO._animations={},sO._implements={},sO._chartPlugin={},sO._vChartPlugin={},sO._componentPlugin={},sO.transforms={fields:Xr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},sO.dataParser={csv:(t,e={},i)=>(i.type=Yr.DSV,na(t)),dsv:(t,e={},i)=>{i.type=Yr.DSV;const s=Vr(aa,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return sa(n).parse(t)},tsv:(t,e={},i)=>(i.type=Yr.DSV,ra(t))},sO._layout={},sO._grammarTransforms={},sO._stageEventPlugins={},sO.registerStageEventPlugin=(t,e)=>{sO._stageEventPlugins[t]=e},sO.getStageEventPlugin=t=>sO._stageEventPlugins[t],sO._interactionTriggers={},sO.registerInteractionTrigger=(t,e)=>{sO._interactionTriggers[t]=e},sO._composedEventMap={},sO.registerComposedEvent=(t,e)=>{sO._composedEventMap[t]=e},sO._tooltipProcessors={},sO.registerTooltipProcessor=(t,e)=>{sO._tooltipProcessors[t]=e},sO.createTooltipProcessor=(t,e)=>{const i=sO._tooltipProcessors[t];return i?new i(e):null};const aO=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},oO=aO(),lO={[QR.name]:QR},hO=QR.name,cO=new Map(Object.keys(lO).map((t=>[t,lO[t]]))),dO=new Map,uO=new Map(Object.keys(lO).map((t=>[t,t===hO]))),pO=(t,e)=>{if(!t)return;const i=vO(e);cO.set(t,i),uO.set(t,!0)},gO=(t=hO)=>(uO.has(t)&&!uO.get(t)&&pO(t,cO.get(t)),cO.get(t)),fO=t=>cO.delete(t)&&dO.delete(t)&&uO.delete(t),mO=t=>!!_(t)&&cO.has(t),vO=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:hO;return nO({},gO(i),t)};class _O{static registerInstance(t){_O.instances.set(t.id,t)}static unregisterInstance(t){_O.instances.delete(t.id)}static getInstance(t){return _O.instances.get(t)}static instanceExist(t){return _O.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return _O.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}_O.instances=new Map;class yO{static registerTheme(t,e){pO(t,e)}static getTheme(t,e=!1){return gO(t)}static removeTheme(t){return fO(t)}static themeExist(t){return mO(t)}static getDefaultTheme(){return yO.themes.get(hO)}static setCurrentTheme(t){yO.themeExist(t)&&(yO._currentThemeName=t,_O.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return yO.getTheme(yO._currentThemeName,t)}static getCurrentThemeName(){return yO._currentThemeName}}function bO(t){return _(t)?yO.themeExist(t)?yO.getTheme(t):{}:g(t)?t:{}}yO.themes=cO,yO._currentThemeName=hO;const xO=["animationThreshold","colorScheme","name","padding"];function SO(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];xO.includes(n)?s[n]=r:m(r)?BR(r)?s[n]=ER(r,e):ZR(r)?s[n]=qR(i,r):s[n]=SO(r,e,i):s[n]=r})),s}function AO(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=AO(t[s],e)}return i}return y(t)?t.map((t=>AO(t,e))):t}function kO(t,e){if(!t)return t;if(m(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=kO(t[s],e)}return i}return y(t)?t.map((t=>kO(t,e))):t}function MO(t,...e){return d(t)?t(...e):t}const TO=(t,e,i,s)=>((t,e,i)=>UM(t,e,i,{fontFamily:JR.fontFamily,fontSize:JR.fontSize}))(e,i,s).measure(t),wO="__VCHART",CO=500,EO=500,BO=`${wO}_MEASURE_CANVAS_ID`,PO=`${wO}_DEFAULT_DATA_INDEX`,LO=`${wO}_DEFAULT_DATA_KEY`,RO=`${wO}_DEFAULT_DATA_SERIES_FIELD`,OO=`${wO}_DEFAULT_SERIES_STYLE_NAME`,IO=`${wO}_STACK_KEY`,DO=`${wO}_STACK_START`,FO=`${wO}_STACK_END`,zO=`${wO}_STACK_START_PERCENT`,jO=`${wO}_STACK_END_PERCENT`,HO=`${wO}_STACK_START_OffsetSilhouette`,VO=`${wO}_STACK_END_OffsetSilhouette`,NO=`${wO}_STACK_TOTAL`,UO=`${wO}_STACK_TOTAL_PERCENT`,WO=`${wO}_STACK_TOTAL_TOP`,GO=`${wO}_STACK_TOTAL_BOTTOM`,YO=`${wO}_MOSAIC_VALUE_START_PERCENT`,XO=`${wO}_MOSAIC_VALUE_END_PERCENT`,$O=`${wO}_MOSAIC_CAT_START_PERCENT`,KO=`${wO}_MOSAIC_CAT_END_PERCENT`,qO=`${wO}_SEGMENT_START`,ZO=`${wO}_SEGMENT_END`,JO=`${wO}_KEY`,QO=`${wO}_MAP_LOOK_UP_KEY`;function tI(t,e){for(let i=0;it.key===e))}function iI(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function sI(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},lI(t,a,n[o],l,e,r))})),s?nI(n):n}function nI(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):nI(t[e].nodes);return t}function rI(t,e){if("values"in t&&t.values.length){const i=hR(t.values,e),s=lR(t.values,jO);t.values.forEach((t=>{t[NO]=i,t[UO]=s}))}else for(const i in t.nodes)rI(t.nodes[i],e)}function aI(t){if(!t.values.length)return;const e=t.values[t.values.length-1][FO]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)oI(t.nodes[r],e,i,s,n)}function lI(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[FO]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),lI(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const hI=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=dI(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function uI(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>fI(t.style(e,i,s,n)):P(t.style)||(e.style=fI(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>fI(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=fI(t.state[e]))})),e.state=i}return e}function pI(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>fI(t[i](e,s,n,r)):P(t[i])||(e[i]=fI(t[i]))})),e}function gI(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),fI(i)}function fI(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const mI=t=>"line"===t||"area"===t,vI=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return mI(i)?e:null==e?void 0:e[0]},_I=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let yI=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=sO.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(sO.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var bI;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(bI||(bI={}));const xI=["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 SI,AI,kI;t.ChartEvent=void 0,(SI=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",SI.rendered="rendered",SI.renderFinished="renderFinished",SI.animationFinished="animationFinished",SI.regionSeriesDataFilterOver="regionSeriesDataFilterOver",SI.afterInitData="afterInitData",SI.afterInitEvent="afterInitEvent",SI.afterInitMark="afterInitMark",SI.rawDataUpdate="rawDataUpdate",SI.viewDataFilterOver="viewDataFilterOver",SI.viewDataUpdate="viewDataUpdate",SI.viewDataStatisticsUpdate="viewDataStatisticsUpdate",SI.markDeltaYUpdate="markDeltaYUpdate",SI.viewDataLabelUpdate="viewDataLabelUpdate",SI.scaleDomainUpdate="scaleDomainUpdate",SI.scaleRawDomainUpdate="scaleRawDomainUpdate",SI.scaleUpdate="scaleUpdate",SI.dataZoomChange="dataZoomChange",SI.drill="drill",SI.layoutStart="layoutStart",SI.layoutEnd="layoutEnd",SI.layoutRectUpdate="layoutRectUpdate",SI.playerPlay="playerPlay",SI.playerPause="playerPause",SI.playerEnd="playerEnd",SI.playerChange="playerChange",SI.playerForward="playerForward",SI.playerBackward="playerBackward",SI.scrollBarChange="scrollBarChange",SI.brushStart="brushStart",SI.brushChange="brushChange",SI.brushEnd="brushEnd",SI.brushClear="brushClear",SI.brushActive="brushActive",SI.legendSelectedDataChange="legendSelectedDataChange",SI.legendFilter="legendFilter",SI.legendItemClick="legendItemClick",SI.legendItemHover="legendItemHover",SI.legendItemUnHover="legendItemUnHover",SI.tooltipShow="tooltipShow",SI.tooltipHide="tooltipHide",SI.tooltipRelease="tooltipRelease",SI.afterResize="afterResize",SI.afterRender="afterRender",SI.afterLayout="afterLayout",SI.afterMarkLayoutEnd="afterMarkLayoutEnd",SI.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(AI||(AI={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(kI||(kI={}));const MI=[kI.mark,kI.model,kI.chart,kI.vchart];class TI{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(kI.vchart,[]),this._levelNodes.set(kI.chart,[]),this._levelNodes.set(kI.model,[]),this._levelNodes.set(kI.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const wI={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class CI{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>vI(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||AI.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||AI.chart);o.get(t)||o.set(t,new TI);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||AI.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||AI.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||AI.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||AI.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?MI.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[AI.chart,AI.window,AI.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&L(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return wI[a]&&(a=wI[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?kI.model:kI.vchart:kI.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=AI.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==kI.model&&s!==kI.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=kI.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case AI.chart:return this._viewBubbles;case AI.window:return this._windowBubbles;case AI.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case AI.chart:return this._viewListeners;case AI.window:return this._windowListeners;case AI.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return xI.includes(t)||Object.values(bI).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&sO.hasInteractionTrigger(e)}}function EI(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function BI(t,e,i){t.getParser(e)||t.registerParser(e,i)}const PI=new Map;let LI;function RI(){LI||(LI=new Ba,BI(LI,"geojson",ka),BI(LI,"topojson",Ta),EI(LI,"simplify",Gr))}function OI(t,e,i={type:"geojson",centroid:!0}){PI.has(t)&&Jy(`map type of '${t}' already exists, will be overwritten.`),RI();const s=new Pa(LI),n=j({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),PI.set(t,s)}function II(t){PI.has(t)?PI.delete(t):Jy(`map type of '${t}' does not exists.`)}function DI(t,e=!1){let i=e;return t.latestData instanceof Pa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const FI=(t,e)=>0===t.length?[]:1===t.length?DI(t[0],null==e?void 0:e.deep):t.map((t=>DI(t,null==e?void 0:e.deep)));function zI(e,i,s){EI(i=i instanceof Ba?i:e.dataSet,"copyDataView",FI);const n=new Pa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function jI(t,e,i=[]){var s;if(t instanceof Pa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Pa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Jy(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Jy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Jy("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function HI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var VI,NI,UI,WI;t.TransformLevel=void 0,(VI=t.TransformLevel||(t.TransformLevel={}))[VI.copyDataView=-10]="copyDataView",VI[VI.treemapFilter=-8]="treemapFilter",VI[VI.treemapFlatten=-7]="treemapFlatten",VI[VI.dotObjFlat=-7]="dotObjFlat",VI[VI.linkDotInfo=-7]="linkDotInfo",VI[VI.sankeyLayout=-7]="sankeyLayout",VI[VI.dataZoomFilter=-6]="dataZoomFilter",VI[VI.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(NI||(NI={})),function(t){t.data="data",t.mark="mark"}(UI||(UI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(WI||(WI={}));const GI=["line","area","trail"];function YI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(JO,i?t.slice().sort(i):t.slice()),{keys:[JO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const XI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function $I(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{$I(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function qI(t,e,i,s){const n=YI(t,(t=>i(t))),r=YI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const ZI=`${wO}_BuiltIn_CallBack_Disappear`;var JI;!function(t){t.render="render",t.disappear="disappear"}(JI||(JI={}));class QI{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;I_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new K_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Rp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:nb(o))&&!1!==c&&sO.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=WI.before}_setCanvasStyle(){if(this._stage&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(I_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=I_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>$I(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>$I(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{$I(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Zy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===WI.before&&(this._layoutState=WI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=WI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),Zy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=KI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=qI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=qI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=YI(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=YI(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:ZI,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{$I(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===NI.appear))?NI.appear:e.every((t=>t===NI.disappear))?NI.disappear:NI.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===AI.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:vI(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===AI.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===AI.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===AI.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===AI.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===AI.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{$I(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=KI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return sb(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return Su(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ao.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{$I(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=I_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){I_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function tD(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:Qy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function eD(t){t.crosshair=Y(t.crosshair||{}).map((e=>iO({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function iD(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=oi(l,i.width,i.height);a=t,o=e}else if(h&&sb(e.mode)){let t;t=_(h)?I_.getElementById(h):h;const{width:e,height:s}=oi(t,i.width,i.height);a=e,o=s}else if(rb(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function sD(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function nD(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var rD,aD,oD,lD,hD,cD;t.LayoutZIndex=void 0,(rD=t.LayoutZIndex||(t.LayoutZIndex={}))[rD.SeriesGroup=0]="SeriesGroup",rD[rD.Axis_Grid=50]="Axis_Grid",rD[rD.CrossHair_Grid=100]="CrossHair_Grid",rD[rD.Region=450]="Region",rD[rD.Mark=300]="Mark",rD[rD.Node=400]="Node",rD[rD.Axis=100]="Axis",rD[rD.MarkLine=500]="MarkLine",rD[rD.MarkArea=100]="MarkArea",rD[rD.MarkPoint=500]="MarkPoint",rD[rD.DataZoom=500]="DataZoom",rD[rD.ScrollBar=500]="ScrollBar",rD[rD.Player=500]="Player",rD[rD.Legend=500]="Legend",rD[rD.CrossHair=500]="CrossHair",rD[rD.Indicator=500]="Indicator",rD[rD.Title=500]="Title",rD[rD.Label=500]="Label",rD[rD.Brush=500]="Brush",rD[rD.CustomMark=500]="CustomMark",rD[rD.Interaction=700]="Interaction",t.LayoutLevel=void 0,(aD=t.LayoutLevel||(t.LayoutLevel={}))[aD.Indicator=10]="Indicator",aD[aD.Region=20]="Region",aD[aD.Axis=30]="Axis",aD[aD.DataZoom=40]="DataZoom",aD[aD.Player=40]="Player",aD[aD.ScrollBar=40]="ScrollBar",aD[aD.Legend=50]="Legend",aD[aD.Title=70]="Title",aD[aD.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(oD=t.AttributeLevel||(t.AttributeLevel={}))[oD.Default=0]="Default",oD[oD.Theme=1]="Theme",oD[oD.Chart=2]="Chart",oD[oD.Base_Series=3]="Base_Series",oD[oD.Series=4]="Series",oD[oD.Mark=5]="Mark",oD[oD.User_Chart=6]="User_Chart",oD[oD.User_Series=7]="User_Series",oD[oD.User_Mark=8]="User_Mark",oD[oD.User_SeriesStyle=9]="User_SeriesStyle",oD[oD.Built_In=99]="Built_In";class dD{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,j({},dD.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}dD.defaultMarkInfo={};class uD{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class pD{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>iO({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class gD extends uD{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=pD,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new dD,this._lastLayoutRect=null,this.id=ob(),this.userId=t.id,this._spec=t,this.effect={},this.event=new yI(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${wO}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=sO.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return L(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class fD{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=WR(YR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:UR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:UR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:UR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:UR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:UR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:UR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=UR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=UR(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=UR(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(GR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class mD extends gD{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new fD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=j(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=j(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class vD extends pD{_initTheme(t,e){return{spec:t,theme:this._theme}}}class _D extends mD{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=vD,this.modelType="region",this.specKey="region",this.type=_D.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function yD(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function bD(t,e,i){e?t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function xD(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function SD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=TD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),xD(d,!0,p,l),s&&bD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function AD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=TD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=TD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),xD(d,!1,p,o),s&&bD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function MD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=TD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=TD(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=yD(t);n.length&&SD(n,e,i,!1,"left",s),r.length&&SD(r,e,i,!0,"left",s),a.length&&AD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=yD(t);n.length&&kD(n,e,i,!1,"top",s),r.length&&kD(r,e,i,!0,"top",s),a.length&&MD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=yD(t);n.length&&SD(n,e,i,!1,"right",s),r.length&&SD(r,e,i,!0,"right",s),a.length&&AD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=yD(t);n.length&&kD(n,e,i,!1,"bottom",s),r.length&&kD(r,e,i,!0,"bottom",s),a.length&&MD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=TD(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{U(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=TD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Qy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}wD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(lD||(lD={})),t.STATE_VALUE_ENUM=void 0,(hD=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",hD.STATE_HOVER="hover",hD.STATE_HOVER_REVERSE="hover_reverse",hD.STATE_DIMENSION_HOVER="dimension_hover",hD.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",hD.STATE_SELECTED="selected",hD.STATE_SELECTED_REVERSE="selected_reverse",hD.STATE_SANKEY_EMPHASIS="selected",hD.STATE_SANKEY_EMPHASIS_REVERSE="blur",hD.STATE_HIGHLIGHT="highlight",hD.STATE_BLUR="blur",hD.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(cD||(cD={}));const CD=["linear","radial","conical"],ED={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const BD={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{BD[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class PD extends uD{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class LD extends PD{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,GI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!BD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(wO)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(wO))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(JC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class RD extends uD{constructor(){super(...arguments),this.id=ob(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=sO.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class OD extends RD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const ID=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,DD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=ID(l.delay,n,a,o),d=ID(l.duration,n,a,o),u=ID(l.oneByOne,n,a,o),p=ID(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Qw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:tC)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Kw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Qw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:tC)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Gw(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Xw(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:qo.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new $w({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Hw,null!==(l=i.easing)&&void 0!==l?l:Vw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:qo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new qw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Hw,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Vw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Kw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},FD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},zD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class jD extends RD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new OD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Rp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Wl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==lD.enter&&t.context.diffState!==lD.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=e,this.model=i.model,this.key=i.key,this.state=new LD(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&iO(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(QC(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=DR(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):CD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):QC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=wR(TR(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},ED[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ii.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)CD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=wR(TR(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return YI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return sO.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[LO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=YI(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===NI.appear))?NI.appear:t.every((t=>t===NI.disappear))?NI.disappear:t[0];return null!=e?e:NI.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{zD(t),s.push(...t.getGraphics())})),e.forEach((t=>{zD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);DD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=FD(e,n),r=FD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===NI.exit?NI.exit:i===NI.update?NI.update:NI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===lD.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===lD.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=lD.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=lD.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=lD.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=NI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=NI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return XI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=XI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),u(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=_I(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=sO.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=sO.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===WI.before||(this._product||this._initProduct(),Zy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===lD.exit&&!e.isExiting)if(e.context.animationState===lD.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:lD.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Rp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{t.clearStates()}))}}var HD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(HD||(HD={}));class VD extends jD{constructor(){super(...arguments),this.type=VD.type,this._marks=[],this._diffState=lD.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Jy("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?(Jy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return $I(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===lD.update){const t=this.hasAnimation(),e=_I(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=lD.update}render(){this._isCommited&&(Zy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}VD.type="group";const ND={measureText:TO};class UD{static instance(){return UD.instance_||(UD.instance_=new UD),UD.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class WD{constructor(){this.id=ob(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Jy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class GD extends WD{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const YD={type:"fadeIn"};function XD(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return YD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const $D={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},KD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},qD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},ZD=()=>{sO.registerAnimation("scaleInOut",(()=>KD))},JD=()=>{sO.registerAnimation("fadeInOut",(()=>qD))},QD=(t,e)=>({appear:XD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:nC,duration:$D.update.duration,easing:$D.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),tF=()=>{sO.registerAnimation("line",QD)},eF=()=>{kw.registerBuiltInAnimate("growPointsIn",bC),kw.registerBuiltInAnimate("growPointsOut",xC),kw.registerBuiltInAnimate("growPointsXIn",AC),kw.registerBuiltInAnimate("growPointsXOut",kC),kw.registerBuiltInAnimate("growPointsYIn",TC),kw.registerBuiltInAnimate("growPointsYOut",wC),kw.registerBuiltInAnimate("clipIn",oC),kw.registerBuiltInAnimate("clipOut",lC)},iF=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class sF{constructor(t){this._markSet=new dD,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const nF={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class rF extends sF{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},nF,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}rF.type="element-highlight",rF.defaultOptions=nF;const aF=()=>{sO.registerInteractionTrigger(rF.type,rF)},oF={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class lF extends sF{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},oF,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}lF.type="element-select",lF.defaultOptions=oF;const hF=()=>{sO.registerInteractionTrigger(lF.type,lF)};class cF extends WD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class dF{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>sO.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>sO.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>sO.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return sO.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>sO.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){sO.registerTransform(t,e)}static registerFunction(t,e){t&&e&&UD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&UD.instance().unregisterFunction(t)}static getFunction(t){return t?UD.instance().getFunction(t):null}static getFunctionList(){return UD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=sO.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=sO.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,PI.get(e);var e}static registerSVG(t,e,i){const s=sO.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=sO.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){_O.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 ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=ob(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=JI.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=sD(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?sO.getSeriesBuiltInTheme(e):sO.getComponentBuiltInTheme(e);i=i?iO({},s,i[e]):s}s===t.length-1&&p(i)&&(i=SO({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},yR(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=sb(v);if(S?vx(xo):"node"===v&&_A(xo),S&&f&&(this._container=_(f)?I_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=yO.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new QI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new CI(this,this._compiler),this._event=new yI(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),_O.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=iO({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=AO(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;dF.getFunctionList()&&dF.getFunctionList().length&&(t=kO(t,dF)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=sO.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=sO.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=sO.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return iD(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:CO,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:EO})}_initDataSet(t){this._dataSet=t instanceof Ba?t:new Ba,BI(this._dataSet,"dataview",wa),BI(this._dataSet,"array",s),EI(this._dataSet,"copyDataView",FI);for(const t in sO.transforms)EI(this._dataSet,t,sO.transforms[t]);for(const t in sO.dataParser)BI(this._dataSet,t,sO.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(!0),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))):t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?NI.none:NI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,_O.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Pa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=jI(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?iO({},t[n][e.index],i):i):t[n]=s?iO({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?iO({},t[n][r],i):i)}else t.id===e&&(t[n]=s?iO({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=iO({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=nO({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=bO(this._currentThemeName),this._currentTheme=o(a,l);else{const t=nO({},bO(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),bO(n),bO(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(iT.poptip,eT,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!sb(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return bO(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!yO.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield tD(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!sb(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t,e,i;null===(t=this._chart)||void 0===t||t.resetLayoutItemTag(),null===(e=this._chart)||void 0===e||e.setLayoutTag(!0,null,!1),null===(i=this._compiler)||void 0===i||i.render()}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?I_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?XR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Jy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?XR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Jy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return UD.instance().getFunction(t)}registerFunction(t,e){t&&e&&UD.instance().registerFunction(t,e)}unregisterFunction(t){t&&UD.instance().unregisterFunction(t)}getFunctionList(){return UD.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=sO.getChartPlugins();t.length>0&&(this._chartPlugin=new GD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=sO.getVChartPlugins();e.length>0&&(this._vChartPlugin=new cF(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=JI.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;this._renderState=JI.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent()}}dF.InstanceManager=_O,dF.ThemeManager=yO,dF.globalConfig={uniqueTooltip:!0},dF.Utils=ND,dF.vglobal=I_;sO.registerRegion("region",_D),sO.registerLayout("base",wD),hM(),Kk(),sO.registerMark(VD.type,VD),sO.registerStageEventPlugin("gesture",Hb),aF(),hF(),pO(tO.name,tO);const uF="monotone",pF="linear",gF="bevel";function fF(t,e){return e("component",t)}function mF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=sO.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const vF=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},_F=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))},yF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},bF=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=mF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},xF=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const SF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function AF(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=MF(bF(h,r,a,c),d,g),o.value=MF(bF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=bF(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function kF(t,e,i,s,n,r,a){if(d(e)){AF(t,e(n,a),i,s,r,a)}else e&&AF(t,e,i,s,r,a)}const MF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=mi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class TF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{kF(a,t,e,i,s,n,r)})):d(t)?kF(a,t,e,i,s,n,r):t&&AF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:bF(r.visible,t,n),value:MF(bF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:bF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=bF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&SF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const wF={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?$(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?$(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},CF=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=tI([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return EF(a,n,o)},EF=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{lb(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{lb(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=wF[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},BF=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{lb(t[e])||(t[e]=0)}))})),t},PF=`${wO}_HIERARCHY_DEPTH`,LF=`${wO}_HIERARCHY_ROOT`,RF=`${wO}_HIERARCHY_ROOT_INDEX`;function OF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function IF(t,e,i){t&&(i.needDefaultSeriesField&&(t[RO]=i.defaultSeriesField),t[PO]=e,t[LO]=i.getKey(t,e,i))}function DF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function FF(t,e,i,s=0,n,r){void 0===r&&(r=e),IF(t,e,i),t[PF]=s,t[LF]=n||t[i.categoryField],t[RF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>FF(e,s,i,t[PF]+1,t[LF],r)))}const zF={label:{name:"label",type:"text"}},jF=`${wO}_rect_x`,HF=`${wO}_rect_x1`,VF=`${wO}_rect_y`,NF=`${wO}_rect_y1`,UF={data:!0},WF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},GF=[...Object.keys($D),"normal"];function YF(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return ZF(n)&&delete n.type,n.oneByOne&&(n=$F(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:KF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=iO({},o[e],a);return ZF(n)&&delete n.type,n.oneByOne&&(n=$F(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:KF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function XF(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),JF(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function $F(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function KF(t,e){var i;return null!==(i=null==t?void 0:t[PO])&&void 0!==i?i:e.context.graphicIndex}function qF(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function ZF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function JF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),JF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),JF(t[s],e,i))}function QF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class tz extends pD{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=AR(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=sO.getSeriesMarkMap(o)?function(t,e,i){const s=sO.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=iO({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return iO({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=iO({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>iO({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class ez extends gD{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${wO}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=tz,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=QF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(EI(this._rawData.dataSet,"invalidTravel",BF),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=jI(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=zI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=zI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new OD(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=$(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=EF(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){EI(this._dataSet,"dimensionStatistics",CF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Pa(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&tI(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){EI(this._dataSet,"dimensionStatistics",CF);const s=new Pa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=tI(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&tI(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Pa(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(EI(this._rawData.dataSet,"addVChartProperty",yF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:OF.bind(this),call:IF}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=YF({},XF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:nb(s)||rb(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=iO(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=iO(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=iF(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=iF(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=iF(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:RO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:OO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,OO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new TF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},UF),WF),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>WF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Pa||HI(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();QF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:RO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new OR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return TR(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:RO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,iO({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:LO}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==FO&&t!==jO&&t!==DO&&t!==zO||(t=this.getStackValueField()),null!==(e=iI(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>lb(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:RO]}}function iz(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();JC(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function sz(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}ez.mark=zF,ez.transformerConstructor=tz;class nz extends ez{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);JC(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${wO}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(FO),this.setFieldX2(DO)):(this.setFieldY(FO),this.setFieldY2(DO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(jO),this.setFieldX2(zO)):(this.setFieldY(jO),this.setFieldY2(zO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(VO),this.setFieldX2(HO)):(this.setFieldY(VO),this.setFieldY2(HO))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(iz("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function rz(t){return"bottom"===t||"top"===t}function az(t){return"left"===t||"right"===t}function oz(t){return"z"===t}function lz(t,e){return HR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function hz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function cz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?rz(t)?"linear":"band":rz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const dz=(t,e,i)=>{var s;const n=null!==(s="band"===e?fF("axisBand",i):["linear","log","symlog"].includes(e)?fF("axisLinear",i):{})&&void 0!==s?s:{},r=rz(t)?fF("axisX",i):az(t)?fF("axisY",i):fF("axisZ",i);return iO({},fF("axis",i),n,r)};class uz{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:Qy)("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:Qy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>tE(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return rz(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class pz extends uz{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:AI.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const gz=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},fz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},mz=(t,e,i,s)=>{var n;const r=e.getScale(),a=tE(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:vz(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,_z=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class yz extends uz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!gz(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:AI.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:AI.canvas}),callback:this.onMouseOut}),nb(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:AI.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),nb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var bz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(bz||(bz={}));const xz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class Sz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(xz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:gF,curveType:pF,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===uF?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(xz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:qF(this._spec,xz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Pa(this._option.dataSet,{name:`${wO}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(bz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[xz.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(bz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,iO({},this._spec[xz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Az=Object.assign(Object.assign({},zF),xz),kz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>kz(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},Mz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class Tz extends jD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return Mz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(QC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?kz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:lD.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[LO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class wz extends Tz{constructor(){super(...arguments),this.type=wz.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)===xR.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}wz.type="line";const Cz=()=>{sO.registerMark(wz.type,wz),hM(),Qk(),HB(),IB(),eF(),sO.registerGraphicComponent("line",Lg)};class Ez extends jD{constructor(){super(...arguments),this.type=Ez.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}Ez.type="symbol";const Bz=()=>{sO.registerMark(Ez.type,Ez),hM(),dM(),IB(),sO.registerGraphicComponent("symbol",Eg)};class Pz extends tz{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function Lz(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function Rz(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function Oz(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function Iz(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function Dz(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function Fz(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const zz=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return YC(v)};class jz{constructor(t){this.id=ob(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Hz extends jz{constructor(){super(Hz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!JC(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&Lz(c)&&Lz(d)))return;const u=Rz(t,c),p=Rz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!Iz(u,p))return}else if(0===y&&0===b){if(!Iz(p,u))return}else if(_||A)if(_&&!A){if(!Oz(u,p))return}else if(A&&!_){if(!Oz(p,u))return}else{if(f===b)return;if(f>b){if(!Dz(u,p))return}else if(!Dz(p,u))return}else{if(0===f&&0===y){if(!Fz(u,p))return}else if(0===b&&0===g&&!Fz(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){EI(e.getOption().dataSet,"tickAlign",zz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Hz.pluginType="component",Hz.type="AxisSyncPlugin";const Vz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Nz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function Uz(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function Wz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Gz=t=>"band"===t||"ordinal"===t||"point"===t;function Yz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Xz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class $z extends WD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const Kz=`${wO}_ARC_TRANSFORM_VALUE`,qz=`${wO}_ARC_RATIO`,Zz=`${wO}_ARC_START_ANGLE`,Jz=`${wO}_ARC_END_ANGLE`,Qz=`${wO}_ARC_K`,tj=`${wO}_ARC_MIDDLE_ANGLE`,ej=`${wO}_ARC_QUADRANT`,ij=`${wO}_ARC_RADIAN`,sj=-Math.PI/2,nj=3*Math.PI/2,rj=.6,aj=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},oj=(t,e,i)=>{var s;const n=null!==(s="band"===e?fF("axisBand",i):"linear"===e?fF("axisLinear",i):{})&&void 0!==s?s:{},r=fF("angle"===t?"axisAngle":"axisRadius",i);return iO({},fF("axis",i),n,r)};function lj(t,e,i,s){switch(t){case r.cartesianBandAxis:return dz(lz(i,["z"]),"band",e);case r.cartesianLinearAxis:return dz(lz(i,["z"]),"linear",e);case r.cartesianLogAxis:return dz(lz(i,["z"]),"log",e);case r.cartesianSymlogAxis:return dz(lz(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return dz(lz(i),void 0,e);case r.polarBandAxis:return oj(i.orient,"band",e);case r.polarLinearAxis:return oj(i.orient,"linear",e);case r.polarAxis:return oj(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=fF(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>rz(t.orient)));let g;g=p(u)?iO({},Gz(u.type)?a:o,l):l;const f=n.find((t=>az(t.orient)));let m;return m=p(f)?iO({},tE(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=fF(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?iO({},Gz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?iO({},tE(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return hj(i,fF(t,e));default:return fF(t,e)}}const hj=(t,e)=>{var i;const s=iO({},e,e[hz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class cj extends pD{getTheme(t,e){return lj(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},YR(e)),{[s]:0}))}}class dj extends mD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=cj,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof jc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:AI.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new $z(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!U(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(t.release(!0),null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var uj,pj;dj.transformerConstructor=cj,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(uj||(uj={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(pj||(pj={}));class gj extends jD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=sO.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(bI.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}gj.type="component";const fj=()=>{sO.registerMark(gj.type,gj)},mj=t=>t;class vj extends dj{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?uj.circleAxis:uj.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?pj.circleAxisGrid:pj.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=YF(null===(h=sO.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this._specVisible&&(this.getVisible()||this._spec.forceInitTick||this._hideWhenEmpty)}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new OD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&fR(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?JC(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!JC(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return fR(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=mR(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),fR(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):fR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(fR(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=$(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=uI(s=t.domainLine)).startSymbol=uI(s.startSymbol),s.endSymbol=uI(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return fI(iO({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:fI(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>fI(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=fI(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return fI(iO({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:fI(t.tick.style)),t.tick.state&&(i.tick.state=pI(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return fI(iO({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:fI(t.subTick.style)),t.subTick.state&&(i.subTick.state=pI(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=Vz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:iO({},d,fI(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:fI(h.style)}),h.state&&(i.title.state.shape=pI(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:fI(o.style)}),o.state&&(i.title.state.background=pI(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=pI(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=fI(t.background.style)),t.background.state&&(i.panel.state=pI(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:MO(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return fI(iO({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:fI(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:MO(t.subGrid.alternateColor),style:fI(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=mF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){BI(this._option.dataSet,"scale",mj);const i=this.registerTicksTransform();return new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===CT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}vj.specKey="axes";const _j=()=>{fj(),sO.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},yj=[Hz];class bj extends vj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),fR(this._regions,(t=>{const e=this.getOrient();rz(e)?Xz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):az(e)?Xz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):oz(e)&&Xz(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=iO({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(iO({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=rz(this.getOrient()),n=t=>{var e;return(s?!rz(t.getOrient()):rz(t.getOrient()))&&JC(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=lz(i,["z"]),oz(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!Wz(e))return null;const{axisType:t,componentName:s}=cz(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>az(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!Wz(t))return;const{axisType:s,componentName:n}=cz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=sO.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return rz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):oz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(yj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){rz(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!rz(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!oz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;az(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=UR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=UR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=rz(this.getOrient())?t.fieldX:oz(this.getOrient())?t.fieldZ:t.fieldY,JC(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:JC(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(bI.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(rz(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=rz(this._orient)?{x:$(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return fR(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:rz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:oz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();fR(this._regions,(e=>{rz(t)?Xz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):az(t)?Xz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):oz(t)&&Xz(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=rz(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=rz(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=iO(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ve).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=rz(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?_t(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):_t(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return Yz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:JC(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}bj.type=r.cartesianAxis,bj.specKey="axes";const xj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Sj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,kj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function Mj(t,e,i="count"){const s=kj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const Tj=Math.sqrt(50),wj=Math.sqrt(10),Cj=Math.sqrt(2);class Ej{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=Uz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=rz(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Aj),e.sort(Aj),{domain:Sj(t,e),scope:Mj(t,e,i)}}(r,Ky(t),this._spec.breaks[0].scopeType);e=Ky(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=Uz(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-$(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=Tj?10:n>=wj?5:n>=Cj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const Bj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},Pj={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},Lj={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},Rj={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}};class Oj extends bj{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new NE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!oz(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=rz(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=VR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=Ky(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,ZE),t}}Oj.type=r.cartesianLinearAxis,Oj.specKey="axes",Oj.builtInTheme={axis:Rj,axisLinear:Bj,axisX:Pj,axisY:Lj},G(Oj,Ej);const Ij=()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),_j(),sO.registerComponent(Oj.type,Oj)};class Dj{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new OD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=Yz(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>Yz(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const Fj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class zj extends bj{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new xE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,iB),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=uE(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),_j(),sO.registerComponent(zj.type,zj,!1)};class Hj extends Oj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),fR(this._regions,(t=>{rz(this.getOrient())?Xz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Xz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=iO({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new OD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=mi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>Yz(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>Yz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,ZE),t}transformScaleDomain(){}}Hj.type=r.cartesianTimeAxis,Hj.specKey="axes",Hj.builtInTheme={axis:Rj,axisX:Pj,axisY:Lj};class Vj extends Oj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new YE}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,ZE),t}transformScaleDomain(){}}Vj.type=r.cartesianLogAxis,Vj.specKey="axes",Vj.builtInTheme={axis:Rj,axisLinear:Bj,axisX:Pj,axisY:Lj},G(Vj,Ej);class Nj extends Oj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new XE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,ZE),t}transformScaleDomain(){}}Nj.type=r.cartesianSymlogAxis,Nj.specKey="axes",Nj.builtInTheme={axis:Rj,axisLinear:Bj,axisX:Pj,axisY:Lj},G(Nj,Ej);const Uj=`${wO}_hide_`;function Wj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Gj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[Uj]&&(Wj(t,!0),t[Uj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[Uj]=!0,Wj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},Yj=()=>{sO.registerGrammarTransform("symbolOverlap",{transform:Gj,runType:"afterEncode"})},Xj={min:K,max:$,average:cR,sum:hR};function $j(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function Kj(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function qj(t,e,i,s){return Kj(t,e,i,"min",s)}function Zj(t,e,i,s){return Kj(t,e,i,"max",s)}function Jj(t,e,i,s){return Kj(t,e,i,"average",s)}function Qj(t,e,i,s){return Kj(t,e,i,"sum",s)}const tH=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=$j;if("min"===n?l=qj:"max"===n?l=Zj:"average"===n?l=Jj:"sum"===n&&(l=Qj),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},eH=()=>{sO.registerGrammarTransform("dataSampling",{transform:tH})};class iH extends nz{constructor(){super(...arguments),this.type=xR.line,this.transformerConstructor=Pz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),XF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=sz(this);this._symbolMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),XF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}iH.type=xR.line,iH.mark=Az,iH.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},iH.transformerConstructor=Pz,G(iH,Sz);class sH{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{HI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Pa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Jy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Jy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class nH{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{hb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{tI(e,[{key:t,operations:JC(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&tI(e,[{key:i.field,operations:JC(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?DR("colorOrdinal"):DR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(hb(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(U(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),hb(s.domain)?e.reRender=!0:U(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!hb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=JC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=JC(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;JC(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(JC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=JC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));JC(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class rH{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class aH extends uD{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=ob(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:CO,height:EO},this._viewRect={width:CO,height:EO},this._viewBox={x1:0,y1:0,x2:CO,y2:EO},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=YR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new yI(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new sH(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new rH;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=sO.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(YF({},XF("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=sO.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=sO.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof gD)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof jD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof jD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&HI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=iD(this._spec,this._option,{width:CO,height:EO})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=TR(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new nH(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){sD(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=TR(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{sD(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,sD(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):sD(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];sD(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=WR(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(bI.AFTER_MARK_RENDER_END,e)};this._event.on(bI.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:vI;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(mI(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===bz.dimensionHover||s===bz.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>tE(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>tE(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const oH=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class lH{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):eO(t,a,c.spec),eO(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=oH(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=oH(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(sO.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(sO.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=sO.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=sO.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=sO.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):vF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=vF(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class hH extends lH{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),L(i,"trimPadding")&&iO(i,nD(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class cH extends hH{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),eD(t)}}const dH=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=sI(t,!0);for(const e in o)for(const i in o[e].nodes)oI(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)aI(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&rI(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class pH{_beforeInit(){this._dataSet&&EI(this._dataSet,"stackSplit",dH)}_initStack(){this._stack=new uH(this),this._stack.init()}}const gH={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:bz.dimensionHover};class fH extends sF{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},gH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=vI(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}fH.type="dimension-hover",fH.defaultOptions=gH;const mH=()=>{sO.registerInteractionTrigger(fH.type,fH)},vH=()=>{sO.registerComposedEvent(bz.dimensionHover,yz),sO.registerComposedEvent(bz.dimensionClick,pz)},_H=t=>t.fieldX[0],yH=t=>t.fieldY[0],bH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},xH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},SH=(t,e)=>t?e?_H:bH:e?yH:xH,AH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=_z(t,(t=>rz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=_z(t,(t=>az(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{tE(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=kH(t,i,SH(e,tE(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=kH(t,i,SH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},kH=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:MH(t,s,i)},MH=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=mz(e,t,"cartesian",null!=i?i:rz(t.getOrient())?_H:yH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},TH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(tE(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(JC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Nz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};CH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&wH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),wH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=mF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},CH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},EH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=BH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},BH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},PH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return TH(c,r,e),c.xField.cacheInfo?EH(c.xField):c.yField.cacheInfo?EH(c.yField):void 0},LH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],RH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&LH.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(OH(s).every((t=>{var e;return!SF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},OH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},IH={dom:`${wO}_TOOLTIP_HANDLER_DOM`,canvas:`${wO}_TOOLTIP_HANDLER_CANVAS`},DH={key:"其他",value:"..."};var FH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(FH||(FH={}));class zH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=RH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},DH),t):DH;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&SF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class jH extends zH{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!tE(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const HH=()=>{sO.registerTooltipProcessor("dimension",jH)};class VH extends zH{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Ko.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(vI(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const NH=()=>{sO.registerTooltipProcessor("mark",VH)};class UH extends zH{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const WH=()=>{sO.registerTooltipProcessor("group",UH)};class GH extends aH{constructor(){super(...arguments),this.transformerConstructor=cH,this.type="line",this.seriesType=xR.line}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}GH.type="line",GH.seriesType=xR.line,GH.transformerConstructor=cH,G(GH,pH);const YH=[...Mz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class XH extends Tz{constructor(){super(...arguments),this.type=XH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return YH}_getIgnoreAttributes(){return[]}}XH.type="area";const $H=()=>{sO.registerMark(XH.type,XH),hM(),Uk(),HB(),IB(),eF(),sO.registerGraphicComponent("area",nf)};class KH extends TF{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const qH=Object.assign(Object.assign(Object.assign({},zF),xz),{area:{name:"area",type:"area"}}),ZH=()=>{sO.registerAnimation("area",QD),tF(),ZD()};class JH extends Pz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=iO({},f.style,g.style),l.state=iO({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class QH extends nz{constructor(){super(...arguments),this.type=xR.area,this.transformerConstructor=JH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(QH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===uF?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return FR(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return FR(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[FO]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),XF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),XF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=sz(this);this._symbolMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),XF("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new KH(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}QH.type=xR.area,QH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},QH.mark=qH,QH.transformerConstructor=JH,G(QH,Sz);class tV extends hH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),eD(t)}}class eV extends aH{constructor(){super(...arguments),this.transformerConstructor=tV,this.type="area",this.seriesType=xR.area}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}eV.type="area",eV.seriesType=xR.area,eV.transformerConstructor=tV,G(eV,pH);function iV(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const sV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:iV(t,e)}),nV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:iV(t,e)}),rV={type:"fadeIn"},aV={type:"growCenterIn"};function oV(t,e){if(!1===e)return{};switch(e){case"fadeIn":return rV;case"scaleIn":return aV;default:return sV(t)}}class lV extends jD{constructor(){super(...arguments),this.type=lV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}lV.type="rect";const hV=()=>{hM(),rM(),LB("rect",FB),sO.registerMark(lV.type,lV),kw.registerBuiltInAnimate("growHeightIn",mC),kw.registerBuiltInAnimate("growHeightOut",vC),kw.registerBuiltInAnimate("growWidthIn",RC),kw.registerBuiltInAnimate("growWidthOut",OC),kw.registerBuiltInAnimate("growCenterIn",pC),kw.registerBuiltInAnimate("growCenterOut",gC),sO.registerGraphicComponent("rect",Dg)},cV=Object.assign(Object.assign({},zF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function dV(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=$R(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[jF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):FR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[HF]):FR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=FR(this._dataToPosX(t),e,i),n=FR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[VF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):FR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[NF]):FR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=FR(this._dataToPosY(t),e,i),n=FR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},gV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:qF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(gV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(EI(this._option.dataSet,"addVChartProperty",yF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};EI(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Pa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:OF.bind(this),call:IF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new OD(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=NF,s=VF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=HF,s=jF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=sI(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)dV(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=FR(this[r](t),l,i),u=FR(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!zR(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[DO],n=e[FO],r=e[zO],d=e[jO];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?VF:jF],i=e[a?NF:HF];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[DO]:s,[FO]:o}),c?{[zO]:u,[jO]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(Dg(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>FR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>FR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=$(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=sz(this);this._barMark.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),XF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=$R(this._spec.barWidth,a)),l&&(c=Math.max(c,$R(this._spec.barMinWidth,a))),h&&(c=Math.min(c,$R(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=$R(null!==(l=i[r-1])&&void 0!==l?l:X(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=JC(g.type||"band");return d(e,m)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}gV.type=xR.bar,gV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},gV.mark=cV,gV.transformerConstructor=pV;const fV=()=>{eH(),hV(),sO.registerAnimation("bar",((t,e)=>({appear:oV(t,e),enter:sV(t,!1),exit:nV(t,!1),disappear:{duration:$D.disappear.duration}}))),jj(),Ij(),sO.registerSeries(gV.type,gV)};class mV extends hH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),eD(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class vV extends aH{constructor(){super(...arguments),this.transformerConstructor=mV,this.type="bar",this.seriesType=xR.bar}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}vV.type="bar",vV.seriesType=xR.bar,vV.transformerConstructor=mV,G(vV,pH);const _V=[10,20],yV=qC.Linear,bV="circle",xV=qC.Ordinal,SV=["circle","square","triangle","diamond","star"],AV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},kV=Object.assign(Object.assign({},zF),{point:{name:"point",type:"symbol"}});class MV extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class TV extends nz{constructor(){super(...arguments),this.type=xR.scatter,this.transformerConstructor=MV,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${wO}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${wO}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:yV,defaultRange:_V},"size")}getShapeAttribute(t,e){return u(e)?bV:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:xV,defaultRange:SV},"shape")}initMark(){this._symbolMark=this._createMark(TV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:qF(this._spec,TV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=sz(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),XF("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:bV},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i,s,n;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.y)}))}));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==r?void 0:r.renderInner)&&r.renderInner();const a=null===(i=null==r?void 0:r.getComponent)||void 0===i?void 0:i.call(r);(null==a?void 0:a.evaluate)&&a.evaluate(null,null);const o=null===(s=null==r?void 0:r.getProduct)||void 0===s?void 0:s.call(r);o&&(null==t?void 0:t.scale)&&(null==t?void 0:t.scaleCenter)&&((null===(n=o.attribute)||void 0===n?void 0:n.postMatrix)||o.setAttributes({postMatrix:new We}),o.scale(t.scale,t.scale,t.scaleCenter))}handlePan(t){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}TV.type=xR.scatter,TV.mark=kV,TV.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},TV.transformerConstructor=MV;const wV=()=>{Bz(),sO.registerAnimation("scatter",((t,e)=>Object.assign({appear:AV(0,e)},KD))),jj(),Ij(),sO.registerSeries(TV.type,TV)};class CV extends hH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class EV extends aH{constructor(){super(...arguments),this.transformerConstructor=CV,this.type="scatter",this.seriesType=xR.scatter}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}EV.type="scatter",EV.seriesType=xR.scatter,EV.transformerConstructor=CV,G(EV,pH);class BV extends ez{constructor(){super(...arguments),this.type=xR.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${wO}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const PV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[PO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[QO]=e.nameMap[n]:t[QO]=n})),t.features);class LV extends TF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class RV extends jD{constructor(){super(...arguments),this.type=RV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}RV.type="path";const OV=()=>{sO.registerMark(RV.type,RV),hM(),eM(),sO.registerGraphicComponent("path",tf)},IV=Object.assign(Object.assign({},zF),{area:{name:"area",type:"path"}});class DV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ia(i,e):Ra[i]?(La[i]||(La[i]=Ia(i,Ra[i])),La[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class FV{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class zV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function jV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:FV}:nb(e)||rb(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:zV}:null}const HV={debounce:St,throttle:At};class VV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=nb(this._renderMode)||rb(this._renderMode),jV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return jV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:kI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:kI.chart,consume:!1}];l.on(...c,HV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,HV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||jV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||jV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:kI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:kI.chart,consume:!1}];l.on(...c,HV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,HV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){jV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||jV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:kI.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:kI.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||jV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:kI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||jV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:kI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:kI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:kI.chart,source:AI.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:kI.chart,source:AI.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=HV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=HV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:kI.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:kI.chart,source:AI.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:kI.chart,source:AI.chart},this._handleDragMouseUp)}))}}function NV(t,e){return`${wO}_${e}_${t}`}class UV extends dj{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:NV(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=iO(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new DV(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===xR.map||e.type===xR.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),fR(this._regions,(t=>{var e;if(t.type===xR.map||t.type===xR.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new We})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==xR.map&&e.type!==xR.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[QO],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}UV.type=r.geoCoordinate,G(UV,VV);const WV=()=>{sO.registerComponent(UV.type,UV)};class GV extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class YV extends BV{constructor(){super(...arguments),this.type=xR.map,this.transformerConstructor=GV,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),PI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),EI(this._dataSet,"copyDataView",FI),EI(this._dataSet,"map",PV),EI(this._dataSet,"lookup",_F);const s=PI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Pa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:QO,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new OD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(YV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:qF(this._spec,YV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:RO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:RO]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(YF(null===(t=sO.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),XF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new LV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[PO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[PO],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s,n;const{scale:r,scaleCenter:a}=t;if(1===r)return;const o=this.getRootMark().getProduct();o&&(o.attribute.postMatrix||o.setAttributes({postMatrix:new We}),o.scale(r,r,a));const l=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==l?void 0:l.renderInner)&&l.renderInner();const h=null===(i=null==l?void 0:l.getComponent)||void 0===i?void 0:i.call(l);(null==h?void 0:h.evaluate)&&h.evaluate(null,null);const c=null===(s=null==l?void 0:l.getProduct)||void 0===s?void 0:s.call(l);c&&r&&a&&((null===(n=c.attribute)||void 0===n?void 0:n.postMatrix)||c.setAttributes({postMatrix:new We}),c.scale(r,r,a))}handlePan(t){var e,i,s,n;const{delta:r}=t;if(0===r[0]&&0===r[1])return;const a=this.getRootMark().getProduct();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new We}),a.translate(r[0],r[1]));const o=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==o?void 0:o.renderInner)&&o.renderInner();const l=null===(i=null==o?void 0:o.getComponent)||void 0===i?void 0:i.call(o);(null==l?void 0:l.evaluate)&&l.evaluate(null,null);const h=null===(s=null==o?void 0:o.getProduct)||void 0===s?void 0:s.call(o);h&&r&&((null===(n=h.attribute)||void 0===n?void 0:n.postMatrix)||h.setAttributes({postMatrix:new We}),h.translate(r[0],r[1]))}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return PO}getActiveMarks(){return[this._pathMark]}}YV.type=xR.map,YV.mark=IV,YV.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},YV.transformerConstructor=GV;const XV=`${wO}_waterfall_default_seriesField`,$V=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[WO]=!0:delete t[WO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=KV([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const f=g[0];let{start:m,end:v}=qV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=se(_,e)):(t[c]=+y,y=se(y,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=KV(r,t,n,a,c,h,i,e),a.push(n)})),a};function KV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=qV(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===XV)&&(t[XV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function qV(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?Jy("total.collectCountField error"):n=e[a].start;o<0?Jy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=se(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const ZV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},JV={type:"fadeIn"},QV={type:"growCenterIn"};function tN(t,e){switch(e){case"fadeIn":return JV;case"scaleIn":return QV;default:return sV(t,!1)}}class eN extends jD{constructor(){super(...arguments),this.type=eN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Lg(t)}}eN.type="rule";const iN=()=>{sO.registerMark(eN.type,eN),hM(),Qk(),sO.registerGraphicComponent("line",Lg)},sN=Object.assign(Object.assign({},cV),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),nN=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:rN(t.map((t=>t.latestData)).flat(),e.fields,i)}};function rN(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>rN(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class aN{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new Pa(e instanceof Ba?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),EI(e,"dimensionTree",nN),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class oN extends pV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const lN={rect:gN,symbol:uN,arc:mN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=uN(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:vN,line:_N,area:_N,rect3d:gN,arc3d:mN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function hN(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=lN[t])&&void 0!==i?i:lN.point;return e.series.type===xR.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=dN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:yN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function cN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==xR.sankey){const{formatFunc:t,args:n}=mF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function dN(t){return d(t)?e=>t(e.data):t}function uN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=dN(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:pN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function pN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function gN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=dN(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:fN(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function fN(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function mN(t){var e;const{labelSpec:i}=t,s=null!==(e=dN(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function vN(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=cN(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Tg(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function _N(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[RO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function yN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class bN extends gV{constructor(){super(...arguments),this.type=xR.waterfall,this.transformerConstructor=oN,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&rI(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new aN(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=XV)}getSeriesKeys(){return this._seriesField===XV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),EI(this._dataSet,"waterfallFillTotal",ZV),EI(this._dataSet,"waterfall",$V),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=zI(this.getViewData(),this._dataSet,{name:`${wO}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new OD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:DO,endAs:FO,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=sz(this);this._barMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),XF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),XF("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(bN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return vN(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?FR(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):FR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&zR([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}bN.type=xR.waterfall,bN.mark=sN,bN.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},bN.transformerConstructor=oN;const xN=()=>{iN(),hV(),sO.registerAnimation("waterfall",((t,e)=>({appear:tN(t,e),enter:sV(t,!1),exit:nV(t,!1),disappear:{duration:$D.disappear.duration}}))),JD(),jj(),Ij(),sO.registerSeries(bN.type,bN)},SN=`${wO}_BOX_PLOT_OUTLIER_VALUE`;var AN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(AN||(AN={}));const kN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[SN]:e};return n.forEach((e=>{i[e]=t[e]})),p(r)&&(i[r]=t[r]),i})))})),i};class MN extends TF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===AN.OUTLIER)return this.series.getOutliersField();if(t===AN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case AN.MIN:return this.series.getMinField();case AN.MAX:return this.series.getMaxField();case AN.MEDIAN:return this.series.getMedianField();case AN.Q1:return this.series.getQ1Field();case AN.Q3:return this.series.getQ3Field();case AN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===AN.OUTLIER)return e[SN];if(t===AN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case AN.MIN:return e[this.series.getMinField()];case AN.MAX:return e[this.series.getMaxField()];case AN.MEDIAN:return e[this.series.getMedianField()];case AN.Q1:return e[this.series.getQ1Field()];case AN.Q3:return e[this.series.getQ3Field()];case AN.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[SN])}getDefaultContentList(t){return[{key:this.getContentKey(AN.OUTLIER),value:this.getContentValue(AN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(AN.MAX),value:this.getContentValue(AN.MAX)},{key:this.getContentKey(AN.Q3),value:this.getContentValue(AN.Q3)},{key:this.getContentKey(AN.MEDIAN),value:this.getContentValue(AN.MEDIAN)},{key:this.getContentKey(AN.Q1),value:this.getContentValue(AN.Q1)},{key:this.getContentKey(AN.MIN),value:this.getContentValue(AN.MIN)},{key:this.getContentKey(AN.SERIES_FIELD),value:this.getContentValue(AN.SERIES_FIELD)}]}}class TN extends jD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==lD.enter&&t.context.diffState!==lD.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=zg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=sO.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const wN=()=>{sO.registerGraphicComponent("glyph",zg),hM(),Xk()},CN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],EN=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class BN extends TN{constructor(){super(...arguments),this.type=BN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=CN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=EN,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}BN.type="boxPlot";const PN=Object.assign(Object.assign({},zF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),LN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},RN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},ON=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),IN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=ON(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=ON(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=ON(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=ON(t,"box").attribute.width,i=ON(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=ON(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=ON(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=ON(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=ON(t,"box").attribute.height,i=ON(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},DN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=ON(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=ON(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=ON(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=ON(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=ON(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=ON(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=ON(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=ON(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=ON(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=ON(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class FN extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return LN(IN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class zN extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return RN(IN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class jN extends FN{computeAttribute(){return LN(DN)(this.target,this.params,this.params.options)}}class HN extends zN{computeAttribute(){return RN(DN)(this.target,this.params,this.params.options)}}class VN extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class NN extends nz{constructor(){super(...arguments),this.type=xR.boxPlot,this.transformerConstructor=VN,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(NN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(NN.mark.outlier,{key:PO,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>FR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>FR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>FR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>FR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>FR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>FR(e(this.getDatumPositionValues(t,SN),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>FR(e(this.getDatumPositionValues(t,SN),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;EI(this._dataSet,"foldOutlierData",kN),EI(this._dataSet,"addVChartProperty",yF);const t=new Pa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${wO}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:OF.bind(this),call:IF}},!1),this._outlierData=new OD(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=$R(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,$R(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,$R(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=$R(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=JC(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=sz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=sO.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(XF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(YF(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(YF(null===(a=sO.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new MN(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}NN.type=xR.boxPlot,NN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},NN.mark=PN,NN.transformerConstructor=VN;const UN=()=>{wN(),Qk(),rM(),sO.registerGraphicComponent("line",(t=>Lg(t))),sO.registerGraphicComponent("rect",(t=>Dg(t))),sO.registerMark(BN.type,BN),Bz(),ZD(),jj(),Ij(),kw.registerBuiltInAnimate("boxplotScaleIn",FN),kw.registerBuiltInAnimate("boxplotScaleOut",zN),kw.registerBuiltInAnimate("barBoxplotScaleIn",jN),kw.registerBuiltInAnimate("barBoxplotScaleOut",HN),sO.registerSeries(NN.type,NN)};class WN extends jD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=WN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Zg(t):Tg(t)}}WN.type="text";const GN=()=>{sO.registerMark(WN.type,WN),hM(),pM(),oM(),sO.registerGraphicComponent("text",Tg),sO.registerGraphicComponent("richtext",Zg)};class YN extends TF{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const XN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),$N={type:"fadeIn"},KN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function qN(t,e){return"fadeIn"===e?$N:XN(t)}const ZN=Object.assign(Object.assign({},cV),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class JN extends pV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class QN extends gV{constructor(){super(...arguments),this.type=xR.rangeColumn,this._barMarkType="rect",this._barName=xR.bar,this.transformerConstructor=JN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(QN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:qF(this._spec,QN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(QN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(QN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=sz(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),XF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),XF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(YF(null===(n=sO.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),XF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new YN(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}QN.type=xR.rangeColumn,QN.mark=ZN,QN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},QN.transformerConstructor=JN;const tU=()=>{hV(),GN(),sO.registerAnimation("rangeColumn",((t,e)=>({appear:qN(t,e),enter:XN(t),exit:KN(t),disappear:{duration:$D.disappear.duration}}))),JD(),jj(),Ij(),sO.registerSeries(QN.type,QN)};var eU,iU;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(eU||(eU={})),function(t){t.middle="middle",t.start="start",t.end="end"}(iU||(iU={}));class sU extends TF{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const nU=Object.assign({},qH);class rU extends QH{constructor(){super(...arguments),this.type=xR.rangeArea}initMark(){this._areaMark=this._createMark(rU.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new sU(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}rU.type=xR.rangeArea,rU.mark=nU;class aU extends ez{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=rj,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};JC(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:[]};JC(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&iz(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function oU(t){return lb(t)?Number.parseFloat(t):0}const lU=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&hU(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[Kz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[Kz]*t;v(e,A,i),A+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},hU=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===oU(t[e])))||!i&&0===t.reduce(((t,i)=>t+oU(i[e])),0)));function cU(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const dU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:cU(t,!0,NI.appear)}),uU={type:"fadeIn"},pU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:cU(t,!0,NI.enter)}),gU=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:cU(t,!0,NI.exit)});function fU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return uU;case"growRadius":return dU(Object.assign(Object.assign({},t),{growField:"radius"}));default:return dU(Object.assign(Object.assign({},t),{growField:"angle"}))}}class mU extends jD{constructor(t,e){super(t,e),this.type=vU.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[tj])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class vU extends mU{constructor(){super(...arguments),this.type=vU.type}}vU.type="arc";const _U=()=>{hM(),Vk(),LB("arc",UB),kw.registerBuiltInAnimate("growRadiusIn",BC),kw.registerBuiltInAnimate("growRadiusOut",PC),kw.registerBuiltInAnimate("growAngleIn",dC),kw.registerBuiltInAnimate("growAngleOut",uC),sO.registerGraphicComponent("arc",of),sO.registerMark(vU.type,vU)},yU=Object.assign(Object.assign({},zF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class bU extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=iO({},this._theme,i,t);const n=(t,e)=>iO({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const xU=`${wO}_LABEL_VISIBLE`;class SU extends aU{constructor(){super(...arguments),this.transformerConstructor=bU,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:UR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:UR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=sj,this._endAngle=nj,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[tj];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;EI(this._dataSet,"pie",lU),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:Zz,asEndAngle:Jz,asRatio:qz,asMiddleAngle:tj,asRadian:ij,asQuadrant:ej,asK:Qz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Pa(this._dataSet,{name:`${wO}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new OD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},SU.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:LO,groupKey:this._seriesField,isSeriesMark:!0},{morph:qF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return _R(Zz)(t)}endAngleScale(t){return _R(Jz)(t)}_computeLayoutRadius(){return aj((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:jR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:jR(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:_R(xU).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[tj];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===NI.appear)return this._startAngle;if(i===NI.disappear)return this._endAngle;const r=[NI.disappear,NI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[PO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[PO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[PO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[PO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[tj]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[tj]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[tj]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[tj]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=YF(null===(i=sO.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}SU.transformerConstructor=bU,SU.mark=yU,SU.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class AU extends SU{constructor(){super(...arguments),this.type=xR.pie}}AU.type=xR.pie;const kU=()=>{_U(),sO.registerAnimation("pie",((t,e)=>({appear:fU(t,e),enter:pU(t),exit:gU(t),disappear:{duration:$D.disappear.duration}}))),sO.registerAnimation("emptyCircle",((t,e)=>({appear:fU(t,e)}))),sO.registerSeries(AU.type,AU)};function MU(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const TU=t=>({type:MU(t.growField),options:{overall:!0}}),wU={type:"fadeIn"},CU=t=>({type:MU(t.growField)}),EU=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function BU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return wU;case"growAngle":return TU(Object.assign(Object.assign({},t),{growField:"angle"}));default:return TU(Object.assign(Object.assign({},t),{growField:"radius"}))}}class PU extends aU{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(FO),this.setInnerRadiusField(DO)}setValueFieldToPercent(){this.setRadiusField(jO),this.setInnerRadiusField(zO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const LU=Object.assign(Object.assign({},zF),{rose:{name:"rose",type:"arc"}});class RU extends tz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class OU extends vj{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=sO.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=sj,this._endAngle=nj,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),fR(this._regions,(t=>{"radius"===this.getOrient()?Xz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Xz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:UR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:UR(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:Nz(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){fR(this._regions,(t=>{"radius"===this.getOrient()?Xz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Xz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return JC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:JC(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>Yz(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ae.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return aj((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=rj,e=0;const i=this.getChart().getSpec();return fR(this.getRegions(),(s=>{const n=s;if(r=n.type,[xR.rose,xR.radar,xR.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(iO({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(iO({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}OU.type=r.polarAxis,OU.specKey="axes";const IU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},DU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class FU extends OU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new NE}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,ZE),t}}FU.type=r.polarLinearAxis,FU.specKey="axes",FU.builtInTheme={axis:Rj,axisLinear:Bj,axisAngle:DU,axisRadius:IU},G(FU,Ej);const zU=()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),sO.registerGraphicComponent(uj.circleAxis,((t,e)=>new GC(t,e))),sO.registerGraphicComponent(pj.circleAxisGrid,((t,e)=>new tP(t,e))),_j(),sO.registerComponent(FU.type,FU)};class jU extends OU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new xE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}registerTicksTransform(){const t=`${this.type}-ticks`;return EI(this._option.dataSet,t,rB),t}transformScaleDomain(){}}jU.type=r.polarBandAxis,jU.specKey="axes",jU.builtInTheme={axis:Rj,axisBand:Fj,axisAngle:DU,axisRadius:IU},G(jU,Dj);const HU=()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),sO.registerGraphicComponent(uj.circleAxis,((t,e)=>new GC(t,e))),sO.registerGraphicComponent(pj.circleAxisGrid,((t,e)=>new tP(t,e))),_j(),sO.registerComponent(jU.type,jU)};class VU extends PU{constructor(){super(...arguments),this.type=xR.rose,this.transformerConstructor=RU,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(VU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:qF(this._spec,VU.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>FR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=FR(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),XF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}VU.type=xR.rose,VU.mark=LU,VU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},VU.transformerConstructor=RU;const NU=()=>{sO.registerSeries(VU.type,VU),_U(),sO.registerAnimation("rose",((t,e)=>({appear:BU(t,e),enter:CU(t),exit:EU(t),disappear:{duration:$D.disappear.duration}}))),HU(),zU()};class UU extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,aR(this._fromAngle,this._toAngle)&&aR(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class WU extends nC{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!gR(t)&&!gR(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const GU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function YU(t,e,i){return"fadeIn"===e?GU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function XU(t,e,i){return"fadeIn"===e?GU(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const $U=(t,e)=>({custom:iC,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),KU=Object.assign(Object.assign(Object.assign({},zF),xz),{area:{name:"area",type:"area"}});class qU extends PU{constructor(){super(...arguments),this.type=xR.radar,this.transformerConstructor=Pz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(qU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:pF,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?oe(this._spec.startAngle):sj},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(YF(null===(s=sO.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),XF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=sO.getAnimationInKey(e);t.setAnimationConfig(YF(null==i?void 0:i(n,r),XF(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}qU.type=xR.radar,qU.mark=KU,qU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},qU.transformerConstructor=Pz,G(qU,Sz);const ZU=()=>{sO.registerSeries(qU.type,qU),$H(),Cz(),Bz(),sO.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:YU(t,e,"in"),enter:YU(t,e,"in"),exit:YU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:$D.disappear.duration},update:[{channel:["points","center"],custom:WU,customParameters:t,duration:$D.update.duration,easing:$D.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),sO.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:XU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:$D.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:UU,customParameters:t,duration:$D.update.duration,easing:$D.update.easing}]}))),sO.registerAnimation("radarGroup",((t,e)=>({appear:$U(t,"in"),disappear:{duration:$D.disappear.duration}}))),Vk(),HU(),zU()};class JU extends TF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>mi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const QU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(wO)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[PO]:r,[LO]:`${s}_${e}`})),r++}))})),n},tW={fill:"#bbb",fillOpacity:.2},eW=Object.assign(Object.assign({},zF),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}});class iW extends nz{constructor(){super(...arguments),this.type=xR.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),EI(this._option.dataSet,"objFlat",QU),EI(this._option.dataSet,"copyDataView",FI),BI(this._option.dataSet,"dataview",wa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(iO(tW,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(iW.mark.group),this._containerMark=this._createMark(iW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(iW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(iW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(iW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(iW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(iW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(iW.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!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",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:RO}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new OR).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:RO}}initTooltip(){this._tooltipHelper=new JU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}iW.type=xR.dot,iW.mark=eW,iW.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class sW extends TF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>mi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const nW=Object.assign(Object.assign({},zF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),rW=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class aW extends nz{constructor(){super(...arguments),this.type=xR.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),EI(this._option.dataSet,"linkDotInfo",rW),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(aW.mark.group),this._containerMark=this._createMark(aW.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(aW.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(aW.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:RO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new sW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}aW.type=xR.link,aW.mark=nW,aW.builtInTheme={link:{arrow:{style:{size:10}}}};const oW=Object.assign(Object.assign({},zF),{group:{name:"group",type:"group"}});class lW extends aU{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?DO:qO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?FO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?oe(n):sj;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):nj,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=FR(this.angleAxisHelper.dataToPosition([t[DO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=FR(this.angleAxisHelper.dataToPosition([t[FO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?FR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(lW.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return of(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Dg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const uW=()=>{sO.registerAnimation("circularProgress",((t,e)=>({appear:dW(t,e),enter:{type:"growAngleIn"},disappear:{duration:$D.disappear.duration}})))};class pW extends tz{constructor(){super(...arguments),this._supportStack=!0}}class gW extends lW{constructor(){super(...arguments),this.type=xR.circularProgress,this.transformerConstructor=pW,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(gW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:qF(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(gW.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?DO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?FO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),XF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),XF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}gW.type=xR.circularProgress,gW.mark=hW,gW.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},gW.transformerConstructor=pW;const fW=()=>{sO.registerSeries(gW.type,gW),_U(),uW(),JD(),HU(),zU()};function mW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const vW={type:"fadeIn"};function _W(t,e="grow"){return!1===e?{}:"fadeIn"===e?vW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:mW(t)}))(t)}class yW extends TF{enableByType(t){return"dimension"!==t}}const bW=Object.assign(Object.assign({},zF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class xW extends nz{constructor(){super(...arguments),this.type=xR.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(xW.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return FR(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return FR(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?FR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return FR(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return FR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?FR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(xW.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return FR(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return FR(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),XF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),XF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new yW(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}xW.type=xR.linearProgress,xW.mark=bW,xW.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const SW=()=>{hV(),sO.registerAnimation("linearProgress",((t,e)=>({appear:_W(t,e),enter:_W(t),disappear:{duration:$D.disappear.duration}}))),JD(),sO.registerSeries(xW.type,xW)},AW=[0],kW=[20,40],MW=[200,500],TW={shrink:!1,enlarge:!1,fontSizeLimitMin:0},wW=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class CW{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const EW=`${wO}_WORD_CLOUD_TEXT`,BW=Object.assign(Object.assign({},zF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),PW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class LW extends ez{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=kW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:MW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:AW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?EW:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:TW},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||sb(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:AW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!wW.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new CW(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(LW.mark.word,{key:LO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(LW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(YF(sO.getAnimationInKey("wordCloud")(n,s),XF("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new OR).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:RO])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new NE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new NE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[PO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:LO,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:I_.createCanvas.bind(I_),getTextBounds:mf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Wg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}LW.mark=BW,LW.builtInTheme={wordCloud:PW};function RW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||$D.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=OW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},IW=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=IW(t.children,e,t,n))})),s},DW=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=DW(t.children,e,t,n)),n=e(t,s,i,n)})),n},FW=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):FW(t.children,e,i)))})),e};function zW(t,e){let i,s;if(VW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function VW(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function GW(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function YW(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function XW(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function $W(t){return{_:t,next:null,prev:null}}function KW(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];GW(n,s,r);let a,o,l,h,c,d,u,p=$W(s),g=$W(n),f=$W(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=OW(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Ct)/Ct}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:QW.defaultOpionts.nodeSort;IW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)IW([o],qW(h)),DW([o],ZW(this._getPadding,.5,a)),IW([o],JW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);IW([o],qW(QW.defaultOpionts.setRadius)),DW([o],ZW(Rt,1,a)),c&&DW([o],ZW(this._getPadding,o.radius/t,a)),IW([o],JW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}QW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const tG=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=tG(t.children):t.value=0),e+=Math.abs(t.value)})),e};function eG(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){tG(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function iG(t){return t.depth}function sG(t,e){return e-1-t.endDepth}const nG=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),rG=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},aG={left:iG,right:sG,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:iG,end:sG},oG=bt(0,1);class lG{constructor(t){this._ascendingSourceBreadth=(t,e)=>nG(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>nG(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},lG.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):aG[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return eG(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[rG(s[t.source]),rG(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=_t(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*oG(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(nG),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(nG),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];hG(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),cG);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},dG.defaultOpionts,t):Object.assign({},dG.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Lt(this.options.center[0],t.width),s=t.y0+Lt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>Lt(t,n))):Lt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Lt(t,n))):Lt(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Lt(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=OW(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ce({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function uG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:hG,slice:uG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?uG:hG)(t,e,i,s,n)}};class fG{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},fG.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?pG(this.options.aspectRatio):null!==(e=gG[this.options.splitType])&&void 0!==e?e:gG.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=OW(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function mG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ci?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=mG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Ci(o.map(Ci))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rwt(e)));u=Ri(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=vG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function kG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Pi((function(i){return-1*MG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},wG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||yG,s=e.lossFunction||_G,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];di(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:TG(f),arcs:f})}))},CG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:EG,triangle:EG,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 EG(){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 BG(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const PG=t=>CG[t]?CG[t]():CG.circle(),LG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function RG(t){return d(t)?t:function(){return t}}class OG{constructor(t){var e,i;switch(this.options=j({},OG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=PG(this.options.shape),this.getText=null!==(e=RG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=RG(this.options.fontWeight),this.getTextFontSize=RG(this.options.fontSize),this.getTextFontStyle=RG(this.options.fontStyle),this.getTextFontFamily=RG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>LG(10,50);break;case"random-light":this.getTextColor=()=>LG(50,90);break;default:this.getTextColor=RG(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return oe(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():wt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class DG extends OG{constructor(t){var e;super(j({},DG.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<=DG.defaultOptions.minFontSize&&(this.options.minFontSize=DG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=IG[this.options.spiral])&&void 0!==e?e:IG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=RG(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=BG(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(HG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(jG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}HG(p,this._size)&&(p=VG(p,this._size))}else if(HG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||zG(p,i))&&(!i||!FG(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function FG(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function zG(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,HG=(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 VG(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},UG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},WG=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},GG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=BG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=PG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)WG(n,UG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)WG(n,UG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)WG(n,UG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)WG(n,UG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)WG(n,UG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=UG({x:l,y:h},o,-Math.PI/2,5),e=UG({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);WG(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var C=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var M=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const w=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)};const B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=M(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function U(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=U(t),n=U(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=it){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var yt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function _(t){return o=void 0,u&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Ct(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const wt=4294967296;const Et=t=>e=>R(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(_(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Rt=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,Ot=t=>0,It=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Lt(f.min,f);for(let r=0;r=1?jt:t<=-1?-jt:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ae{static distancePP(t,e){return $t(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return $t(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return $t(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Nt;)t+=Nt;else if(t>0)for(;t>Nt;)t-=Nt;return t};function ce(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=pe(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(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 me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function _e(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Ce(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?oe(t.angle):t.angle,s=Me(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+jt;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+jt;u>Ut&&(u-=Ut),g>Ut&&(g-=Ut);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Ce(n,i)+Ce(n,s))/2>Ce(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Ie(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Fe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}},He=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ne(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ue{}class We extends Ue{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class Ge{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ge,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ge;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ge(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=le(r.rotateDeg),r}}class Ye{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Xe(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Ke(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const $e=/^#([0-9a-f]{3,8})$/,qe={transparent:4294967040},Ze={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Je(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Qe(t){return S(t)?new ni(t>>16,t>>8&255,255&t,1):_(t)?new ni(t[0],t[1],t[2]):new ni(255,255,255)}function ti(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ei(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ii=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ni((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Qe(t):8===e?new ni(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class si{static Brighter(t,e=1){return 1===e?t:new si(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new si(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof si?t:new si(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(qe[t]))return function(t){return S(t)?new ni(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ni(t[0],t[1],t[2],t[3]):new ni(255,255,255,1)}(qe[t]);if(p(Ze[t]))return Qe(Ze[t]);const e=`${t}`.trim().toLowerCase(),i=ii(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ni(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Xe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ni(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=si.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ni(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Ke(this.color.r,this.color.g,this.color.b),r=Xe(u(t)?n.h:yt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ni(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ii(e,!0);return null!=i?i:this}setColorName(t){const e=Ze[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new si(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ei(t.color.r),this.color.g=ei(t.color.g),this.color.b=ei(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ni{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Je(this.r)+Je(this.g)+Je(this.b)+(1===this.opacity?"":Je(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Ke(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ri(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new ni(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Ke});function oi(t){if(k(t))return[t,t,t,t];if(_(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function li(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const hi=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function ci(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function di(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const ui=1e-10;function pi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ui)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=vi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=gi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ui,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function gi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function fi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return gi(t,t-(i*i-e*e+t*t)/(2*i))+gi(e,s)}function mi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function vi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let bi;function xi(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class Si{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ai=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ki(t){let e;if(e=Ai.exec(t))return new Si({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});ot.getInstance().error("invalid format: "+t)}const Ci=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ti{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return Ti.instance||(Ti.instance=new Ti),Ti.instance}newFormat(t){const e=ki(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Mi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:y,group:_,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?m:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?Ci[8+bi/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?y+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=_(k,1/0));let C=S.length+k.length+A.length,T=C>1)+S+k+A+T.slice(C);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=ki(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=_i(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ci[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>xi(100*t,e),r:xi,s:function(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(bi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+_i(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function wi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Ri(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ri(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Pi(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},is=Math.sqrt,ss=Math.tan;function ns(t){return t>1?0:t<-1?Ni:Math.acos(t)}function rs(t){return t>1?Ui:t<-1?-Ui:Math.asin(t)}function as(){}function os(t,e){t&&hs.hasOwnProperty(t.type)&&hs[t.type](t,e)}var ls={Feature:function(t,e){os(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sNi?t+Math.round(-t/Wi)*Wi:t,e]}function Ss(t,e,i){return(t%=Wi)?e||i?bs(ks(t),Cs(e,i)):ks(t):e||i?Cs(e,i):xs}function As(t){return function(e,i){return[(e+=t)>Ni?e-Wi:e<-Ni?e+Wi:e,i]}}function ks(t){var e=As(t);return e.invert=As(-t),e}function Cs(t,e){var i=qi(t),s=ts(t),n=qi(e),r=ts(e);function a(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*i+o*s;return[$i(l*n-c*r,o*i-h*s),rs(c*n+l*r)]}return a.invert=function(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*n-l*r;return[$i(l*n+h*r,o*i+c*s),rs(c*i-o*s)]},a}function Ts(t,e){(e=gs(e))[0]-=t,_s(e);var i=ns(-e[1]);return((-e[2]<0?-i:i)+Wi-ji)%Wi}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:as,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ws(t,e){return Xi(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function Ps(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Fs(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function zs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Fs(a);var t=function(t,e){var i=Ls(e),s=e[1],n=ts(s),r=[ts(i),-qi(i),0],a=0,o=0;Is.reset(),1===n?s=Ui+ji:-1===n&&(s=-Ui-ji);for(var l=0,h=t.length;l=0?1:-1,C=k*A,T=C>Ni,M=f*x;if(Is.add($i(M*k*ts(C),m*S+M*qi(C))),a+=T?A+k*Wi:A,T^p>=i^_>=i){var w=ms(gs(u),gs(y));_s(w);var E=ms(r,w);_s(E);var B=(T^A>=0?-1:1)*rs(E[2]);(s>B||s===B&&(w[0]||w[1]))&&(o+=T^A>=0?1:-1)}}return(a<-ji||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Hs))}return u}}function Hs(t){return t.length>1}function js(t,e){return((t=t.x)[0]<0?t[1]-Ui-ji:Ui-t[1])-((e=e.x)[0]<0?e[1]-Ui-ji:Ui-e[1])}1===(Rs=Ds).length&&(Os=Rs,Rs=function(t,e){return Ds(Os(t),e)});var Ns=zs((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Ni:-Ni,l=Xi(r-i);Xi(l-Ni)0?Ui:-Ui),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ni&&(Xi(i-n)ji?Ki((ts(e)*(r=qi(s))*ts(i)-ts(s)*(n=qi(e))*ts(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*Ui,s.point(-Ni,n),s.point(0,n),s.point(Ni,n),s.point(Ni,0),s.point(Ni,-n),s.point(0,-n),s.point(-Ni,-n),s.point(-Ni,0),s.point(-Ni,n);else if(Xi(t[0]-e[0])>ji){var r=t[0]0,n=Xi(e)>ji;function r(t,i){return qi(t)*qi(i)>e}function a(t,i,s){var n=[1,0,0],r=ms(gs(t),gs(i)),a=fs(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ms(n,r),u=ys(n,h);vs(u,ys(r,c));var p=d,g=fs(u,p),f=fs(p,p),m=g*g-f*(fs(u,u)-1);if(!(m<0)){var v=is(m),y=ys(p,(-g-v)/f);if(vs(y,u),y=ps(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Xi(y[0]-b)Ni^(b<=y[0]&&y[0]<=x)){var T=ys(p,(-g+v)/f);return vs(T,u),[y,ps(T)]}}}function o(e,i){var n=s?t:Ni-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return zs(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Ni:-Ni),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ws(e,p)||ws(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&ws(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=qi(e),o=ts(e),l=s*i;null==n?(n=e+s*Wi,r=e-l/2):(n=Ts(a,n),r=Ts(a,r),(s>0?nr)&&(n+=s*Wi));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Xi(s[0]-t)0?0:3:Xi(s[0]-i)0?2:1:Xi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,y,_=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&_.lineEnd()},polygonStart:function(){_=b,l=[],h=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=y&&e,n=(l=Fs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Bs(l,o,e,r,a),a.polygonEnd());_=a,l=h=c=null}};function S(t,e){n(t,e)&&_.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(_.lineStart(),_.point(r,a));else if(o&&m)_.point(r,a);else{var l=[g=Math.max(Ws,Math.min(Vs,g)),f=Math.max(Ws,Math.min(Vs,f))],b=[r=Math.max(Ws,Math.min(Vs,r)),a=Math.max(Ws,Math.min(Vs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(_.lineStart(),_.point(r,a),y=!1):(m||(_.lineStart(),_.point(l[0],l[1])),_.point(b[0],b[1]),o||_.lineEnd(),y=!1)}g=r,f=a,m=o}return x}}function Ys(t){return t}var Xs,Ks,$s,qs,Zs=Di(),Js=Di(),Qs={point:as,lineStart:as,lineEnd:as,polygonStart:function(){Qs.lineStart=tn,Qs.lineEnd=nn},polygonEnd:function(){Qs.lineStart=Qs.lineEnd=Qs.point=as,Zs.add(Xi(Js)),Js.reset()},result:function(){var t=Zs/2;return Zs.reset(),t}};function tn(){Qs.point=en}function en(t,e){Qs.point=sn,Xs=$s=t,Ks=qs=e}function sn(t,e){Js.add(qs*t-$s*e),$s=t,qs=e}function nn(){sn(Xs,Ks)}var rn=Qs,an=1/0,on=an,ln=-an,hn=ln;var cn,dn,un,pn,gn={point:function(t,e){tln&&(ln=t);ehn&&(hn=e)},lineStart:as,lineEnd:as,polygonStart:as,polygonEnd:as,result:function(){var t=[[an,on],[ln,hn]];return ln=hn=-(on=an=1/0),t}},fn=0,mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn={point:Cn,lineStart:Tn,lineEnd:En,polygonStart:function(){kn.lineStart=Bn,kn.lineEnd=Pn},polygonEnd:function(){kn.point=Cn,kn.lineStart=Tn,kn.lineEnd=En},result:function(){var t=An?[xn/An,Sn/An]:bn?[yn/bn,_n/bn]:vn?[fn/vn,mn/vn]:[NaN,NaN];return fn=mn=vn=yn=_n=bn=xn=Sn=An=0,t}};function Cn(t,e){fn+=t,mn+=e,++vn}function Tn(){kn.point=Mn}function Mn(t,e){kn.point=wn,Cn(un=t,pn=e)}function wn(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,Cn(un=t,pn=e)}function En(){kn.point=Cn}function Bn(){kn.point=Rn}function Pn(){On(cn,dn)}function Rn(t,e){kn.point=On,Cn(cn=un=t,dn=pn=e)}function On(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,xn+=(n=pn*t-un*e)*(un+t),Sn+=n*(pn+e),An+=3*n,Cn(un=t,pn=e)}var In=kn;function Ln(t){this._context=t}Ln.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Wi)}},result:as};var Dn,Fn,zn,Hn,jn,Nn=Di(),Un={point:as,lineStart:function(){Un.point=Vn},lineEnd:function(){Dn&&Wn(Fn,zn),Un.point=as},polygonStart:function(){Dn=!0},polygonEnd:function(){Dn=null},result:function(){var t=+Nn;return Nn.reset(),t}};function Vn(t,e){Un.point=Wn,Fn=Hn=t,zn=jn=e}function Wn(t,e){Hn-=t,jn-=e,Nn.add(is(Hn*Hn+jn*jn)),Hn=t,jn=e}var Gn=Un;function Yn(){this._string=[]}function Xn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Kn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),us(t,i(s))),s.result()}return r.area=function(t){return us(t,i(rn)),rn.result()},r.measure=function(t){return us(t,i(Gn)),Gn.result()},r.bounds=function(t){return us(t,i(gn)),gn.result()},r.centroid=function(t){return us(t,i(In)),In.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ys):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Yn):new Ln(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function $n(t){return function(e){var i=new qn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function qn(){}function Zn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),us(i,t.stream(gn)),e(gn.result()),null!=s&&t.clipExtent(s),t}function Jn(t,e,i){return Zn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Qn(t,e,i){return Jn(t,[[0,0],e],i)}function tr(t,e,i){return Zn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function er(t,e,i){return Zn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Yn.prototype={_radius:4.5,_circle:Xn(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=Xn(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}},qn.prototype={constructor:qn,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 ir=16,sr=qi(30*Yi);function nr(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,y=c-n,_=v*v+y*y;if(_>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=is(b*b+x*x+S*S),k=rs(S/=A),C=Xi(Xi(S)-1)e||Xi((v*E+y*B)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Yi:0,E()):[m*Gi,v*Gi,y*Gi]},M.angle=function(t){return arguments.length?(_=t%360*Yi,E()):_*Gi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},M.precision=function(t){return arguments.length?(a=nr(o,T=t*t),B()):is(T)},M.fitExtent=function(t,e){return Jn(M,t,e)},M.fitSize=function(t,e){return Qn(M,t,e)},M.fitWidth=function(t,e){return tr(M,t,e)},M.fitHeight=function(t,e){return er(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&w,E()}}function cr(t){var e=0,i=Ni/3,s=hr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Yi,i=t[1]*Yi):[e*Gi,i*Gi]},n}function dr(t,e){var i=ts(t),s=(i+ts(e))/2;if(Xi(s)2?t[2]*Yi:0),e.invert=function(e){return(e=t.invert(e[0]*Yi,e[1]*Yi))[0]*=Gi,e[1]*=Gi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===yr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function br(t){return ss((Ui+t)/2)}function xr(t,e){var i=qi(t),s=t===e?ts(t):Ji(i/qi(e))/Ji(br(e)/br(t)),n=i*Qi(br(t),s)/s;if(!s)return yr;function r(t,e){n>0?e<-Ui+ji&&(e=-Ui+ji):e>Ui-ji&&(e=Ui-ji);var i=n/Qi(br(e),s);return[i*ts(s*t),n-i*qi(s*t)]}return r.invert=function(t,e){var i=n-e,r=es(s)*is(t*t+i*i),a=$i(t,Xi(i))*es(i);return i*s<0&&(a-=Ni*es(t)*es(i)),[a/s,2*Ki(Qi(n/r,1/s))-Ui]},r}function Sr(t,e){return[t,e]}function Ar(t,e){var i=qi(t),s=t===e?ts(t):(i-qi(e))/(e-t),n=i/s+t;if(Xi(s)ji&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Rr.invert=fr(rs),Or.invert=fr((function(t){return 2*Ki(t)})),Ir.invert=function(t,e){return[-e,2*Ki(Zi(t))-Ui]};var Fr={exports:{}},zr=function(t,e){this.p1=t,this.p2=e};zr.prototype.rise=function(){return this.p2[1]-this.p1[1]},zr.prototype.run=function(){return this.p2[0]-this.p1[0]},zr.prototype.slope=function(){return this.rise()/this.run()},zr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},zr.prototype.isVertical=function(){return!isFinite(this.slope())},zr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},zr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},zr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},zr.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)},zr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Hr=zr,jr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Hr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=jr(t.slice(0,s),e),o=jr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Nr=jr;!function(t){var e=Nr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Vr(Yr,e),{tolerance:s}=i;return Ur(t,s)};var Kr;!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"}(Kr||(Kr={}));const $r=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),_(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let C=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/C:0,T.push(y[t])}return T},Zr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],w=M.length?M:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:w});if(!T.length)return qr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...M,...T];return qr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},Jr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",w=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",R=null!==(p=k.min)&&void 0!==p?p:"min",O=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(y=k.values)&&void 0!==y?y:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),_(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}_(S)&&(S=[yt(Math.min.apply(null,S),0,1),yt(Math.max.apply(null,S),0,1)]);const U=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[M]=o,f[w]=l,f[E]=h,f[B]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,A&&(f[F]=H.get(t)||[]),U.push(f)}return U};var Qr={},ta={};function ea(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ia(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function sa(t,e){var i=t+"",s=i.length;return s9999?"+"+sa(e,6):sa(e,4))+"-"+sa(t.getUTCMonth()+1,2)+"-"+sa(t.getUTCDate(),2)+(r?"T"+sa(i,2)+":"+sa(s,2)+":"+sa(n,2)+"."+sa(r,3)+"Z":n?"T"+sa(i,2)+":"+sa(s,2)+":"+sa(n,2)+"Z":s||i?"T"+sa(i,2)+":"+sa(s,2)+"Z":"")}function ra(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return ta;if(h)return h=!1,Qr;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a0}function ma(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=ha(t));var r=[];switch(t.type){case"GeometryCollection":return va(t,(function(t){_a(t,s)})),t;case"FeatureCollection":return ma(t,(function(t){ma(_a(t,s),(function(t){r.push(t)}))})),di(r)}return _a(t,s)}function _a(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return va(t,(function(t){_a(t,e)})),t;case"LineString":return ba(ga(t),e),t;case"Polygon":return xa(ga(t),e),t;case"MultiLineString":return ga(t).forEach((function(t){ba(t,e)})),t;case"MultiPolygon":return ga(t).forEach((function(t){xa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ba(t,e){fa(t)===e&&t.reverse()}function xa(t,e){fa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Sa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Ta=(t,e={},i)=>{i.type=Kr.GEO;const s=Vr(ka,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ca(t))})):e.push(Ca(t))})),e})(t);let l=t.features;return o&&(l=ya(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=Aa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=Aa.bounds(t);t.bbox=e}})),t.features=l,t},Ma={},wa=(t,e,i)=>{i.type=Kr.GEO;const s=Vr(ka,Ma,e),{object:n}=s;if(!y(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Dr(a,t)}))}:Dr(a,o));var a,o;return Ta(r,s,i)},Ea=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!_(t))throw new TypeError("Invalid data: must be DataView array!");return _(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Ba=0;function Pa(t="dataset"){return Ba>1e8&&(Ba=0),t+"_"+Ba++}class Ra{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:Pa("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Oa{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Pa("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Oa||!0!==(null==e?void 0:e.clone)||(i=!0),i?L(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?H({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",$r),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Kn();const Ia={},La={albers:pr,albersusa:function(){var t,e,i,s,n,r,a=pr(),o=ur().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=ur().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}},Da=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Fa(t,e){return function i(){const s=e();return s.type=t,s.path=Kn().projection(s),s.copy=s.copy||function(){const t=i();return Da.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class za{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class Ha extends za{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}class ja{static GenAutoIncrementId(){return ja.auto_increment_id++}}ja.auto_increment_id=0;class Na{}const Ua=new Na;let Va=0;class Wa{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Ua.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Va,t),this.tryRunAnimationFrameNextFrame(),Va}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class Ga{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Ya=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Xa extends Ga{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=ja.GenAutoIncrementId(),this.hooks={onSetEnv:new Ha(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Wa);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Wa),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Ya(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}var Ka=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class $a extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=ja.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Ka(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(io(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=io(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=io(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=io(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=eo.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(io(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(io(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,io(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):io(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof Qa))return void ot.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=eo.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new so(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Ja,this.rootWheelEvent=new Qa,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&y(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const oo=Nt-1e-8;class lo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>oo)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Nt)<0&&(s+=Nt),(n%=Nt)<0&&(n+=Nt),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const co=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,uo={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},po={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let go,fo,mo,vo,yo,_o;function bo(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;t_o){let t,e=mo;for(let s=1,r=i.length;s1&&(g=Math.sqrt(g),i*=g,s*=g);const f=d/i,m=c/i,v=-c/s,y=d/s,_=f*o+m*l,b=v*o+y*l,x=f*t+m*e,S=v*t+y*e;let A=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const C=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),M=Math.atan2(b-T,_-C);let w=Math.atan2(S-T,x-C)-M;w<0&&1===r?w+=Nt:w>0&&0===r&&(w-=Nt);const E=Math.ceil(Math.abs(w/(jt+.001))),B=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Ro(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=No(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Vo(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new Wo(i,n),new Wo(n,s)]}class Wo extends Oo{constructor(t,e){super(),this.type=Co.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===ko.ROW?Vt(this.p0.x-this.p1.x):t===ko.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class Go{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new Uo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new Wo(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===ko.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===ko.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Yo extends Go{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Xo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Ko(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?ko.ROW:ko.COLUMN;return"monotoneY"===t?new Yo(t,s):new Go(t,s)}class $o{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 qo(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ko("linear",i,t);return Zo(new $o(n,s),t),n}function Zo(t,e){return Xo(t,e,1)}function Jo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Qo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Jo(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:Jo(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 tl(t,e){return Xo(t,e,2)}function el(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return qo(t,e);const n=Ko("basis",i,t);return tl(new Qo(n,s),t),n}function il(t){return t<0?-1:1}function sl(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(il(r)+il(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function nl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function rl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class al{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:rl(this,this._t0,nl(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,rl(this,nl(this,e=sl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:rl(this,this._t0,e=sl(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class ol extends al{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ll(t,e){return Xo(t,e,2)}function hl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return qo(t,e);const n=Ko("monotoneX",i,t);return ll(new al(n,s),t),n}function cl(t,e){return Xo(t,e,2)}function dl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return qo(t,e);const n=Ko("monotoneY",i,t);return cl(new ol(n,s),t),n}let ul=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class pl extends ul{lineEnd(){this.context.closePath()}}function gl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Go("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?ko.ROW:ko.COLUMN);return fl(new ul(r,e,n),t),r}function fl(t,e){return Xo(t,e,1)}function ml(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Go("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?ko.ROW:ko.COLUMN);return fl(new pl(r,e,n),t),r}class vl extends $o{lineEnd(){this.context.closePath()}}function yl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ko("linear",i,t);return _l(new vl(n,s),t),n}function _l(t,e){return Xo(t,e,1)}function bl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function xl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return qo(i,n);const o=Ko(t,r,i);return Xo(new e(o,s,a),i,2),o}}const Sl=xl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:bl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Al=xl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:bl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class kl extends Oo{constructor(t,e,i){super(),this.type=Co.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Ho(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?jo(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===ko.ROW?Vt(this.p0.x-this.p2.x):t===ko.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=Xt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Ho(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new kl(i,a,r),new kl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Cl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Wo(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new kl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new Uo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Tl(t,e,i){var s,n;switch(e){case"linear":default:return qo(t,i);case"basis":return el(t,i);case"monotoneX":return hl(t,i);case"monotoneY":return dl(t,i);case"step":return gl(t,.5,i);case"stepClosed":return ml(t,.5,i);case"stepBefore":return gl(t,0,i);case"stepAfter":return gl(t,1,i);case"catmullRom":return Sl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Al(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return yl(t,i)}}class Ml extends ho{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new lo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([po.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([po.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([po.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([po.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([po.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([po.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([po.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([po.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([po.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Cl(this);Ro(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[po.M]=t=>`M${t[1]} ${t[2]}`,t[po.L]=t=>`L${t[1]} ${t[2]}`,t[po.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[po.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[po.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];Bo(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[po.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=bo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=Tl(e,i);"x"===s?this.direction=ko.ROW:"y"===s?this.direction=ko.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[po.M]=this.moveToTransform,t[po.L]=this.lineToTransform,t[po.Q]=this.quadraticCurveToTransform,t[po.C]=this.bezierCurveToTransform,t[po.AT]=this.arcToTransform,t[po.E]=this.ellipseTransform,t[po.R]=this.rectTransform,t[po.A]=this.arcTransform,t[po.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Ro(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===ko.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===ko.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),Ql=Object.assign(Object.assign({},Gl),{points:[],cornerRadius:0,closePath:!0}),th=Object.assign(Object.assign({},Gl),{width:100,height:100,spikes:5,thickness:.5}),eh=Object.assign(Object.assign({},Gl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),ih=Object.assign(Object.assign({},Gl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),sh=Object.assign(Object.assign({},Gl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),nh=Object.assign(Object.assign(Object.assign({},Gl),jl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),rh=Object.assign(Object.assign(Object.assign({},Gl),jl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ah=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Gl),{fill:!0,cornerRadius:0,cornerType:"round"}),oh=Object.assign(Object.assign({},ah),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});class lh{static GetImage(t,e){var i;const s=lh.cache.get(t);s?"fail"===s.loadState?Ua.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):lh.loadImage(t,e)}static GetSvg(t,e){var i;let s=lh.cache.get(t);s?"fail"===s.loadState?Ua.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},lh.cache.set(t,s),s.dataPromise=Ua.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=lh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},lh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ua.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ua.global.loadBlob(t):"json"===e&&(i.dataPromise=Ua.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!lh.isLoading&&lh.toLoadAueue.length){lh.isLoading=!0;const t=lh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(lh.cache.set(i,n),n.dataPromise=Ua.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()})).catch((t=>{console.error(t),lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()}))}}),0)}static loadImage(t,e){const i=hh(t,lh.toLoadAueue);if(-1!==i)return lh.toLoadAueue[i].marks.push(e),void lh.loading();lh.toLoadAueue.push({url:t,marks:[e]}),lh.loading()}static improveImageLoading(t){const e=hh(t,lh.toLoadAueue);if(-1!==e){const t=lh.toLoadAueue.splice(e,1);lh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function hh(t,e){for(let i=0;i{var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)dh[s]=t,i&&(i=!(null!==(e=dh[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)dh[e]=!!t[e],i&&(i=!!dh[e]);else dh[0]=!1,dh[1]=!1,dh[2]=!1,dh[3]=!1;return{isFullStroke:i,stroke:dh}},ph=[0,0,0,0],gh=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ph[0]=t[0],ph[2]=t[0],ph[1]=t[1],ph[3]=t[1],ph):t:t:0,fh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],mh=[1,2,3,0,1,2,3,0];function vh(t,e,i,s){for(;t>=Ut;)t-=Ut;for(;t<0;)t+=Ut;for(;t>e;)e+=Ut;fh[0].x=i,fh[1].y=i,fh[2].x=-i,fh[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Gt(t)*i,Kt(t)*i),s.add(Gt(e)*i,Kt(e)*i),n!==r||e-t>Ht){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Sh.TimeOut=1e3/60;const Ah=new Sh,kh=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,Ch=(t,e)=>{const i=kh(t,e);return isNaN(i)?i:Math.max(e,i)};class Th{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Mh(t,e,i,s,n){return n?t.arc(i,s,e,0,Nt,!1,n):t.arc(i,s,e,0,Nt),!1}var wh=new class extends Th{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return Mh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Mh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Eh=new class extends Th{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Ph=new class extends Th{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Rh(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Th{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2+n,i,s)}};function Ih(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Lh extends Th{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Ih(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ih(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Lh;var Fh=new class extends Lh{constructor(){super(...arguments),this.type="triangle"}};const zh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Hh=Math.sin(Nt/10)*zh,jh=-Math.cos(Nt/10)*zh;function Nh(t,e,i,s){const n=Hh*e,r=jh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Nt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Uh=new class extends Th{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Nh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Nh(t,this.parseSize(e)/2+n,i,s)}};const Vh=$t(3);function Wh(t,e,i,s){const n=e,r=n/Vh,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Gh=new class extends Th{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Yh(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Xh=new class extends Th{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Yh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Yh(t,this.parseSize(e)/2+n,i,s)}};function Kh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var $h=new class extends Th{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Kh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Kh(t,this.parseSize(e)/2+n,i,s)}};const qh=-.5,Zh=$t(3)/2,Jh=1/$t(12);function Qh(t,e,i,s){const n=e/2,r=e*Jh,a=n,o=e*Jh+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(qh*n-Zh*r+i,Zh*n+qh*r+s),t.lineTo(qh*a-Zh*o+i,Zh*a+qh*o+s),t.lineTo(qh*l-Zh*h+i,Zh*l+qh*h+s),t.lineTo(qh*n+Zh*r+i,qh*r-Zh*n+s),t.lineTo(qh*a+Zh*o+i,qh*o-Zh*a+s),t.lineTo(qh*l+Zh*h+i,qh*h-Zh*l+s),t.closePath(),!1}var tc=new class extends Th{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Qh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qh(t,this.parseSize(e)/2+n,i,s)}};function ec(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ic=new class extends Th{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return ec(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return ec(t,this.parseSize(e)/2,i,s,n)}};function sc(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var nc=new class extends Th{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return sc(t,this.parseSize(e)/2,i,s,n)}};function rc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var ac=new class extends Th{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return rc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return rc(t,this.parseSize(e)/2,i,s,n)}};const oc=$t(3);function lc(t,e,i,s){const n=e*oc;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var hc=new class extends Th{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return lc(t,this.parseSize(e)/2/oc,i,s)}drawOffset(t,e,i,s,n){return lc(t,this.parseSize(e)/2/oc+n,i,s)}};function cc(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var dc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return cc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return cc(t,this.parseSize(e)/4+n,i,s)}};function uc(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var pc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return uc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return uc(t,this.parseSize(e)/4+n,i,s)}};function gc(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var fc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return gc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return gc(t,this.parseSize(e)/4+n,i,s)}};function mc(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var vc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return mc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return mc(t,this.parseSize(e)/4+n,i,s)}};function yc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var _c=new class extends Th{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return yc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function bc(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var xc=new class extends Th{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return bc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return bc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Sc(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var Ac=new class extends Th{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return Sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Sc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function kc(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Cc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Tc=new class extends Th{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?Cc(t,e,i,s):kc(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Cc(t,e+2*n,i,s):kc(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Mc=new Ve;class wc{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Ro(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Ro(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Mc.x1=i.bounds.x1*t,Mc.y1=i.bounds.y1*t,Mc.x2=i.bounds.x2*t,Mc.y2=i.bounds.y2*t,e.union(Mc)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const Ec=[wh,Eh,Ph,Oh,hc,Fh,Uh,Gh,Xh,$h,tc,ic,nc,Dh,ac,dc,pc,fc,vc,Tc,_c,xc,Ac],Bc={};Ec.forEach((t=>{Bc[t.type]=t}));const Pc={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Rc{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ic(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ic(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ic(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Rc(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Rc(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function Fc(t,e){return zc(t)}function zc(t,e){const i={};for(let e=0;e{Ua.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)}))}function Yc(t,e,i,s=0){return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let Xc=0;function Kc(){return Xc++}var $c;function qc(t){const e=[];let i=0,s="";for(let n=0;nZc.set(t,!0)));const Jc=new Map;function Qc(t){if(Zc.has(t))return!0;if(Jc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function td(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Jc.set(t,!0)));const ed=Kc(),id=Kc(),sd=Kc(),nd=Kc(),rd=Kc(),ad=Kc(),od=Kc(),ld=Kc(),hd=Kc(),cd=Kc(),dd=Kc(),ud=Kc(),pd=Kc(),gd=Kc(),fd=Kc(),md=Kc(),vd=Kc(),yd=Symbol.for("GraphicService"),_d=Symbol.for("GraphicCreator"),bd={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},xd=Object.keys(bd),Sd={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Ad=Object.keys(Sd),kd={duration:200,easing:"cubicOut"},Cd=Symbol.for("CanvasFactory"),Td=Symbol.for("Context2dFactory");function Md(t){return function(){var t,e;const i=null===(t=Ua.global)||void 0===t?void 0:t.env,s=i?null===(e=Ua.canvasFactory)||void 0===e?void 0:e.call(Ua,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const wd=1e-4,Ed=Math.sqrt(3),Bd=1/3;function Pd(t){return t>-Gd&&tGd||t<-Gd}function Od(t){return"number"==typeof t&&Number.isFinite(t)}const Id=[0,0],Ld=[0,0],Dd=[0,0];function Fd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function zd(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Hd(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function jd(t){return(t%=Ut)<0&&(t+=Ut),t}function Nd(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Ut);let d=Math.atan2(l,o);return d<0&&(d+=Ut),d>=s&&d<=n||d+Ut>=s&&d+Ut<=n}function Wd(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(Pd(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Xd=[-1,-1,-1],Kd=[-1,-1];function $d(){const t=Kd[0];Kd[0]=Kd[1],Kd[1]=t}function qd(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Pd(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Bd):Math.pow(i,Bd),s=s<0?-Math.pow(-s,Bd):Math.pow(s,Bd);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+Ed*Math.sin(e)))/(3*a),h=(-o+i*(s-Ed*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Xd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&$d(),p=Hd(e,s,r,o,Kd[0]),u>1&&(g=Hd(e,s,r,o,Kd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Pd(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Xd);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=zd(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Xd[0]=-l,Xd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ut-1e-4){s=0,n=Ut;const e=r?1:-1;return a>=Xd[0]+t&&a<=Xd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ut,n+=Ut);let c=0;for(let e=0;e<2;e++){const i=Xd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ut+t),(t>=s&&t<=n||t+Ut>=s&&t+Ut<=n)&&(t>Ht/2&&t<1.5*Ht&&(e=-e),c+=e)}}return c}function Qd(t){return Math.round(t/Ht*1e8)/1e8%2*Ht}function tu(t,e){let i=Qd(t[0]);i<0&&(i+=Ut);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ut?n=i+Ut:e&&i-n>=Ut?n=i-Ut:!e&&i>n?n=i+(Ut-Qd(i-n)):e&&i1&&(i||(h+=Oe(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,A=b;eu[0]=S,eu[1]=A,tu(eu,Boolean(a[6])),S=eu[0],A=eu[1];const k=S,C=A-S,T=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case po.M:u=m,p=v,c=u,d=p;break;case po.L:if(i){if(Wd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case po.C:if(i){if(Ud(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=qd(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(Nd(c,d,m,v,y,_,e,s,n))return!0}else h+=Zd(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case po.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Vd(m,v,y,k,k+C,T,e,M,n))return!0}else h+=Jd(m,v,y,k,k+C,T,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case po.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Wd(u,p,o,p,e,s,n)||Wd(o,p,o,l,e,s,n)||Wd(o,l,u,l,e,s,n)||Wd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case po.Z:if(i){if(Wd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class nu{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(nu.IsGradientStr(t))try{const e=su(t)[0];if(e){if("linear"===e.type)return nu.ParseLinear(e);if("radial"===e.type)return nu.ParseRadial(e);if("conic"===e.type)return nu.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2,n=parseFloat(e.value)/180*Ht-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ut,stops:nu.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:nu.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2;let n="angular"===e.type?parseFloat(e.value)/180*Ht:0;for(;n<0;)n+=Ut;for(;n>=Ut;)n-=Ut;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function ou(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function lu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s,t}function hu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n,t}function cu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s,t}function du(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function uu(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function pu(t,e,i){const s=i[0],n=i[1],r=i[2];return t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function gu(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function fu(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],v=s[0],y=s[1],_=s[2],b=i[0],x=i[1],S=i[2];return Math.abs(g-b)0&&(Au.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Au.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Tu),function(t,e,i){return iu(t,0,!1,e,i)}(this.path.commandList,Tu.x,Tu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Tu);const i=ru(this,this.lineWidth,this.dpr);return function(t,e,i,s){return iu(t,e,!0,i,s)}(this.path.commandList,i,Tu.x,Tu.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(Cu,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Au.free(t))),this.stack.length=0}}const wu={WIDTH:500,HEIGHT:500,DPR:1};class Eu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=wu.WIDTH,height:n=wu.HEIGHT,dpr:r=wu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Bu;Eu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Bu||(Bu={}));class Pu{static Get(t,e=Bu.Color1,i=[0,0,0,1]){if(e===Bu.Color1){const e=Pu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=si.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Pu.store1[t]=e,Pu.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Pu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=si.parseColorString(t);return n&&(Pu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Pu.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Bu.Color1){if(Pu.store1[t])return;Pu.store1[t]=i,Pu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Pu.store255[t])return;Pu.store255[t]=i,Pu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Ru(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Ou(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Iu(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Iu(t,e,i,s,n)}function Iu(t,e,i,s,n){if(!t||!e)return t&&Ru(t)||e&&Ru(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Pu.Get(t,Bu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Pu.Get(e,Bu.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:Ru(a)})))});return o?Ou(r,l,i,s,n):Ou(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return Lu(s,n,i);if("radial"===s.gradient)return Du(s,n,i);if("conical"===s.gradient)return Fu(s,n,i)}return!1}return n&&n(r,a),Ru(zu(r,a,i),s)}function Lu(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Uu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Uu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Fu(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Uu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function zu(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]}function Hu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Pu.store255={},Pu.store1={};const ju=[0,0,0,0],Nu=[0,0,0,0];function Uu(t,e,i){return Pu.Get(t,Bu.Color255,ju),Pu.Get(e,Bu.Color255,Nu),`rgba(${Math.round(ju[0]+(Nu[0]-ju[0])*i)},${Math.round(ju[1]+(Nu[1]-ju[1])*i)},${Math.round(ju[2]+(Nu[2]-ju[2])*i)},${ju[3]+(Nu[3]-ju[3])*i})`}class Vu{static GetCanvas(){try{return Vu.canvas||(Vu.canvas=Ua.global.createCanvas({})),Vu.canvas}catch(t){return null}}static GetCtx(){if(!Vu.ctx){const t=Vu.GetCanvas();Vu.ctx=t.getContext("2d")}return Vu.ctx}}class Wu extends Ye{static getInstance(){return Wu._instance||(Wu._instance=new Wu),Wu._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Vu.GetCanvas(),s=Vu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Wu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Gu{static GetSize(t){for(let e=0;e=t)return Gu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Gu.GenKey(t,e,i,s,n),l=Gu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=Gu.GenKey(t,e,i,s,n);Gu.cache[l]?Gu.cache[l].push({width:a,height:o,pattern:r}):Gu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Yu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Ut;for(;i>Ut;)i-=Ut;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),Ou(o.color,l.color,h,!1)}function Xu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Vu.GetCanvas(),d=Vu.GetCtx();if(!d)return null;const u=Gu.GetSize(o),p=Gu.GetSize(l);let g=Gu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Wu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);t++){const e=y.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Gu.Set(e,i,s,r,a,g,u,p),g}Gu.cache={},Gu.ImageSize=[20,40,80,160,320,640,1280,2560];const Ku=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function $u(t){return null==t?void 0:t}class qu{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:$u(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Ku.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:$u(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function Zu(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Ju(t){if(!Zu(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Ju(t[i])})),e}function Qu(t,e){var i;const s=null!==(i=Ju(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];Zu(n)&&Zu(i)?s[t]=Qu(n,i):s[t]=Ju(i)})),s}class tp{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Ju(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];Zu(r)&&Zu(n)?t[i]=Qu(r,n):!Zu(r)&&Zu(a)&&Zu(n)?t[i]=Qu(a,n):t[i]=Ju(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?ep.PAINT|ep.BOUNDS|ep.PICK:ep.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?ep.PAINT|ep.BOUNDS:ep.PAINT}};class np{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:kd;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:Ao.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:Ao.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:Ao.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const rp=new qu;function ap(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,op(t),!0)}function op(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=rp.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function lp(t){if(t)return t.parentScope&&lp(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&op(t),t}function hp(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function cp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function dp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,cp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),hp(null!=e?e:t.ownerStage))}const up=new Ve,pp=new Ge,gp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],fp=["x","y"],mp=["scaleX","scaleY"],vp=["angle"],yp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),_p=new re,bp=[],xp=ep.PAINT|ep.SHAPE|ep.BOUNDS|ep.TRANSFORM|ep.LAYOUT;function Sp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Ap(t){if(!Sp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=Sp(s)?Ap(s):s})),i}function kp(t,e){return t===e||!!(Sp(t)||Sp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function Cp(t,e){var i;const s=null!==(i=Ap(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];Sp(n)&&Sp(i)?s[t]=Cp(n,i):s[t]=Ap(i)})),s}const Tp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Mp extends $a{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,cp(this.stage,this),hp(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&lp(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Ao.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(lp(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new qu).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Ap(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&Sp(n)&&Sp(s)?e[t]=Cp(n,s):e[t]=Ap(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:Ap(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e){const i=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((s=>{const n=Object.prototype.hasOwnProperty.call(e,s),r=t[s];if(!n)return void(Object.prototype.hasOwnProperty.call(t,s)&&(i.set(s,{prev:r,next:void 0}),delete t[s]));const a=e[s];kp(r,a)||(i.set(s,{prev:r,next:a}),t[s]=Ap(a))})),i}_syncAttribute(){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const t=this.buildStaticAttributeSnapshot(),e=this.syncObjectToSnapshot(this.attribute,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,e}_syncFinalAttributeFromStaticTruth(){const t=this.finalAttribute;if(!t)return;const e=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(t,e)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=sp[t];return n?n(e,i):null!==(s=ip[t])&&void 0!==s?s:ep.PAINT}(e,i,s):null!==(n=ip[e])&&void 0!==n?n:ep.PAINT;return r&ep.PICK&&(r|=ep.BOUNDS),r===ep.PAINT&&this.needUpdateTag(e)&&(r=ep.SHAPE|ep.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&xp)!==xp?(t&ep.SHAPE?this.addUpdateShapeAndBoundsTag():t&ep.BOUNDS&&this.addUpdateBoundTag(),t&ep.PAINT&&this.addUpdatePaintTag(),t&ep.TRANSFORM&&this.addUpdatePositionTag(),t&ep.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=ep.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!Sp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=Sp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&xo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Mp.userSymbolMap[t],e)return e;if(!0===Nc(t=Pc[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=_(i.path)?i.path:[i.path];up.clear();const n=[];s.forEach((t=>{const e=(new Ml).fromString(t.d),i={};Ad.forEach((e=>{t[e]&&(i[Sd[e]]=t[e])})),n.push({path:e,attribute:i}),up.union(e.bounds)}));const r=up.width(),a=up.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new wc(t,n,!0);return Mp.userSymbolMap[t]=l,l}const i=(new Ml).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Yt(s,n);i.transform(0,0,r,r);const a=new wc(t,i);return Mp.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=gh(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new lo(t);return Ro(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ge),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&xo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&xo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&xo.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&xo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=xo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===So.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===Ao.STATE||null!=i&&i>=Ao.ANIMATE_BIND&&i<=Ao.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===Ao.STATE||null!=o&&o>=Ao.ANIMATE_BIND&&o<=Ao.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!kp(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:bp,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Ao.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:Ao.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:kd}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:bp,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Ap(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Ao.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:Ao.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:bp,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:bp,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Ao.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:Ao.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Ao.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Dl.x,y:e=Dl.y,scaleX:i=Dl.scaleX,scaleY:s=Dl.scaleY,angle:n=Dl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Gt(a),f=Kt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const y=m-i,_=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*y-S*_,t.f=p+h*m+d*v-x*y-A*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),Ua.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Dl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=pp.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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:Ua.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:Ao.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:Ao.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=Ua.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Ml).fromString(t):this.pathProxy=new Ml,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:Ua.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new to(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):$a.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:Ao.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:Ao.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Ua.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Mu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}function wp(t){return!!t&&("string"==typeof t?!yp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Op=Pp();class Ip{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Bp.forEach((t=>{this._defaultTheme[t]=Object.create(Op[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Bp.forEach((s=>{const n=Object.create(Op[s]);t&&t[s]&&Rp(n,t[s]),i[s]&&Rp(n,i[s]),e[s]&&Rp(n,e[s]),this.combinedTheme[s]=n})),e.common&&Bp.forEach((t=>{Rp(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Lp=new Ip;function Dp(t,e){return t.glyphHost?Dp(t.glyphHost):e?(t.isContainer,e):Fp(t)||t.attachedThemeGraphic&&Dp(t.attachedThemeGraphic)||Lp.getTheme()}function Fp(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)):Lp.getTheme()}return null}const zp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},Hp=["radius","startAngle","endAngle",...gp];class jp extends Mp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=nd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Dp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ua.graphicService.updateTempAABBBounds(i);return zp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ut-zt?i.set(-r,-r,r,r):vh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Hp)}needUpdateTag(t){return super.needUpdateTag(t,Hp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Ml,s.arc(0,0,r,a,o),s}clone(){return new jp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return jp.NOWORK_ANIMATE_ATTR}}function Np(t){return new jp(t)}function Up(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Vp(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Wp(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[hi(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=hi(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}jp.NOWORK_ANIMATE_ATTR=Tp;class Gp{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Bl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=vd}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Dp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Xp({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Ua.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Yc(n,o/Math.abs(r+a),!0,l),i.union(n)}return Ua.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ua.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ne(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=Ua.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Gp(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=Ua.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new Gp(a,T,C),w=_(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=Up(y,a),e=this.cache.verticalList.length*v,i=Vp(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>qc(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===$c.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const S=Up(y,a),A=x.verticalList.length*v,k=Vp(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Ch(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Yp){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Yp){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Xp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xp.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Xp.baselineMapAlign}getAlignMapBaseline(){return Xp.alignMapBaseline}}function Kp(t){return new Xp(t)}Xp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Tp),Xp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Xp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const $p=["heightLimit","lineClamp"];class qp extends Xp{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=Ch(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=Ua.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new Gp(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),T=[],M=[0,0];let w=1/0;if(y>0&&(w=Math.max(Math.floor(y/x),1)),b&&(w=Math.min(w,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Yc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Jp)}needUpdateTag(t){return super.needUpdateTag(t,Jp)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Ml).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Ml).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function tg(t){return new Qp(t)}Qp.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Tp);const eg=["segments","points","curveType","curveTension",...gp];let ig=class t extends Mp{constructor(t={}){super(t),this.type="line",this.numberType=ld}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}getGraphicTheme(){return Dp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Ua.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,eg)}needUpdateTag(t){return super.needUpdateTag(t,eg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Ml;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function sg(t){return new ig(t)}ig.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const ng=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},rg=["width","x1","y1","height","cornerRadius",...gp];class ag extends Mp{constructor(t){super(t),this.type="rect",this.numberType=ud}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Dp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);return zp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,rg)}needUpdateTag(t){return super.needUpdateTag(t,rg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=ng(e);return t=new Ml,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new ag(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ag.NOWORK_ANIMATE_ATTR}}function og(t){return new ag(t)}ag.NOWORK_ANIMATE_ATTR=Tp;const lg=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class hg extends ag{constructor(t){super(t),this.type="rect3d",this.numberType=pd}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Xt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;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,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Dp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new dg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return dg.NOWORK_ANIMATE_ATTR}}function ug(t){return new dg(t)}dg.NOWORK_ANIMATE_ATTR=Tp;const pg=Symbol.for("EnvContribution"),gg=Symbol.for("VGlobal"),fg="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",mg={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"}},vg=!0,yg=!1,_g=/\w|\(|\)|-/,bg=/[.?!,;:/,。?!、;:]/,xg=/\S/,Sg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Ag(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Ua.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=kg(t,a)),a}function kg(t,e,i=!1){let s=e;for(;_g.test(t[s-1])&&_g.test(t[s])||bg.test(t[s]);)if(s--,s<=0)return i?Cg(t,e):e;return s}function Cg(t,e){let i=e;for(;_g.test(t[i+1])&&_g.test(t[i])||bg.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Tg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Ua.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Mg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=mg[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function wg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Eg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Ch(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Tg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Tg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ag(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Tg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=wg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ag(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Tg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Ag(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Tg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Bg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...gp];class Pg extends Mp{constructor(t){super(t),this.type="image",this.numberType=od,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Dp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);return zp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ah[t]}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}clone(){return new Pg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Pg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Tp);class Og extends Pg{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=gh(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=gh(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=ah.width,height:e=ah.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Ig{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Og?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=mg[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Eg){const e=xg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Og)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Tg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||yg;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Sg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||vg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?au(t,s,{AABBBounds:i}):s,Sg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Og)break;const{width:n}=Tg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Og?t.width:t.getWidthWithEllips(this.direction)})),i}}class Lg{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=mg[this.direction]}store(t){if(t instanceof Og){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 Ig(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Og?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Ag(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Eg(i,t.newLine,t.character,t.ascentDescentMode),new Eg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Dg=!1;try{Dg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Dg=!1}const Fg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...gp];class zg extends Mp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=gd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:rh.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:rh.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:rh.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:rh.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:rh.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:rh.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:rh.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:rh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Dp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&zg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&zg.splitText(t.text).length>1)))}static splitText(t){if(Dg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=zg.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Ua.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ua.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!zg.AllSingleCharacter(y)&&(y=zg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Mg(0,0,(k?n:x?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Lg(T);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&T.lines[T.lines.length-1].paragraphs.push(s)):M.deal(s,!0),T.lines.length!==t&&(t=T.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,T.lines[T.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===T.layoutDirection?k:C)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:s)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new zg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return zg.NOWORK_ANIMATE_ATTR}}function Hg(t){return new zg(t)}zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Tp);const jg=["path","customPath",...gp];class Ng extends Mp{constructor(t){super(t),this.type="path",this.numberType=hd}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Ml?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Ml?this.cache:t.path)}getGraphicTheme(){return Dp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);zp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Ml).fromString(t.path):t.customPath&&(this.cache=new Ml,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,jg)}needUpdateTag(t){return super.needUpdateTag(t,jg)}toCustomPath(){return(new Ml).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Ng(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ng.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Ng(t)}Ng.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Tp);const Vg=["segments","points","curveType","curveTension",...gp];class Wg extends Mp{constructor(t){super(t),this.type="area",this.numberType=sd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Dp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Ua.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Ml;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Wg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wg.NOWORK_ANIMATE_ATTR}}function Gg(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const Yg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...gp];class Xg extends Mp{constructor(t){super(t),this.type="arc",this.numberType=ed}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=he(e),i=e+a,s&&Vt(a)>zt&&Vt(a)zt&&o>zt)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=$t(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Kt(g)),n=Zt(Number(l)/a*Kt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Dp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ua.graphicService.updateTempAABBBounds(i);zp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Ut-zt?i.set(-s,-s,s,s):(vh(l,o,s,i),vh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Yg)}needUpdateTag(t){return super.needUpdateTag(t,Yg)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ut-zt)n.moveTo(0+h*Gt(a),0+h*Kt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Kt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Kt(a),i=l*Gt(o),s=l*Kt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function Kg(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Tp);const $g=["width","height","spikes","thickness",...gp];class qg extends Mp{constructor(t){super(t),this.type="star",this._cachedPoints=[],this.numberType=fd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e,spikes:i}=this.attribute;return(null==t||t>0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return Dp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Ml,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Tp;class Jg extends Xg{constructor(t){super(t),this.type="arc3d",this.numberType=id}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),Ua.graphicService.updateTempAABBBounds(i),Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return Jg.NOWORK_ANIMATE_ATTR}}function Qg(t){return new Jg(t)}var tf;Jg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Tp),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(tf||(tf={}));let ef=class t extends Mp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=ad,this._childUpdateTag=xo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(ap(this.sharedStateScope,t),dp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Ip),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Ip)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===So.GLOBAL){const i=new re(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&xo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Dl.x,y:e=Dl.y,dx:i=Dl.dx,dy:s=Dl.dy,scaleX:n=Dl.scaleX,scaleY:r=Dl.scaleY,angle:a=Dl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Dp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Ua.graphicService.updateTempAABBBounds(i),Ua.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=xo.CLEAR_BOUNDS,this._childUpdateTag&=xo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&xo.UPDATE_BOUNDS||(this._childUpdateTag|=xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:Ua.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&xo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Ua.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&ap(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return op({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function sf(t){return new ef(t)}ef.NOWORK_ANIMATE_ATTR=Tp;const nf=["points","cornerRadius",...gp];class rf extends Mp{constructor(t){super(t),this.type="polygon",this.numberType=cd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Dp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Ua.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,nf)}needUpdateTag(t){return super.needUpdateTag(t,nf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Ml,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new rf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rf.NOWORK_ANIMATE_ATTR}}function af(t){return new rf(t)}rf.NOWORK_ANIMATE_ATTR=Tp;class of extends rf{constructor(t){super(t),this.type="pyramid3d",this.numberType=dd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),Ua.graphicService.updateTempAABBBounds(i),Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,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}getNoWorkAnimateAttr(){return of.NOWORK_ANIMATE_ATTR}}function lf(t){return new of(t)}of.NOWORK_ANIMATE_ATTR=Tp;class hf extends ef{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function cf(t){return new hf(t)}class df{constructor(){this.registry=new Map}create(t,e){const i=this.registry.get(t);if(!i)throw new Error(`GraphicFactory has no creator registered for type "${t}"`);return new i(e)}register(t,e){if(!t)throw new Error("GraphicFactory requires a non-empty graphic type");this.registry.set(t,e)}}const uf=new df;const pf=new class{constructor(){this.store=new Map}registerStore(t,e){this.store.set(t,e),this[t]=e}RegisterGraphicCreator(t,e){gf(t,e)}CreateGraphic(t,e){return this.store.has(t)?ff(t,e):null}};function gf(t,e){if(!t)throw new Error("Graphic registration requires a non-empty graphic type");pf.registerStore(t,e),uf.register(t,function(t){return class{constructor(e){try{return new t(e)}catch(i){return t(e)}}}}(e))}function ff(t,e){return uf.create(t,e)}function mf(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=m[1];y[2]=null!==(s=m[2])&&void 0!==s?s:0}if(ou(t),du(t,t,[n+o,r+l,a+h]),du(t,t,[y[0],y[1],y[2]]),lu(t,t,g),hu(t,t,p),du(t,t,[-y[0],-y[1],y[2]]),pu(t,t,[c,d,u]),f){const i=ku.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}du(i,i,[s[0],s[1],0]),cu(i,i,f),du(i,i,[-s[0],-s[1],0]),gu(t,t,i)}}function vf(t){const{alpha:e,beta:i}=t.attribute;return e||i}class yf{constructor(t=pf){this.creator=t,this.hooks={onAttributeUpdate:new Ha(["graphic"]),onSetStage:new Ha(["graphic","stage"]),onRemove:new Ha(["graphic"]),onRelease:new Ha(["graphic"]),onAddIncremental:new Ha(["graphic","group","stage"]),onClearIncremental:new Ha(["graphic","group","stage"]),beforeUpdateAABBBounds:new Ha(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Ha(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new Ha(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Vp(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Up(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Yc(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Yc(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Ne(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}let _f,bf;function xf(t){return _f||(_f=ff("text",{})),_f.initAttributes(t),_f.AABBBounds}function Sf(t){return bf||(bf=ff("richtext",{})),bf.setAttributes(t),bf.AABBBounds}const Af=Symbol.for("TransformUtil"),kf=Symbol.for("GraphicUtil"),Cf=Symbol.for("LayerService"),Tf=Symbol.for("StaticLayerHandlerContribution"),Mf=Symbol.for("DynamicLayerHandlerContribution"),wf=Symbol.for("VirtualLayerHandlerContribution"),Ef=Symbol.for("RenderService"),Bf=Symbol.for("BeforeRenderConstribution"),Pf=Symbol.for("AutoEnablePlugins"),Rf=Symbol.for("PluginService"),Of=Symbol.for("GraphicPicker"),If=Symbol.for("PickerService"),Lf=Symbol.for("BoundsPicker"),Df=Symbol.for("GlobalPickerService"),Ff=Symbol.for("PickItemInterceptor"),zf=Symbol.for("PickServiceInterceptor"),Hf=Symbol.for("IncrementalDrawContribution"),jf=Symbol.for("ArcRender"),Nf=Symbol.for("Arc3dRender"),Uf=Symbol.for("AreaRender"),Vf=Symbol.for("CircleRender"),Wf=Symbol.for("GraphicRender"),Gf=Symbol.for("GroupRender"),Yf=Symbol.for("LineRender"),Xf=Symbol.for("PathRender"),Kf=Symbol.for("PolygonRender"),$f=Symbol.for("RectRender"),qf=Symbol.for("Rect3DRender"),Zf=Symbol.for("SymbolRender"),Jf=Symbol.for("TextRender"),Qf=Symbol.for("RichTextRender"),tm=Symbol.for("Pyramid3dRender"),em=Symbol.for("GlyphRender"),im=Symbol.for("ImageRender"),sm=Symbol.for("RenderSelector"),nm=Symbol.for("DrawContribution"),rm=Symbol.for("StarRender"),am=Symbol.for("VWindow"),om=Symbol.for("WindowHandlerContribution");function lm(t){const e=Ua.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class hm extends Ga{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=Ua.global,e=lm){super(),this.handlerFactory=e,this.hooks={onChange:new Ha(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=ja.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&>(this.width,t.width())&>(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class cm{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Md(Object.assign({nativeCanvas:Ua.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Md(Object.assign({nativeCanvas:Ua.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const dm=new cm;class um{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Ua.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=dm.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:jl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:jl.fontFamily,fontSize:jl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=Ua.windowFactory)||void 0===s?void 0:s.call(Ua))&&void 0!==n?n:new hm(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var pm;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(pm||(pm={}));const gm=new Ge;class fm{constructor(){this.matrix=new Ge}init(t){return this.mode=pm.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=pm.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(gm.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(gm.a,gm.b,gm.c,gm.d,gm.e,gm.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(gm.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(gm.a,gm.b,gm.c,gm.d,gm.e,gm.f),this}scale(t,e,i){return this.mode===pm.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===pm.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return gm.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(gm.a,gm.b,gm.c,gm.d,gm.e,gm.f),this}translate(t,e){return this.mode===pm.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===pm.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}class mm{constructor(){this.global=Ua.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ge(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new re(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var vm=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function ym(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function _m(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=ym(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=ym(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Sm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Am{constructor(){this.time=To.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(Tm(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Dp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){Im(t,e,i,s)}}const km=new Am,Cm=new Set(["top","center","bottom"]);function Tm(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Mm({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const wm={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Em({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=wm[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Mm({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Bm(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Pm(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:Cm.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Bm(s,e,"left","center","right"),y:Bm(n,i,"top","center","bottom")}}function Rm(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Om(t){if(!t)return null;const e=Rm(t.naturalWidth,t.videoWidth,t.width),i=Rm(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Im(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Om(e),{backgroundRepeatMode:m,backgroundSizing:v}=Em({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Pm(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=dm.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),dm.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class Lm{constructor(t){this.subRenderContribitions=t,this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}}class Dm{constructor(){this.time=To.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const Fm=new Dm;class zm{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Hm=new zm,jm={getContributions:()=>[]};class Nm{constructor(t=[],e=jm,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):_m(e,Gl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ue,this.backupDirtyBounds=new Ue,this.global=null!==(s=i.global)&&void 0!==s?s:Ua.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:Ua.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:jm,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Gl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Gl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Au.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=xm(e,i,Gl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Sm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Au.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Sm.free(n),Au.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||function(){const t=Ua.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class Vm{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class Wm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Gm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Ym{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const Xm={getContributions:()=>[]};class Km{constructor(t=Xm,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new Gm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class $m{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class qm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Ua.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Ua.global.getRequestAnimationFrame();this.rafId=t((()=>{Ua.global.devicePixelRatio!==this.dpr&&(this.dpr=Ua.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Ua.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class Zm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ua.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Jm=new Ve;class Qm{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&xo.UPDATE_PAINT)||s._updateTag&xo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(Jm.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(Jm,t.parent&&t.parent.globalTransMatrix)))})),t.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let tv;function ev(){if(null==tv)try{const t=document.createElement("canvas"),e=t.getContext("2d");tv=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),tv&&(tv=!!document.createElement)}catch(t){tv=!1}}function iv(){ev();const t=Ua.global&&Ua.global.env;return t?"browser"===t:tv}const sv="white";class nv extends ef{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:sv}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Ip,this.hooks={beforeRender:new Ha(["stage"]),afterRender:new Ha(["stage"]),afterClearScreen:new Ha(["stage"]),afterClearRect:new Ha(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:Ua.global,!this.global.env&&iv()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:Ua.windowFactory)&&void 0!==n?n:()=>new hm(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=Ua.pickerServiceFactory)&&void 0!==a?a:()=>new mm,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=Ua.renderServiceFactory)||void 0===h?void 0:h.call(Ua))&&void 0!==c?c:Ua.renderService)&&void 0!==d?d:new Um,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=Ua.pluginServiceFactory)||void 0===p?void 0:p.call(Ua))&&void 0!==g?g:Ua.pluginService)&&void 0!==f?f:new Km,this.layerService=null!==(v=null!==(m=e.layerService)&&void 0!==m?m:Ua.layerService)&&void 0!==v?v:new cv(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:Ua.graphicService)&&void 0!==b?b:new yf,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:sv,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,op(s)),dp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new ao(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[y,_,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,A=Math.cos(d)*Math.cos(u)*1);const k=lv.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=lv.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=lv.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new $m))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new qm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new Zm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ue;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Qm,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=lv.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=lv.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=lv.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return op({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class rv{constructor(t=nv,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class av extends ef{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Ip,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Ua.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Ua.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}class ov{constructor(t=av){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let lv=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function hv(t){const e=Ua.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}lv._pluginClasses={};class cv{static GenerateLayerId(){return`${cv.idprefix}_${cv.prefix_count++}`}constructor(t=Ua.global,e=new ov,i=hv){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:cv.GenerateLayerId(),layerHandler:n})}),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}}cv.idprefix="visactor_layer",cv.prefix_count=0;const dv=Symbol("ContributionProvider");class uv{constructor(t,e){this.serviceIdentifier=t,this.container=e,mv.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function pv(t,e){return new uv(t,e)}function gv(t,e){t(dv).toDynamicValue((({container:t})=>pv(e,t))).inSingletonScope().whenTargetNamed(e)}function fv(t,e){t(dv).toDynamicValue((({container:t})=>pv(e,t))).whenTargetNamed(e)}class mv{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}mv.store=new Map;class vv{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=nh.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=kg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=kg(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}}const yv=Symbol.for("TextMeasureContribution");class _v extends vv{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function bv({bind:t}){t(gg).toDynamicValue((({container:t})=>new Xa(pv(pg,t)))).inSingletonScope(),t(am).to(hm),t(kf).toDynamicValue((({container:t})=>new um(pv(yv,t)))).inSingletonScope(),t(Af).to(fm).inSingletonScope(),t(Cf).to(cv).inSingletonScope()}function xv({bind:t}){t(Ef).to(Um)}const Sv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===id,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Ut;for(;o<0;)o+=Ut;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};class Av{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class kv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Dp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Au.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class Cv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class Tv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=Sv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function Mv({bind:t,isBound:e}){e(If)||(t(Df).toSelf(),t(If).toService(Df)),t(Tv).toSelf().inSingletonScope(),t(Ff).toService(Tv),t(kv).toSelf().inSingletonScope(),t(Ff).toService(kv),t(Cv).toSelf().inSingletonScope(),t(Ff).toService(Cv),gv(t,Ff),t(Av).toSelf().inSingletonScope(),t(zf).toService(Av),gv(t,zf)}function wv({bind:t}){t(yd).to(yf),t(_d).toConstantValue(pf)}class Ev{constructor(){this.type="static",this.offscreen=!1,this.global=Ua.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Md({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}}function Bv(t){(function({bind:t}){gv(t,pg)})({bind:t.bind}),function({bind:t}){t(yv).to(_v).inSingletonScope(),gv(t,yv)}({bind:t.bind}),function({bind:t}){t(Ev).toSelf(),t(Tf).toService(Ev)}({bind:t.bind})}const Pv=Ht/2;function Rv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Pv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Pv,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Pv,Ht,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ht,Ht+Pv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function Ov(t,e){return!(!t&&!e)}function Iv(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Lv(t,e,i){return i&&t*e>0}function Dv(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Fv(t,e){return t*e>0}function zv(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Hv(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uB*B+P*P&&(k=T,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Nv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*Gt(c),k=n*Kt(c),C=s*Gt(u),T=s*Kt(u);let M,w,E,B;if((b>zt||y>zt)&&(M=n*Gt(d),w=n*Kt(d),E=s*Gt(p),B=s*Kt(p),r1?0:P<-1?Ht:Math.acos(P))/2),l=$t(t[0]*t[0]+t[1]*t[1]);S=Xt(b,(s-l)/(o-1)),x=Xt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:M,yore:w,xire:C,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Uv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ut-zt)e.moveTo(i+n*Gt(o),s+n*Kt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Kt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:T,innerDeltaAngle:M,innerEndAngle:w,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Nv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=Xt(v,m),r=Xt(y,m),o=jv(g,f,u,p,n,t,Number(c)),l=jv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Gt(Wt(l.y01,l.x01)),s+o.cy+m*Kt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Kt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Kt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Gt(C),s+n*Kt(C));if(!(r>zt)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=Xt(B,T),n=Xt(P,T),o=jv(S,A,b,x,r,-n,Number(c)),l=jv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Kt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,w,E,c):e.moveTo(i+r*Gt(E),s+r*Kt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Kt(o)):e.closePath(),d}const Vv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Wv{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=dm.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),dm.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Ut),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=dm.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=tg({}));const C=h.columns?v/h.columns:b,T=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,T-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:Vv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=dm.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),dm.free(l),c}dm.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const Gv=new Wv;class Yv{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{innerPadding:m=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,T-=m;const w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:ru(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:T-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Uv(t,e,i,s,M+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&w(u,"outerBorder"),f&&w(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:T,startAngle:y,endAngle:_})}}const Xv=new Yv,Kv=Gv,$v=km;class qv{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:ru(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Zv=new qv,Jv=Gv,Qv=km;class ty extends Am{constructor(){super(...arguments),this.time=To.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Tm(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const ey=new ty;class iy{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:k-i)||0,w=(null!=w?w:C-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:ru(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,w-o*g)):(e.beginPath(),Rv(e,u,p,M-o*g,w-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}class sy{constructor(){this.time=To.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}}class ny{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Rv(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ry=new iy,ay=Gv,oy=km;class ly extends iy{constructor(){super(...arguments),this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}}const hy=new ly,cy=km;class dy{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:ru(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class uy{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const py=new dy,gy=new uy,fy=Gv,my=km,vy=Gv,yy=km;class _y extends Wv{constructor(){super(...arguments),this.time=To.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:xh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:xh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:xh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:xh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class by{constructor(t){this.groupRenderContribitions=t,this.numberType=ad}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ey)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Dp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:T=l.y}=t.attribute,M=Dv(p,m,g,f,c),w=zv(p,v,g,f),E=Ov(c,u),B=Iv(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(M||w||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Rv(e,i,s,g,f,y,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ey));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===To.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,T-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,C-i,T-s,l),e.stroke()))};A?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===To.afterFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Ua.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Dp(t,null==s?void 0:s.theme).group,i=ku.allocate(),n=ku.allocate();mf(n,t,e),gu(i,p||i,n),a.modelMatrix=i,ku.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ku.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var xy,Sy=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(xy||(xy={}));class Ay extends Nm{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=xy.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Ha([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Sy(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Gl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Gl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return Sy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Sy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Sy(this,void 0,void 0,(function*(){if(2!==t.count)yield bm(t,Gl.zIndex,((i,s)=>{if(this.status===xy.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Sy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Sy(this,void 0,void 0,(function*(){this.rendering&&(this.status=xy.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=xy.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 Sy(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:()=>Sy(this,void 0,void 0,(function*(){yield bm(t,Gl.zIndex,(t=>Sy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const ky=Symbol.for("DrawItemInterceptor"),Cy=new Ve,Ty=new Ve;class My{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Cy.copy(s.dirtyBounds),Ty.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Au.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Cy),s.backupDirtyBounds.copy(Ty)),!0}}class wy{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}class Ey{constructor(){this.order=1,this.interceptors=[new My,new Py,new By,new wy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ku.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const Ry=Symbol.for("ArcRenderContribution"),Oy=Symbol.for("AreaRenderContribution"),Iy=Symbol.for("CircleRenderContribution"),Ly=Symbol.for("GroupRenderContribution"),Dy=Symbol.for("ImageRenderContribution"),Fy=Symbol.for("PathRenderContribution"),zy=Symbol.for("PolygonRenderContribution"),Hy=Symbol.for("RectRenderContribution"),jy=Symbol.for("SymbolRenderContribution"),Ny=Symbol.for("TextRenderContribution"),Uy=Symbol.for("StarRenderContribution"),Vy=Symbol.for("CommonRenderContribution"),Wy=Symbol.for("InteractiveSubRenderContribution");function Gy(t){!function({bind:t}){t(Am).toSelf().inSingletonScope(),t(Wv).toSelf().inSingletonScope(),t(nm).to(Nm),t(Hf).to(Ay),t(Gf).toDynamicValue((({container:t})=>new by(pv(Ly,t)))).inSingletonScope(),t(Wf).toService(Gf),gv(t,Ly),gv(t,Wy),t(Lm).toDynamicValue((({container:t})=>new Lm(pv(Wy,t)))).inSingletonScope(),gv(t,Wf),t(Ey).toSelf().inSingletonScope(),t(ky).toService(Ey),gv(t,ky)}({bind:t.bind})}class Yy{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class Xy{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new Yy(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function Ky(){return new Xy}const $y=Ky();function qy(){qy.__loaded||(qy.__loaded=!0,bv({bind:$y.bind}),wv({bind:$y.bind}),xv({bind:$y.bind}),Mv({bind:$y.bind,isBound:$y.isBound}),function({bind:t}){t(Rf).to(Km),fv(t,Pf)}({bind:$y.bind}),Bv($y),Gy($y))}function Zy(){return $y}function Jy(t){qy();const[e]=$y.getAll(t);return e}function Qy(t,e){return qy(),$y.getNamed(t,e)}function t_(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}qy.__loaded=!1;const e_=t_((()=>Jy(gg)));Ua.global=e_;const i_=Zy(),s_=t_((()=>Jy(kf))),n_=t_((()=>Jy(Af))),r_=t_((()=>Jy(yd))),a_=t_((()=>Jy(Cf)));function o_(){Ua.global=e_,Ua.graphicUtil=s_,Ua.transformUtil=n_,Ua.graphicService=r_,Ua.layerService=a_,Ua.canvasFactory=t=>Qy(Cd,t),Ua.context2dFactory=t=>Qy(Td,t),Ua.windowFactory=()=>new hm(Ua.global),Ua.windowHandlerFactory=t=>function(t){const e=Qy(om,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),Ua.renderServiceFactory=()=>Jy(Ef),Ua.renderService=t_((()=>Jy(Ef))),Ua.pluginServiceFactory=()=>Jy(Rf),Ua.pluginService=t_((()=>Jy(Rf))),Ua.pickerServiceFactory=()=>Jy(If),Ua.layerHandlerFactory=t=>Jy("static"===t?Tf:"dynamic"===t?Mf:wf),Ua.incrementalDrawContributionFactory=()=>Jy(Hf)}o_();const l_={x:0,y:0,z:0,lastModelMatrix:null};class h_{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(Fm),e(Hm),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===To.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===To.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Dp(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,y=Lv(d,u,h),_=Fv(d,g),b=Ov(h),x=Iv(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Ro(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Lv(o,l,n),p=Fv(o,c),g=Ov(n,r),f=Iv(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;l_.x=n,l_.y=r,l_.z=a,l_.lastModelMatrix=d;const p=u&&(s||vf(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=ku.allocate(),n=ku.allocate();mf(n,t,e),gu(s,d||s,n),l_.x=0,l_.y=0,l_.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ku.free(n)}if(g&&!d){const s=t.getOffsetXY(e);l_.x+=s.x,l_.y+=s.y,l_.z=a,i.setTransformForCurrent()}else if(p)l_.x=0,l_.y=0,l_.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);l_.x+=s.x,l_.y+=s.y,this.transformWithoutTranslate(i,l_.x,l_.y,l_.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),l_.x=0,l_.y=0,l_.z=0;return l_}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,f,m,v,y,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ku.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class c_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ed,this.builtinContributions=[Xv,$v,Kv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nzt){const t=Xt(b,_),r=Xt(x,_),a=jv(v,y,f,m,n,t,Number(u)),o=jv(A,k,C,T,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||w<.001)e.lineTo(i+C,s+T),p=!0;else if(M>zt){const t=Xt(B,M),n=Xt(P,M),a=jv(C,T,A,k,r,-n,Number(u)),o=jv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Kt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Dp(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let T=0;const M=(c(S)&&S||S[0])&&"conical"===h.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Ut-zt){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),w||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Yu(0,0,h,n);a||Lv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}class d_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=nd,this.builtinContributions=[Zv,Qv,Jv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}function u_(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=No(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function p_(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function g_(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=p_(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),u_(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=ko.ROW:"y"===s?u=ko.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function m_(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}class v_ extends h_{constructor(){super(...arguments),this.numberType=ld}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();g_(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Tl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Xt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}function y_(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?ko.ROW:ko.COLUMN,Number.isFinite(c)||(o=ko.COLUMN),Number.isFinite(d)||(o=ko.ROW);const u=i*(o===ko.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),u_(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),u_(t,l,1,s),o=!1):o=!0}t.closePath()}const b_=new _y,x_=km;class S_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=sd,this.builtinContributions=[b_,x_],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Dp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:T,points:M,segments:w}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===C&&!w&&!M.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,_,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(w&&w.length){let e,i;const s=w.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Tl(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Tl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Tl(e,E,{curveTension:b}),n=Tl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Xt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=ko.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),A=Vt(y.y-b.y);x=null==y.x1?ko.ROW:null==y.y1?ko.COLUMN:Number.isFinite(S+A)?S>A?ko.ROW:ko.COLUMN:ko.ROW,y_(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),g_(t,i[0]?e.top:e.bottom,l,x===ko.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const A_=Gv,k_=km;class C_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=hd,this.builtinContributions=[k_,A_],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Dp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)Ro(t.pathShape.commandList,e,i,s,1,1,f);else{Ro((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}class T_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=ud,this.builtinContributions=[ry,oy,ay],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Dp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:M}=t.attribute;T=(null!=T?T:b-S)||0,M=(null!=M?M:x-A)||0;const w=Dv(g,f,T,M,h),E=zv(g,v,T,M,C),B=Ov(h,c),P=Iv(d,m);if(!t.valid||!y)return;if(!B&&!P)return;if(!(w||E||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,M)):(e.beginPath(),Rv(e,i,s,T,M,u,"bevel"!==p));const R={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,w,E,l,n,a,o,R),k?(this._runStroke(t,e,i,s,l,R,E,S,A,o),this._runFill(t,e,i,s,l,R,w,S,A,a)):(this._runFill(t,e,i,s,l,R,w,S,A,a),this._runStroke(t,e,i,s,l,R,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,w,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}class M_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=md,this.builtinContributions=[py,my,fy,gy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Dp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,M=s,w=C;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,C);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,M=t.y,w=void 0}!1===A.draw(e,c,T,M,w,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,A,a)):(this._runFill(t,e,i,s,l,x,y,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const w_=new class extends Am{constructor(){super(...arguments),this.time=To.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:w=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:R=l.backgroundClip,backgroundCornerRadius:O=l.backgroundCornerRadius}=t.attribute;let I,{background:L}=t.attribute;if(!L)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(L)&&L.background?L:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Sm.allocate(i,s,i+n,s+r),L=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=xf(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const i=t.resources.get(L);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,R&&(e.beginPath(),O?Rv(e,F.x1,F.y1,F.width(),F.height(),O,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:T,backgroundKeepAspectRatio:M,backgroundScale:w,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=L,O?(Rv(e,F.x1,F.y1,F.width(),F.height(),O,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Sm.free(F),D()}};class E_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=vd,this.builtinContributions=[w_],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Dp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=Ch(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:T}=S,M=!f,w=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,T,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,w,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Au.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Au.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,w))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,w))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,w),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,w)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,w),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,w,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,w,e),this.afterRenderStep(t,e,i,s,C,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!u(c),_=y?c.width:i.clipedWidth,b=y?0:Up(d,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}function B_(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?B_(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void B_(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,y=v/m;const _=P_(d,u),b=P_(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=R_(h,y,_,d,u),A=R_(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,T=P_(k,C),M=R_(h,P_(y,v),T,k,C);let w=Math.atan2(S.y-M.y,S.x-M.x);const E=Math.atan2(A.y-M.y,A.x-M.x);let B=E-w;B<0&&(w=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const D_=["","repeat-x","repeat-y","repeat"];function F_(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?D_[i]:"no-repeat"}function z_({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=F_(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const H_={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function j_(t){return{backgroundMode:H_[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function N_({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=z_({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function U_(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=z_({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?j_(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Im(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class V_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=od,this.builtinContributions=[hy,cy],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:T,doStroke:M}=A;if(!S||!t.resources)return;const w=t.resources.get(S);if("success"!==w.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Rv(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),U_(e,w.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},O=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=N_({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),L=P||I;g?(O(),L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore()):(L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore(),O()),this.afterRenderStep(t,e,i,s,T,!1,k,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&y(s))return void lh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Dp(t).image;this._draw(t,a,!1,i)}}var W_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class G_{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return W_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class Y_{constructor(){this._uid=ja.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class X_{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Pu.Get(e,Bu.Color1),this.ambient=i;const s=$t(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Xt(Yt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=y(e)?Pu.Get(e,Bu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const K_=()=>{lv.registerPlugin("DirectionalLight",X_)};class $_{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=ku.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=ku.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return fu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=ku.allocate()),this._vp=gu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=ku.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=ku.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return mu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=ku.allocate()),this._vp=gu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return vu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;vu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const q_=()=>{lv.registerPlugin("OrthoCamera",$_)},Z_={getContributions:()=>[]},J_={getContributions:()=>[]};class Q_{constructor(t=Z_,e=J_,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:Ua.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:Z_,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:J_,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ge(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=Dp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new re(e.x,e.y);l.transformPoint(a,a);const o=Dp(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&ku.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Au.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class tb{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new Vm,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new Wm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new Ym,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new Gm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new rv(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new ov,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new df}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new Um(new Nm([],(t=this.registry.contribution,e=ky,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class eb{constructor(t={}){this.context=new tb(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function ib(t={}){return new eb(t)}class sb extends eb{}class nb extends eb{}class rb extends S_{constructor(){super(...arguments),this.numberType=sd}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Dp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Lv(u,d,c),f=Ov(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=Dp(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=Lv(u,p,c),y=Fv(u,g),_=Ov(c),b=Iv(d,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||a||o))return;const{context:x}=n;for(let n=e;n{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function fb(t,e){let i=cb.get(t);i||(i=new Map,cb.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function mb(t,e,i){const s=fb(t,e);i&&s.forEach((t=>i(t))),s.clear()}function vb(){return ub(),ob}function yb(){mv.refreshAllContributions()}function _b(){return ub(),null!=lb||(lb=new Xa(pv(pg,ob))),lb}function bb(t){const e=vb(),i=_b();Ua.global=i,Ua.canvasFactory=t=>e.getNamed(Cd,t),Ua.context2dFactory=t=>e.getNamed(Td,t),Ua.windowHandlerFactory=t=>pb(om,t),Ua.windowFactory=()=>new hm(i,(t=>pb(om,t))),Ua.pluginServiceFactory=()=>new Km(pv(Pf,e),{pluginRegistry:t.context.registry.plugin}),Ua.incrementalDrawContributionFactory=()=>new Ay([],new ab,new rb(pv(Oy,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,ky))}function xb(t){var e;const i=vb();yb();const s=i.getAll(Wf),n=fb(t.registry.renderer,"vrender:runtime-renderer");mb(t.registry.renderer,"vrender:runtime-renderer",null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),gb(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,"vrender:runtime-renderer")}function Sb(t){var e;const i=vb();yb();const s=i.getAll(ky),n=null!==(e=db.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,ky,e)})),n.clear(),db.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(ky));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(ky,e),r.add(e)),n.add(e)}))}function Ab(t,e){var i;const s=vb();yb();const n=s.getAll(e),r=fb(t.registry.picker,"vrender:runtime-picker");mb(t.registry.picker,"vrender:runtime-picker",null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),gb(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,"vrender:runtime-picker")}function kb(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function Cb(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function Tb(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function Mb(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function Lb(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=ng(t.attribute),n=Fb(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=Fb(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=Fb(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;n{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return Xb(l,e,h),h},Vb=(t,e)=>{const i=t.attribute,s=i.points;if(s)return Nb(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return Nb(t,e)}return[]};const Wb=t=>t.map((t=>({x:t.x,y:t.y}))),Gb=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},Yb=t=>{const e=new Ue;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return Gb(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return Gb(t,{x:e.x1,y:n},{x:e.x2,y:n})},Xb=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=Yb(t);Xb(n[0],s,i),Xb(n[1],e-s,i)}},Kb=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:Wb(i)}];const s=[];return Xb(i,e,s),s},$b=(t,e)=>{const i=Ib(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;rObject.assign({},t))):[]}function Zb(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:qb(t.touches),configurable:!0},changedTouches:{value:qb(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function Jb(t,e){try{return t[e]}catch(t){return}}function Qb(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Zb(t),l=Jb(t,"target"),h=Jb(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var tx=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function sx(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class nx{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:ix(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},ex(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},ex(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=tx(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=ix(i,this.selectionStartCursorIdx),a=ix(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=ex(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=sx(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),Ua.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),Ua.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class rx{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=ix(i,Math.ceil(t)),n=ix(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=ix(i.attribute.textConfig,a),h=ix(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(ax,[this.formatTextCommandCb]),this.commandCbs.set(ox,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):g(t)&&e.forEach((e=>H(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new nx,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),Ua.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(Ua.global.isMacOS()&&t.metaKey&&"c"===t.key||!Ua.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return Ua.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(Ua.global.isMacOS()&&t.metaKey&&"a"===t.key||!Ua.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},ex(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=Hg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:Sf(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||og({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},ex(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),Ua.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=sf({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,lx.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=sg({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=sf({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=Sf(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=Sf(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(og({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(og({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(og({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=Sf(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=Sf(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:Sf(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Mx=new Tx;function Ex(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Bx=new WeakSet;function Px({bind:t}){Ex(Bx,t)||(t(c_).toDynamicValue((({container:t})=>new c_(pv(Ry,t)))).inSingletonScope(),t(jf).toService(c_),t(Wf).toService(jf),t(Ry).toService(Lm),gv(t,Ry))}const Rx=Px,Ox=new WeakSet;function Ix({bind:t}){Ex(Ox,t)||(t(T_).toDynamicValue((({container:t})=>new T_(pv(Hy,t)))).inSingletonScope(),t($f).toService(T_),t(Wf).toService($f),t(ny).toSelf(),t(sy).toSelf(),t(Hy).toService(ny),t(Hy).toService(sy),t(Hy).toService(Lm),gv(t,Hy))}const Lx=Ix,Dx=new WeakSet;function Fx({bind:t}){Ex(Dx,t)||(t(v_).toDynamicValue((()=>new v_)).inSingletonScope(),t(Yf).toService(v_),t(Wf).toService(Yf))}const zx=Fx,Hx=new WeakSet;function jx({bind:t}){Ex(Hx,t)||(t(S_).toDynamicValue((({container:t})=>new S_(pv(Oy,t)))).inSingletonScope(),t(Uf).toService(S_),t(Wf).toService(Uf),t(Oy).toService(Lm),gv(t,Oy))}const Nx=jx,Ux=new WeakSet;function Vx({bind:t}){Ex(Ux,t)||(t(M_).toDynamicValue((({container:t})=>new M_(pv(jy,t)))).inSingletonScope(),t(Zf).toService(M_),t(Wf).toService(Zf),t(jy).toService(Lm),gv(t,jy))}const Wx=Vx,Gx=new WeakSet;function Yx({bind:t}){Ex(Gx,t)||(t(d_).toDynamicValue((({container:t})=>new d_(pv(Iy,t)))).inSingletonScope(),t(Vf).toService(d_),t(Wf).toService(Vf),t(Iy).toService(Lm),gv(t,Iy))}const Xx=Yx,Kx=new WeakSet;function $x({bind:t}){Ex(Kx,t)||(t(Jf).toDynamicValue((({container:t})=>new E_(pv(Ny,t)))).inSingletonScope(),t(Wf).toService(Jf),t(Ny).toService(Lm),gv(t,Ny))}const qx=$x,Zx=new WeakSet;function Jx({bind:t}){Ex(Zx,t)||(t(C_).toDynamicValue((({container:t})=>new C_(pv(Fy,t)))).inSingletonScope(),t(Xf).toService(C_),t(Wf).toService(Xf),t(Fy).toService(Lm),gv(t,Fy))}const Qx=Jx,tS=new WeakSet;function eS({bind:t}){Ex(tS,t)||(t(Kf).toDynamicValue((({container:t})=>new L_(pv(zy,t)))).inSingletonScope(),t(Wf).toService(Kf),t(zy).toService(Lm),gv(t,zy))}const iS=eS;class sS extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[yy,vy],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const nS=new WeakSet;function rS({bind:t}){Ex(nS,t)||(t(sS).toDynamicValue((({container:t})=>new sS(pv(Uy,t)))).inSingletonScope(),t(rm).toService(sS),t(Wf).toService(rm),gv(t,Uy))}const aS=rS;class oS{constructor(){this.numberType=rd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Dp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const lS=new WeakSet;function hS({bind:t}){Ex(lS,t)||(t(oS).toDynamicValue((()=>new oS)).inSingletonScope(),t(em).toService(oS),t(Wf).toService(em))}const cS=hS;class dS extends h_{constructor(){super(),this.numberType=gd,this.builtinContributions=[w_],this.init()}drawShape(t,e,i,s,n){const r=Dp(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Lv(o,l,!0),d=Lv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Dp(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,y)):(e.beginPath(),Rv(e,i-t,s-n,v,y,f,!0)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,s,o,l))}draw(t,e,i){const s=Dp(t).richtext;this._draw(t,s,!1,i)}}const uS=new WeakSet;function pS({bind:t}){Ex(uS,t)||(t(dS).toDynamicValue((()=>new dS)).inSingletonScope(),t(Qf).toService(dS),t(Wf).toService(Qf))}const gS=pS,fS=new WeakSet;function mS({bind:t}){Ex(fS,t)||(t(im).toDynamicValue((({container:t})=>new V_(pv(Dy,t)))).inSingletonScope(),t(Wf).toService(im),t(Dy).toService(Lm),gv(t,Dy))}const vS=mS;class yS extends h_{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Pu.Get(r,Bu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[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+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class _S extends yS{constructor(){super(...arguments),this.type="rect3d",this.numberType=pd}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=Dp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,T=Dv(v,y,A,k,d),M=zv(v,b,A,k,S),w=Ov(d),E=Iv(u,_);if(!t.valid||!x)return;if(!w&&!E)return;if(!(T||M||a||o))return;const{light:B}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,B,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=Dp(t).rect;this._draw(t,s,!1,i)}}const bS=new WeakSet;function xS({bind:t}){Ex(bS,t)||(t(_S).toDynamicValue((()=>new _S)).inSingletonScope(),t(qf).toService(_S),t(Wf).toService(qf))}const SS=xS;class AS extends h_{constructor(){super(...arguments),this.numberType=id}drawShape(t,e,i,s,n,r,a,o){var l;const h=Dp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Pu.Get(c,Bu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},T={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Ut-zt)e.moveTo(i+r*Gt(o),s+r*Kt(o),n),e.arc(i,s,r,o,l,!c,n),a>zt&&(e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Gt(p),y=r*Kt(p),_=a*Gt(f),b=a*Kt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>zt)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Ut,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=zt)e.moveTo(i,s,n);else if(c>=Ut-zt)e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Gt(h),s+a*Kt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Gt(c),f=a*Kt(c),m=a*Gt(p),v=a*Kt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const kS=new WeakSet;function CS({bind:t}){Ex(kS,t)||(t(AS).toDynamicValue((()=>new AS)).inSingletonScope(),t(Nf).toService(AS),t(Wf).toService(Nf))}const TS=CS;class MS extends yS{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=dd}drawShape(t,e,i,s,n,r,a,o){var l;const h=Dp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=Dp(t).polygon;this._draw(t,s,!1,i)}}const wS=new WeakSet;function ES({bind:t}){Ex(wS,t)||(t(MS).toDynamicValue((()=>new MS)).inSingletonScope(),t(tm).toService(MS),t(Wf).toService(tm))}const BS=ES;function PS(){gf("arc",Kg)}function RS(){gf("arc3d",Qg)}function OS(){gf("area",Gg)}function IS(){gf("circle",Np)}function LS(){gf("glyph",ug)}function DS(){gf("group",sf)}function FS(){gf("image",Rg)}function zS(){gf("line",sg)}function HS(){gf("path",Ug)}function jS(){gf("polygon",af)}function NS(){gf("star",Zg)}function US(){gf("pyramid3d",lf)}function VS(){gf("rect",og)}function WS(){gf("rect3d",cg)}function GS(){gf("richtext",Hg)}function YS(){gf("symbol",tg)}function XS(){gf("text",Kp)}function KS(){gf("shadowRoot",cf)}function $S(){gf("wrapText",Zp)}class qS{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?Ua.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Ua.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Wp("text"===t.type&&t.attribute?t.attribute:Dp(t).text)}getTransformOfText(t){const e=Dp(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let p=n.anchorType;if(u(p)&&(p="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===p&&(p="top-left"),"position"===p||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=ze(c,p);l=t.x,h=t.y}const f=Ua.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),v=e.viewBox,_=l+m.left-f.left+v.x1,b=h+m.top-f.top+v.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===p&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:b,left:_,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else g(n.style)?o=Object.assign(Object.assign({},o),n.style):y(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));Ua.global.updateDom(i,{width:n.width,height:n.height,style:o})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===Ua.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Gl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Gl.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&Ua.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===Ua.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const ZS=()=>{lv.registerPlugin("HtmlAttributePlugin",qS)};class JS extends qS{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?Ua.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&Ua.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const QS=()=>{lv.registerPlugin("ReactAttributePlugin",JS)};class tA{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/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,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}const eA=()=>{lv.registerPlugin("ViewTransform3dPlugin",tA)},iA=new Ve;class sA{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=ja.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Dp(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},f=g.main,m=g.cross;"column"!==r&&"column-reverse"!==r||(f.len=d,m.len=c,f.field="y",m.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,y=0;const _=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===f.field?e.width():e.height(),s="x"===m.field?e.width():e.height();_.push({mainLen:i,crossLen:s}),v+=i,y=Math.max(y,s)}));const b=[];if(v>f.len&&"wrap"===a){let t=0,e=0;_.forEach((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),b.push({idx:_.length-1,mainLen:t,crossLen:e})}else b.push({idx:_.length-1,mainLen:v,crossLen:y});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,f,_,x,t),x=t.idx+1})),y=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":m.len,center:m.len/2};this.layoutCross(p,o,m,t,_,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(m.len-y)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",m,s,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(m.len-y)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(m.len-y)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&iA.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(iA.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const nA=()=>{lv.registerPlugin("FlexLayoutPlugin",sA)};var rA=Object.freeze({__proto__:null,ARC3D_NUMBER_TYPE:id,ARC_NUMBER_TYPE:ed,AREA_NUMBER_TYPE:sd,AbstractGraphicRender:class{},get AnimateMode(){return Pl},get AnimateStatus(){return Il},get AnimateStepType(){return Ol},AppContext:tb,Application:Na,Arc:Xg,Arc3d:Jg,Arc3dRender:Nf,ArcRender:jf,ArcRenderContribution:Ry,Area:Wg,AreaRender:Uf,AreaRenderContribution:Oy,get AttributeUpdateType(){return Ao},AutoEnablePlugins:Pf,BaseCanvas:Eu,BaseEnvContribution:G_,BaseRender:h_,get BaseRenderContributionTime(){return To},BaseWindowHandlerContribution:Y_,Basis:Qo,BeforeRenderConstribution:Bf,BoundsContext:lo,BoundsPicker:Lf,BrowserEntry:eb,CIRCLE_NUMBER_TYPE:nd,Canvas3DDrawItemInterceptor:Py,Canvas3DPickItemInterceptor:Tv,CanvasFactory:Cd,CanvasTextLayout:Gp,Circle:jp,CircleRender:Vf,CircleRenderContribution:Iy,ColorInterpolate:Wu,ColorStore:Pu,get ColorType(){return Bu},CommonDrawItemInterceptorContribution:Ey,CommonRenderContribution:Vy,Context2dFactory:Td,ContributionProvider:dv,ContributionRegistry:Ym,ContributionStore:mv,CubicBezierCurve:Uo,CurveContext:Cl,get CurveTypeEnum(){return Co},CustomEvent:to,CustomPath2D:Ml,CustomSymbolClass:wc,DEFAULT_TEXT_FONT_FAMILY:fg,DebugDrawItemInterceptorContribution:wy,DefaultArcAllocate:ux,DefaultArcAttribute:Yl,DefaultArcRenderContribution:Yv,DefaultAreaAllocate:gx,DefaultAreaAttribute:Xl,DefaultAreaTextureRenderContribution:_y,DefaultAttribute:Gl,DefaultBaseBackgroundRenderContribution:Am,DefaultBaseClipRenderAfterContribution:zm,DefaultBaseClipRenderBeforeContribution:Dm,DefaultBaseInteractiveRenderContribution:Lm,DefaultBaseTextureRenderContribution:Wv,DefaultCanvasAllocate:cm,DefaultCanvasArcRender:c_,DefaultCanvasAreaRender:S_,DefaultCanvasCircleRender:d_,DefaultCanvasGroupRender:by,DefaultCanvasImageRender:V_,DefaultCanvasLineRender:v_,DefaultCanvasPathRender:C_,DefaultCanvasPolygonRender:L_,DefaultCanvasRectRender:T_,DefaultCanvasSymbolRender:M_,DefaultCanvasTextRender:E_,DefaultCircleAllocate:mx,DefaultCircleAttribute:Kl,DefaultCircleRenderContribution:qv,DefaultConnectAttribute:Vl,DefaultDebugAttribute:Wl,DefaultFillStyle:Fl,DefaultGlobal:Xa,DefaultGlobalPickerService:mm,DefaultGlyphAttribute:ql,DefaultGraphicAllocate:hx,DefaultGraphicMemoryManager:Tx,DefaultGraphicService:yf,DefaultGraphicUtil:um,DefaultGroupAttribute:$l,DefaultGroupBackgroundRenderContribution:ty,DefaultImageAttribute:ah,DefaultImageRenderContribution:ly,DefaultLayerService:cv,DefaultLayout:Ll,DefaultLineAllocate:yx,DefaultLineAttribute:Zl,DefaultMat4Allocate:Su,DefaultMatrixAllocate:xu,DefaultPathAllocate:bx,DefaultPathAttribute:Jl,DefaultPickService:Q_,DefaultPickStyle:Nl,DefaultPolygonAttribute:Ql,DefaultRect3dAttribute:ih,DefaultRectAllocate:cx,DefaultRectAttribute:eh,DefaultRectRenderContribution:iy,DefaultRenderService:Um,DefaultRichTextAttribute:rh,DefaultRichTextIconAttribute:oh,DefaultStarAttribute:th,DefaultStrokeStyle:Hl,DefaultStyle:Ul,DefaultSymbolAllocate:Sx,DefaultSymbolAttribute:sh,DefaultSymbolClipRangeStrokeRenderContribution:uy,DefaultSymbolRenderContribution:dy,DefaultTextAllocate:kx,DefaultTextAttribute:nh,DefaultTextMeasureContribution:_v,DefaultTextStyle:jl,DefaultTransform:Dl,DefaultTransformUtil:fm,DefaultWindow:hm,get Direction(){return ko},DirectionalLight:X_,DrawContribution:nm,DrawItemInterceptor:ky,DynamicLayerHandlerContribution:Mf,get Edge(){return ch},EditModule:nx,EmptyContext2d:Mu,EnvContribution:pg,EventManager:so,EventSystem:ao,EventTarget:no,FORMAT_ALL_TEXT_COMMAND:ox,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:ax,Factory:lv,FederatedEvent:qa,FederatedMouseEvent:Za,FederatedPointerEvent:Ja,FederatedWheelEvent:Qa,FlexLayoutPlugin:sA,GLYPH_NUMBER_TYPE:rd,GRAPHIC_UPDATE_TAG_KEY:gp,GROUP_NUMBER_TYPE:ad,Generator:ja,GlobalPickerService:Df,Glyph:dg,GlyphRender:em,GradientParser:nu,Graphic:Mp,GraphicCreator:_d,GraphicFactory:df,GraphicPicker:Of,GraphicRender:Wf,GraphicService:yd,GraphicUtil:kf,Group:ef,GroupRender:Gf,GroupRenderContribution:Ly,get GroupUpdateAABBBoundsMode(){return tf},HtmlAttributePlugin:qS,get IContainPointMode(){return So},IMAGE_NUMBER_TYPE:od,Image:Pg,ImageRender:im,ImageRenderContribution:Dy,IncrementalDrawContribution:Hf,InteractiveDrawItemInterceptorContribution:By,InteractivePickItemInterceptorContribution:Cv,InteractiveSubRenderContribution:Wy,LINE_NUMBER_TYPE:ld,Layer:av,LayerFactory:ov,LayerService:Cf,Line:ig,LineRender:Yf,Linear:$o,LinearClosed:vl,Mat4Allocate:_u,MatrixAllocate:yu,get MeasureModeEnum(){return Bl},MiniappEntry:nb,MonotoneX:al,MonotoneY:ol,NOWORK_ANIMATE_ATTR:Tp,Node:$a,NodeEntry:sb,OrthoCamera:$_,PATH_NUMBER_TYPE:hd,POLYGON_NUMBER_TYPE:cd,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:dd,Path:Ng,PathRender:Xf,PathRenderContribution:Fy,PerformanceRAF:Wa,PickItemInterceptor:Ff,PickServiceInterceptor:zf,PickerRegistry:Wm,PickerService:If,PluginRegistry:Gm,PluginService:Rf,Polygon:rf,PolygonRender:Kf,PolygonRenderContribution:zy,Pyramid3d:of,Pyramid3dRender:tm,RECT3D_NUMBER_TYPE:pd,RECT_NUMBER_TYPE:ud,RICHTEXT_NUMBER_TYPE:gd,RafBasedSTO:Sh,ReactAttributePlugin:JS,Rect:ag,Rect3DRender:qf,Rect3d:hg,RectRender:$f,RectRenderContribution:Hy,ReflectSegContext:Yo,RenderSelector:sm,RenderService:Ef,RendererRegistry:Vm,ResourceLoader:lh,RichText:zg,RichTextEditPlugin:lx,RichTextRender:Qf,STAR_NUMBER_TYPE:fd,get STATUS(){return Rl},SVG_ATTRIBUTE_MAP:bd,SVG_ATTRIBUTE_MAP_KEYS:xd,SVG_PARSE_ATTRIBUTE_MAP:Sd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Ad,SYMBOL_NUMBER_TYPE:md,SegContext:Go,ShadowPickServiceInterceptorContribution:Av,ShadowRoot:hf,ShadowRootDrawItemInterceptorContribution:My,ShadowRootPickItemInterceptorContribution:kv,SplitRectAfterRenderContribution:ny,SplitRectBeforeRenderContribution:sy,Stage:nv,StageFactory:rv,Star:qg,StarRender:rm,StarRenderContribution:Uy,StateDefinitionCompiler:qu,StateEngine:tp,StaticLayerHandlerContribution:Tf,Step:ul,StepClosed:pl,Symbol:Qp,SymbolRender:Zf,SymbolRenderContribution:jy,TEXT_NUMBER_TYPE:vd,Text:Xp,get TextDirection(){return $c},TextMeasureContribution:yv,TextRender:Jf,TextRenderContribution:Ny,Theme:Ip,TransformUtil:Af,get UpdateTag(){return xo},VGlobal:gg,VWindow:am,ViewTransform3dPlugin:tA,VirtualLayerHandlerContribution:wf,WILDCARD:"*",WindowHandlerContribution:om,WrapText:qp,XMLParser:Vc,_calculateLineHeight:kh,_interpolateColor:Iu,addArcToBezierPath:Bo,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:Ob,alignSubpath:Mb,application:Ua,applyTransformOnBezierCurves:Lb,arc3dModule:TS,arcModule:Rx,areaModule:Nx,bezier:wo,bezierCurversToPath:Db,binarySplitPolygon:Yb,bindArc3dRenderModule:CS,bindArcRenderModule:Px,bindAreaRenderModule:jx,bindCircleRenderModule:Yx,bindContributionProvider:gv,bindContributionProviderNoSingletonScope:fv,bindGlyphRenderModule:hS,bindImageRenderModule:mS,bindLineRenderModule:Fx,bindPathRenderModule:Jx,bindPolygonRenderModule:eS,bindPyramid3dRenderModule:ES,bindRect3dRenderModule:xS,bindRectRenderModule:Ix,bindRichtextRenderModule:pS,bindStarRenderModule:rS,bindSymbolRenderModule:Vx,bindTextRenderModule:$x,boundStroke:Yc,builtInSymbolStrMap:Pc,builtinSymbols:Ec,builtinSymbolsMap:Bc,calcLineCache:Tl,calculateArcCornerRadius:Nv,calculateLineHeight:Ch,canvasAllocate:dm,centroidOfSubpath:Bb,circleBounds:vh,circleModule:Xx,clock:eo,colorEqual:function(t,e){const i=si.parseColorString(t),s=si.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:Uu,configureRuntimeApplicationForApp:bb,container:i_,cornerTangents:jv,createApp:ib,createArc:Kg,createArc3d:Qg,createArea:Gg,createBrowserApp:ib,createCanvasEventTransformer:function(t,e,i,s){return Qb(t.parentElement,e,i,s)},createCircle:Np,createColor:au,createConicalGradient:Xu,createContributionProvider:pv,createEventTransformer:Qb,createGlyph:ug,createGraphic:ff,createGroup:sf,createImage:Rg,createLine:sg,createMat4:bu,createMiniappApp:function(t={}){return new nb(t)},createNodeApp:function(t={}){return new sb(t)},createPath:Ug,createPolygon:af,createPyramid3d:lf,createRect:og,createRect3d:cg,createRectPath:Rv,createRichText:Hg,createShadowRoot:cf,createStage:function(t){return o_(),(new rv).create(t)},createStar:Zg,createSymbol:tg,createText:Kp,createWrapText:Zp,cubicCalc:Do,cubicLength:Lo,cubicPointAt:Fo,cubicSubdivide:Tb,defaultArcAllocate:px,defaultArcBackgroundRenderContribution:$v,defaultArcRenderContribution:Xv,defaultArcTextureRenderContribution:Kv,defaultAreaAllocate:fx,defaultBaseBackgroundRenderContribution:km,defaultBaseClipRenderAfterContribution:Hm,defaultBaseClipRenderBeforeContribution:Fm,defaultBaseTextureRenderContribution:Gv,defaultCircleAllocate:vx,defaultCircleBackgroundRenderContribution:Qv,defaultCircleRenderContribution:Zv,defaultCircleTextureRenderContribution:Jv,defaultGraphicMemoryManager:Mx,defaultGroupBackgroundRenderContribution:ey,defaultImageBackgroundRenderContribution:cy,defaultImageRenderContribution:hy,defaultLineAllocate:_x,defaultPathAllocate:xx,defaultRectAllocate:dx,defaultRectBackgroundRenderContribution:oy,defaultRectRenderContribution:ry,defaultRectTextureRenderContribution:ay,defaultStarBackgroundRenderContribution:yy,defaultStarTextureRenderContribution:vy,defaultSymbolAllocate:Ax,defaultSymbolBackgroundRenderContribution:my,defaultSymbolClipRangeStrokeRenderContribution:gy,defaultSymbolRenderContribution:py,defaultSymbolTextureRenderContribution:fy,defaultTextAllocate:Cx,diff:Cb,divideCubic:No,drawArc:Eo,drawArcPath:Uv,drawAreaSegments:y_,drawBackgroundImage:Im,drawImageWithLayout:U_,drawIncrementalAreaSegments:m_,drawIncrementalSegments:f_,drawSegments:g_,enumCommandMap:po,fillVisible:Lv,findBestMorphingRotation:Rb,findConfigIndexByCursorIdx:ix,findCursorIdxByConfigIndex:sx,findNextGraphic:xm,flatten_simplify:kb,foreach:_m,foreachAsync:bm,genBasisSegments:el,genBasisTypeSegments:tl,genLinearClosedSegments:yl,genLinearClosedTypeSegments:_l,genLinearSegments:qo,genLinearTypeSegments:Zo,genMonotoneXSegments:hl,genMonotoneXTypeSegments:ll,genMonotoneYSegments:dl,genMonotoneYTypeSegments:cl,genNumberType:Kc,genStepClosedSegments:ml,genStepSegments:gl,genStepTypeSegments:fl,getAttributeFromDefaultAttrList:xh,getBackgroundImage:Tm,getConicGradientAt:Yu,getCurrentEnv:function(){return iv()?"browser":"node"},getDefaultCharacterConfig:ex,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Up(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=ku.allocate();return du(o,o,[a[0],a[1],0]),n&&lu(o,o,n),s&&hu(o,o,s),du(o,o,[-a[0],-a[1],0]),o},getLegacyBindingContext:Zy,getModelMatrix:mf,getRichTextBounds:Sf,getRuntimeInstallerBindingContext:vb,getRuntimeInstallerGlobal:_b,getScaledStroke:ru,getTextBounds:xf,getTheme:Dp,getThemeFromGroup:Fp,globalTheme:Lp,glyphModule:cS,graphicCreator:pf,graphicService:r_,graphicUtil:s_,identityMat4:ou,imageModule:vS,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeDrawContributionsToApp:Sb,installRuntimeGraphicRenderersToApp:xb,installRuntimePickersToApp:Ab,interpolateColor:Ou,interpolateGradientConicalColor:Fu,interpolateGradientLinearColor:Lu,interpolateGradientRadialColor:Du,interpolatePureColorArray:zu,interpolatePureColorArrayToStr:Hu,intersect:Hv,isBrowserEnv:iv,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){ev();const t=Ua.global&&Ua.global.env;return t?"node"===t:!tv},isSvg:Nc,isXML:Uc,layerService:a_,lineModule:zx,lookAt:fu,mapToCanvasPointForCanvas:function(t){var e;if(Od(t._canvasX)&&Od(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:uu,mat4Allocate:ku,matrixAllocate:Au,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i.c,b=i.d,x=0,S=0,t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=0,b=0,x=1,S=0,t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i.e,b=i.f,x=0,S=1,t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t},multiplyMat4Mat4:gu,newThemeObj:Pp,ortho:mu,parsePadding:gh,parseStroke:uh,parseSvgPath:bo,pathModule:Qx,pathToBezierCurves:Ib,point:Jo,pointEqual:yh,pointInterpolation:_h,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Jt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Jt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>yh(t,e[i]))):!Number.isNaN(t.x+t.y)&&yh(t,e))},pointsInterpolation:bh,polygonModule:iS,preLoadAllModule:qy,pyramid3dModule:BS,quadCalc:zo,quadLength:jo,quadPointAt:Ho,rafBasedSto:Ah,rect3dModule:SS,rectFillVisible:Dv,rectModule:Lx,rectStrokeVisible:zv,recursiveCallBinarySplit:Xb,refreshRuntimeInstallerContributions:yb,registerArc3dGraphic:RS,registerArcGraphic:PS,registerAreaGraphic:OS,registerCircleGraphic:IS,registerDirectionalLight:K_,registerFlexLayoutPlugin:nA,registerGlobalEventTransformer:function(t,e,i,s,n){const r=Qb(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:LS,registerGraphic:gf,registerGroupGraphic:DS,registerHtmlAttributePlugin:ZS,registerImageGraphic:FS,registerLineGraphic:zS,registerOrthoCamera:q_,registerPathGraphic:HS,registerPolygonGraphic:jS,registerPyramid3dGraphic:US,registerReactAttributePlugin:QS,registerRect3dGraphic:WS,registerRectGraphic:VS,registerRichtextGraphic:GS,registerShadowRootGraphic:KS,registerStarGraphic:NS,registerSymbolGraphic:YS,registerTextGraphic:XS,registerViewTransform3dPlugin:eA,registerWindowEventTransformer:function(t,e,i,s,n){const r=Qb(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:$S,renderCommandList:Ro,resolveBackgroundDrawMode:Em,resolveBackgroundParamsByImageSizing:j_,resolveBackgroundPosition:Pm,resolveBackgroundSizing:Mm,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:z_,resolveImageRepeatMode:F_,resolveRenderableImageSize:Om,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:gS,rotateX:lu,rotateY:hu,rotateZ:cu,runFill:Ov,runStroke:Iv,scaleMat4:pu,segments:Mo,shouldClipImageByLayout:N_,shouldUseMat4:vf,snapLength:Io,splitArc:Hb,splitArea:Ub,splitCircle:jb,splitLine:Vb,splitPath:$b,splitPolygon:Kb,splitRect:zb,splitToGrids:Fb,starModule:aS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Fv,symbolModule:Wx,textAttributesToStyle:Wp,textDrawOffsetX:Up,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Vp,textModule:qx,transformMat4:vu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:n_,translate:du,verticalLayout:qc,vglobal:e_,waitForAllSubLayers:Gc,wrapCanvas:Md,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=Ua.global)||void 0===t?void 0:t.env,s=i?null===(e=Ua.context2dFactory)||void 0===e?void 0:e.call(Ua,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=_(t)?t[0]:t,i=[];if(!e)return i;if(!0===Uc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};td(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};td(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});function aA(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),hA=(t,e)=>(d(dA.warnHandler)&&dA.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),cA=(t,e,i)=>{if(!d(dA.errorHandler))throw new Error(t);dA.errorHandler.call(null,t,e)},dA={silent:!1,warnHandler:!1,errorHandler:!1},uA=iv(),pA=uA&&globalThis?globalThis.document:void 0;function gA(t){return("desktop-browser"===t||"mobile-browser"===t)&&uA}function fA(t){return mA(t)||"mobile-browser"===t}function mA(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let vA=0;function yA(){return vA>=9999999&&(vA=0),vA++}function _A(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function bA(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}function xA(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&xA(t,e)}))}const SA=t=>!u(t)&&!1!==t.visible;function AA(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function kA(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const TA=["#ffffff","#000000"];function MA(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new si(t).toHex(),o=new si(e).toHex();return wA(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...TA);for(const n of a)if(t!==n&&wA(n,e,i,s,r))return n}(a,o,i,s,n,r)}function wA(t,e,i,s,n){if("lightness"===n){const i=si.getColorBrightness(new si(e));return si.getColorBrightness(new si(t))<.5?i>=.5:i<.5}return s?EA(t,e)>s:"largeText"===i?EA(t,e)>3:EA(t,e)>4.5}function EA(t,e){const i=BA(t),s=BA(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function BA(t){const e=ri(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function PA(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function RA(t,e){return[t[0]*e,t[1]*e]}function OA(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function IA(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const LA=ff,DA={arc:t=>LA("arc",t),circle:t=>LA("circle",t),group:t=>LA("group",t),image:t=>LA("image",t),line:t=>LA("line",t),path:t=>LA("path",t),polygon:t=>LA("polygon",t),rect:t=>LA("rect",t),richtext:t=>LA("richtext",t),symbol:t=>LA("symbol",t),text:t=>LA("text",t)},FA=-.5*Math.PI,zA=1.5*Math.PI,HA="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var jA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(jA||(jA={}));const NA={[jA.selectedReverse]:{},[jA.selected]:{},[jA.hover]:{},[jA.hoverReverse]:{}},UA={container:"",width:30,height:30,style:{}},VA="scrollDrag",WA=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:HA,fontSize:14},s),getTextBounds:i?void 0:xf,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function GA(t,e,i={}){if(!t)return{width:0,height:0};const s=xf({text:t,fontFamily:e.fontFamily||i.fontFamily||HA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function YA(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function XA(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function KA(t,e="type"){const i=YA(t,e);return"rich"===i?DA.richtext(XA(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),DA.text(t))}function $A(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const qA=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function ZA(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function JA(t,e){const{dx:i,dy:s}=ZA(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const QA={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},tk={size:8,stroke:"#000",lineWidth:1,zIndex:1};const ek=Math.sin(Math.PI/10);function ik(t,e=ek){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function sk(t,e=ek){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function nk(t){const e={};return xA(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function rk(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function ak(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return RA(r,(s?-1:1)*(n?-1:1)*t/OA(r))}function ok(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function hk(t,e,i){var s;if(sk(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>He(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>He(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function ck(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function pk(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function gk(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function fk(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function mk(t,e){const i=fk(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function vk(t,e){const i=yk(t),s=yk(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function yk(t,e={x:0,y:0}){return ae.distancePP(t,e)}function _k(t){return k(t.x)&&k(t.y)}function bk(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function xk(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const Sk=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function kk(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&kk(t[i],e)}}var Ck;!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"}(Ck||(Ck={}));const Tk={};function Mk(t){switch(t){case Ck.Linear:case Ck.Log:case Ck.Pow:case Ck.Sqrt:case Ck.Symlog:case Ck.Time:return!0;default:return!1}}function wk(t){return!!Tk[t]}function Ek(t){switch(t){case Ck.Ordinal:case Ck.Point:case Ck.Band:return!0;default:return!1}}function Bk(t){return t}Object.values(Ck).forEach((t=>{Tk[t]=!0}));const Pk=t=>-Math.log(-t),Rk=t=>-Math.exp(-t),Ok=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Ik=t=>10===t?Ok:t===Math.E?Math.exp:e=>Math.pow(t,e),Lk=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Dk=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Fk=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function zk(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 Hk(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function jk(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Nk(t,e,i,s){return 1===i&&(i=0),jk(t,i,s)*(e/(1-i))}function Uk(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Vk(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class Gk{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=Uk(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=yt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Yk=Symbol("implicit");class Xk extends Gk{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=Ck.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Yk}clone(){const t=(new Xk).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==Yk)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return Kk(t,e,r,n)}class qk extends Xk{constructor(t){super(),this.type=Ck.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=Nk(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:$k(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return $k(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new qk(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:Zk}=ai;function Jk(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=si.parseColorString(e)){const e=Zk(si.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof ni?Zk(t,e):e instanceof si?Zk(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class Qk extends Gk{constructor(t=Bk,e=Bk){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Bk,this._piecewise=Hk,this._interpolate=Jk}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Ct,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=bt(i[0],i[r-1])),this._piecewise=r>2?Vk:Hk,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Bk),this.rescale(i)):this._clamp!==Bk}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const tC=Math.sqrt(50),eC=Math.sqrt(10),iC=Math.sqrt(2),sC=[1,2,5,10],nC=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=lC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?aC(0,-(e-1)/s,s):aC((e-1)/s,0,s)},rC=vt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return nC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return nC(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=aC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=aC(t,e,l);return n&&r.reverse(),r})),lC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=sC[0];return i>=tC?s=sC[3]:i>=eC?s=sC[2]:i>=iC&&(s=sC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function hC(t,e,i){const s=(e-t)/Math.max(0,i);return lC(s)}function cC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=hC(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function uC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const pC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),gC=vt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),fC=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=oC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?pC(t,e,n):pC(t,e,Wk(n)),h=pC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),mC=vt(((t,e,i,s,n)=>cC(s(t),s(e),i).map((t=>Wk(n(t))))));class vC extends Qk{constructor(){super(...arguments),this.type=Ck.Linear}clone(){var t;const e=new vC;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return rC(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=oC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return cC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function _C(t){return e=>-t(-e)}function bC(t=Number.EPSILON){return e=>Math.max(e,t)}class xC extends Qk{constructor(){super(Lk(10),Ik(10)),this.type=Ck.Log,this._limit=bC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new xC).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=Lk(this._base),s=Ik(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=_C(i),this._pows=_C(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Pk,this.untransformer=Rk):(this._logs=i,this._pows=s,this._limit=bC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Bk}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return gC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return fC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(xC,yC);class SC extends vC{constructor(){super(Dk(1),Fk(1)),this.type=Ck.Symlog,this._const=1}clone(){return(new SC).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=Dk(t),this.untransformer=Fk(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return gC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return fC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(SC,yC);class AC{constructor(){this.type=Ck.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[lt(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 AC).domain(this._domain).range(this._range).unknown(this._unknown)}}var kC,CC,TC;function MC(t){var e,i;const{type:s}=t;return s===CC.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(kC||(kC={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(CC||(CC={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(TC||(TC={}));const wC={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},EC={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function BC(t,e){var i;if(!t)return[];const s=FC(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?LC(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>IC(i)?RC(t,i,e):i)).filter(p)}))):i.map((i=>IC(i)?RC(t,i,e):i)).filter(p):[]}return[]}function PC(t,e){var i,s;return LC(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function RC(t,e,i){var s;const n=FC(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=wC[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=EC[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!y(r))return r;let o=new si(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ke(t,i,s),a=Xe(n,r,e.l),l=new si(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const OC=(t,e)=>{if(e&&IC(t)){const i=RC(e,t);if(i)return i}return t};function IC(t){return t&&"palette"===t.type&&!!t.key}function LC(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function DC(t){return _(t)?{dataScheme:t}:t}function FC(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=MC(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class zC extends Xk{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!LC(this._range))return void super.range(this._range);const t=PC(this._range,this._domain);super.range(t)}}const HC={linear:vC,band:qk,point:class extends qk{constructor(t){super(!1),this.type=Ck.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:Xk,threshold:AC,colorOrdinal:zC};function jC(t){const e=HC[t];return e?new e:null}function NC(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function UC(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function VC(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function WC(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function GC(t){return!!y(t)&&(!!t.endsWith("%")&&_A(t.substring(0,t.length-1)))}function YC(t){return!!g(t)&&("percent"in t||"offset"in t)}function XC(t,e,i,s=0){var n,r;return S(t)?t:GC(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function KC(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=XC(t[s],e.size,i)}))})),o}function $C(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function qC(t){let e={};return _(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||GC(t)||d(t)||YC(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function ZC(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const JC=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},QC=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function tT(t,e){return t&&e.key in t?t[e.key]:e.default}function eT(t){return t&&"token"===t.type&&!!t.key}const iT={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},sT={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:QC,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:iT,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},nT={name:"dark",colorScheme:{default:{dataScheme:QC,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},rT=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),rT(t[s],e.slice(1),i))};function aT(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=DC(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}oT._charts={},oT._series={},oT._components={},oT._graphicComponents={},oT._marks={},oT._regions={},oT._animations={},oT._implements={},oT._chartPlugin={},oT._vChartPlugin={},oT._componentPlugin={},oT.transforms={fields:$r,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},oT.dataParser={csv:(t,e={},i)=>(i.type=Kr.DSV,aa(t)),dsv:(t,e={},i)=>{i.type=Kr.DSV;const s=Vr(la,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return ra(n).parse(t)},tsv:(t,e={},i)=>(i.type=Kr.DSV,oa(t))},oT._layout={},oT._grammarTransforms={},oT._stageEventPlugins={},oT.registerStageEventPlugin=(t,e)=>{oT._stageEventPlugins[t]=e},oT.getStageEventPlugin=t=>oT._stageEventPlugins[t],oT._interactionTriggers={},oT.registerInteractionTrigger=(t,e)=>{oT._interactionTriggers[t]=e},oT._composedEventMap={},oT.registerComposedEvent=(t,e)=>{oT._composedEventMap[t]=e},oT._tooltipProcessors={},oT.registerTooltipProcessor=(t,e)=>{oT._tooltipProcessors[t]=e},oT.createTooltipProcessor=(t,e)=>{const i=oT._tooltipProcessors[t];return i?new i(e):null};const cT=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},dT=cT(),uT={[sT.name]:sT},pT=sT.name,gT=new Map(Object.keys(uT).map((t=>[t,uT[t]]))),fT=new Map,mT=new Map(Object.keys(uT).map((t=>[t,t===pT]))),vT=(t,e)=>{if(!t)return;const i=xT(e);gT.set(t,i),mT.set(t,!0)},yT=(t=pT)=>(mT.has(t)&&!mT.get(t)&&vT(t,gT.get(t)),gT.get(t)),_T=t=>gT.delete(t)&&fT.delete(t)&&mT.delete(t),bT=t=>!!y(t)&&gT.has(t),xT=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:pT;return lT({},yT(i),t)};class ST{static registerInstance(t){ST.instances.set(t.id,t)}static unregisterInstance(t){ST.instances.delete(t.id)}static getInstance(t){return ST.instances.get(t)}static instanceExist(t){return ST.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return ST.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}ST.instances=new Map;class AT{static registerTheme(t,e){vT(t,e)}static getTheme(t,e=!1){return yT(t)}static removeTheme(t){return _T(t)}static themeExist(t){return bT(t)}static getDefaultTheme(){return AT.themes.get(pT)}static setCurrentTheme(t){AT.themeExist(t)&&(AT._currentThemeName=t,ST.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return AT.getTheme(AT._currentThemeName,t)}static getCurrentThemeName(){return AT._currentThemeName}}function kT(t){return y(t)?AT.themeExist(t)?AT.getTheme(t):{}:g(t)?t:{}}AT.themes=gT,AT._currentThemeName=pT;const CT=["animationThreshold","colorScheme","name","padding"];function TT(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];CT.includes(n)?s[n]=r:m(r)?IC(r)?s[n]=OC(r,e):eT(r)?s[n]=tT(i,r):s[n]=TT(r,e,i):s[n]=r})),s}function MT(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=MT(t[s],e)}return i}return _(t)?t.map((t=>MT(t,e))):t}function wT(t,e){if(!t)return t;if(m(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(y(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=wT(t[s],e)}return i}return _(t)?t.map((t=>wT(t,e))):t}function ET(t,...e){return d(t)?t(...e):t}const BT=(t,e,i,s)=>((t,e,i)=>WA(t,e,i,{fontFamily:iT.fontFamily,fontSize:iT.fontSize}))(e,i,s).measure(t),PT="__VCHART",RT=500,OT=500,IT=`${PT}_MEASURE_CANVAS_ID`,LT=`${PT}_DEFAULT_DATA_INDEX`,DT=`${PT}_DEFAULT_DATA_KEY`,FT=`${PT}_DEFAULT_DATA_SERIES_FIELD`,zT=`${PT}_DEFAULT_SERIES_STYLE_NAME`,HT=`${PT}_STACK_KEY`,jT=`${PT}_STACK_START`,NT=`${PT}_STACK_END`,UT=`${PT}_STACK_START_PERCENT`,VT=`${PT}_STACK_END_PERCENT`,WT=`${PT}_STACK_START_OffsetSilhouette`,GT=`${PT}_STACK_END_OffsetSilhouette`,YT=`${PT}_STACK_TOTAL`,XT=`${PT}_STACK_TOTAL_PERCENT`,KT=`${PT}_STACK_TOTAL_TOP`,$T=`${PT}_STACK_TOTAL_BOTTOM`,qT=`${PT}_MOSAIC_VALUE_START_PERCENT`,ZT=`${PT}_MOSAIC_VALUE_END_PERCENT`,JT=`${PT}_MOSAIC_CAT_START_PERCENT`,QT=`${PT}_MOSAIC_CAT_END_PERCENT`,tM=`${PT}_SEGMENT_START`,eM=`${PT}_SEGMENT_END`,iM=`${PT}_KEY`,sM=`${PT}_MAP_LOOK_UP_KEY`;function nM(t,e){for(let i=0;it.key===e))}function aM(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function oM(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},uM(t,a,n[o],l,e,r))})),s?lM(n):n}function lM(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):lM(t[e].nodes);return t}function hM(t,e){if("values"in t&&t.values.length){const i=gk(t.values,e),s=pk(t.values,VT);t.values.forEach((t=>{t[YT]=i,t[XT]=s}))}else for(const i in t.nodes)hM(t.nodes[i],e)}function cM(t){if(!t.values.length)return;const e=t.values[t.values.length-1][NT]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)dM(t.nodes[r],e,i,s,n)}function uM(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[NT]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),uM(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const pM=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=fM(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function mM(t){return!d(t)&&!P(t)&&Object.keys(t).some((e=>d(t[e])))}function vM(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(d(t))return xM(t(r,i,s,n));if(mM(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{d(e[t])&&(e[t]=e[t](r,i,s,n))})),xM(e)}return xM(t)}function yM(t={}){const e=Object.assign({},t);if(d(t.style)||mM(t.style)?e.style=(e,i,s,n)=>vM(t.style,e,i,s,n):P(t.style)||(e.style=xM(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])||mM(t.state[e])?i[e]=(i,s,n,r)=>vM(t.state[e],i,s,n,r):P(t.state[e])||(i[e]=xM(t.state[e]))})),e.state=i}return e}function _M(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>xM(t[i](e,s,n,r)):P(t[i])||(e[i]=xM(t[i]))})),e}function bM(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),xM(i)}function xM(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const SM=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},AM=t=>"line"===t||"area"===t,kM=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return AM(i)?e:null==e?void 0:e[0]},CM=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let TM=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=oT.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(oT.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var MM;!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"}(MM||(MM={}));const wM=["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 EM,BM,PM;t.ChartEvent=void 0,(EM=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",EM.rendered="rendered",EM.renderFinished="renderFinished",EM.animationFinished="animationFinished",EM.regionSeriesDataFilterOver="regionSeriesDataFilterOver",EM.afterInitData="afterInitData",EM.afterInitEvent="afterInitEvent",EM.afterInitMark="afterInitMark",EM.rawDataUpdate="rawDataUpdate",EM.viewDataFilterOver="viewDataFilterOver",EM.viewDataUpdate="viewDataUpdate",EM.viewDataStatisticsUpdate="viewDataStatisticsUpdate",EM.markDeltaYUpdate="markDeltaYUpdate",EM.viewDataLabelUpdate="viewDataLabelUpdate",EM.scaleDomainUpdate="scaleDomainUpdate",EM.scaleRawDomainUpdate="scaleRawDomainUpdate",EM.scaleUpdate="scaleUpdate",EM.dataZoomChange="dataZoomChange",EM.drill="drill",EM.layoutStart="layoutStart",EM.layoutEnd="layoutEnd",EM.layoutRectUpdate="layoutRectUpdate",EM.playerPlay="playerPlay",EM.playerPause="playerPause",EM.playerEnd="playerEnd",EM.playerChange="playerChange",EM.playerForward="playerForward",EM.playerBackward="playerBackward",EM.scrollBarChange="scrollBarChange",EM.brushStart="brushStart",EM.brushChange="brushChange",EM.brushEnd="brushEnd",EM.brushClear="brushClear",EM.brushActive="brushActive",EM.legendSelectedDataChange="legendSelectedDataChange",EM.legendFilter="legendFilter",EM.legendItemClick="legendItemClick",EM.legendItemHover="legendItemHover",EM.legendItemUnHover="legendItemUnHover",EM.tooltipShow="tooltipShow",EM.tooltipHide="tooltipHide",EM.tooltipRelease="tooltipRelease",EM.afterResize="afterResize",EM.afterRender="afterRender",EM.afterLayout="afterLayout",EM.afterMarkLayoutEnd="afterMarkLayoutEnd",EM.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(BM||(BM={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(PM||(PM={}));const RM=[PM.mark,PM.model,PM.chart,PM.vchart];class OM{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(PM.vchart,[]),this._levelNodes.set(PM.chart,[]),this._levelNodes.set(PM.model,[]),this._levelNodes.set(PM.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const IM={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class LM{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>kM(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||BM.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||BM.chart);o.get(t)||o.set(t,new OM);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||BM.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||BM.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||BM.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||BM.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?RM.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[BM.chart,BM.window,BM.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return IM[a]&&(a=IM[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?PM.model:PM.vchart:PM.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=BM.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==PM.model&&s!==PM.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=PM.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case BM.chart:return this._viewBubbles;case BM.window:return this._windowBubbles;case BM.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case BM.chart:return this._viewListeners;case BM.window:return this._windowListeners;case BM.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return wM.includes(t)||Object.values(MM).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&oT.hasInteractionTrigger(e)}}function DM(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function FM(t,e,i){t.getParser(e)||t.registerParser(e,i)}const zM=new Map;let HM;function jM(){HM||(HM=new Ra,FM(HM,"geojson",Ta),FM(HM,"topojson",wa),DM(HM,"simplify",Xr))}function NM(t,e,i={type:"geojson",centroid:!0}){zM.has(t)&&hA(`map type of '${t}' already exists, will be overwritten.`),jM();const s=new Oa(HM),n=H({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),zM.set(t,s)}function UM(t){zM.has(t)?zM.delete(t):hA(`map type of '${t}' does not exists.`)}function VM(t,e=!1){let i=e;return t.latestData instanceof Oa&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const WM=(t,e)=>0===t.length?[]:1===t.length?VM(t[0],null==e?void 0:e.deep):t.map((t=>VM(t,null==e?void 0:e.deep)));function GM(e,i,s){DM(i=i instanceof Ra?i:e.dataSet,"copyDataView",WM);const n=new Oa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function YM(t,e,i=[]){var s;if(t instanceof Oa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Oa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return hA(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return hA(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),hA("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function XM(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var KM,$M,qM,ZM;t.TransformLevel=void 0,(KM=t.TransformLevel||(t.TransformLevel={}))[KM.copyDataView=-10]="copyDataView",KM[KM.treemapFilter=-8]="treemapFilter",KM[KM.treemapFlatten=-7]="treemapFlatten",KM[KM.dotObjFlat=-7]="dotObjFlat",KM[KM.linkDotInfo=-7]="linkDotInfo",KM[KM.sankeyLayout=-7]="sankeyLayout",KM[KM.dataZoomFilter=-6]="dataZoomFilter",KM[KM.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}($M||($M={})),function(t){t.data="data",t.mark="mark"}(qM||(qM={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(ZM||(ZM={}));const JM=["line","area","trail"];function QM(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(iM,i?t.slice().sort(i):t.slice()),{keys:[iM],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const tw=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function ew(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{ew(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function sw(t,e,i,s){const n=QM(t,(t=>i(t))),r=QM(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const nw=`${PT}_BuiltIn_CallBack_Disappear`;var rw;!function(t){t.render="render",t.disappear="disappear"}(rw||(rw={}));const aw=[0,0,0];class ow{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Fl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Hl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},jl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ge(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ge(1,0,0,1,0,0),this._clearMatrix=new Ge(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ge(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Au.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&&(Au.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Au.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Ut;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=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:jl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:jl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(vu(aw,[e,i,s],this.modelMatrix),e=aw[0],i=aw[1],s=aw[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=au(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:ru(this,a,this.dpr),r.strokeStyle=au(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Au.free(t))),this.stack.length=0}}ow.env="browser";class lw extends Eu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ua.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ow(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}}function hw(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,Cd,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Td,e.env));r||i.bind(Cd).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(Td).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}lw.env="browser";const cw=hw(lw,ow);class dw extends ow{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}dw.env="feishu";class uw extends Eu{constructor(t){super(t)}init(){this._context=new dw(this,this._dpr)}release(...t){}}uw.env="feishu";const pw=hw(uw,dw);class gw extends ow{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:ru(this,l,this.dpr),r.strokeStyle=au(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=Ua.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Ua.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}gw.env="harmony";class fw extends Eu{constructor(t){super(t)}init(){this._context=new gw(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}fw.env="harmony";const mw=hw(fw,gw);class vw extends ow{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:ru(this,l,this.dpr),r.strokeStyle=au(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=Ua.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Ua.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}vw.env="lynx";class yw extends Eu{constructor(t){super(t)}init(){this._context=new vw(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}yw.env="lynx";const _w=hw(yw,vw);class bw extends ow{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}bw.env="node";class xw extends Eu{constructor(t){super(t)}init(){this._context=new bw(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}}xw.env="node";const Sw=hw(xw,bw);class Aw extends ow{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,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(au(this,l,t,i,s)))}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:ru(this,l,this.dpr)),r.setStrokeStyle(au(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}Aw.env="taro";class kw extends Eu{constructor(t){super(t)}init(){this._context=new Aw(this,this._dpr)}release(...t){}}kw.env="taro";const Cw=hw(kw,Aw);class Tw extends dw{}Tw.env="tt";class Mw extends Eu{constructor(t){super(t)}init(){this._context=new Tw(this,this._dpr)}release(...t){}}Mw.env="tt";const ww=hw(Mw,Tw);class Ew extends ow{draw(){}createPattern(t,e){return null}}Ew.env="wx";class Bw extends Eu{constructor(t){super(t)}init(){this._context=new Ew(this,this._dpr)}release(...t){}}Bw.env="wx";const Pw=hw(Bw,Ew);function Rw(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function Ow(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}class Iw extends Q_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=dm.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:ru(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class vE extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ed}}let yE=!1;function _E(t){yE||(yE=!0,t.bind(Kw).toDynamicValue((()=>new vE(Rw(t,jf)))).inSingletonScope(),t.bind(pE).toService(Kw))}class bE extends h_{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ku.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class xE extends bE{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=id,this.themeType="arc"}}let SE=!1;function AE(t){var e;SE||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Nf))&&(SE=!0,t.bind($w).toDynamicValue((()=>new xE(Rw(t,Nf)))).inSingletonScope(),t.bind(pE).toService($w))}class kE extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=sd}}let CE=!1;function TE(t){CE||(CE=!0,t.bind(qw).toDynamicValue((()=>new kE(Rw(t,Uf)))).inSingletonScope(),t.bind(pE).toService(qw))}class ME extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=nd}}let wE=!1;function EE(t){wE||(wE=!0,t.bind(Zw).toDynamicValue((()=>new ME(Rw(t,Vf)))).inSingletonScope(),t.bind(pE).toService(Zw))}class BE{constructor(){this.type="glyph",this.numberType=rd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}class PE extends BE{constructor(t){super(),this.canvasRenderer=t}}let RE=!1;function OE(t){RE||(RE=!0,t.bind(cE).toDynamicValue((()=>new PE(Rw(t,em)))).inSingletonScope(),t.bind(pE).toService(cE))}class IE extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=od}}let LE=!1;function DE(t){LE||(LE=!0,t.bind(Jw).toDynamicValue((()=>new IE(Rw(t,im)))).inSingletonScope(),t.bind(pE).toService(Jw))}class FE extends h_{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:ru(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ku.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class zE extends FE{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ld}}let HE=!1;function jE(t){HE||(HE=!0,t.bind(tE).toDynamicValue((()=>new zE(Rw(t,Yf)))).inSingletonScope(),t.bind(pE).toService(tE))}const NE=new Ve;class UE{constructor(){this.type="rect",this.numberType=ud}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:ru(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;NE.setValue(i.x1,i.y1,i.x2,i.y2),NE.expand(-r/2),h=!NE.containsPoint(e)}}return s.highPerformanceRestore(),h}}class VE extends UE{constructor(t){super(),this.canvasRenderer=t}}let WE=!1;class GE extends FE{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=hd}}let YE=!1;function XE(t){YE||(YE=!0,t.bind(iE).toDynamicValue((()=>new GE(Rw(t,Xf)))).inSingletonScope(),t.bind(pE).toService(iE))}class KE extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=cd}}let $E=!1;function qE(t){$E||($E=!0,t.bind(oE).toDynamicValue((()=>new KE(Rw(t,Kf)))).inSingletonScope(),t.bind(pE).toService(oE))}class ZE extends bE{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=dd,this.themeType="polygon"}}let JE=!1;function QE(t){var e;JE||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,tm))&&(JE=!0,t.bind(lE).toDynamicValue((()=>new ZE(Rw(t,tm)))).inSingletonScope(),t.bind(pE).toService(lE))}class tB extends UE{constructor(t){super(),this.canvasRenderer=t}}let eB=!1;function iB(t){eB||(eB=!0,t.bind(sE).toDynamicValue((()=>new tB(Rw(t,$f)))).inSingletonScope(),t.bind(pE).toService(sE))}class sB extends bE{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=pd,this.themeType="rect"}}let nB=!1;function rB(t){var e;nB||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,qf))&&(nB=!0,t.bind(nE).toDynamicValue((()=>new sB(Rw(t,qf)))).inSingletonScope(),t.bind(pE).toService(nE))}class aB{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=gd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let oB=!1;function lB(t){oB||(oB=!0,t.bind(hE).toDynamicValue((()=>new aB(Rw(t,Qf)))).inSingletonScope(),t.bind(pE).toService(hE))}class hB extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=fd}}let cB=!1;function dB(t){var e;cB||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,rm))&&(cB=!0,t.bind(uE).toDynamicValue((()=>new hB(Rw(t,rm)))).inSingletonScope(),t.bind(pE).toService(uE))}class uB extends bE{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=md}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:ru(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ku.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let pB=!1;function gB(t){pB||(pB=!0,t.bind(rE).toDynamicValue((()=>new uB(Rw(t,Zf)))).inSingletonScope(),t.bind(pE).toService(rE))}class fB extends bE{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=vd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Vp(a,u,n),v=Up(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&ku.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let mB=!1;function vB(t){mB||(mB=!0,t.bind(aE).toDynamicValue((()=>new fB(Rw(t,Jf)))).inSingletonScope(),t.bind(pE).toService(aE))}const yB=Kc();Kc();class _B{constructor(){this.type="gif-image",this.numberType=yB}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let bB=!1;function xB(t){bB||(bB=!0,t.bind(Qw).toDynamicValue((()=>new _B)).inSingletonScope(),t.bind(pE).toService(Qw))}function SB(t){t.isBound(Iw)||t.bind(Iw).toDynamicValue((()=>new Iw(Ow(pE,t),Rw(t,nm),Ow(Ff,t),Ow(zf,t)))).inSingletonScope(),t.isBound(If)?t.rebind(If).toService(Iw):t.bind(If).toService(Iw)}function AB(t){(function(t){fE||(fE=!0,t.bind(dE).toDynamicValue((()=>new gE)).inSingletonScope(),t.bind(pE).toService(dE),gv(t.bind.bind(t),pE))})(t),_E(t),AE(t),TE(t),EE(t),OE(t),DE(t),jE(t),function(t){WE||(WE=!0,t.bind(eE).toDynamicValue((()=>new VE(Rw(t,$f)))).inSingletonScope(),t.bind(pE).toService(eE))}(t),XE(t),qE(t),QE(t),iB(t),rB(t),lB(t),dB(t),gB(t),vB(t),xB(t),SB(t)}class kB extends Y_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${kB.idprefix}_${kB.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ua.global,this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:kB.GenerateCanvasId(),canvasControled:!0};this.canvas=new lw(s)}createWindowByCanvas(t){var e,i;let s;if("string"==typeof t.canvas){if(s=this.global.getElementById(t.canvas),s||"undefined"==typeof document||(s=document.getElementById(t.canvas)),!s)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else s=t.canvas;if(!s)throw new Error("发生错误,传入的canvas不正确");let n=t.width,r=t.height;if(null==n||null==r||!t.canvasControled){const t=s.getBoundingClientRect();n=t.width,r=t.height}let a=t.dpr;null==a&&(a=null!==(e=s.getContext("2d").pixelRatio)&&void 0!==e?e:s.width/n),this.canvas=new lw({width:n,height:r,dpr:a,nativeCanvas:s,canvasControled:null!==(i=t.canvasControled)&&void 0!==i&&i})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}}function CB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,kB))||t.bind(kB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,kB.env))||t.bind(om).toService(kB).whenTargetNamed(kB.env)}kB.env="browser",kB.idprefix="visactor_window",kB.prefix_count=0;var TB=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class MB{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function wB(t,e=!1){const i=document.createElement("img");if(Ua.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class EB extends G_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new MB(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return wB(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return wB(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ja.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return TB(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function BB(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,EB))||(t.bind(EB).toSelf().inSingletonScope(),t.bind(pg).toService(EB))}function PB(t=Zy(),e=!0){PB.__loaded||(PB.__loaded=!0,BB(t),cw(t),CB(t),e&&AB(t))}PB.__loaded=!1;class RB extends Y_{get container(){return null}constructor(t=Ua.global){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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new uw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new uw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function OB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,RB))||t.bind(RB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,RB.env))||t.bind(om).toService(RB).whenTargetNamed(RB.env)}RB.env="feishu";class IB extends Q_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Mu(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}}let LB=!1;class DB extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ed}}let FB=!1;function zB(t){FB||(FB=!0,t.bind(Dw).toDynamicValue((()=>new DB(Rw(t,jf)))).inSingletonScope(),t.bind(Lw).toService(Dw))}class HB extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=sd}}let jB=!1;function NB(t){jB||(jB=!0,t.bind(Fw).toDynamicValue((()=>new HB(Rw(t,Uf)))).inSingletonScope(),t.bind(Lw).toService(Fw))}class UB extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=nd}}let VB=!1;function WB(t){VB||(VB=!0,t.bind(zw).toDynamicValue((()=>new UB(Rw(t,Vf)))).inSingletonScope(),t.bind(Lw).toService(zw))}class GB extends BE{constructor(t){super(),this.canvasRenderer=t}}let YB=!1;function XB(t){YB||(YB=!0,t.bind(Yw).toDynamicValue((()=>new GB(Rw(t,em)))).inSingletonScope(),t.bind(Lw).toService(Yw))}class KB{constructor(){this.type="image",this.numberType=od}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let $B=!1;function qB(t){$B||($B=!0,t.bind(Hw).toDynamicValue((()=>new KB)).inSingletonScope(),t.bind(Lw).toService(Hw))}class ZB extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ld}}let JB=!1;function QB(t){JB||(JB=!0,t.bind(jw).toDynamicValue((()=>new ZB(Rw(t,Yf)))).inSingletonScope(),t.bind(Lw).toService(jw))}class tP extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=cd}}let eP=!1;function iP(t){eP||(eP=!0,t.bind(Gw).toDynamicValue((()=>new tP(Rw(t,Kf)))).inSingletonScope(),t.bind(Lw).toService(Gw))}class sP extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=hd}}let nP=!1;function rP(t){nP||(nP=!0,t.bind(Nw).toDynamicValue((()=>new sP(Rw(t,Xf)))).inSingletonScope(),t.bind(Lw).toService(Nw))}class aP extends UE{constructor(t){super(),this.canvasRenderer=t}}let oP=!1;function lP(t){oP||(oP=!0,t.bind(Uw).toDynamicValue((()=>new aP(Rw(t,$f)))).inSingletonScope(),t.bind(Lw).toService(Uw))}class hP{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=gd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let cP=!1;function dP(t){cP||(cP=!0,t.bind(Xw).toDynamicValue((()=>new hP(Rw(t,Qf)))).inSingletonScope(),t.bind(Lw).toService(Xw))}class uP extends mE{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=md}}let pP=!1;function gP(t){pP||(pP=!0,t.bind(Vw).toDynamicValue((()=>new uP(Rw(t,Zf)))).inSingletonScope(),t.bind(Lw).toService(Vw))}class fP{constructor(){this.type="text",this.numberType=vd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let mP=!1;function vP(t){mP||(mP=!0,t.bind(Ww).toDynamicValue((()=>new fP)).inSingletonScope(),t.bind(Lw).toService(Ww))}function yP(t){(function(t){LB||(LB=!0,gv(t.bind.bind(t),Lw))})(t),function(t){t.isBound(IB)||t.bind(IB).toDynamicValue((()=>new IB(Ow(Lw,t),Ow(Ff,t),Ow(zf,t)))).inSingletonScope(),t.isBound(If)?t.rebind(If).toService(IB):t.bind(If).toService(IB)}(t),zB(t),NB(t),WB(t),XB(t),qB(t),QB(t),iP(t),rP(t),lP(t),dP(t),gP(t),vP(t)}class _P{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class bP{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function xP(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function SP(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new _P(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function AP(t,e,i,s){const n=xP(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new bP(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function kP(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function CP(t,e=kP(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class TP extends G_{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},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 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=kP(i),n=null!==(e=t.dpr)&&void 0!==e?e:CP(i,s),r=AP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=xP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=SP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return CP(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function MP(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,TP))||(t.bind(TP).toSelf().inSingletonScope(),t.bind(pg).toService(TP))}function wP(t=Zy(),e=!0){wP.__loaded||(wP.__loaded=!0,MP(t),pw(t),OB(t),e&&yP(t))}wP.__loaded=!1;function EP(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function BP(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new fw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new fw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return EP(t,"target",s),EP(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=BP(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=BP(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&PP(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),PP(t,"x",_),PP(t,"y",b),PP(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),PP(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),PP(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),PP(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),PP(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),PP(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function OP(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,RP))||t.bind(RP).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,RP.env))||t.bind(om).toService(RP).whenTargetNamed(RP.env)}RP.env="harmony";const IP="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function LP(t){return"number"==typeof t&&Number.isFinite(t)}function DP(...t){for(let e=0;e({width:i,height:s})),new bP(t,l,n,i,s,e)}function NP(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=HP(e*s,i*s);if(t)return t}throw new Error(IP)}class UP extends G_{constructor(){super(),this.type="harmony",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,this.rafSTO=new Sh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=FP(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=FP(s),r=null!==(i=t.dpr)&&void 0!==i?i:zP(s),a=function(t,e){if(!LP(t)||!LP(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=jP(NP(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=jP(NP(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return zP(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=DP(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=DP(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function VP(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,UP))||(t.bind(UP).toSelf().inSingletonScope(),t.bind(pg).toService(UP))}function WP(t=Zy(),e=!0){WP.__loaded||(WP.__loaded=!0,VP(t),mw(t),OP(t),e&&yP(t))}WP.__loaded=!1;function GP(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function YP(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new yw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new yw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return GP(t,"target",s),GP(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=YP(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=YP(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&XP(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),XP(t,"x",_),XP(t,"y",b),XP(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),XP(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),XP(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),XP(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),XP(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),XP(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function $P(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,KP))||t.bind(KP).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,KP.env))||t.bind(om).toService(KP).whenTargetNamed(KP.env)}KP.env="lynx";function qP(t){return"number"==typeof t&&Number.isFinite(t)}function ZP(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=QP(r),o=null!==(i=t.dpr)&&void 0!==i?i:tR(r,a),l=iR(t.width,t.height),h=sR(nR(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=QP(a),l=null!==(n=t.dpr)&&void 0!==n?n:tR(a,o),h=iR(t.width,t.height),c=Math.random().toString(),d=sR(nR(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tR(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=ZP(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=ZP(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function aR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,rR))||(t.bind(rR).toSelf().inSingletonScope(),t.bind(pg).toService(rR))}function oR(t=Zy(),e=!0){oR.__loaded||(oR.__loaded=!0,aR(t),_w(t),$P(t),e&&yP(t))}oR.__loaded=!1;class lR extends Y_{get container(){return null}constructor(t=Ua.global){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:ja.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new xw(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new xw({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function hR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,lR))||t.bind(lR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,lR.env))||t.bind(om).toService(lR).whenTargetNamed(lR.env)}lR.env="node";class cR extends G_{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function dR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,cR))||(t.bind(cR).toSelf().inSingletonScope(),t.bind(pg).toService(cR))}function uR(t=Zy(),e=!0){uR.__loaded||(uR.__loaded=!0,dR(t),Sw(t),hR(t))}uR.__loaded=!1;class pR extends Y_{get container(){return null}constructor(t=Ua.global){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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new kw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new kw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.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){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function gR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,pR))||t.bind(pR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,pR.env))||t.bind(om).toService(pR).whenTargetNamed(pR.env)}pR.env="taro";class fR extends G_{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},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 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=AP(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=xP(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=SP(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}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(...t){}}function mR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,fR))||(t.bind(fR).toSelf().inSingletonScope(),t.bind(pg).toService(fR))}function vR(t=Zy(),e=!0){vR.__loaded||(vR.__loaded=!0,mR(t),Cw(t),gR(t),e&&yP(t))}vR.__loaded=!1;class yR extends Y_{get container(){return null}constructor(t=Ua.global){super(),this.global=t,this.type="tt",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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Mw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Mw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function _R(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,yR))||t.bind(yR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,yR.env))||t.bind(om).toService(yR).whenTargetNamed(yR.env)}yR.env="tt";function bR(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function xR(t,e=bR(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class SR extends G_{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=bR(i),n=null!==(e=t.dpr)&&void 0!==e?e:xR(i,s),r=AP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=xP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=SP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return xR(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function AR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,SR))||(t.bind(SR).toSelf().inSingletonScope(),t.bind(pg).toService(SR))}function kR(t=Zy(),e=!0){kR.__loaded||(kR.__loaded=!0,AR(t),ww(t),_R(t),e&&yP(t))}kR.__loaded=!1;class CR{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={}}}function TR(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class MR extends Y_{get container(){return null}constructor(t=Ua.global){super(),this.global=t,this.type="wx",this.eventManager=new CR}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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Bw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Bw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,s,n,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return TR(t,"target",o),TR(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s: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!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function wR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,MR))||t.bind(MR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,MR.env))||t.bind(om).toService(MR).whenTargetNamed(MR.env)}MR.env="wx";function ER(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function BR(t,e=ER(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class PR extends G_{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=ER(i),n=null!==(e=t.dpr)&&void 0!==e?e:BR(i,s),r=AP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=xP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=SP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return BR(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function RR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,PR))||(t.bind(PR).toSelf().inSingletonScope(),t.bind(pg).toService(PR))}function OR(t=Zy(),e=!0){OR.__loaded||(OR.__loaded=!0,RR(t),Pw(t),wR(t),e&&yP(t))}OR.__loaded=!1;var IR={},LR={},DR={};Object.defineProperty(DR,"__esModule",{value:!0}),DR.loop=DR.conditional=DR.parse=void 0;DR.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};DR.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};DR.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var FR={};Object.defineProperty(FR,"__esModule",{value:!0}),FR.readBits=FR.readArray=FR.readUnsigned=FR.readString=FR.peekBytes=FR.readBytes=FR.peekByte=FR.readByte=FR.buildStream=void 0;FR.buildStream=function(t){return{data:t,pos:0}};var zR=function(){return function(t){return t.data[t.pos++]}};FR.readByte=zR;FR.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var HR=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};FR.readBytes=HR;FR.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};FR.readString=function(t){return function(e){return Array.from(HR(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};FR.readUnsigned=function(t){return function(e){var i=HR(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};FR.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=HR(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=$R(t),i=VR(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=$R(this.attribute.gifImage),e=VR(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=Ua.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=Ua.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function JR(t){return new ZR(t)}class QR extends V_{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=yB,this._renderContribitions=void 0,this.builtinContributions=[tO],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=Dp(t).image;this._draw(t,n,!1,i)}}const tO=new class extends iy{constructor(){super(...arguments),this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let eO=!1;function iO(t){eO||(eO=!0,t.bind(QR).toDynamicValue((()=>new QR(Ow(Dy,t)))).inSingletonScope(),t.bind(Wf).toService(QR))}function sO(){pf.RegisterGraphicCreator("gif",JR)}function nO(){if(nO.__loaded)return;nO.__loaded=!0;const t=Zy();sO(),iO(t),xB(t)}nO.__loaded=!1;const rO=nO,aO=[{register:PS,bindModule:Rx},{register:RS,bindModule:TS},{register:OS,bindModule:Nx},{register:IS,bindModule:Xx},{register:LS,bindModule:cS},{register:DS},{register:FS,bindModule:vS},{register:zS,bindModule:zx},{register:HS,bindModule:Qx},{register:jS,bindModule:iS},{register:US,bindModule:BS},{register:VS,bindModule:Lx},{register:WS,bindModule:SS},{register:GS,bindModule:gS},{register:KS},{register:NS,bindModule:aS},{register:YS,bindModule:Wx},{register:XS,bindModule:qx},{register:$S},{register:sO}];let oO=!1;const lO=[_E,AE,TE,EE,OE,DE,jE,XE,qE,QE,iB,rB,lB,dB,gB,vB,xB];function hO(t){return{getContributions:t}}function cO(t,{envParams:e,force:i=!1}={}){_b().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function dO(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){bb(t);const a=vb();i(a),s(a),n(a),yb(),cO(e,{envParams:r,force:!0})}function uO(t,e){dO(t,"browser",{bindEnv:BB,bindCanvasModules:cw,bindWindowContribution:CB},e)}function pO(t,e){dO(t,"node",{bindEnv:dR,bindCanvasModules:Sw,bindWindowContribution:hR},e)}function gO(t){bb(t),function(){if(oO)return;const t=vb();oO=!0,aO.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),iO(t),yb()}(),Sb(t),xb(t)}function fO(t){bb(t);const e=vb();lO.forEach((t=>t(e))),SB(e),Ab(t,pE),function(t){const e=vb(),i=hO((()=>t.registry.picker.getAll())),s=hO((()=>e.isBound(Ff)?e.getAll(Ff):[])),n=hO((()=>e.isBound(zf)?e.getAll(zf):[])),r=_b();Ua.pickerServiceFactory=()=>new Iw(i,{},s,n),Ua.global=r}(t)}function mO(t){bb(t);yP(vb()),Ab(t,Lw),function(t){const e=vb(),i=hO((()=>t.registry.picker.getAll())),s=hO((()=>e.isBound(Ff)?e.getAll(Ff):[])),n=hO((()=>e.isBound(zf)?e.getAll(zf):[]));Ua.pickerServiceFactory=()=>new IB(i,s,n)}(t)}const vO=iv();function yO(){if(yO.__loaded)return;yO.__loaded=!0;const t=Zy();PS(),Rx({bind:t.bind}),vO?_E(t):zB(t)}yO.__loaded=!1;const _O=yO;function bO(){if(bO.__loaded)return;bO.__loaded=!0;const t=Zy();RS(),K_(),q_(),TS({bind:t.bind}),AE(t)}bO.__loaded=!1;const xO=bO;function SO(){if(SO.__loaded)return;SO.__loaded=!0;const t=Zy();OS(),Nx({bind:t.bind}),vO?TE(t):NB(t)}SO.__loaded=!1;const AO=SO;function kO(){if(kO.__loaded)return;kO.__loaded=!0;const t=Zy();IS(),Xx({bind:t.bind}),vO?EE(t):WB(t)}kO.__loaded=!1;const CO=kO;function TO(){if(TO.__loaded)return;TO.__loaded=!0;const t=Zy();LS(),cS({bind:t.bind}),vO?OE(t):XB(t)}TO.__loaded=!1;const MO=TO;function wO(){wO.__loaded||(wO.__loaded=!0,DS())}wO.__loaded=!1;const EO=wO;function BO(){if(BO.__loaded)return;BO.__loaded=!0;const t=Zy();FS(),vS({bind:t.bind}),vO?DE(t):qB(t)}BO.__loaded=!1;const PO=BO;function RO(){if(RO.__loaded)return;RO.__loaded=!0;const t=Zy();zS(),zx({bind:t.bind}),vO?jE(t):QB(t)}RO.__loaded=!1;const OO=RO;function IO(){if(IO.__loaded)return;IO.__loaded=!0;const t=Zy();HS(),Qx({bind:t.bind}),vO?XE(t):rP(t)}IO.__loaded=!1;const LO=IO;function DO(){if(DO.__loaded)return;DO.__loaded=!0;const t=Zy();jS(),iS({bind:t.bind}),vO?qE(t):iP(t)}DO.__loaded=!1;const FO=DO;function zO(){if(zO.__loaded)return;zO.__loaded=!0;const t=Zy();US(),K_(),q_(),BS({bind:t.bind}),QE(t)}zO.__loaded=!1;const HO=zO;function jO(){if(jO.__loaded)return;jO.__loaded=!0;const t=Zy();VS(),Lx({bind:t.bind}),vO?iB(t):lP(t)}jO.__loaded=!1;const NO=jO;function UO(){if(UO.__loaded)return;UO.__loaded=!0;const t=Zy();WS(),SS({bind:t.bind}),rB(t)}UO.__loaded=!1;const VO=UO;function WO(){if(WO.__loaded)return;WO.__loaded=!0;const t=Zy();GS(),gS({bind:t.bind}),vO?lB(t):dP(t)}WO.__loaded=!1;const GO=WO;function YO(){YO.__loaded||(YO.__loaded=!0,KS())}YO.__loaded=!1;const XO=YO;function KO(){if(KO.__loaded)return;KO.__loaded=!0;const t=Zy();NS(),aS({bind:t.bind}),dB(t)}KO.__loaded=!1;const $O=KO;function qO(){if(qO.__loaded)return;qO.__loaded=!0;const t=Zy();YS(),Wx({bind:t.bind}),vO?gB(t):gP(t)}qO.__loaded=!1;const ZO=qO;function JO(){if(JO.__loaded)return;JO.__loaded=!0;const t=Zy();XS(),qx({bind:t.bind}),vO?vB(t):vP(t)}JO.__loaded=!1;const QO=JO;function tI(){tI.__loaded||(tI.__loaded=!0,$S())}tI.__loaded=!1;const eI=tI;function iI(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}class sI{static registerBuiltInAnimate(t,e){sI.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._activeConfigList=null,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:sI.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=iI(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:sI.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=iI(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:T,customType:M,controlOptions:w}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),E.startAt(b);const O=i*x+B;O>0&&E.wait(O);let I=null,L=t.to,D=t.from;const F=this.shouldCommitAttrOutChannel(p);L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(E,T,M,D,L,_,m,f,w,C,p,e);let z=0;x&&(z=x*(s-i-1));const H=d(y)?y(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&E.wait(z),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,y,_,b;if(e&&i){i=iI(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:sI.builtInAnimateMap[r],m=t.custom?t.customType:iI(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Il.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}sI.builtInAnimateMap={};class nI{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-nI.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*nI.bounceIn(2*t):.5*nI.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ut/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ut*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ut/e)*.5+1}}static registerFunc(t,e){nI[t]=e}}function rI(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}nI.quadIn=nI.getPowIn(2),nI.quadOut=nI.getPowOut(2),nI.quadInOut=nI.getPowInOut(2),nI.cubicIn=nI.getPowIn(3),nI.cubicOut=nI.getPowOut(3),nI.cubicInOut=nI.getPowInOut(3),nI.quartIn=nI.getPowIn(4),nI.quartOut=nI.getPowOut(4),nI.quartInOut=nI.getPowInOut(4),nI.quintIn=nI.getPowIn(5),nI.quintOut=nI.getPowOut(5),nI.quintInOut=nI.getPowInOut(5),nI.backIn=nI.getBackIn(1.7),nI.backOut=nI.getBackOut(1.7),nI.backInOut=nI.getBackInOut(1.7),nI.elasticIn=nI.getElasticIn(1,.3),nI.elasticOut=nI.getElasticOut(1,.3),nI.elasticInOut=nI.getElasticInOut(1,.3*1.5),nI.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),nI.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},nI.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)nI[`flicker${t}`]=e=>rI(e,t);for(let t=2;t<10;t++)nI[`aIn${t}`]=e=>t*e*e+(1-t)*e;function aI(t,e,i){return t+(e-t)*i}const oI=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=aI(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=aI(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=aI(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=aI(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=aI(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=aI(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=aI(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=aI(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=aI(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Ou(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?Hu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Ou(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?Hu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=aI(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=aI(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=aI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=aI(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=aI(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=aI(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=aI(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=aI(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=aI(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=aI(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=bh(e,i,s),r.addUpdateBoundTag()}}};function lI(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:Ao.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=nI[s])&&void 0!==n?n:nI.linear:nI.linear,"wait"===t&&(this.onUpdate=yI),this.id=ja.GenAutoIncrementId(),this.syncAttributeUpdate=yI}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Pu.Get(i,Bu.Color255),r=Pu.Get(s,Bu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(oI["fill"===e?"fillPure":"strokePure"])}else oI[e]?t.push(oI[e]):t.push(lI)}else oI[e]?t.push(oI[e]):t.push(lI)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class xI extends bI{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();mI(this.target,t,Ao.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class SI extends bI{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class AI extends SI{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class kI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Il.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class CI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class TI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,mI(this.target,i,Ao.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class MI extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class wI extends TI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class EI extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class BI extends TI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}class PI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){mI(this.target,this.from,Ao.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const RI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class OI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){gI(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){gI(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class II extends OI{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=RI(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,r),this.determineUpdateFunction()}}class LI extends OI{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class DI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class FI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const zI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class HI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=zI(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){fI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class jI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){fI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const NI=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class UI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(gI(this.target,{points:r.map(((t,i)=>_h(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class VI extends UI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:NI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&vI(this.target,e)}else this.valid=!1}}class WI extends UI{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:NI(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const GI=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class YI extends UI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:GI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&vI(this.target,e)}else this.valid=!1}}class XI extends UI{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:GI(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const KI=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class $I extends UI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:KI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&vI(this.target,e)}else this.valid=!1}}class qI extends UI{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:KI(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const ZI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class JI extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class QI extends JI{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=ZI(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,r)}}class tL extends JI{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const eL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class iL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=eL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&vI(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){fI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){fI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rL extends nL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?y:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&vI(this.target,e)}}class aL extends nL{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,y=v&&k(v.x)?v.x:f,_=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class oL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,mI(this.target,{text:n})}}class lL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class hL extends lL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&vI(this.target,e)}}class cL extends lL{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class dL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),T=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,w=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,E=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,B=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(w){case"x":A={scaleX:null!==(g=null!=E?E:T.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=B?B:T.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=E?E:T.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=B?B:T.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&vI(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),gI(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class uL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),gI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class pL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function gL(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;tfL[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&gL(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(gI(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class yL{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new sI(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function _L(t){return new yL(t)}class bL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;mI(this.target,{text:o})}}class xL extends AI{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(vI(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),vI(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),vI(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),vI(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;vI(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:bL});const i=s._titleBottom.attribute.text;vI(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:bL})}else vI(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),vI(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;vI(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());vI(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class SL extends AI{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class AL extends AI{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if(vI(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:bL}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:bL}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class kL extends AI{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class CL extends kI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=e_.createCanvas({width:t.width,height:t.height,dpr:e_.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=e_.createCanvas({width:t.width,height:t.height,dpr:e_.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==CL.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class TL extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class ML extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==ML.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==ML.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class wL{static createTempCanvas(t,e,i){return e_.createCanvas({width:t,height:e,dpr:i||e_.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=wL.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(wL.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(wL.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(wL.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(wL.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(wL.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(wL.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(wL.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class PL extends ML{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class LL extends ML{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=wL.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class DL extends CL{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=e_.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=e_.createCanvas({width:i,height:s,dpr:e_.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class FL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}mI(this.target,{textConfig:o})}}class zL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),mI(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),mI(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class HL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),mI(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),mI(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function VL(t,e){gI(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class WL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,vI(this.target,m)}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class GL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,vI(this.target,d)}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class YL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,vI(this.target,p)}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class XL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,vI(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),mI(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class KL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,vI(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),mI(this.target,n)}}class $L extends SI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new sI(this.target);a.execute({type:"custom",custom:WL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:GL,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class qL extends SI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new sI(this.target);a.execute({type:"custom",custom:WL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:YL,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class ZL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class JL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class QL extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){VL(this.target,UL(this.propKeys,this.from,this.to,e))}}class tD extends SI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new sI(this.target);n.execute({type:"custom",custom:JL,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:ZL,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class eD extends SI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new sI(this.target);n.execute({type:"custom",custom:QL,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:ZL,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class iD extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),gI(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Ou(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Ou(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class sD extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Ua.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Ml,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Ua.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Ao.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Ao.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=No(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=No(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}nD.getInstance();const rD="appear",aD="disappear",oD="update",lD="highlight",hD="unhighlight";class cD{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class dD{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new sI(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new sI(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([rD],[{name:rD,animation:t}],e)}applyDisappearState(t,e){this.applyState([aD],[{name:aD,animation:t}],e)}applyUpdateState(t,e){this.applyState([oD],[{name:oD,animation:t}],e)}applyHighlightState(t,e){this.applyState([lD],[{name:lD,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([hD],[{name:hD,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class uD{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new dD(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new cD(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class pD extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=ja.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Il.END?this.removeAnimate(t,!0):t.status!==Il.RUNNING&&t.status!==Il.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const gD=new pD;function fD(t,e){for(let i=0;i{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new bI(Ol.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new xI(Ol.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new PI(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Il.RUNNING&&(this.status=Il.PAUSED)}resume(){this.status===Il.PAUSED&&(this.status=Il.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Il.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Il.END,this.target.restoreStaticAttribute(),void(this.__skipRestoreStaticAttributeOnRemove=!0);this.status=Il.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&mI(this.target,this._startProps,Ao.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const yD=new Wa;class _D{constructor(){this.released=!1}tick(t,e){yD.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class bD extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Rl.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Rl.INITIAL,Ua.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Ua.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new _D;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Rl.INITIAL&&(this.status=Rl.PAUSE,!0)}resume(){return this.status!==Rl.INITIAL&&(this.status=Rl.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Rl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Rl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Rl.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Rl.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Rl.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Rl.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Ua.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function SD(){G(Mp,uD),G(Mp,xD)}const AD=Symbol.for("vrender.bootstrap.state"),kD=new WeakMap;function CD(t,e){var i;const s=null!==(i=t[AD])&&void 0!==i?i:new Set;return t[AD]=s,!s.has(e)&&(s.add(e),!0)}function TD(t,e){var i,s,n,r;const a=null!==(i=null==t?void 0:t.type)&&void 0!==i?i:"unknown",o=null!==(s=null==t?void 0:t.numberType)&&void 0!==s?s:"unknown",l=null!==(r=null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)&&void 0!==r?r:"anonymous";return`${e}:${String(o)}:${String(a)}:${l}`}function MD(t,e){let i=kD.get(t);i||(i=new Map,kD.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function wD(t,e,i){const s=MD(t,e);i&&s.forEach((t=>i(t))),s.clear()}function ED(t){var e,i;const s=null!==(e=Zy().getAll(Wf))&&void 0!==e?e:[],n=MD(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;wD(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=TD(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function BD(t,e){var i,s;const n=null!==(i=Zy().getAll(e))&&void 0!==i?i:[],r=MD(t.registry.picker,"vrender:legacy-picker"),a=new Set;wD(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=TD(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const PD=uO,RD=pO,OD={taro:{installEnv:function(t,e){dO(t,"taro",{bindEnv:mR,bindCanvasModules:Cw,bindWindowContribution:gR},e)},loadEnv:vR},feishu:{installEnv:function(t,e){dO(t,"feishu",{bindEnv:MP,bindCanvasModules:pw,bindWindowContribution:OB},e)},loadEnv:wP},tt:{installEnv:function(t,e){dO(t,"tt",{bindEnv:AR,bindCanvasModules:ww,bindWindowContribution:_R},e)},loadEnv:kR},wx:{installEnv:function(t,e){dO(t,"wx",{bindEnv:RR,bindCanvasModules:Pw,bindWindowContribution:wR},e)},loadEnv:OR},lynx:{installEnv:function(t,e){dO(t,"lynx",{bindEnv:aR,bindCanvasModules:_w,bindWindowContribution:$P},e)},loadEnv:oR},harmony:{installEnv:function(t,e){dO(t,"harmony",{bindEnv:VP,bindCanvasModules:mw,bindWindowContribution:OP},e)},loadEnv:WP}},ID=[nA,eA,ZS,QS,K_,q_],LD=[()=>{sI.registerBuiltInAnimate("increaseCount",oL),sI.registerBuiltInAnimate("fromTo",PI),sI.registerBuiltInAnimate("scaleIn",dL),sI.registerBuiltInAnimate("scaleOut",uL),sI.registerBuiltInAnimate("growHeightIn",HI),sI.registerBuiltInAnimate("growHeightOut",jI),sI.registerBuiltInAnimate("growWidthIn",iL),sI.registerBuiltInAnimate("growWidthOut",sL),sI.registerBuiltInAnimate("growCenterIn",DI),sI.registerBuiltInAnimate("growCenterOut",FI),sI.registerBuiltInAnimate("clipIn",MI),sI.registerBuiltInAnimate("clipOut",wI),sI.registerBuiltInAnimate("fadeIn",EI),sI.registerBuiltInAnimate("fadeOut",BI),sI.registerBuiltInAnimate("growPointsIn",VI),sI.registerBuiltInAnimate("growPointsOut",WI),sI.registerBuiltInAnimate("growPointsXIn",YI),sI.registerBuiltInAnimate("growPointsXOut",XI),sI.registerBuiltInAnimate("growPointsYIn",$I),sI.registerBuiltInAnimate("growPointsYOut",qI),sI.registerBuiltInAnimate("growAngleIn",II),sI.registerBuiltInAnimate("growAngleOut",LI),sI.registerBuiltInAnimate("growRadiusIn",QI),sI.registerBuiltInAnimate("growRadiusOut",tL),sI.registerBuiltInAnimate("moveIn",rL),sI.registerBuiltInAnimate("moveOut",aL),sI.registerBuiltInAnimate("rotateIn",hL),sI.registerBuiltInAnimate("rotateOut",cL),sI.registerBuiltInAnimate("update",vL),sI.registerBuiltInAnimate("state",pL),sI.registerBuiltInAnimate("labelItemAppear",xL),sI.registerBuiltInAnimate("labelItemDisappear",SL),sI.registerBuiltInAnimate("poptipAppear",AL),sI.registerBuiltInAnimate("poptipDisappear",kL),sI.registerBuiltInAnimate("inputText",bL),sI.registerBuiltInAnimate("inputRichText",FL),sI.registerBuiltInAnimate("outputRichText",zL),sI.registerBuiltInAnimate("slideRichText",jL),sI.registerBuiltInAnimate("slideOutRichText",HL),sI.registerBuiltInAnimate("slideIn",WL),sI.registerBuiltInAnimate("growIn",GL),sI.registerBuiltInAnimate("spinIn",YL),sI.registerBuiltInAnimate("moveScaleIn",$L),sI.registerBuiltInAnimate("moveRotateIn",qL),sI.registerBuiltInAnimate("strokeIn",XL),sI.registerBuiltInAnimate("slideOut",ZL),sI.registerBuiltInAnimate("growOut",JL),sI.registerBuiltInAnimate("spinOut",QL),sI.registerBuiltInAnimate("moveScaleOut",tD),sI.registerBuiltInAnimate("moveRotateOut",eD),sI.registerBuiltInAnimate("strokeOut",KL),sI.registerBuiltInAnimate("pulse",iD),sI.registerBuiltInAnimate("MotionPath",NL),sI.registerBuiltInAnimate("streamLight",sD),sI.registerBuiltInAnimate("dissolve",BL),sI.registerBuiltInAnimate("grayscale",IL),sI.registerBuiltInAnimate("distortion",PL),sI.registerBuiltInAnimate("particle",LL),sI.registerBuiltInAnimate("glitch",OL),sI.registerBuiltInAnimate("gaussianBlur",RL),sI.registerBuiltInAnimate("pixelation",DL)},SD],DD=[_O,xO,AO,CO,MO,rO,EO,PO,OO,LO,FO,HO,NO,VO,GO,XO,ZO,QO,eI,$O];function FD(){ID.forEach((t=>t())),LD.forEach((t=>t()))}function zD(t,e){if(!CD(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==e_?void 0:e_.env)?e_.envParams:void 0}(e);return void 0===i?pO(t):RD(t,i),gO(t),mO(t),uR(),DD.forEach((t=>t())),ED(t),BD(t,Lw),FD(),t}function HD(t,e,i){if(!CD(t,e))return t;const s=OD[e];return s.installEnv(t,i),gO(t),function(t){mO(t)}(t),s.loadEnv(),DD.forEach((t=>t())),ED(t),BD(t,Lw),FD(),t}var jD=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt())),ED(t),BD(t,pE),FD(),t):t}(ib(jD(t,["envParams"])),e)}var UD=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nqD(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=$D(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&qD(t,i,s))}}}(t,s,r,o)}function JD(t){const{env:e}=t,i=Object.assign({},t);return delete i.env,delete i.key,"browser"===e?ND(i):"node"===e?function(t={}){const{envParams:e}=t,i=GD(t,["envParams"]);return zD(YD(i),e)}(i):"taro"===e?function(t={}){return WD("taro",t)}(i):"feishu"===e?function(t={}){return WD("feishu",t)}(i):"tt"===e?function(t={}){return WD("tt",t)}(i):"wx"===e?function(t={}){return WD("wx",t)}(i):"lynx"===e?function(t={}){return WD("lynx",t)}(i):function(t={}){return WD("harmony",t)}(i)}const QD=e=>{switch(e){case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony";case t.RenderModeEnum.lynx:return"lynx";default:return"browser"}},tF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},eF=(t,e)=>{const i=QD(t),s=tF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},iF=(t,e)=>{const i=ZD((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,JD,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}};class sF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option,m=eF(o,l);e_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=m?m:{});const v=this._option.stage;if(this._isExternalStage=!!v,this._releaseVRenderAppRef=void 0,this._stage=v,!this._stage){const t=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=QD(i.mode),n=eF(i.mode,i.modeParams);return iF(s,n)})({app:this._option.app,mode:o,modeParams:l});this._releaseVRenderAppRef=t.releaseAppRef;try{this._stage=(y=t.app,_=Object.assign({background:f,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(s=this._option.renderHooks)&&void 0!==s?s:{}),y.createStage(_))}catch(t){throw null===(n=this._releaseVRenderAppRef)||void 0===n||n.call(this),this._releaseVRenderAppRef=void 0,t}}var y,_;this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const b=sf({x:0,y:0,width:this._width,height:this._height});b.name="root",this._stage.defaultLayer.appendChild(b),this._rootGroup=b;const x=(p(h)?h:fA(o))&&!1!==c&&oT.getStageEventPlugin("gesture");x&&(this._gestureController=new x(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=ZM.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!_(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!gA(this._option.mode))return!1;return!1===(p(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:e_.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(e_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=e_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>ew(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>ew(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{ew(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===ZM.before;(e||i)&&(lA(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=ZM.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=ZM.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),lA(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=iw(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=sw(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=sw(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=QM(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=QM(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:nw,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{ew(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===$M.appear))?$M.appear:e.every((t=>t===$M.disappear))?$M.disappear:$M.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===BM.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=SM(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=SM(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:kM(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===BM.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===BM.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===BM.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===BM.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===BM.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{ew(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=iw(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return gA(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&Gc(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{ew(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=e_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){e_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function nF(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:cA)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const rF={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}},aF={poptip:H({},rF)};function oF(t){t.crosshair=Y(t.crosshair||{}).map((e=>aT({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function lF(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=li(l,i.width,i.height);a=t,o=e}else if(h&&gA(e.mode)){let t;t=y(h)?e_.getElementById(h):h;const{width:e,height:s}=li(t,i.width,i.height);a=e,o=s}else if(mA(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}const hF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function cF(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function dF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function uF(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;hF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function pF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var gF,fF,mF,vF,yF,_F;t.LayoutZIndex=void 0,(gF=t.LayoutZIndex||(t.LayoutZIndex={}))[gF.SeriesGroup=0]="SeriesGroup",gF[gF.Axis_Grid=50]="Axis_Grid",gF[gF.CrossHair_Grid=100]="CrossHair_Grid",gF[gF.Region=450]="Region",gF[gF.Mark=300]="Mark",gF[gF.Node=400]="Node",gF[gF.Axis=100]="Axis",gF[gF.MarkLine=500]="MarkLine",gF[gF.MarkArea=100]="MarkArea",gF[gF.MarkPoint=500]="MarkPoint",gF[gF.DataZoom=500]="DataZoom",gF[gF.ScrollBar=500]="ScrollBar",gF[gF.Player=500]="Player",gF[gF.Legend=500]="Legend",gF[gF.CrossHair=500]="CrossHair",gF[gF.Indicator=500]="Indicator",gF[gF.Title=500]="Title",gF[gF.Label=500]="Label",gF[gF.Brush=500]="Brush",gF[gF.CustomMark=500]="CustomMark",gF[gF.Interaction=700]="Interaction",t.LayoutLevel=void 0,(fF=t.LayoutLevel||(t.LayoutLevel={}))[fF.Indicator=10]="Indicator",fF[fF.Region=20]="Region",fF[fF.Axis=30]="Axis",fF[fF.DataZoom=40]="DataZoom",fF[fF.Player=40]="Player",fF[fF.ScrollBar=40]="ScrollBar",fF[fF.Legend=50]="Legend",fF[fF.Title=70]="Title",fF[fF.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(mF=t.AttributeLevel||(t.AttributeLevel={}))[mF.Default=0]="Default",mF[mF.Theme=1]="Theme",mF[mF.Chart=2]="Chart",mF[mF.Base_Series=3]="Base_Series",mF[mF.Series=4]="Series",mF[mF.Mark=5]="Mark",mF[mF.User_Chart=6]="User_Chart",mF[mF.User_Series=7]="User_Series",mF[mF.User_Mark=8]="User_Mark",mF[mF.User_SeriesStyle=9]="User_SeriesStyle",mF[mF.Built_In=99]="Built_In";class bF{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,H({},bF.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}bF.defaultMarkInfo={};class xF{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class SF{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>aT({},i,s,t);return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class AF extends xF{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=SF,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new bF,this._lastLayoutRect=null,this.id=yA(),this.userId=t.id,this._spec=t,this.effect={},this.event=new TM(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${PT}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=oT.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class kF{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=KC(qC(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:XC(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:XC(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:XC(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:XC(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:XC(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:XC(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=XC(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=XC(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=XC(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec($C(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class CF extends AF{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new kF(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=H(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=H(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class TF extends SF{_initTheme(t,e){return{spec:t,theme:this._theme}}}class MF extends CF{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=TF,this.modelType="region",this.specKey="region",this.type=MF.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function wF(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function EF(t,e,i){e?t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function BF(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function PF(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=LF(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),BF(d,!0,p,l),s&&EF(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function RF(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=LF(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=LF(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),BF(d,!1,p,o),s&&EF(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function IF(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=LF(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=LF(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=wF(t);n.length&&PF(n,e,i,!1,"left",s),r.length&&PF(r,e,i,!0,"left",s),a.length&&RF(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=wF(t);n.length&&OF(n,e,i,!1,"top",s),r.length&&OF(r,e,i,!0,"top",s),a.length&&IF(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=wF(t);n.length&&PF(n,e,i,!1,"right",s),r.length&&PF(r,e,i,!0,"right",s),a.length&&RF(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=wF(t);n.length&&OF(n,e,i,!1,"bottom",s),r.length&&OF(r,e,i,!0,"bottom",s),a.length&&IF(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=LF(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=LF(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:cA)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}DF.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(vF||(vF={})),t.STATE_VALUE_ENUM=void 0,(yF=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",yF.STATE_HOVER="hover",yF.STATE_HOVER_REVERSE="hover_reverse",yF.STATE_DIMENSION_HOVER="dimension_hover",yF.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",yF.STATE_SELECTED="selected",yF.STATE_SELECTED_REVERSE="selected_reverse",yF.STATE_SANKEY_EMPHASIS="selected",yF.STATE_SANKEY_EMPHASIS_REVERSE="blur",yF.STATE_HIGHLIGHT="highlight",yF.STATE_BLUR="blur",yF.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(_F||(_F={}));const FF=["linear","radial","conical"],zF={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const HF={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{HF[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class jF extends xF{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(H(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class NF extends jF{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,JM.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!HF[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(PT)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(PT))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(Mk(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class UF extends xF{constructor(){super(...arguments),this.id=yA(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=oT.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class VF extends UF{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const WF=1e3,GF="quadInOut",YF=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],XF=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=Ou(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},KF=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Ib(t):[],n=Ib(e);i&&s&&(i.fromTransform&&Lb(s,i.fromTransform.clone().getInverse()),Lb(s,i.toTransfrom));const[r,a]=Ob(s,n);return t?Rb(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},qF=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],ZF=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!qF.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Pu.Get(t,Bu.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class JF extends SI{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;KF(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&XF(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):mI(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const QF=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=$F(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=ZF(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new JF({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:WF,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:GF);return c.play(d),c};class tz extends SI{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;KF(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&XF(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const ez=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>YF.includes(t))(i)||(e[i]=t[i])})),e},iz=(t,e,i)=>{const s=ez(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=Ua.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},sz=(t,e,i)=>{const s=[],n=i?null:ez(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:ez(t.attribute);if("rect"===t.type)zb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)Hb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)jb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=Vb(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ua.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?Kb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?Ub(t,e).forEach((t=>{s.push(Ua.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&$b(t,e).forEach((t=>{"path"in t?s.push(Ua.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ua.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&iz(t,s,e),s},rz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,az=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=rz(l.delay,n,a,o),d=rz(l.duration,n,a,o),u=rz(l.oneByOne,n,a,o),p=rz(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?sz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:nz)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);QF(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?sz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:nz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>$F(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>ZF(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Ao.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new JF({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:WF,null!==(l=i.easing)&&void 0!==l?l:GF))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Ao.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new tz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:WF,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:GF))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):QF(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},oz=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},lz=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},hz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},cz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];hz(t,a,s)},dz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));hz(t,r,i)},uz=Symbol("statesClearedBeforeReInit");class pz extends UF{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new VF(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=sf("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Ml)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===vF.enter||t.context.diffState===vF.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&hz(t,r,e)},this.name=e,this.model=i.model,this.key=i.key,this.state=new NF(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&aT(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(wk(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return y(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=jC(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):FF.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):wk(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=PC(BC(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},zF[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=si.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)FF.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=PC(BC(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return QM(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return oT.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[DT],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=QM(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===$M.appear))?$M.appear:t.every((t=>t===$M.disappear))?$M.disappear:t[0];return null!=e?e:$M.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{lz(t),s.push(...t.getGraphics())})),e.forEach((t=>{lz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);az([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=oz(e,n),r=oz(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===$M.exit?$M.exit:i===$M.update?$M.update:$M.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===vF.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===vF.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=vF.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=vF.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=vF.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=$M.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=$M.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return tw(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=tw(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||d(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!d(r)&&(!FF.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!wk(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);u(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,CM(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=oT.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=oT.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===ZM.before||(this._product||this._initProduct(),lA(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[uz],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?cz(i,t,!0,a):dz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[uz]=e:delete s[uz]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===vF.exit&&!e.isExiting)if(e.context.animationState===vF.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===vF.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:vF.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=sf({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[uz]=t.currentStates.slice())}))}}var gz;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(gz||(gz={}));class fz extends pz{constructor(){super(...arguments),this.type=fz.type,this._marks=[],this._diffState=vF.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(hA("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?(hA("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return ew(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===vF.update){const t=this.hasAnimation(),e=CM(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=vF.update}render(){this._isCommited&&(lA(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}fz.type="group";const mz={measureText:BT};class vz{static instance(){return vz.instance_||(vz.instance_=new vz),vz.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class yz{constructor(){this.id=yA(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?hA("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class _z extends yz{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const bz=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},xz=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class Sz extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=eo.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=eo.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||bz(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=xz(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=eo.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=xz(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=bz(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=eo.now()-i>this.config.press.time&&xz(s[0],t){Ua.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:Ao.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class kz extends Az{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},y=null!==(o=v.width)&&void 0!==o?o:0,_=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const C=Ua.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:y/2,y:null!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:_/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(y+_)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,M;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},M={startAngle:x}):(T={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?T:M,"in"===b?M:T,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class Cz extends Az{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",y=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",_=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Ua.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===y?0:f,height:"in"===v&&"y"===y?0:m,fill:!0});let x={},S={};"y"===y?"negative"===_?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===_?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Tz extends SI{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=yt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&gL(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(gI(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=_h(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));mI(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const Mz={type:"fadeIn"};function wz(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return Mz;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const Ez={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},Bz={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},Pz={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},Rz=()=>{oT.registerAnimation("scaleInOut",(()=>Bz))},Oz=()=>{oT.registerAnimation("fadeInOut",(()=>Pz))},Iz=(t,e)=>({appear:wz(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Tz,duration:Ez.update.duration,easing:Ez.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),Lz=()=>{oT.registerAnimation("line",Iz)},Dz=()=>{sI.registerBuiltInAnimate("growPointsIn",VI),sI.registerBuiltInAnimate("growPointsOut",WI),sI.registerBuiltInAnimate("growPointsXIn",YI),sI.registerBuiltInAnimate("growPointsXOut",XI),sI.registerBuiltInAnimate("growPointsYIn",$I),sI.registerBuiltInAnimate("growPointsYOut",qI),sI.registerBuiltInAnimate("clipIn",MI),sI.registerBuiltInAnimate("clipOut",wI)},Fz=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class zz{constructor(t){this._markSet=new bF,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const Hz={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class jz extends zz{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},Hz,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&dz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}jz.type="element-highlight",jz.defaultOptions=Hz;const Nz=()=>{oT.registerInteractionTrigger(jz.type,jz)},Uz={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class Vz extends zz{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},Uz,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),cz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&dz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}Vz.type="element-select",Vz.defaultOptions=Uz;const Wz=()=>{oT.registerInteractionTrigger(Vz.type,Vz)};class Gz extends yz{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const Yz=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},Xz=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...Xz(t))})),s},Kz=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(Yz(t,r),!1)};class $z{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>oT.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>oT.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>oT.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return oT.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>oT.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){oT.registerTransform(t,e)}static registerFunction(t,e){t&&e&&vz.instance().registerFunction(t,e)}static unregisterFunction(t){t&&vz.instance().unregisterFunction(t)}static getFunction(t){return t?vz.instance().getFunction(t):null}static getFunctionList(){return vz.instance().getFunctionNameList()}static registerMap(t,e,i){const s=oT.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=oT.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,zM.get(e);var e}static registerSVG(t,e,i){const s=oT.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=oT.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){ST.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 ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=yA(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=rw.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=uF(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?oT.getSeriesBuiltInTheme(e):oT.getComponentBuiltInTheme(e);i=i?aT({},s,i[e]):s}s===t.length-1&&p(i)&&(i=TT({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},kk(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=gA(v);if(S?PB(i_):"node"===v&&uR(i_),S&&f&&(this._container=y(f)?e_.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=AT.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new sF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new LM(this,this._compiler),this._event=new TM(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),ST.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=aT({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=MT(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;$z.getFunctionList()&&$z.getFunctionList().length&&(t=wT(t,$z)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=oT.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=oT.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=oT.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return lF(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:RT,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:OT})}_initDataSet(t){this._dataSet=t instanceof Ra?t:new Ra,FM(this._dataSet,"dataview",Ea),FM(this._dataSet,"array",s),DM(this._dataSet,"copyDataView",WM);for(const t in oT.transforms)DM(this._dataSet,t,oT.transforms[t]);for(const t in oT.dataParser)FM(this._dataSet,t,oT.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),cF(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?$M.none:$M.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,ST.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{Yz(t)})),this._exitingVRenderComponents.clear())}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Oa?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=YM(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?aT({},t[n][e.index],i):i):t[n]=s?aT({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?aT({},t[n][r],i):i)}else t.id===e&&(t[n]=s?aT({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=aT({},t.getSpec(),e));const r=t.updateSpec(e),a=cF(r),o=dF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=lT({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=kT(this._currentThemeName),this._currentTheme=o(a,l);else{const t=lT({},kT(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),kT(n),kT(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),H(aF.poptip,rF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!gA(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return kT(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!AT.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield nF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!gA(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=y(this._canvas)?e_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?ZC(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return hA("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?ZC(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(hA("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return vz.instance().getFunction(t)}registerFunction(t,e){t&&e&&vz.instance().registerFunction(t,e)}unregisterFunction(t){t&&vz.instance().unregisterFunction(t)}getFunctionList(){return vz.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=oT.getChartPlugins();t.length>0&&(this._chartPlugin=new _z(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=oT.getVChartPlugins();e.length>0&&(this._vChartPlugin=new Gz(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=rw.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;this._renderState=rw.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent()}}$z.InstanceManager=ST,$z.ThemeManager=AT,$z.globalConfig={uniqueTooltip:!0},$z.Utils=mz,$z.vglobal=e_;oT.registerRegion("region",MF),oT.registerLayout("base",DF),XO(),EO(),oT.registerMark(fz.type,fz),oT.registerStageEventPlugin("gesture",Sz),Nz(),Wz(),vT(nT.name,nT);const qz="monotone",Zz="linear",Jz="bevel";t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));class Qz{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}function tH(t,e){return e("component",t)}function eH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=oT.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const iH=(t,e,i,s)=>{if(u(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},sH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,d(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],c=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(d(e.set))g=function(t){const i=c.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=c.get(`${e[a]}`);if(u(i))for(let i=0;i(g(t),t)))},nH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},rH=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=eH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},aH=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const oH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function lH(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=cH(rH(h,r,a,c),d,g),o.value=cH(rH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=rH(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function hH(t,e,i,s,n,r,a){if(d(e)){lH(t,e(n,a),i,s,r,a)}else e&&lH(t,e,i,s,r,a)}const cH=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=yi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class dH{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{hH(a,t,e,i,s,n,r)})):d(t)?hH(a,t,e,i,s,n,r):t&&lH(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:rH(r.visible,t,n),value:cH(rH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:rH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=rH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&oH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const uH={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?K(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?K(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},pH=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=nM([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return gH(a,n,o)},gH=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{_A(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{_A(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=uH[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},fH=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{_A(t[e])||(t[e]=0)}))})),t},mH=`${PT}_HIERARCHY_DEPTH`,vH=`${PT}_HIERARCHY_ROOT`,yH=`${PT}_HIERARCHY_ROOT_INDEX`;function _H(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function bH(t,e,i){t&&(i.needDefaultSeriesField&&(t[FT]=i.defaultSeriesField),t[LT]=e,t[DT]=i.getKey(t,e,i))}function xH(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function SH(t,e,i,s=0,n,r){void 0===r&&(r=e),bH(t,e,i),t[mH]=s,t[vH]=n||t[i.categoryField],t[yH]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>SH(e,s,i,t[mH]+1,t[vH],r)))}const AH={label:{name:"label",type:"text"}},kH=`${PT}_rect_x`,CH=`${PT}_rect_x1`,TH=`${PT}_rect_y`,MH=`${PT}_rect_y1`,wH={data:!0},EH={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},BH=[...Object.keys(Ez),"normal"];function PH(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var s;let n=t;return DH(n)&&delete n.type,n.oneByOne&&(n=OH(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:IH,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=aT({},o[e],a);return DH(n)&&delete n.type,n.oneByOne&&(n=OH(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:IH,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function RH(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=L(t,null,i),FH(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function OH(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function IH(t,e){var i;return null!==(i=null==t?void 0:t[LT])&&void 0!==i?i:e.context.graphicIndex}function LH(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function DH(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function FH(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),FH(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),FH(t[s],e,i))}function zH(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class HH extends SF{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=MC(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=oT.getSeriesMarkMap(o)?function(t,e,i){const s=oT.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=aT({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return aT({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=aT({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>aT({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const jH=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(EH[e]||(t[e]=!0),t)),{}),NH={compileOnlyKeys:EH,dataRelatedKeys:jH,seriesOnlyKeys:{tooltip:!0}},UH={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},VH=t=>(t=>g(t)&&!_(t)&&!d(t))(t)?t:u(t)?{}:null,WH=(t,e,i)=>{const s=VH(t),n=VH(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function GH(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class YH extends AF{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${PT}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=HH,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=zH(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(DM(this._rawData.dataSet,"invalidTravel",fH),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=YM(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=GM(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=GM(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new VF(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=K(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=gH(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=H(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){DM(this._dataSet,"dimensionStatistics",pH);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Oa(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&nM(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){DM(this._dataSet,"dimensionStatistics",pH);const s=new Oa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=nM(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&nM(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Oa(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:y(t)?e=>e[t]:_(t)&&t.every((t=>y(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(DM(this._rawData.dataSet,"addVChartProperty",nH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:_H.bind(this),call:bH}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:y(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=PH({},RH(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:fA(s)||mA(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=aT(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=aT(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=Fz(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=Fz(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=Fz(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:FT;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:zT,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,zT,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(oT.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new dH(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,GH(i))}_getSpecUpdatePolicy(){return NH}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},wH),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),l),!l.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>WH(t[i],e[i],UH)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&WH(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?GH(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&GH(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Oa||XM(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();zH(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:FT,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new zC).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return BC(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:FT}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),u(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),u(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,p=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${p}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,aT({},d,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:DT}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${u(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==NT&&t!==VT&&t!==jT&&t!==UT||(t=this.getStackValueField()),null!==(e=aM(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>_A(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:FT]}}function XH(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Mk(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function KH(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}YH.mark=AH,YH.transformerConstructor=HH;class $H extends YH{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);Mk(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${PT}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(NT),this.setFieldX2(jT)):(this.setFieldY(NT),this.setFieldY2(jT))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(VT),this.setFieldX2(UT)):(this.setFieldY(VT),this.setFieldY2(UT))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(GT),this.setFieldX2(WT)):(this.setFieldY(GT),this.setFieldY2(WT))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(XH("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function qH(t){return"bottom"===t||"top"===t}function ZH(t){return"left"===t||"right"===t}function JH(t){return"z"===t}function QH(t,e){return WC(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function tj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function ej(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?qH(t)?"linear":"band":qH(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const ij=(t,e,i)=>{var s;const n=null!==(s="band"===e?tH("axisBand",i):["linear","log","symlog"].includes(e)?tH("axisLinear",i):{})&&void 0!==s?s:{},r=qH(t)?tH("axisX",i):ZH(t)?tH("axisY",i):tH("axisZ",i);return aT({},tH("axis",i),n,r)};class sj{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:cA)("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:cA)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>Ek(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return qH(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class nj extends sj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:BM.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const rj=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},aj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},oj=(t,e,i,s)=>{var n;const r=e.getScale(),a=Ek(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:lj(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,hj=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class cj extends sj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!rj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:BM.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:BM.canvas}),callback:this.onMouseOut}),fA(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:BM.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),fA(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var dj;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(dj||(dj={}));const uj={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},pj={sampling:!0,samplingFactor:!0};class gj{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(uj.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:Jz,curveType:Zz,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===qz?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(uj.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:LH(this._spec,uj.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Oa(this._option.dataSet,{name:`${PT}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(dj.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[uj.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(dj.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,aT({},this._spec[uj.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const fj=Object.assign(Object.assign({},AH),uj),mj=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>mj(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},vj=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class yj extends pz{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return vj}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(wk(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?mj(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:vF.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[DT]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const _j=new Uint32Array(33),bj=new Uint32Array(33);bj[0]=0,_j[0]=~bj[0];for(let t=1;t<=32;++t)bj[t]=bj[t-1]<<1|1,_j[t]=~bj[t];function xj(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&_j[31&o]&bj[1+(31&l)])return!0}else{if(i[h]&_j[31&o])return!0;if(i[c]&bj[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,_j[31&o]&bj[1+(31&l)]);else for(s(h,_j[31&o]),s(c,bj[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,bj[31&a]|_j[1+(31&o)]);else for(n(l,bj[31&a]),n(h,_j[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function Sj(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=yt(i,-o,t.width+l),d=yt(s,-o,t.width+l),u=yt(n,-a,t.height+h),p=yt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function Aj(t,e,i=!1){return i?Sj(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function kj(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=Aj(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=Sj(t,r)),e.getRange(r)))}function Cj(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return Cj(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return Cj(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return Cj(t,e,n,s,h,c)}return!1}const Mj=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],wj=["top","inside-top","inside"];function Ej(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const Bj={mode:"same-time",duration:300,easing:"linear"};function Pj(t){return 3===t||4===t}function Rj(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const Oj=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function Ij(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}class Lj extends AI{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class Dj extends AI{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const Fj=(t,e)=>Math.ceil(t)>Math.floor(e),zj=([t,e],[i,s])=>s>t&&e>i;function Hj(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const jj=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Nj extends ef{constructor(t,e){super(t),this._skipRenderAttributes=jj,(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?H(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{Wj(t,e,i)})),e}function Gj(t,e){e&&(null==t||t.onComplete.push(e))}function Yj(t){t.forEach((t=>{t()}))}function Xj(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var Kj=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(jA.hover,!0),xA(this,(t=>{t===e||P(t.states)||t.addState(jA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(xA(this,(t=>{P(t.states)||(t.removeState(jA.hoverReverse),t.removeState(jA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void xA(this,(t=>{P(t.states)||(t.removeState(jA.selectedReverse),t.removeState(jA.selected))}));P(e.states)||(e.addState(jA.selected,!0),xA(this,(t=>{t===e||P(t.states)||t.addState(jA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===Ao.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Ao.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[Ij(g,f,c,d,a,o),Ij(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=DA.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Ml)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),Yj(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Gj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(Bj),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=Wj(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=Wj(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},Xj(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(d(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(a);const o=[],l=a;if(!c(t)&&d(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}d(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return KA(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&Fj(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&Fj(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(Hj([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!zj([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(Aj(i,e,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(Aj(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(Aj(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;Vj(i,null==n?void 0:n.attribute),Vj(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{qj[t]=e};var Jj=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};Qj.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const tN=()=>{Zj("line",Qj),Zj("area",Qj)};var eN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}iN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const sN=()=>{Zj("symbol",iN),Zj("line-data",iN)};class nN extends yj{constructor(){super(...arguments),this.type=nN.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)===CC.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}nN.type="line";const rN=()=>{oT.registerMark(nN.type,nN),XO(),OO(),tN(),sN(),Dz(),oT.registerGraphicComponent("line",sg)};class aN extends pz{constructor(){super(...arguments),this.type=aN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}aN.type="symbol";const oN=()=>{oT.registerMark(aN.type,aN),XO(),ZO(),sN(),oT.registerGraphicComponent("symbol",tg)};class lN extends HH{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function hN(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function cN(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function dN(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function uN(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function pN(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function gN(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const fN=t=>t.map(((t,e)=>({index:e,value:t}))),mN=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},vN=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=WA(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return fN(v)};class bN{constructor(t){this.id=yA(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class xN extends bN{constructor(){super(xN.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Mk(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&hN(c)&&hN(d)))return;const u=cN(t,c),p=cN(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=u,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!uN(u,p))return}else if(0===_&&0===b){if(!uN(p,u))return}else if(y||A)if(y&&!A){if(!dN(u,p))return}else if(A&&!y){if(!dN(p,u))return}else{if(f===b)return;if(f>b){if(!pN(u,p))return}else if(!pN(p,u))return}else{if(0===f&&0===_){if(!gN(u,p))return}else if(0===b&&0===g&&!gN(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){DM(e.getOption().dataSet,"tickAlign",_N);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}xN.pluginType="component",xN.type="AxisSyncPlugin";const SN={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function AN(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function kN(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function CN(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const TN=t=>"band"===t||"ordinal"===t||"point"===t;function MN(t,e){return{id:t,label:t,value:e,rawValue:t}}function wN(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class EN extends yz{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const BN=`${PT}_ARC_TRANSFORM_VALUE`,PN=`${PT}_ARC_RATIO`,RN=`${PT}_ARC_START_ANGLE`,ON=`${PT}_ARC_END_ANGLE`,IN=`${PT}_ARC_K`,LN=`${PT}_ARC_MIDDLE_ANGLE`,DN=`${PT}_ARC_QUADRANT`,FN=`${PT}_ARC_RADIAN`,zN=-Math.PI/2,HN=3*Math.PI/2,jN=.6,NN=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},UN=(t,e,i)=>{var s;const n=null!==(s="band"===e?tH("axisBand",i):"linear"===e?tH("axisLinear",i):{})&&void 0!==s?s:{},r=tH("angle"===t?"axisAngle":"axisRadius",i);return aT({},tH("axis",i),n,r)};function VN(t,e,i,s){switch(t){case r.cartesianBandAxis:return ij(QH(i,["z"]),"band",e);case r.cartesianLinearAxis:return ij(QH(i,["z"]),"linear",e);case r.cartesianLogAxis:return ij(QH(i,["z"]),"log",e);case r.cartesianSymlogAxis:return ij(QH(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return ij(QH(i),void 0,e);case r.polarBandAxis:return UN(i.orient,"band",e);case r.polarLinearAxis:return UN(i.orient,"linear",e);case r.polarAxis:return UN(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=tH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>qH(t.orient)));let g;g=p(u)?aT({},TN(u.type)?a:o,l):l;const f=n.find((t=>ZH(t.orient)));let m;return m=p(f)?aT({},Ek(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=tH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?aT({},TN(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?aT({},Ek(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return WN(i,tH(t,e));default:return tH(t,e)}}const WN=(t,e)=>{var i;const s=aT({},e,e[tj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class GN extends SF{getTheme(t,e){return VN(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},qC(e)),{[s]:0}))}}class YN extends CF{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=GN,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof to||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:BM.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new EN(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;Yz(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=Xz(t),s=Kz(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}Yz(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var XN,KN;YN.transformerConstructor=GN,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(XN||(XN={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(KN||(KN={}));class $N extends pz{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=Kz(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?Yz(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(Yz(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=oT.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(MM.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}$N.type="component";const qN=()=>{oT.registerMark($N.type,$N)};var ZN,JN;!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.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(ZN||(ZN={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(JN||(JN={}));const QN={[JN.selectedReverse]:{},[JN.selected]:{},[JN.hover]:{},[JN.hoverReverse]:{}},tU=t=>t,eU={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class iU extends YN{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?XN.circleAxis:XN.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?KN.circleAxisGrid:KN.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=PH(null===(h=oT.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new VF(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&bk(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?Mk(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!Mk(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return bk(this._regions,(e=>{var i;_(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=xk(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),bk(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):bk(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(bk(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=K(t.map((t=>t.fields.length)));for(let t=1;tV(null==e?void 0:e[i],null==t?void 0:t[i])||eU[i]))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=yM(s=t.domainLine)).startSymbol=yM(s.startSymbol),s.endSymbol=yM(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=j(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return xM(aT({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:xM(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>xM(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=xM(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return xM(aT({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:xM(t.tick.style)),t.tick.state&&(i.tick.state=_M(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return xM(aT({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:xM(t.subTick.style)),t.subTick.state&&(i.subTick.state=_M(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=SN[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:aT({},d,xM(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:xM(h.style)}),h.state&&(i.title.state.shape=_M(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:xM(o.style)}),o.state&&(i.title.state.background=_M(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=_M(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=xM(t.background.style)),t.background.state&&(i.panel.state=_M(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:ET(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return xM(aT({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:xM(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:ET(t.subGrid.alternateColor),style:xM(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=eH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){FM(this._option.dataSet,"scale",tU);const i=this.registerTicksTransform();return new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===ZN.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}iU.specKey="axes";const sU=()=>{qN(),oT.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},nU=[xN];class rU extends iU{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),bk(this._regions,(t=>{const e=this.getOrient();qH(e)?wN(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):ZH(e)?wN(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):JH(e)&&wN(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=aT({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(aT({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=qH(this.getOrient()),n=t=>{var e;return(s?!qH(t.getOrient()):qH(t.getOrient()))&&Mk(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=QH(i,["z"]),JH(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!CN(e))return null;const{axisType:t,componentName:s}=ej(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>ZH(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!CN(t))return;const{axisType:s,componentName:n}=ej(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=oT.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return qH(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):JH(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(nU.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){qH(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!qH(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!JH(this.getOrient())&&this._spec.innerOffset){const t=this._spec;ZH(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=XC(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=XC(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=qH(this.getOrient())?t.fieldX:JH(this.getOrient())?t.fieldZ:t.fieldY,Mk(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:Mk(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(MM.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(qH(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=qH(this._orient)?{x:K(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return bk(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:qH(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:JH(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();bk(this._regions,(e=>{qH(t)?wN(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):ZH(t)?wN(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):JH(t)&&wN(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=qH(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&_(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=qH(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=aT(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ue).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=qH(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?yt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):yt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return MN(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:Mk(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}rU.type=r.cartesianAxis,rU.specKey="axes";class aU{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new VF(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=MN(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>MN(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const oU=(t,e,i,s)=>{const n=yN(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},lU=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,hU=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?fN([s[s.length-1]]):fN([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(g),a=K(g);if(s.length<=f/n){const i=oU(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=dU(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=oU(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!lU(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?hU(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function pU(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=lk(t,!!n),o=lk(r,!!n);const h=ae.distancePP(s,l),c=ae.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=uU(e,t,!1,!!n),o=uU(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=lk(t,!!n),o=lk(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class gU extends Nj{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&nk(this._innerView),this.removeAllChild(!0),this._innerView=DA.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return rk(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=H({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${ZN.grid}-sub`:`${ZN.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=lk(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=uU(t,o,!1,!!a)}const u=DA.path(Object.assign({path:c,z:l},d(r)?H({},this.skipDefault?null:gU.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=lk(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=DA.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ht/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?H({},this.skipDefault?null:gU.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}gU.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class fU{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=OA(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return RA([n[1],-1*n[0]],t*(e?1:-1)*s)}}class mU extends AI{onBind(){var t;const e=_L(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;Vj(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class vU extends AI{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;Vj(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function yU(){EO(),OO(),GO(),QO(),sI.registerBuiltInAnimate("axisEnter",mU),sI.registerBuiltInAnimate("axisUpdate",vU)}EO(),LO();class _U extends gU{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},gU.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=FA,endAngle:r=zA}=this.attribute;i=ok(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=H({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function bU(){EO(),OO(),FO(),ZO()}function xU(){EO(),OO(),_O(),ZO()}G(_U,fU),bU();class SU extends Nj{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},SU.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=DA.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=DA.line;Y(i)[0].cornerRadius&&(t=DA.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=DA.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}SU.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}}},xU();class AU extends SU{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},SU.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=DA.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function kU(){EO(),NO(),ZO(),GO(),QO()}var CU=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-E)):j>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-E/2));const N="right"===_||"end"===_,U="left"===_||"start"===_,V=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:Y(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=T-b[1]-b[3],e=I+E,i=1===j?(t-e)/2+E+I/2:b[0]+E-(T/2+e/2-E)+I/2;if(V(i,"center"),A){const t=i-I/2-E+F/2;A.setAttributes({x:t})}}if(U&&1!==j){const t=T-b[1]-b[3],e=0===j?-t/2+E/2:-T+b[3]+b[1]+E;if(V(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=T-b[1]-b[3],e=0===j?t/2+E/2:t;if(V(e,"right"),A){const t=e-I-E+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===H&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(O.states=m.text);const{visible:W}=a,G=CU(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:M,x:k,y:C}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Ml)}this._bgRect=t}this._textShape=O,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:H({},TU.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}TU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const MU=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(jA.hover,!0),xA(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(jA.hoverReverse,!0)})),s):i},wU=(t,e,i)=>i?(xA(e,(t=>{t.name&&!P(t.states)&&(t.removeState(jA.hoverReverse),t.removeState(jA.hover))})),null):i,EU=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(jA.selected)?(xA(e,(t=>{t.name&&!P(t.states)&&(t.removeState(jA.selectedReverse),t.removeState(jA.selected))})),null):s.name&&!P(s.states)?(s.addState(jA.selected,!0),xA(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(jA.selectedReverse,!0)})),s):i},BU={type:"default",duration:300,easing:"linear"};class PU extends Uj{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=MU(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=wU(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=EU(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=DA.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),Yj(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Gj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(xA(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=Wj(this),{delay:a=0,duration:o=BU.duration,easing:l=BU.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};Vj(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=Wj(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},Xj(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&nk(this._innerView),this.removeAllChild(!0),this._innerView=DA.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(BU)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=DA.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=ZN.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=DA.group({x:0,y:0,pickable:!1});t.name=ZN.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=DA.group({x:0,y:0,pickable:!1});i.name=ZN.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=DA.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=ZN.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=NA;else{const t=this.data[s],e=H({},NA,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=DA.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=ZN.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=NA;else{const i=H({},NA,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=DA.group({x:0,y:0,pickable:!1});return r.name=`${ZN.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=KA(this._getLabelAttribute(t,e,n,i));if(a.name=ZN.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=NA;else{const s=H({},NA,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new TU(Object.assign({},e));i.name=ZN.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return rk(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=Ht/2*(l.x>e.x?1:-1):h=Ht/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=d(y)?H({},QA.label.style,y(t,e,i,s)):y;y=H(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return d(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},xA(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=L(r.attribute),a=L(e.attribute),o=Cb(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},Vj(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const RU={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&hk(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function OU(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function IU(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:RU[n]||RU.parity;if(s.length>=3&&ck(s,r)){do{s=a(s,r)}while(s.length>=3&&ck(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);hk(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),IU(l,s,n,(t=>hk(t,l,r))),IU(h,s,o,(t=>hk(t,h,r)||!(!n||t===l)&&hk(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function DU(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},HU(t,e.attribute.angle)),{angle:zU(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({},jU(t,e.attribute.angle)),{angle:zU(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function zU(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function HU(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=zU(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function jU(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=zU(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function NU(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=sk(h),m=ik(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function UU(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var VU=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=DA.group({zIndex:999});e.name=ZN.axisBreak,e.id=this._getNodeId(`${ZN.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=H({},tk,s),a=null!==(e=r.size)&&void 0!==e?e:tk.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=DA.symbol(Object.assign({x:s.x,y:s.y},o));l.name=ZN.axisBreakSymbol;const h=DA.symbol(Object.assign({x:n.x,y:n.y},o));h.name=ZN.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=DA.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=ZN.background,n.id=this._getNodeId("background"),n.states=H({},QN,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new TU(Object.assign({},t));e.name=ZN.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=VU(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:H({},QN,l),symbol:H({},QN,l)});const d=new SU(c);d.name=ZN.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=VU(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let T,M,{angle:w}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=IA(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else T=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(w&&0!==w){const t=Math.abs(Math.sin(w));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:M},a),state:{text:H({},QN,c.text),shape:H({},QN,c.shape),panel:H({},QN,c.background)}});return B.angle=w,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=VU(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(u(b)&&a){b=IA(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return HU(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return jU(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),FU(i,t),!DU(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=sk(a),l=ik(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=UU(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Xt(c,i))}}else{if(l){const i=UU(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Xt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);NU(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&LU(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=DA.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=ZN.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=GA(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=oi(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}WU.defaultAttributes=QA,G(WU,fU);const GU={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},YU={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},XU={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},KU={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}};class $U extends rU{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new qk}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,cU),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Nk(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),sU(),oT.registerComponent($U.type,$U,!1)},ZU=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function JU(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,tV=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function eV(t,e,i="count"){const s=tV(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const iV=Math.sqrt(50),sV=Math.sqrt(10),nV=Math.sqrt(2);class rV{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=kN(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=qH(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!d(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(X(e)-e[0]);i<=1||k(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(QU),e.sort(QU),{domain:JU(t,e),scope:eV(t,e,i)}}(r,aA(t),this._spec.breaks[0].scopeType);e=aA(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=kN(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-K(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=iV?10:n>=sV?5:n>=nV?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function aV(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function oV(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!Mk(t.type))return fN(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return fN([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=aV(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=aV(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=aV(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=yN(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=yN(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?hV.greedy:hV.parity;for(;l.length>=3&&ck(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;hk(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),oV(t,l,a,(e=>hk(e,t,i))),oV(n,l,o,(e=>hk(e,n,i)||!(!a||e===t)&&hk(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return fN(m)},hV={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&hk(i,t,e)||(i=t,0))))}},cV={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class dV extends rU{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new vC}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!JH(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=qH(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=GC(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=aA(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,lV),t}}dV.type=r.cartesianLinearAxis,dV.specKey="axes",dV.builtInTheme={axis:YU,axisLinear:cV,axisX:XU,axisY:KU},G(dV,rV);const uV=()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),sU(),oT.registerComponent(dV.type,dV)},pV=`${PT}_hide_`;function gV(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const fV=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[pV]&&(gV(t,!0),t[pV]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[pV]=!0,gV(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},mV=()=>{oT.registerGrammarTransform("symbolOverlap",{transform:fV,runType:"afterEncode"})},vV={min:$,max:K,average:fk,sum:gk};function yV(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function _V(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function bV(t,e,i,s){return _V(t,e,i,"min",s)}function xV(t,e,i,s){return _V(t,e,i,"max",s)}function SV(t,e,i,s){return _V(t,e,i,"average",s)}function AV(t,e,i,s){return _V(t,e,i,"sum",s)}const kV=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=yV;if("min"===n?l=bV:"max"===n?l=xV:"average"===n?l=SV:"sum"===n&&(l=AV),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},CV=()=>{oT.registerGrammarTransform("dataSampling",{transform:kV})};class TV extends $H{constructor(){super(...arguments),this.type=CC.line,this.transformerConstructor=lN,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),pj)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),RH("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=KH(this);this._symbolMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),RH("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}TV.type=CC.line,TV.mark=fj,TV.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},TV.transformerConstructor=lN,G(TV,gj);class MV{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{XM(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Oa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];hA(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];hA(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class wV{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{bA(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{nM(e,[{key:t,operations:Mk(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&nM(e,[{key:i.field,operations:Mk(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?jC("colorOrdinal"):jC(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(bA(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),bA(s.domain)?e.reRender=!0:V(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!bA(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Mk(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Mk(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;Mk(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(Mk(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Mk(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Mk(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class EV{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");cz(t,s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");dz(t,s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");dz(t,s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");cz(t,s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&cz(t,i,!0,l):a&&cz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&cz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{dz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&dz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const BV={[r.markPoint]:!0,[r.markLine]:!0,[r.markArea]:!0},PV={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class RV extends xF{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=yA(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:RT,height:OT},this._viewRect={width:RT,height:OT},this._viewBox={x1:0,y1:0,x2:RT,y2:OT},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(PV).some((t=>!u(e[t])))},this._paddingSpec=qC(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new TM(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new MV(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new EV;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=oT.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(PH({},RH("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=j(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=oT.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=oT.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof AF)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof pz))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof pz)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&XM(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=lF(this._spec,this._option,{width:RT,height:OT})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=BC(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new wV(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){uF(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=BC(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=qC(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{uF(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},n={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===r.label||l.type===r.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));n[l.type]&&(n[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(_(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);dF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),uF(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);dF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),uF(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(n).forEach((e=>{if(n[e]){const i=this._spec[e];(_(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(BV[t]&&_(e)&&_(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return BV[t]&&_(e)&&e.length>0&&_(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!BV[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;BV[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];uF(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=KC(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(MM.AFTER_MARK_RENDER_END,e)};this._event.on(MM.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:kM;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(AM(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===dj.dimensionHover||s===dj.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>Ek(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>Ek(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const OV=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)},IV={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class LV{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},IV),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):rT(t,a,c.spec),rT(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=OV(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=OV(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(oT.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(oT.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=oT.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=oT.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=oT.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):iH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=iH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class DV extends LV{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&aT(i,pF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class FV extends DV{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),oF(t)}}const zV=(t,e)=>{const i={nodes:{}},{fields:s}=d(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=oM(t,!0);for(const e in o)for(const i in o[e].nodes)dM(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)cM(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&hM(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class jV{_beforeInit(){this._dataSet&&DM(this._dataSet,"stackSplit",zV)}_initStack(){this._stack=new HV(this),this._stack.init()}}const NV={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:dj.dimensionHover};class UV extends zz{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},NV,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=kM(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}UV.type="dimension-hover",UV.defaultOptions=NV;const VV=()=>{oT.registerInteractionTrigger(UV.type,UV)},WV=()=>{oT.registerComposedEvent(dj.dimensionHover,cj),oT.registerComposedEvent(dj.dimensionClick,nj)},GV=t=>t.fieldX[0],YV=t=>t.fieldY[0],XV=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},KV=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},$V=(t,e)=>t?e?GV:XV:e?YV:KV,qV=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=hj(t,(t=>qH(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=hj(t,(t=>ZH(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Ek(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=ZV(t,i,$V(e,Ek(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=ZV(t,i,$V(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},ZV=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:JV(t,s,i)},JV=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=oj(e,t,"cartesian",null!=i?i:qH(t.getOrient())?GV:YV);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},QV=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(Ek(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(Mk(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=AN(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};eW(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&tW(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),tW=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=eH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},eW=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},iW=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=sW(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},sW=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},nW=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return QV(c,r,e),c.xField.cacheInfo?iW(c.xField):c.yField.cacheInfo?iW(c.yField):void 0},rW=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],aW=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&rW.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(oW(s).every((t=>{var e;return!oH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},oW=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},lW={dom:`${PT}_TOOLTIP_HANDLER_DOM`,canvas:`${PT}_TOOLTIP_HANDLER_CANVAS`},hW={key:"其他",value:"..."};var cW;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(cW||(cW={}));class dW{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=aW(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},hW),t):hW;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&oH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class uW extends dW{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Ek(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const pW=()=>{oT.registerTooltipProcessor("dimension",uW)};class gW extends dW{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,So.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(kM(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const fW=()=>{oT.registerTooltipProcessor("mark",gW)};class mW extends dW{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const vW=()=>{oT.registerTooltipProcessor("group",mW)};class yW extends RV{constructor(){super(...arguments),this.transformerConstructor=FV,this.type="line",this.seriesType=CC.line}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}yW.type="line",yW.seriesType=CC.line,yW.transformerConstructor=FV,G(yW,jV);const _W=[...vj,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class bW extends yj{constructor(){super(...arguments),this.type=bW.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return _W}_getIgnoreAttributes(){return[]}}bW.type="area";const xW=()=>{oT.registerMark(bW.type,bW),XO(),AO(),tN(),sN(),Dz(),oT.registerGraphicComponent("area",Gg)};class SW extends dH{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const AW=Object.assign(Object.assign(Object.assign({},AH),uj),{area:{name:"area",type:"area"}}),kW=()=>{oT.registerAnimation("area",Iz),Lz(),Rz()};class CW extends lN{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=aT({},f.style,g.style),l.state=aT({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function TW(){EO(),NO()}function MW(){return"browser"===e_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const wW={debounce:St,throttle:At};TW();let EW=class t extends Nj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=yt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=yt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=MW(),a="browser"===e_.env?e_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=yt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:wW[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(VA,{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",wW[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===e_.env?e_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:oi(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=oi(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=yt(t[0],0,1),c=yt(t[1],0,1),d=yt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=MW(),e="browser"===e_.env?e_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===e_.env?e_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};EW.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class BW{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ue).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=BW.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(VA,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new EW(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Xt(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Xt(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ht/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ht/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ht,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}HW.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class jW{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};H(s,HW.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new HW(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,H(e,aF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class NW{constructor(){this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class UW extends NW{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class VW extends NW{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function WW(t){t.isBound(jW)||(t.bind(jW).toSelf().inSingletonScope(),t.bind(Wy).toService(jW)),t.isBound(UW)||(t.bind(UW).toSelf(),t.bind(Pf).toService(UW)),t.isBound(VW)||(t.bind(VW).toSelf(),t.bind(Pf).toService(VW))}class GW extends Nj{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}EO(),OO();class YW extends GW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},YW.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}YW.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},EO(),NO();class XW extends GW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},XW.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}XW.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},EO(),_O();class KW extends GW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},KW.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}KW.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},EO(),_O();class $W extends GW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},$W.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=FA,endAngle:s=zA}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}$W.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},EO(),LO();class qW extends GW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},qW.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ce(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}qW.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class ZW{isInValidValue(t){const{startAngle:e=FA,endAngle:i=zA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=FA,endAngle:i=zA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return ak(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function JW(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=JW(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var eG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=ok(n,l,c,e,i);h=DA.path(Object.assign(Object.assign({},a.style),{path:lk(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=DA.circle(t)}h.name=ZN.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=H({},QN,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=eG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;u(_)&&(_=0===r?"end":"middle"),"start"===_?(y="bottom",g={x:s.x,y:s.y-v}):"end"===_&&(y="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:y,textAlign:"center"},l),state:{text:H({},QN,d.text),shape:H({},QN,d.shape),panel:H({},QN,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=JW(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&QW(e,c,i)}else e.AABBBounds.width()>r&&QW(e,r,i)}else o>a.x&&h.x2>n.x2?(QW(e,n.x2-o,i),r&&tG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}iG.defaultAttributes=QA,G(iG,ZW);const sG=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=WA(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=rk(r,ak(s,r,e,n));return o=a,l=ak(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(gt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return fN(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=sG(t,i,e),r=$(s),l=K(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=rG(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return fN(c)},rG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&mN(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var aG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new hG(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):Pj(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=Pj(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=Pj(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=Pj(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?Pj(t.quadrant)?"left":"right":Pj(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(Pj(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),Yj(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Gj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}uG.defaultAttributes={pickable:!1};var pG,gG,fG,mG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(vG,ZW),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(pG||(pG={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(gG||(gG={})),function(t){t.dataZoomChange="dataZoomChange"}(fG||(fG={}));const yG="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",_G={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:yG,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:yG,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},bG={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}},xG=0,SG=1,AG=2,kG=3,CG=4,TG=5,MG=5,wG=999,EG=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var BG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:AG},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:AG},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:xG},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,T;const{orient:M,middleHandlerStyle:w={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(w.visible){const t=(null===(i=w.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t,zIndex:TG},null===(s=w.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=w.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=w.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:TG},w.icon),{pickable:!P&&(null===(h=w.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},bG.horizontal),{zIndex:TG}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},bG.horizontal),{zIndex:TG}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:wG},bG.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:wG},bG.horizontal),{pickable:!P}),"rect")}else{if(w.visible){const t=(null===(g=w.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D,zIndex:TG},null===(f=w.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=w.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=w.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:TG},w.icon),{pickable:!P&&(null===(S=null===(x=w.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},bG.vertical),{zIndex:TG}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(C=B.symbolType)&&void 0!==C?C:"square",zIndex:TG},bG.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:wG},bG.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:wG},bG.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:kG},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:kG},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:SG},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:CG},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return kb(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ue).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=BG(c,["formatMethod"]),{formatMethod:g}=d,f=BG(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,T,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},T={textAlign:EG(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:EG(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:EG(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:EG(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),H({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:MG}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),H({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:MG}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new TU(e),s.name=i,t.add(s)),s}}const RG={debounce:St,throttle:At};class OG extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=pG.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=pG.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=pG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=pG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=pG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===e_.env?e_:this.stage,s=MW();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===pG.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===pG.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===pG.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===pG.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(gG.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(gG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(gG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===pG.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(gG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(gG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:RG[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===e_.env?e_:this.stage,e=MW();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===e_.env?e_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===e_.env?e_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:yt(e+t,0,1),end:yt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=pG.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}kU(),NO(),ZO(),AO(),OO();let IG=class t extends Nj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,y;h.visible?this._isHorizontal?(m=p,v=g-f,y={x:a.x,y:a.y+f}):(m=p-f,v=g,y={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,y=a);const _=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(_+b)/2,y={x:y.x+_/2,y:y.y}):(v-=(_+b)/2,y={x:y.x,y:y.y+_/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new PG(this._getRendererAttrs()),this._interaction=new OG(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(gG.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(gG.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(fG.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(gG.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(fG.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var LG,DG,FG,zG;function HG(){EO(),kU(),SD()}IG.defaultAttributes=_G,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(LG||(LG={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(DG||(DG={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(FG||(FG={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(zG||(zG={}));class jG extends Nj{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=MU(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=wU(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=EU(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:H({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:H({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:H({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=DA.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=DA.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=DA.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),Yj(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Gj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=Wj(this);this.markerAnimate("exit");const n=Wj(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},Xj(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function NG(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function UG(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;Vj(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function VG(t,e,i,s){t&&(UG(t.startSymbol,e,i,s),NG(t).forEach((t=>UG(t,e,i,s))),UG(t.endSymbol,e,i,s))}function WG(t,e,i,s){t&&(UG(t.getTextShape(),e,i,s),UG(t.getBgRect(),e,i,s))}function GG(t,e,i,s){var n,r,a,o;t&&(Vj(t,{fillOpacity:0,strokeOpacity:0},{fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function YG(t,e,i,s){t&&(GG(t.startSymbol,e,i,s),NG(t).forEach((t=>GG(t,e,i,s))),GG(t.endSymbol,e,i,s))}function XG(t,e,i,s){t&&(GG(t.getTextShape(),e,i,s),GG(t.getBgRect(),e,i,s))}function KG(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;UG(t.startSymbol,s,r,n);const h=NG(t);h.forEach((t=>Vj(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),UG(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;UG(t.getTextShape(),e,l,n),UG(t.getBgRect(),e,l,n)}))}function $G(t,e,i,s,n){VG(t,s,i,n),Y(e).forEach((t=>{WG(t,s,i,n)}))}function qG(t,e,i,s,n){UG(t,s,i,n),Y(e).forEach((t=>{WG(t,s,i,n)}))}function ZG(t,e,i,s,n){UG(t,s,i,n),Y(e).forEach((t=>{WG(t,s,i,n)}))}function JG(t,e,i,s,n,r){var a;VG(t,n,s,r),UG(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?WG(i,n,s,r):UG(i,n,s,r)}function QG(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;UG(t.startSymbol,n,o,r);const u=NG(t);u.forEach((t=>Vj(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),UG(e,n+o+l,h,r),UG(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(UG(i.getTextShape(),n+o+l+h+c,d,r),UG(i.getBgRect(),n+o+l+c,d,r)):UG(i,n+o+l+c,d,r)}function tY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?KG(t,e,s,r,a):"fadeIn"===i&&$G(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?KG(t,e,s,n,a):"fadeIn"===i&&$G(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){YG(t,s,i,n),Y(e).forEach((t=>{XG(t,s,i,n)}))}(t,e,i,s,n)}}function eY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&qG(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&qG(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){GG(t,s,i,n),Y(e).forEach((t=>{XG(t,s,i,n)}))}(t,e,i,s,n)}}function iY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&ZG(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&ZG(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){GG(t,s,i,n),Y(e).forEach((t=>{XG(t,s,i,n)}))}(t,e,i,s,n)}}function sY(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?JG(n,r,e,i,s,o):"callIn"===t&&QG(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?JG(n,r,e,i,s,a):"callIn"===t&&QG(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;YG(t,n,s,r),GG(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?XG(i,n,s,r):GG(i,n,s,r)}(n,r,e,t,i,s)}}const nY={type:"clipIn",duration:500,easing:"linear",delay:0},rY={type:"fadeIn",duration:500,easing:"linear",delay:0},aY={type:"callIn",duration:500,easing:"linear",delay:0},oY={type:"fadeOut",duration:500,easing:"linear",delay:0};class lY{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=H({},i,s),c=new TU(Object.assign(Object.assign({},h),{state:{panel:H({},NA,null!==(o=a[n])&&void 0!==o?o:X(a)),text:H({},NA,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=H({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:H({},NA,null!==(a=r[s])&&void 0!==a?a:X(r)),text:H({},NA,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class hY extends jG{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=nY,this.defaultExitAnimation=oY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;JA(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(hY,lY);const cY=.001,dY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:LG.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]}},uY={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},pY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:FG.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},gY={interactive:!0,label:{position:DG.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}},fY={interactive:!0,label:{autoRotate:!0,position:FG.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},mY={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},yY={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function _Y(){bY._animate=tY}HG(),bU(),SD();class bY extends hY{markerAnimate(t){bY._animate&&this._animationConfig&&bY._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},bY.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(AA(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return kA(Math.abs(e),Math.PI/2,cY)||kA(Math.abs(e),3*Math.PI/2,cY)?CA(i,e,t):AA(e)?uY.postiveXAxis[t]:uY.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new SU({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:H({},NA,null==a?void 0:a.line),startSymbol:H({},NA,null==a?void 0:a.lineStartSymbol),endSymbol:H({},NA,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:H({},NA,null==a?void 0:a.line),startSymbol:H({},NA,null==a?void 0:a.lineStartSymbol),endSymbol:H({},NA,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",bY.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(bY.defaultAttributes.label)}}function xY(){SY._animate=eY}bY.defaultAttributes=dY,HG(),FO(),SD();class SY extends jG{markerAnimate(t){SY._animate&&this._animationConfig&&SY._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},SY.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=rY,this.defaultExitAnimation=oY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},vY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;JA(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=DA.polygon(Object.assign({points:e},i));n.states=H({},NA,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",SY.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=H({},NA,null==i?void 0:i.area)),this._updateMarkLabels(SY.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}SY.defaultAttributes=gY,G(SY,lY),HG(),xU(),SD();class AY extends hY{markerAnimate(t){AY._animate&&this._animationConfig&&AY._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},AY.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case FG.arcInnerStart:l=n;case FG.arcOuterStart:l=n;break;case FG.arcInnerEnd:l=r;case FG.arcOuterEnd:l=r;break;case FG.center:case FG.arcInnerMiddle:case FG.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return mY[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new AU({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},NA,null==o?void 0:o.line),startSymbol:H({},NA,null==o?void 0:o.lineStartSymbol),endSymbol:H({},NA,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},NA,null==o?void 0:o.line),startSymbol:H({},NA,null==o?void 0:o.lineStartSymbol),endSymbol:H({},NA,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",AY.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(AY.defaultAttributes.label)}}AY.defaultAttributes=pY,HG(),_O(),SD();class kY extends jG{markerAnimate(t){kY._animate&&this._animationConfig&&kY._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},kY.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=rY,this.defaultExitAnimation=oY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case FG.center:h=(s+n)/2,c=(r+a)/2;break;case FG.arcInnerStart:h=s,c=r;break;case FG.arcOuterStart:h=n,c=r;break;case FG.arcInnerEnd:h=s,c=a;break;case FG.arcOuterEnd:h=n,c=a;break;case FG.arcInnerMiddle:h=s,c=(r+a)/2;break;case FG.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},mY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;JA(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=DA.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=H({},NA,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",kY.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=H({},NA,null==o?void 0:o.area)),this._updateMarkLabels(kY.defaultAttributes.label)}isValidPoints(){return!0}}function CY(){TY._animate=sY}kY.defaultAttributes=fY,G(kY,lY),HG(),bU(),xU(),ZO(),PO(),OO(),SD();class TY extends jG{markerAnimate(t){TY._animate&&this._animationConfig&&TY._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},TY.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=aY,this.defaultExitAnimation=oY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return kA(Math.abs(s),Math.PI/2,cY)||kA(Math.abs(s),3*Math.PI/2,cY)?CA(t,s,n):AA(s)?yY.postiveXAxis[n]:yY.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=zG.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:H({},NA,null==p?void 0:p.textBackground),text:H({},NA,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=H({},NA,null==p?void 0:p.itemContent));const v=AA(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=DA.symbol(Object.assign(Object.assign({},i),r)),o.states=H({},NA,null==s?void 0:s.itemContent)):"text"===n?o=new TU(Object.assign(Object.assign({},i),{state:{panel:H({},NA,null==s?void 0:s.textBackground),text:H({},NA,null==s?void 0:s.itemContent)}})):"richText"===n?(o=DA.richtext(Object.assign(Object.assign({},i),r)),o.states=H({},NA,null==s?void 0:s.itemContent)):"image"===n?(o=DA.image(Object.assign(Object.assign({},i),r)),o.states=H({},NA,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=H({},NA,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=kA(c,0,cY)||kA(d,0,cY),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=qA(e-u,t-d),o=qA(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(LY.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(LY.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===LY.focus||"focus"===o){const s=a.hasState(OY.focus);a.toggleState(OY.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[OY.unSelected,OY.unSelectedHover,OY.focus],t),this._setLegendItemState(e,OY.selected,t)})):(this._setLegendItemState(a,OY.selected,t),this._removeLegendItemState(a,[OY.unSelected,OY.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[OY.selected,OY.selectedHover,OY.focus],t),this._setLegendItemState(e,OY.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(OY.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(OY.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(IY.legendItemClick,a,t);i?(this._removeLegendItemState(a,[OY.selected,OY.selectedHover],t),this._setLegendItemState(a,OY.unSelected,t)):(this._setLegendItemState(a,OY.selected,t),this._removeLegendItemState(a,[OY.unSelected,OY.unSelectedHover],t))}else this._setLegendItemState(a,OY.selected,t),this._removeLegendItemState(a,[OY.unSelected,OY.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[OY.selected,OY.selectedHover],t),this._setLegendItemState(e,OY.unSelected,t))}))}this._dispatchLegendEvent(IY.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,OY.selected),this._removeLegendItemState(e,[OY.unSelected,OY.unSelectedHover])):(this._removeLegendItemState(e,[OY.selected,OY.selectedHover]),this._setLegendItemState(e,OY.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=BY,spaceRow:l=PY,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,T=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),M.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=DA.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(y,t,e,i,s),k=this._handleStyle(b,t,e,i,s),C=this._handleStyle(x,t,e,i,s),T=oi(c);let M;!1===x.visible?(M=DA.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,LY.item,t,M)):(M=DA.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,LY.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?OY.selected:OY.unSelected);const w=DA.group({x:0,y:0,pickable:!1});M.add(w);let E,B=0,P=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);P=_(i)?i[0]||0:i,O=R(v,"space",8);const s=DA.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,LY.itemShape,t,M,S.state),s.addState(e?OY.selected:OY.unSelected),w.add(s)}let I=0;if(d){const e=R(g,"size",10);E=DA.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,LY.focus,t,M),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=KA(Object.assign(Object.assign({x:P/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,LY.itemLabel,t,M,A.state),D.addState(e?OY.selected:OY.unSelected),w.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=KA(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,LY.itemValue,t,M,k.state),r.addState(e?OY.selected:OY.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),w.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-O-I),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),w.add(E));const z=w.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;w.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const j=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:H+T[1]+T[3],U=this._itemHeightByUser||j+T[0]+T[2];return M.setAttributes({width:N,height:U}),E&&E.setAttribute("visible",!1),w.translateTo(-z.x1+T[3],-z.y1+T[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new EY(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},H({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new EY(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new EW(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new EW(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=BY,spaceRow:o=PY}=n,l=this._itemsContainer,{space:h=RY,defaultCurrent:c=1}=r,d=HY(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=DA.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=BY,spaceRow:a=PY}=s,o=this._itemsContainer,{space:l=RY,defaultCurrent:h=1}=n,c=HY(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=DA.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=DA.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(yt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(yt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(OY.selected)?this._setLegendItemState(t,OY.selectedHover,e):this._setLegendItemState(t,OY.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===LY.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(IY.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(OY.unSelectedHover)||t.hasState(OY.selectedHover))&&(i=!0),t.removeState(OY.unSelectedHover),t.removeState(OY.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(OY.unSelectedHover)&&!t.hasState(OY.selectedHover)||(i=!0),t.removeState(OY.unSelectedHover),t.removeState(OY.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===LY.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(IY.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(IY.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==LY.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(IY.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==LY.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(IY.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(OY.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=H({},jY,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(OY.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var UY;function VY(t){return _(t)?t:[t,t]}function WY(t){return t?"ew-resize":"ns-resize"}NY.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:BY,spaceRow:PY,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:RY,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"}(UY||(UY={})),FY();class GY extends Nj{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},GY.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=yt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=MW(),n="browser"===e_.env?e_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=yt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=MW(),n="browser"===e_.env?e_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?yt(t+p,h,c):yt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?yt(t+p,0,c-h):yt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:VY(d)[0],endValue:VY(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=DA.group({x:0,y:0});f.name=UY.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=DA.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=UY.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=DA.group({x:g?v:0,y:g?0:v});f.add(y);const _=DA.group({x:0,y:0});let b;if(_.name=UY.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=DA.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=UY.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=DA.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=UY.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=VY(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":WY(p)},r));if(v.name=UY.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=UY.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":WY(p)},r));if(i.name=UY.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=UY.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=yt(h,i,s);const p=this._isHorizontal;e||(c=i);const f=DA.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=UY.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":WY(p);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(d,e?"end":"start"),b=DA.rect(Object.assign({x:p?Math.min(y,_):0,y:p?0:Math.min(y,_),width:p?Math.abs(_-y):r,height:p?n:Math.abs(_-y),cursor:v},a));b.name=UY.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return DA.symbol(t)}_renderHandlerText(t,e){return DA.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":WY(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=DA.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=DA.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===e_.env?e_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=MW(),e="browser"===e_.env?e_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===UY.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===UY.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===UY.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===UY.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===e_.env?e_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}GY.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},zY(),FY();class YY extends DY{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},YY.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip:y,inverse:_,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function XY(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}YY.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},zY(),FY(),LO();class KY extends DY{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},KY.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,sizeBackground:y,disableTriggerEvent:_,inverse:b}=this.attribute,x=DA.group({x:0,y:0});this._innerView.add(x);const S=new GY({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:XY(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:_,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const C=DA.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);const T=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}KY.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)"}},EO(),QO(),GO();let $Y=class t extends Nj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:T,subtextStyle:M={},width:w,height:E,minWidth:B,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=oi(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||p(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:w)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},UA),C),x:h,y:c,width:null!==(s=null!=t?t:w)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:w,heightLimit:null!==(a=C.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,O-j);if("rich"===k||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:T},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},UA),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(T)?T:[T],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const U=this._subTitle?this._subTitle.AABBBounds.height():0,V=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,V),G=j+(null!==(f=M.height)&&void 0!==f?f:U);if(p(w)&&(W=w),p(E)&&(G=E),p(B)&&WP&&(W=P),p(R)&&GO&&(G=O),z.setAttributes({width:W,height:G,boundsPadding:F}),this._mainTitle){if(p(I)||p(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:L,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(I)||p(M.align)){const t=M.align?M.align:I,e=null!==(y=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==y?y:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=this._mainTitle?p(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};$Y.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 qY={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"}}};EO(),QO(),GO();let ZY=class extends Nj{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=H({},R(qY,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=KA(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=GA(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;k(_)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class JY extends Qp{constructor(t){super(t)}}var QY,tX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(QY||(QY={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(tX||(tX={}));class eX extends Nj{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},eX.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"},eX.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"},eX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},eX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},eX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new JY(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new JY(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new JY(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(QY.OnPlay)},this.pause=()=>{this._dispatchEvent(QY.OnPause)},this.forward=()=>{this._dispatchEvent(QY.OnForward)},this.backward=()=>{this._dispatchEvent(QY.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}eX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},eX.defaultAttributes={[tX.Start]:{},[tX.Pause]:{},[tX.Backward]:{},[tX.Forward]:{}};const iX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},sX=[200,10];var nX,rX;!function(t){t.Default="default",t.Reverse="reverse"}(nX||(nX={})),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"}(rX||(rX={}));const aX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===nX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===nX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),oX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===nX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===nX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),lX=t=>"top"===t||"bottom"===t;class hX extends Nj{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},hX.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Yt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(lX(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:sX[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:sX[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new GY(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=lX(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new eX(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=lX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:sX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(lX(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:lX(this._orient)?t+s:(this._size.width-r)/2,y:lX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:lX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:lX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:lX(this._orient)?t+s:(this._size.width-r)/2,y:lX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function cX(){FY(),EO(),ZO()}hX.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({},iX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},iX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},iX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},iX),{key:"backward",position:"start"})}},cX();class dX extends hX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:nX.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(QY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(QY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(QY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(QY.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(rX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(aX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||oX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===nX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(rX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=e_.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(rX.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(rX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=e_.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(),e_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(rX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,e_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(rX.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(rX.change),this.dispatchCustomEvent(rX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var uX,pX=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};cX();class gX extends hX{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(QY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(QY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(QY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(QY.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(rX.change))},this.play=()=>pX(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(rX.play),this._rafId=e_.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=e_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,e_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(rX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,e_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(rX.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(rX.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(rX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}(uX||(uX={}));const fX={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},mX=5;const vX={debounce:St,throttle:At};EO(),FO();let yX=class t extends Nj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=fX.updateTrigger,endTrigger:i=fX.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(Y(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:vX[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(uX.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=fX.trigger,resetTrigger:i=fX.resetTrigger}=this.attribute;Y(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),Y(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(uX.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(uX.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=mX}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(uX.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(uX.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent(uX.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=mX}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(uX.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(uX.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),Y(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=fX.updateTrigger,endTrigger:s=fX.endTrigger}=this.attribute;Y(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),Y(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=DA.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Re(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};yX.defaultAttributes=fX;const _X=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return H(t,...e,{shape:i.every(u)?void 0:H({},...i),key:s.every(u)?void 0:H({},...s),value:n.every(u)?void 0:H({},...n)})},bX=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},xX={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:HA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:HA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:HA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},SX=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];EO(),NO(),ZO(),QO(),GO();let AX=class t extends Nj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=oi(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",H({symbolType:"circle"},u.shape,{visible:SA(u)&&SA(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:SA(u)&&SA(u.value)},bX(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:SA(u)&&SA(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:SA(u)&&SA(u.value)},bX(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},UA),u.value),visible:SA(u)&&SA(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=SA(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=SA(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!SA(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(SA(n.key)?r+n.key.spacing:0)+(SA(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&($A(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:SA(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),$A(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(SA(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Ch(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(SA(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},bX(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},bX(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},UA),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(SA(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},bX(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},bX(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>SX.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&SA(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=SA(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=WA(d),y=WA(u);let _=0;if(SA(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(SA(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return _X({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return _X({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};AX.defaultAttributes=xX;class kX extends dV{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),bk(this._regions,(t=>{qH(this.getOrient())?wN(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):wN(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=aT({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new VF(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=yi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>MN(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>MN(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,lV),t}transformScaleDomain(){}}kX.type=r.cartesianTimeAxis,kX.specKey="axes",kX.builtInTheme={axis:YU,axisX:XU,axisY:KU};class CX extends dV{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new xC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,lV),t}transformScaleDomain(){}}CX.type=r.cartesianLogAxis,CX.specKey="axes",CX.builtInTheme={axis:YU,axisLinear:cV,axisX:XU,axisY:KU},G(CX,rV);class TX extends dV{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new SC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,lV),t}transformScaleDomain(){}}TX.type=r.cartesianSymlogAxis,TX.specKey="axes",TX.builtInTheme={axis:YU,axisLinear:cV,axisX:XU,axisY:KU},G(TX,rV);class MX extends $H{constructor(){super(...arguments),this.type=CC.area,this.transformerConstructor=CW,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),pj)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(MX.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===qz?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return NC(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return NC(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[NT]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),RH("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),RH("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=KH(this);this._symbolMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),RH("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new SW(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}MX.type=CC.area,MX.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},MX.mark=AW,MX.transformerConstructor=CW,G(MX,gj);class wX extends DV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),oF(t)}}class EX extends RV{constructor(){super(...arguments),this.transformerConstructor=wX,this.type="area",this.seriesType=CC.area}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}EX.type="area",EX.seriesType=CC.area,EX.transformerConstructor=wX,G(EX,jV);function BX(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const PX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:BX(t,e)}),RX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:BX(t,e)}),OX={type:"fadeIn"},IX={type:"growCenterIn"};function LX(t,e){if(!1===e)return{};switch(e){case"fadeIn":return OX;case"scaleIn":return IX;default:return PX(t)}}class DX extends pz{constructor(){super(...arguments),this.type=DX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}DX.type="rect";const FX=()=>{XO(),NO(),Zj("rect",oG),oT.registerMark(DX.type,DX),sI.registerBuiltInAnimate("growHeightIn",HI),sI.registerBuiltInAnimate("growHeightOut",jI),sI.registerBuiltInAnimate("growWidthIn",iL),sI.registerBuiltInAnimate("growWidthOut",sL),sI.registerBuiltInAnimate("growCenterIn",DI),sI.registerBuiltInAnimate("growCenterOut",FI),oT.registerGraphicComponent("rect",og)},zX=Object.assign(Object.assign({},AH),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function HX(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=JC(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[kH]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):NC(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[CH]):NC(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=NC(this._dataToPosX(t),e,i),n=NC(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[TH]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):NC(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[MH]):NC(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=NC(this._dataToPosY(t),e,i),n=NC(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),UX)})}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},VX.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:LH(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(VX.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(DM(this._option.dataSet,"addVChartProperty",nH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};DM(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Oa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:_H.bind(this),call:bH}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new VF(this._option,n)}init(t){super.init(t),this.initRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=MH,s=TH,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=CH,s=kH,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=oM(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)HX(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=NC(this[r](t),l,i),u=NC(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!UC(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&u(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[jT],n=e[NT],r=e[UT],d=e[VT];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?TH:kH],i=e[a?MH:CH];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[jT]:s,[NT]:o}),c?{[UT]:u,[VT]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(og(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>NC(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>NC(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=K(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=KH(this);this._barMark.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),RH(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=JC(this._spec.barWidth,a)),l&&(c=Math.max(c,JC(this._spec.barMinWidth,a))),h&&(c=Math.min(c,JC(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=JC(null!==(l=i[r-1])&&void 0!==l?l:X(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*y+(u-1)*p,n+=g*(y+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const _=Mk(g.type||"band");return d(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}VX.type=CC.bar,VX.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},VX.mark=zX,VX.transformerConstructor=NX;const WX=()=>{CV(),FX(),oT.registerAnimation("bar",((t,e)=>({appear:LX(t,e),enter:PX(t,!1),exit:RX(t,!1),disappear:{duration:Ez.disappear.duration}}))),qU(),uV(),oT.registerSeries(VX.type,VX)};class GX extends DV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),oF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class YX extends RV{constructor(){super(...arguments),this.transformerConstructor=GX,this.type="bar",this.seriesType=CC.bar}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}YX.type="bar",YX.seriesType=CC.bar,YX.transformerConstructor=GX,G(YX,jV);const XX=[10,20],KX=Ck.Linear,$X="circle",qX=Ck.Ordinal,ZX=["circle","square","triangle","diamond","star"],JX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},QX=Object.assign(Object.assign({},AH),{point:{name:"point",type:"symbol"}});class tK extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const eK={sizeField:!0};class iK extends $H{constructor(){super(...arguments),this.type=CC.scatter,this.transformerConstructor=tK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),eK)})}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(_(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${PT}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${PT}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:y(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:KX,defaultRange:XX},"size")}getShapeAttribute(t,e){return u(e)?$X:y(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:qX,defaultRange:ZX},"shape")}initMark(){this._symbolMark=this._createMark(iK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:LH(this._spec,iK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=KH(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),RH("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:y(this._shape)||d(this._shape)?this._shape:$X},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ge});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}iK.type=CC.scatter,iK.mark=QX,iK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},iK.transformerConstructor=tK;const sK=()=>{oN(),oT.registerAnimation("scatter",((t,e)=>Object.assign({appear:JX(0,e)},Bz))),qU(),uV(),oT.registerSeries(iK.type,iK)};class nK extends DV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class rK extends RV{constructor(){super(...arguments),this.transformerConstructor=nK,this.type="scatter",this.seriesType=CC.scatter}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}rK.type="scatter",rK.seriesType=CC.scatter,rK.transformerConstructor=nK,G(rK,jV);class aK extends YH{constructor(){super(...arguments),this.type=CC.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${PT}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const oK=(t,e)=>{const i=d(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[LT]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[sM]=a||r})),s};class lK extends dH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class hK extends pz{constructor(){super(...arguments),this.type=hK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}hK.type="path";const cK=()=>{oT.registerMark(hK.type,hK),XO(),LO(),oT.registerGraphicComponent("path",Ug)},dK=Object.assign(Object.assign({},AH),{area:{name:"area",type:"path"}});class uK{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Fa(i,e):La[i]?(Ia[i]||(Ia[i]=Fa(i,La[i])),Ia[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class pK{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class gK{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function fK(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:pK}:fA(e)||mA(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:gK}:null}const mK={debounce:St,throttle:At};class vK{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=fA(this._renderMode)||mA(this._renderMode),fK(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return fK(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:PM.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:PM.chart,consume:!1}];l.on(...c,mK[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,mK[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||fK(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||fK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:PM.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:PM.chart,consume:!1}];l.on(...c,mK[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,mK[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){fK(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||fK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:PM.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:PM.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||fK(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:PM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||fK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:PM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:PM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:PM.chart,source:BM.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:PM.chart,source:BM.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=mK[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=mK[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:PM.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:PM.chart,source:BM.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:PM.chart,source:BM.chart},this._handleDragMouseUp)}))}}class yK extends YN{constructor(){var e,i;super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:(e=this.type,i=this.id,`${PT}_${i}_${e}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=aT(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new uK(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===CC.map||e.type===CC.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),bk(this._regions,(t=>{var e;if(t.type===CC.map||t.type===CC.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==CC.map&&e.type!==CC.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[sM],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}yK.type=r.geoCoordinate,G(yK,vK);const _K=()=>{oT.registerComponent(yK.type,yK)};class bK extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class xK extends aK{constructor(){super(...arguments),this.type=CC.map,this.transformerConstructor=bK,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),zM.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),DM(this._dataSet,"copyDataView",WM),DM(this._dataSet,"map",oK),DM(this._dataSet,"lookup",sH);const s=zM.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Oa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:()=>({nameMap:this._nameMap,nameProperty:this._nameProperty})}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:sM,fields:()=>this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new VF(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(xK.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:LH(this._spec,xK.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:FT])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:FT]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(PH(null===(t=oT.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),RH("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new lK(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[LT]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[LT],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ge}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ge}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return LT}getActiveMarks(){return[this._pathMark]}}xK.type=CC.map,xK.mark=dK,xK.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},xK.transformerConstructor=bK;const SK=`${PT}_waterfall_default_seriesField`,AK=(t,e)=>{if(!t||0===t.length)return t;const i=d(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let c=Array.from(l[s]);"decrease"===a&&(c=c.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return c.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[KT]=!0:delete t[KT]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===c.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=kK([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const f=g[0];let{start:m,end:v}=CK(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=se(y,e)):(t[c]=+_,_=se(_,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,c,e,i,a),void o.push(s)}u=kK(r,t,s,o,u,c,e,i),o.push(s)})),o};function kK(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=CK(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===SK)&&(t[SK]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function CK(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?hA("total.collectCountField error"):n=e[a].start;o<0?hA("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=se(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const TK=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=d(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},MK={type:"fadeIn"},wK={type:"growCenterIn"};function EK(t,e){switch(e){case"fadeIn":return MK;case"scaleIn":return wK;default:return PX(t,!1)}}class BK extends pz{constructor(){super(...arguments),this.type=BK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return sg(t)}}BK.type="rule";const PK=()=>{oT.registerMark(BK.type,BK),XO(),OO(),oT.registerGraphicComponent("line",sg)},RK=Object.assign(Object.assign({},zX),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),OK=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:IK(t.map((t=>t.latestData)).flat(),e.fields,i)}};function IK(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>IK(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class LK{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new Oa(e instanceof Ra?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),DM(e,"dimensionTree",OK),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class DK extends NX{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const FK={rect:VK,symbol:NK,arc:GK,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=NK(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:YK,line:XK,area:XK,rect3d:VK,arc3d:GK,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function zK(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=FK[t])&&void 0!==i?i:FK.point;return e.series.type===CC.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=jK(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:KK(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function HK(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==CC.sankey){const{formatFunc:t,args:n}=eH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function jK(t){return d(t)?e=>t(e.data):t}function NK(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=jK(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:UK(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function UK(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function VK(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=jK(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:WK(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function WK(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function GK(t){var e;const{labelSpec:i}=t,s=null!==(e=jK(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:y(s)&&s.includes("inside"),{position:n,smartInvert:r}}function YK(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=HK(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Kp(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function XK(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[FT]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function KK(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const $K={calculationMode:!0};class qK extends VX{constructor(){super(...arguments),this.type=CC.waterfall,this.transformerConstructor=DK,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&hM(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),$K)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new LK(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=SK)}getSeriesKeys(){return this._seriesField===SK?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),DM(this._dataSet,"waterfallFillTotal",TK),DM(this._dataSet,"waterfall",AK),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=GM(this.getViewData(),this._dataSet,{name:`${PT}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new VF(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:jT,endAs:NT,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=KH(this);this._barMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),RH("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),RH("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(qK.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return YK(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?NC(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):NC(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,y1:t=>this.totalPositionY(t,"index",this._getLeaderLineCategoryPos(!1,e))},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,x1:t=>this.totalPositionX(t,"index",this._getLeaderLineCategoryPos(!1,e)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&UC([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}qK.type=CC.waterfall,qK.mark=RK,qK.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},qK.transformerConstructor=DK;const ZK=()=>{PK(),FX(),oT.registerAnimation("waterfall",((t,e)=>({appear:EK(t,e),enter:PX(t,!1),exit:RX(t,!1),disappear:{duration:Ez.disappear.duration}}))),Oz(),qU(),uV(),oT.registerSeries(qK.type,qK)},JK=`${PT}_BOX_PLOT_OUTLIER_VALUE`;var QK;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(QK||(QK={}));const t$=(t,e)=>{const i=[],s=d(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=_(e)?e:[e];i.push(...s.map((e=>{const i={[JK]:e};return r.forEach((e=>{i[e]=t[e]})),p(a)&&(i[a]=t[a]),i})))})),i};class e$ extends dH{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===QK.OUTLIER)return this.series.getOutliersField();if(t===QK.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case QK.MIN:return this.series.getMinField();case QK.MAX:return this.series.getMaxField();case QK.MEDIAN:return this.series.getMedianField();case QK.Q1:return this.series.getQ1Field();case QK.Q3:return this.series.getQ3Field();case QK.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===QK.OUTLIER)return e[JK];if(t===QK.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case QK.MIN:return e[this.series.getMinField()];case QK.MAX:return e[this.series.getMaxField()];case QK.MEDIAN:return e[this.series.getMedianField()];case QK.Q1:return e[this.series.getQ1Field()];case QK.Q3:return e[this.series.getQ3Field()];case QK.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[JK])}getDefaultContentList(t){return[{key:this.getContentKey(QK.OUTLIER),value:this.getContentValue(QK.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(QK.MAX),value:this.getContentValue(QK.MAX)},{key:this.getContentKey(QK.Q3),value:this.getContentValue(QK.Q3)},{key:this.getContentKey(QK.MEDIAN),value:this.getContentValue(QK.MEDIAN)},{key:this.getContentKey(QK.Q1),value:this.getContentValue(QK.Q1)},{key:this.getContentKey(QK.MIN),value:this.getContentValue(QK.MIN)},{key:this.getContentKey(QK.SERIES_FIELD),value:this.getContentValue(QK.SERIES_FIELD)}]}}const i$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class s$ extends pz{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.context.diffState!==vF.enter&&t.context.diffState!==vF.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{i$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?H(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?H(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=ug(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e),e.addEventListener("afterAttributeUpdate",(t=>{var i;2===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.type)&&this._syncInheritedStyleAttrs(e,e.attribute)}));const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=oT.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const n$=()=>{oT.registerGraphicComponent("glyph",ug),XO(),MO()},r$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],a$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class o$ extends s${constructor(){super(...arguments),this.type=o$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=r$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=a$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}o$.type="boxPlot";const l$=Object.assign(Object.assign({},AH),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),h$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},c$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},d$=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),u$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,C;if(i&&k(i.center))return i.center;let T,M,w,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=d$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=d$(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,w=null===(p=null===(u=null===(d=null===(c=d$(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=d$(t,"box").attribute.width,i=d$(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=d$(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=d$(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,w=null===(C=null===(A=null===(S=null===(x=d$(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===C?void 0:C.y;const e=d$(t,"box").attribute.height,i=d$(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(M)&&k(w)?(M+w)/2:k(w)?w:k(M)?M:NaN},p$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=d$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=d$(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=d$(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=d$(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=d$(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=d$(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=d$(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=d$(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=d$(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=d$(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(y)&&k(_)?(y+_)/2:k(_)?_:k(y)?y:NaN};class g$ extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return h$(u$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class f$ extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return c$(u$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class m$ extends g${computeAttribute(){return h$(p$)(this.target,this.params,this.params.options)}}class v$ extends f${computeAttribute(){return c$(p$)(this.target,this.params,this.params.options)}}class y$ extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const _$={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class b$ extends $H{constructor(){super(...arguments),this.type=CC.boxPlot,this.transformerConstructor=y$,this._bandPosition=0}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}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),_$)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(b$.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(b$.mark.outlier,{key:LT,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.initBoxPlotMarkStyle()}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>NC(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>NC(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>NC(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>NC(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>NC(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>NC(e(this.getDatumPositionValues(t,JK),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>NC(e(this.getDatumPositionValues(t,JK),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;DM(this._dataSet,"foldOutlierData",t$),DM(this._dataSet,"addVChartProperty",nH);const t=new Oa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${PT}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:_H.bind(this),call:bH}},!1),this._outlierData=new VF(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=JC(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,JC(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,JC(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=JC(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=Mk(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=H({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=KH(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=oT.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(RH("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(PH(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(PH(null===(a=oT.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new e$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}b$.type=CC.boxPlot,b$.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},b$.mark=l$,b$.transformerConstructor=y$;const x$=()=>{n$(),OO(),NO(),oT.registerGraphicComponent("line",(t=>sg(t))),oT.registerGraphicComponent("rect",(t=>og(t))),oT.registerMark(o$.type,o$),oN(),Rz(),qU(),uV(),sI.registerBuiltInAnimate("boxplotScaleIn",g$),sI.registerBuiltInAnimate("boxplotScaleOut",f$),sI.registerBuiltInAnimate("barBoxplotScaleIn",m$),sI.registerBuiltInAnimate("barBoxplotScaleOut",v$),oT.registerSeries(b$.type,b$)};class S$ extends pz{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=S$.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Hg(t):Kp(t)}}S$.type="text";const A$=()=>{oT.registerMark(S$.type,S$),XO(),QO(),GO(),oT.registerGraphicComponent("text",Kp),oT.registerGraphicComponent("richtext",Hg)};class k$ extends dH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const C$=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),T$={type:"fadeIn"},M$=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function w$(t,e){return"fadeIn"===e?T$:C$(t)}const E$=Object.assign(Object.assign({},zX),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class B$ extends NX{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class P$ extends VX{constructor(){super(...arguments),this.type=CC.rangeColumn,this._barMarkType="rect",this._barName=CC.bar,this.transformerConstructor=B$}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(P$.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:LH(this._spec,P$.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(P$.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(P$.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=KH(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),RH("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),RH("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(PH(null===(n=oT.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),RH("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new k$(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}P$.type=CC.rangeColumn,P$.mark=E$,P$.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},P$.transformerConstructor=B$;const R$=()=>{FX(),A$(),oT.registerAnimation("rangeColumn",((t,e)=>({appear:w$(t,e),enter:C$(t),exit:M$(t),disappear:{duration:Ez.disappear.duration}}))),Oz(),qU(),uV(),oT.registerSeries(P$.type,P$)};var O$,I$;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(O$||(O$={})),function(t){t.middle="middle",t.start="start",t.end="end"}(I$||(I$={}));class L$ extends dH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const D$=Object.assign({},AW);class F$ extends MX{constructor(){super(...arguments),this.type=CC.rangeArea}initMark(){this._areaMark=this._createMark(F$.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new L$(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}F$.type=CC.rangeArea,F$.mark=D$;class z$ extends YH{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=jN,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Mk(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:[]};Mk(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&XH(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function H$(t){return _A(t)?Number.parseFloat(t):0}const j$=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&N$(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[BN],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[BN]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},N$=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===H$(t[e])))||!i&&0===t.reduce(((t,i)=>t+H$(i[e])),0)));function U$(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const V$=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:U$(t,!0,$M.appear)}),W$={type:"fadeIn"},G$=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:U$(t,!0,$M.enter)}),Y$=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:U$(t,!0,$M.exit)});function X$(t,e){if(!1===e)return{};switch(e){case"fadeIn":return W$;case"growRadius":return V$(Object.assign(Object.assign({},t),{growField:"radius"}));default:return V$(Object.assign(Object.assign({},t),{growField:"angle"}))}}class K$ extends pz{constructor(t,e){super(t,e),this.type=$$.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[LN])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class $$ extends K${constructor(){super(...arguments),this.type=$$.type}}$$.type="arc";const q$=()=>{XO(),_O(),Zj("arc",cG),sI.registerBuiltInAnimate("growRadiusIn",QI),sI.registerBuiltInAnimate("growRadiusOut",tL),sI.registerBuiltInAnimate("growAngleIn",II),sI.registerBuiltInAnimate("growAngleOut",LI),oT.registerGraphicComponent("arc",Kg),oT.registerMark($$.type,$$)},Z$=Object.assign(Object.assign({},AH),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class J$ extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=aT({},this._theme,i,t);const n=(t,e)=>aT({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const Q$=`${PT}_LABEL_VISIBLE`,tq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},eq={outerRadius:!0};class iq extends z${constructor(){super(...arguments),this.transformerConstructor=J$,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:XC(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:XC(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=zN,this._endAngle=HN,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[LN];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;DM(this._dataSet,"pie",j$),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:RN,asEndAngle:ON,asRatio:PN,asMiddleAngle:LN,asRadian:FN,asQuadrant:DN,asK:IN,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Oa(this._dataSet,{name:`${PT}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new VF(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},iq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:DT,groupKey:this._seriesField,isSeriesMark:!0},{morph:LH(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Ak(RN)(t)}endAngleScale(t){return Ak(ON)(t)}_computeLayoutRadius(){return NN((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:VC(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:VC(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Ak(Q$).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),eq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),tq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[LN];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===$M.appear)return this._startAngle;if(i===$M.disappear)return this._endAngle;const r=[$M.disappear,$M.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[LT];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[LT]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[LT])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[LT])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[LN]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[LN]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[LN]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[LN]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=PH(null===(i=oT.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}iq.transformerConstructor=J$,iq.mark=Z$,iq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class sq extends iq{constructor(){super(...arguments),this.type=CC.pie}}sq.type=CC.pie;const nq=()=>{q$(),oT.registerAnimation("pie",((t,e)=>({appear:X$(t,e),enter:G$(t),exit:Y$(t),disappear:{duration:Ez.disappear.duration}}))),oT.registerAnimation("emptyCircle",((t,e)=>({appear:X$(t,e)}))),oT.registerSeries(sq.type,sq)};function rq(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const aq=t=>({type:rq(t.growField),options:{overall:!0}}),oq={type:"fadeIn"},lq=t=>({type:rq(t.growField)}),hq=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function cq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return oq;case"growAngle":return aq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return aq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const dq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class uq extends z${_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),dq)})}getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(NT),this.setInnerRadiusField(jT)}setValueFieldToPercent(){this.setRadiusField(VT),this.setInnerRadiusField(UT)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const pq=Object.assign(Object.assign({},AH),{rose:{name:"rose",type:"arc"}});class gq extends HH{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class fq extends iU{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=oT.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=zN,this._endAngle=HN,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),bk(this._regions,(t=>{"radius"===this.getOrient()?wN(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):wN(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:XC(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:XC(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:AN(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){bk(this._regions,(t=>{"radius"===this.getOrient()?wN(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):wN(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Mk(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Mk(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>MN(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ae.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return NN((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=jN,e=0;const i=this.getChart().getSpec();return bk(this.getRegions(),(s=>{const n=s;if(r=n.type,[CC.rose,CC.radar,CC.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(aT({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(aT({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}fq.type=r.polarAxis,fq.specKey="axes";const mq={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},vq={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class yq extends fq{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new vC}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,lV),t}}yq.type=r.polarLinearAxis,yq.specKey="axes",yq.builtInTheme={axis:YU,axisLinear:cV,axisAngle:vq,axisRadius:mq},G(yq,rV);const _q=()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),oT.registerGraphicComponent(XN.circleAxis,((t,e)=>new iG(t,e))),oT.registerGraphicComponent(KN.circleAxisGrid,((t,e)=>new vG(t,e))),sU(),oT.registerComponent(yq.type,yq)};class bq extends fq{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new qk}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return DM(this._option.dataSet,t,nG),t}transformScaleDomain(){}}bq.type=r.polarBandAxis,bq.specKey="axes",bq.builtInTheme={axis:YU,axisBand:GU,axisAngle:vq,axisRadius:mq},G(bq,aU);const xq=()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),oT.registerGraphicComponent(XN.circleAxis,((t,e)=>new iG(t,e))),oT.registerGraphicComponent(KN.circleAxisGrid,((t,e)=>new vG(t,e))),sU(),oT.registerComponent(bq.type,bq)};class Sq extends uq{constructor(){super(...arguments),this.type=CC.rose,this.transformerConstructor=gq,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(Sq.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:LH(this._spec,Sq.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>NC(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=NC(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),RH("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}Sq.type=CC.rose,Sq.mark=pq,Sq.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},Sq.transformerConstructor=gq;const Aq=()=>{oT.registerSeries(Sq.type,Sq),q$(),oT.registerAnimation("rose",((t,e)=>({appear:cq(t,e),enter:lq(t),exit:hq(t),disappear:{duration:Ez.disappear.duration}}))),xq(),_q()};class kq extends SI{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,dk(this._fromAngle,this._toAngle)&&dk(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Cq extends Tz{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!_k(t)&&!_k(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const Tq=t=>({type:"in"===t?"fadeIn":"fadeOut"});function Mq(t,e,i){return"fadeIn"===e?Tq(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function wq(t,e,i){return"fadeIn"===e?Tq(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const Eq=(t,e)=>({custom:kz,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),Bq=Object.assign(Object.assign(Object.assign({},AH),uj),{area:{name:"area",type:"area"}});class Pq extends uq{constructor(){super(...arguments),this.type=CC.radar,this.transformerConstructor=lN,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(Pq.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:Zz,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?oe(this._spec.startAngle):zN},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(PH(null===(s=oT.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),RH("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=oT.getAnimationInKey(e);t.setAnimationConfig(PH(null==i?void 0:i(n,r),RH(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&_(a)?a[0]:a}}}Pq.type=CC.radar,Pq.mark=Bq,Pq.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Pq.transformerConstructor=lN,G(Pq,gj);const Rq=()=>{oT.registerSeries(Pq.type,Pq),xW(),rN(),oN(),oT.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:Mq(t,e,"in"),enter:Mq(t,e,"in"),exit:Mq(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:Ez.disappear.duration},update:[{channel:["points","center"],custom:Cq,customParameters:t,duration:Ez.update.duration,easing:Ez.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),oT.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:wq(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:Ez.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:kq,customParameters:t,duration:Ez.update.duration,easing:Ez.update.easing}]}))),oT.registerAnimation("radarGroup",((t,e)=>({appear:Eq(t,"in"),disappear:{duration:Ez.disappear.duration}}))),_O(),xq(),_q()};class Oq extends dH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>yi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const Iq=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(PT)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[LT]:r,[DT]:`${s}_${e}`})),r++}))})),n},Lq={fill:"#bbb",fillOpacity:.2},Dq=Object.assign(Object.assign({},AH),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),Fq={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},zq={grid:{background:!0}};class Hq extends $H{constructor(){super(...arguments),this.type=CC.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Fq),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),zq)})}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),DM(this._option.dataSet,"objFlat",Iq),DM(this._option.dataSet,"copyDataView",WM),FM(this._option.dataSet,"dataview",Ea),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(aT(Lq,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(Hq.mark.group),this._containerMark=this._createMark(Hq.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(Hq.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(Hq.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(Hq.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(Hq.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(Hq.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(Hq.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!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",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:FT}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new zC).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:FT}}initTooltip(){this._tooltipHelper=new Oq(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}Hq.type=CC.dot,Hq.mark=Dq,Hq.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class jq extends dH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>yi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const Nq=Object.assign(Object.assign({},AH),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),Uq=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class Vq extends $H{constructor(){super(...arguments),this.type=CC.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),DM(this._option.dataSet,"linkDotInfo",Uq),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(Vq.mark.group),this._containerMark=this._createMark(Vq.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(Vq.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(Vq.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:FT}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new jq(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}Vq.type=CC.link,Vq.mark=Nq,Vq.builtInTheme={link:{arrow:{style:{size:10}}}};const Wq=Object.assign(Object.assign({},AH),{group:{name:"group",type:"group"}}),Gq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class Yq extends z${constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?jT:tM],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?NT:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Gq)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?oe(n):zN;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):HN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=NC(this.angleAxisHelper.dataToPosition([t[jT]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=NC(this.angleAxisHelper.dataToPosition([t[NT]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?NC(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(Yq.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return Kg(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[og({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const qq=()=>{oT.registerAnimation("circularProgress",((t,e)=>({appear:$q(t,e),enter:{type:"growAngleIn"},disappear:{duration:Ez.disappear.duration}})))};class Zq extends HH{constructor(){super(...arguments),this._supportStack=!0}}const Jq={cornerRadius:!0,roundCap:!0};class Qq extends Yq{constructor(){super(...arguments),this.type=CC.circularProgress,this.transformerConstructor=Zq,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Jq)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(Qq.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:LH(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(Qq.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?jT:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?NT:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),RH("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),RH("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}Qq.type=CC.circularProgress,Qq.mark=Xq,Qq.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},Qq.transformerConstructor=Zq;const tZ=()=>{oT.registerSeries(Qq.type,Qq),q$(),qq(),Oz(),xq(),_q()};function eZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const iZ={type:"fadeIn"};function sZ(t,e="grow"){return!1===e?{}:"fadeIn"===e?iZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:eZ(t)}))(t)}class nZ extends dH{enableByType(t){return"dimension"!==t}}const rZ=Object.assign(Object.assign({},AH),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),aZ={bandWidth:!0,cornerRadius:!0,clamp:!0},oZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class lZ extends $H{constructor(){super(...arguments),this.type=CC.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),aZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),oZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(lZ.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return NC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return NC(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?NC(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return NC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return NC(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?NC(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(lZ.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return NC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return NC(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),RH("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),RH("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new nZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}lZ.type=CC.linearProgress,lZ.mark=rZ,lZ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const hZ=()=>{FX(),oT.registerAnimation("linearProgress",((t,e)=>({appear:sZ(t,e),enter:sZ(t),disappear:{duration:Ez.disappear.duration}}))),Oz(),oT.registerSeries(lZ.type,lZ)},cZ=[0],dZ=[20,40],uZ=[200,500],pZ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},gZ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class fZ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const mZ=`${PT}_WORD_CLOUD_TEXT`,vZ=Object.assign(Object.assign({},AH),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),yZ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class _Z extends YH{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=dZ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:uZ,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:cZ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?mZ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:pZ},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||gA(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:cZ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!gZ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new fZ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(_Z.mark.word,{key:DT,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(_Z.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(PH(oT.getAnimationInKey("wordCloud")(n,s),RH("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new zC).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:FT])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new vC).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new vC).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[LT])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:DT,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:e_.createCanvas.bind(e_),getTextBounds:xf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Rg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}_Z.mark=vZ,_Z.builtInTheme={wordCloud:yZ};function bZ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||Ez.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=xZ(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},SZ=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=SZ(t.children,e,t,n))})),s},AZ=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=AZ(t.children,e,t,n)),n=e(t,s,i,n)})),n},kZ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):kZ(t.children,e,i)))})),e};function CZ(t,e){let i,s;if(wZ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function wZ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*T*w))/(2*T):w/M);return{x:s+S+A*E,y:n+k+C*E,radius:E}}function RZ(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function OZ(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function IZ(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function LZ(t){return{_:t,next:null,prev:null}}function DZ(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];RZ(n,s,r);let a,o,l,h,c,d,u,p=LZ(s),g=LZ(n),f=LZ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=xZ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:jZ.defaultOpionts.nodeSort;SZ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)SZ([o],FZ(h)),AZ([o],zZ(this._getPadding,.5,a)),SZ([o],HZ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);SZ([o],FZ(jZ.defaultOpionts.setRadius)),AZ([o],zZ(Ot,1,a)),c&&AZ([o],zZ(this._getPadding,o.radius/t,a)),SZ([o],HZ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}jZ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const NZ=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=NZ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function UZ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){NZ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function VZ(t){return t.depth}function WZ(t,e){return e-1-t.endDepth}const GZ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),YZ=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},XZ={left:VZ,right:WZ,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:VZ,end:WZ},KZ=bt(0,1);class $Z{constructor(t){this._ascendingSourceBreadth=(t,e)=>GZ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>GZ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},$Z.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):XZ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return UZ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[YZ(s[t.source]),YZ(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=$(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(y(e)){const t=yt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*KZ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(GZ),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(GZ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];qZ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),ZZ);const s=_(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},JZ.defaultOpionts,t):Object.assign({},JZ.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Rt(this.options.center[0],t.width),s=t.y0+Rt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Rt(t,n))):Rt(r,n),h=_(a),c=this.options.gapRadius,d=h?a.map((t=>Rt(t,n))):Rt(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Rt(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(_(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=xZ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ce({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function QZ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,y=Math.max(v/x,x/m),y>_){f-=h;break}_=y}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:qZ,slice:QZ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?QZ:qZ)(t,e,i,s,n)}};class iJ{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},iJ.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?tJ(this.options.aspectRatio):null!==(e=eJ[this.options.splitType])&&void 0!==e?e:eJ.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=xZ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function sJ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ui?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=sJ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=nJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function dJ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*uJ({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},gJ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||aJ,s=e.lossFunction||rJ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];pi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:pJ(f),arcs:f})}))},fJ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:mJ,triangle:mJ,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 mJ(){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 vJ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const yJ=t=>fJ[t]?fJ[t]():fJ.circle(),_J=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function bJ(t){return d(t)?t:function(){return t}}class xJ{constructor(t){var e,i;switch(this.options=H({},xJ.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=yJ(this.options.shape),this.getText=null!==(e=bJ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=bJ(this.options.fontWeight),this.getTextFontSize=bJ(this.options.fontSize),this.getTextFontStyle=bJ(this.options.fontStyle),this.getTextFontFamily=bJ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>_J(10,50);break;case"random-light":this.getTextColor=()=>_J(50,90);break;default:this.getTextColor=bJ(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return oe(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():Mt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class AJ extends xJ{constructor(t){var e;super(H({},AJ.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<=AJ.defaultOptions.minFontSize&&(this.options.minFontSize=AJ.defaultOptions.minFontSize),this.spiral=y(this.options.spiral)?null!==(e=SJ[this.options.spiral])&&void 0!==e?e:SJ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=bJ(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=vJ(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,y=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;y[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(MJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(TJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}MJ(p,this._size)&&(p=wJ(p,this._size))}else if(MJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||CJ(p,i))&&(!i||!kJ(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function kJ(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function CJ(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,MJ=(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 wJ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},BJ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},PJ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},RJ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=vJ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=yJ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)PJ(n,BJ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)PJ(n,BJ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)PJ(n,BJ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)PJ(n,BJ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)PJ(n,BJ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=BJ({x:l,y:h},o,-Math.PI/2,5),e=BJ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);PJ(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let YG=class t extends OG{constructor(e){super(j({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)B(C,w,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?NG(t,o,l.width,l.height,h):"geometric"===t.type&&GG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=BG(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};YG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class XG extends OG{constructor(t){super(j({},XG.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}XG.defaultOptions={enlarge:!1};const KG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},qG=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.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?ZG(t.fontFamily):"sans-serif",d=t.fontStyle?ZG(t.fontStyle):"normal",u=t.fontWeight?ZG(t.fontWeight):"normal",p=t.rotate?ZG(t.rotate):0,g=ZG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?ZG(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},KG),t.as):KG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?ZG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=QG(tY(t,l),C);w=i=>e(t(i))}let E=DG;"fast"===t.layoutType?E=XG:"grid"===t.layoutType&&(E=YG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},ZG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],JG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),QG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=JG(t[0]),n=JG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(JG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},tY=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function eY(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{sO.registerGrammarTransform("wordcloud",{transform:qG}),GN(),sO.registerAnimation("wordCloud",((t,e)=>({appear:RW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:$D.disappear.duration}}))),sO.registerSeries(iY.type,iY)},nY=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:f=!1,isCone:m=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(y*v)&&0!==v?y/v:0,S=k(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},rY=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},aY=`${wO}_FUNNEL_TRANSFORM_RATIO`,oY=`${wO}_FUNNEL_REACH_RATIO`,lY=`${wO}_FUNNEL_HEIGHT_RATIO`,hY=`${wO}_FUNNEL_VALUE_RATIO`,cY=`${wO}_FUNNEL_LAST_VALUE_RATIO`,dY=`${wO}_FUNNEL_NEXT_VALUE_RATIO`,uY=`${wO}_FUNNEL_LAST_VALUE`,pY=`${wO}_FUNNEL_CURRENT_VALUE`,gY=`${wO}_FUNNEL_NEXT_VALUE`,fY=`${wO}_FUNNEL_TRANSFORM_LEVEL`;class mY extends TF{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[oY])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class vY extends jD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class _Y extends vY{constructor(){super(...arguments),this.type=_Y.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}_Y.type="polygon";const yY=()=>{sO.registerMark(_Y.type,_Y),hM(),sM(),kw.registerBuiltInAnimate("growPointsOut",xC),sO.registerGraphicComponent("polygon",cf)},bY=Object.assign(Object.assign({},zF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class xY extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class SY extends ez{constructor(){super(...arguments),this.type=xR.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=xY,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;EI(this._dataSet,"funnel",nY),EI(this._dataSet,"funnelTransform",rY);const t=new Pa(this._dataSet,{name:`${wO}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new OD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:pY,asTransformRatio:aY,asReachRatio:oY,asHeightRatio:lY,asValueRatio:hY,asNextValueRatio:dY,asLastValueRatio:cY,asLastValue:uY,asNextValue:gY,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:fY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},SY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:qF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},SY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(SY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(SY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new mY(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&qy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&qy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*_R(oY).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),XF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(YF(sO.getAnimationInKey("fadeInOut")(),XF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(YF(sO.getAnimationInKey("funnel")({},o),XF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(YF(null===(a=sO.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),XF("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[cY])/2:this._getSecondaryAxisLength(t[hY])/2,n=this._getSecondaryAxisLength(t[hY])/2):(s=this._getSecondaryAxisLength(t[hY])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[dY])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[fY])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[LO]===t[LO]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{yY(),GN(),iN(),sO.registerSeries(SY.type,SY),sO.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},qD))),sO.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:sC,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),JD()},kY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},MY=t=>{const e=t.filter((t=>t.context.diffState===lD.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},TY=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=$(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},wY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MY(i.parent.children),a=TY(r,s,n);return kY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MY(i.parent.children),a=TY(r,s,n);return kY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),CY=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=$(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},EY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MY(i.parent.children),a=CY(r);return kY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=MY(i.parent.children),a=CY(r);return kY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),BY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},PY=(t,e={})=>{if(!t)return[];const i=[];return FW(t,i,e),i},LY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new dG(i).layout(t,{width:s,height:n})};class RY extends TF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var OY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(OY||(OY={}));const IY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===OY.DrillDown){return Y(hI(t,n,s,"children"))}if(i.type===OY.DrillUp){const e=cI(t,n,s,"children");if(e)return Y(e)}return t};class DY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=jV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;EI(t,"drillFilter",IY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:OY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:OY.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:OY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:OY.DrillUp},model:this}),r}}const FY=Object.assign(Object.assign({},zF),{sunburst:{name:"sunburst",type:"arc"}}),zY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:PF,operations:["max","min","values"]}),t.push({key:LF,operations:["values"]}),t),jY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class HY extends aU{constructor(){super(...arguments),this.type=xR.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:LF),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:LO},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),EI(this._dataSet,"sunburstLayout",LY),EI(this._dataSet,"flatten",PY),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return zY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(EI(t.dataSet,"addVChartProperty",yF),t.transform({type:"addVChartProperty",options:{beforeCall:DF.bind(this),call:FF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(HY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(HY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new RY(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),XF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),XF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}HY.type=xR.sunburst,HY.mark=FY,HY.builtInTheme={sunburst:jY},G(HY,DY);const VY=()=>{sO.registerSeries(HY.type,HY),_U(),GN(),JD(),sO.registerAnimation("sunburst",((t,e)=>({appear:BY(0,e),enter:wY(t),exit:EY(t),disappear:{duration:$D.disappear.duration}})))},NY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new QW(i).layout(t,{width:s,height:n})};class UY extends TF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const WY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},GY=Object.assign(Object.assign({},zF),{circlePacking:{name:"circlePacking",type:"arc"}});class YY extends nz{constructor(){super(...arguments),this.type=xR.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:LF),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:LO},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),EI(this._dataSet,"circlePackingLayout",NY),EI(this._dataSet,"flatten",PY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(EI(t.dataSet,"addVChartProperty",yF),t.transform({type:"addVChartProperty",options:{beforeCall:DF.bind(this),call:FF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(YY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(YY.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return zY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new UY(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),XF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),XF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}YY.type=xR.circlePacking,YY.mark=GY,YY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(YY,DY);const XY=()=>{sO.registerSeries(YY.type,YY),_U(),GN(),ZD(),sO.registerAnimation("circlePacking",((t,e)=>({appear:WY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:$D.disappear.duration}})))},$Y=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&$Y(t,e.children,i)}))},KY=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},qY=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new lG(e),r=[];return r.push(n.layout(s,i)),r},ZY=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},JY=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class QY extends TF{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const tX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),eX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:tX(t),iX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class sX extends Iw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class nX extends Iw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const rX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},aX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class oX extends TN{constructor(){super(...arguments),this.type=oX.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?aX:rX,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}oX.type="linkPath";const lX=Object.assign(Object.assign({},zF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class hX extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const cX=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class dX extends nz{constructor(){super(...arguments),this.type=xR.sankey,this.transformerConstructor=hX,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ve,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=vI(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=vI(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=vI(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),cX(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=vI(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=vI(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=vI(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=vI(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=vI(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void cX(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void cX(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(vI(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=vI(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=vI(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void cX(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void cX(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void cX(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){EI(this._dataSet,"sankeyLayout",qY),EI(this._dataSet,"sankeyFormat",KY),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;EI(o,"sankeyNodes",ZY),EI(o,"flatten",PY);const l=new Pa(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:OF.bind(this),call:IF}},!1),this._nodesSeriesData=l,EI(o,"sankeyLinks",JY);const h=new Pa(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:OF.bind(this),call:IF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(dX.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(dX.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=mF(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),XF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),XF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:kI.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(vI(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new QY(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new OR;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return $Y(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}dX.type=xR.sankey,dX.transformerConstructor=hX,dX.mark=lX,dX.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const uX=()=>{hV(),wN(),eM(),sO.registerGraphicComponent("path",(t=>tf(t))),sO.registerMark(oX.type,oX),GN(),sO.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:eX(t,e)},qD))),sO.registerAnimation("sankeyLinkPath",((t,e)=>({appear:iX(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:$D.disappear.duration}}))),kw.registerBuiltInAnimate("linkPathGrowOut",nX),kw.registerBuiltInAnimate("linkPathGrowIn",sX),JD(),sO.registerSeries(dX.type,dX)},pX=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=PY(n);return i=CF([{latestData:r}],e),i};class gX extends TF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const fX=Object.assign(Object.assign({},zF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),mX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class vX extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const _X=(t,e)=>{if(e.getViewBox()){const i=new fG(e).layout(t,e.getViewBox()),s=[];return FW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[LF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class yX extends nz{constructor(){super(...arguments),this.type=xR.treemap,this.transformerConstructor=vX,this._categoryField="name",this._valueField="value",this._viewBox=new Ve,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:LF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new We),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:LO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),EI(this._dataSet,"treemap",_X),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(EI(this._rawData.dataSet,"addVChartProperty",yF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:DF.bind(this),call:FF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=pX([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){EI(this._dataSet,"hierarchyDimensionStatistics",pX),EI(this._dataSet,"flatten",PY);const i=new Pa(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 zY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(yX.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(yX.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("treemap"))||void 0===e?void 0:e(),XF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new gX(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(bI.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(bI.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}yX.type=xR.treemap,yX.mark=fX,yX.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},yX.transformerConstructor=vX,G(yX,DY),G(yX,VV);const bX=()=>{sO.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),sO.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),hV(),GN(),sO.registerAnimation("treemap",((t,e)=>({appear:mX(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:$D.disappear.duration}}))),JD(),sO.registerSeries(yX.type,yX)},xX=Object.assign(Object.assign({},oW),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),SX=Object.assign(Object.assign({},zF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),AX={type:"fadeIn"};function kX(t,e){return"fadeIn"===e?AX:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class MX extends tz{constructor(){super(...arguments),this._supportStack=!1}}class TX extends TF{enableByType(t){return"dimension"!==t}}const wX="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",CX={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:wX,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:wX,fill:"#ddd"}}};class EX extends lW{constructor(){super(...arguments),this.type=xR.gaugePointer,this.transformerConstructor=MX,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(EX.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},EX.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(EX.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new TX(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=$(e),s=K(e),n=_t(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),XF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}EX.type=xR.gaugePointer,EX.mark=SX,EX.builtInTheme={gaugePointer:CX},EX.transformerConstructor=MX;const BX=()=>{sO.registerSeries(EX.type,EX),OV(),hV(),sO.registerAnimation("gaugePointer",((t,e)=>{const i=kX(t,e);return{appear:i,enter:i,disappear:{duration:$D.disappear.duration}}})),HU(),zU()};class PX extends tz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class LX extends lW{constructor(){super(...arguments),this.type=xR.gauge,this.transformerConstructor=PX,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();EI(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[ZO]=t[this._angleField[0]],t[qO]=e>0?i[e-1][ZO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(LX.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(LX.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?FR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?FR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[qO])?this.angleAxisHelper.dataToPosition([t[qO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[ZO]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),XF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}LX.type=xR.gauge,LX.mark=xX,LX.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},LX.transformerConstructor=PX;class RX extends jD{constructor(){super(...arguments),this.type=RX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Eg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}RX.type="cell";function OX(t){return!1===t?{}:{type:"fadeIn"}}class IX extends TF{enableByType(t){return"dimension"!==t}}const DX=Object.assign(Object.assign({},zF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class FX extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class zX extends nz{constructor(){super(...arguments),this.type=xR.heatmap,this.transformerConstructor=FX}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(zX.mark.cell,{isSeriesMark:!0},{morph:qF(this._spec,zX.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(zX.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ai(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=sz(this);this._cellMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),XF("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new IX(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}zX.type=xR.heatmap,zX.mark=DX,zX.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},zX.transformerConstructor=FX;const jX=()=>{GN(),sO.registerMark(RX.type,RX),sO.registerGraphicComponent("symbol",Eg),hM(),dM(),IB(),sO.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},qD),{appear:OX(e)}))),jj(),Ij(),sO.registerSeries(zX.type,zX)},HX=Object.assign(Object.assign({},zF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),VX=`${wO}_CORRELATION_X`,NX=`${wO}_CORRELATION_Y`,UX=`${wO}_CORRELATION_SIZE`,WX=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=oe(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=oe(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Lt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Lt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Lt(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+Lt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Pt(e.field),C=t.map(w),[E,B]=Ot(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Pt(e.radiusField),R=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>R;if(L){const[i,s]=L!==w?Ot(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=GX(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),YX({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,a>D?a=I:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},YX=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[PO]:null==n?void 0:n[PO],[RO]:null==n?void 0:n[RO]}};class $X extends TN{constructor(){super(...arguments),this.type=$X.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=_t(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}$X.type="ripple";const KX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class qX extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class ZX extends aU{constructor(){super(...arguments),this.type=xR.correlation,this.transformerConstructor=qX,this._viewBox=new Ve}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;EI(this._dataSet,"correlation",WX);const s=new Ba;BI(s,"dataview",wa),EI(s,"correlationCenter",XX);const n=new Pa(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new OD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const e=this._createMark(ZX.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:PO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(ZX.mark.ripplePoint,{key:PO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(ZX.mark.centerPoint,{key:PO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[VX],y:t=>t[NX],size:t=>t[UX],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),XF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}ZX.type=xR.correlation,ZX.mark=HX,ZX.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},ZX.transformerConstructor=qX;const JX=()=>{Bz(),wN(),dM(),sO.registerMark($X.type,$X),sO.registerGraphicComponent("symbol",(t=>Eg(t))),sO.registerSeries(ZX.type,ZX),sO.registerAnimation("correlation",((t,e)=>Object.assign({appear:KX(0,e)},KD)))},QX=Object.assign(Object.assign({},zF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class t$ extends TN{constructor(){super(...arguments),this.type=t$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}t$.type="liquid";const e$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class i$ extends TF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class s$ extends ez{constructor(){super(...arguments),this.type=xR.liquid,this.transformerConstructor=Pz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Dg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Eg({x:s,y:n,size:r,symbolType:e$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=YR(this._spec.outlineMargin),this._paddingSpec=YR(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(s$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(s$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(s$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(s$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new i$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(YF(null===(i=sO.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),XF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(YF(null===(s=sO.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),XF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=IM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}s$.type=xR.liquid,s$.mark=QX,s$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},s$.transformerConstructor=Pz;const n$=t=>Y(t).join(",");class r$ extends TF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>n$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>n$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const a$=Object.assign(Object.assign({},zF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class o$ extends tz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const l$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?wG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class h$ extends ez{constructor(){super(...arguments),this.type=xR.venn,this.transformerConstructor=o$,this._viewBox=new Ve}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:LO)}initData(){var t;super.initData(),EI(this._dataSet,"venn",l$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(h$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(h$.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>n$(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>n$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new r$(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:n$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return n$(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[n$(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(n$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),XF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(YF(null===(e=sO.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),XF(t.name,this._spec,this._markAttributeContext)))}))}}h$.type=xR.venn,h$.mark=a$,h$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},h$.transformerConstructor=o$;class c$ extends gV{constructor(){super(...arguments),this.type=xR.mosaic,this.transformerConstructor=pV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(XO),this.setFieldX2(YO)),this.setFieldY(KO),this.setFieldY2($O)):(t&&(this.setFieldY(XO),this.setFieldY2(YO)),this.setFieldX(KO),this.setFieldX2($O)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}c$.type=xR.mosaic,c$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},c$.transformerConstructor=pV;class d$ extends lH{_isValidSeries(t){return t===xR.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class u$ extends aH{constructor(){super(...arguments),this.transformerConstructor=d$,this.type="map",this.seriesType=xR.map}}u$.type="map",u$.seriesType=xR.map,u$.transformerConstructor=d$;class p$ extends lH{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class g$ extends p${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=Uz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,iO({},s,l)),n&&Object.assign(o,iO({},n,o))}}class f$ extends p${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class m$ extends p${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class v$ extends aH{constructor(){super(...arguments),this.transformerConstructor=m$}}v$.transformerConstructor=m$;class _$ extends v${constructor(){super(...arguments),this.transformerConstructor=m$,this.type="pie",this.seriesType=xR.pie}}_$.type="pie",_$.seriesType=xR.pie,_$.transformerConstructor=m$;class y$ extends f${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:rj,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:rj,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>iO({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const b$=(t,e)=>{if(!t)return null;const i=_z(t,(t=>"angle"===t.getOrient()),e),s=_z(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&tE(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=uR({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=$(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=pR(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=mz(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&tE(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=uR({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=pR(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=mz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class x$ extends aH{constructor(){super(...arguments),this.transformerConstructor=y$,this.type="rose",this.seriesType=xR.rose}_setModelOption(){this._modelOption.getDimensionInfo=b$}}x$.type="rose",x$.seriesType=xR.rose,x$.transformerConstructor=y$,G(x$,pH);class S$ extends f${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=iO({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>iO({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class A$ extends aH{constructor(){super(...arguments),this.transformerConstructor=S$,this.type="radar",this.seriesType=xR.radar}_setModelOption(){this._modelOption.getDimensionInfo=b$}}A$.type="radar",A$.seriesType=xR.radar,A$.transformerConstructor=S$,G(A$,pH);class k$ extends lH{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{L(e,"trimPadding")&&iO(e,nD(this.type,t))})),this._transformAxisSpec(t)}}class M$ extends aH{constructor(){super(...arguments),this.transformerConstructor=k$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=AH(t,e,i))&&void 0!==s?s:[],...null!==(n=b$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}M$.type="common",M$.transformerConstructor=k$,G(M$,pH);class T$ extends hH{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class w$ extends aH{constructor(){super(...arguments),this.transformerConstructor=T$}}w$.transformerConstructor=T$,G(w$,pH);class C$ extends T${transformSpec(t){super.transformSpec(t),eD(t)}}class E$ extends w${constructor(){super(...arguments),this.transformerConstructor=C$,this.type="histogram",this.seriesType=xR.bar}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}E$.type="histogram",E$.seriesType=xR.bar,E$.transformerConstructor=C$;class B$ extends g${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class P$ extends aH{constructor(){super(...arguments),this.transformerConstructor=B$,this.type="circularProgress",this.seriesType=xR.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=b$}}P$.type="circularProgress",P$.seriesType=xR.circularProgress,P$.transformerConstructor=B$,G(P$,pH);class L$ extends g${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=xR.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===xR.gauge||t.type===xR.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===xR.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class R$ extends aH{constructor(){super(...arguments),this.transformerConstructor=L$,this.type="gauge",this.seriesType=xR.gaugePointer}}R$.type="gauge",R$.seriesType=xR.gaugePointer,R$.transformerConstructor=L$;class O$ extends lH{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class I$ extends aH{constructor(){super(...arguments),this.transformerConstructor=O$,this.type="wordCloud",this.seriesType=xR.wordCloud}}I$.transformerConstructor=O$;class D$ extends I${constructor(){super(...arguments),this.transformerConstructor=O$,this.type="wordCloud",this.seriesType=xR.wordCloud}}D$.type="wordCloud",D$.seriesType=xR.wordCloud,D$.transformerConstructor=O$;class F$ extends lH{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class z$ extends aH{constructor(){super(...arguments),this.transformerConstructor=F$,this.type="funnel",this.seriesType=xR.funnel}}z$.type="funnel",z$.seriesType=xR.funnel,z$.transformerConstructor=F$;class j$ extends hH{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=Uz(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=Uz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class H$ extends aH{constructor(){super(...arguments),this.transformerConstructor=j$,this.type="linearProgress",this.seriesType=xR.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}H$.type="linearProgress",H$.seriesType=xR.linearProgress,H$.transformerConstructor=j$,G(H$,pH);class V$ extends hH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),eD(t)}}class N$ extends aH{constructor(){super(...arguments),this.transformerConstructor=V$,this.type="rangeColumn",this.seriesType=xR.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}N$.type="rangeColumn",N$.seriesType=xR.rangeColumn,N$.transformerConstructor=V$;class U$ extends lH{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class W$ extends aH{constructor(){super(...arguments),this.transformerConstructor=U$,this.type="sunburst",this.seriesType=xR.sunburst}}W$.type="sunburst",W$.seriesType=xR.sunburst,W$.transformerConstructor=U$;class G$ extends lH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class Y$ extends aH{constructor(){super(...arguments),this.transformerConstructor=G$,this.type="circlePacking",this.seriesType=xR.circlePacking}}Y$.type="circlePacking",Y$.seriesType=xR.circlePacking,Y$.transformerConstructor=G$;class X$ extends lH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class $$ extends aH{constructor(){super(...arguments),this.transformerConstructor=X$,this.type="treemap",this.seriesType=xR.treemap}}$$.type="treemap",$$.seriesType=xR.treemap,$$.transformerConstructor=X$;class K$ extends mV{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),eD(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class q$ extends vV{constructor(){super(...arguments),this.transformerConstructor=K$,this.type="waterfall",this.seriesType=xR.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}q$.type="waterfall",q$.seriesType=xR.waterfall,q$.transformerConstructor=K$;class Z$ extends hH{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),eD(t)}}class J$ extends aH{constructor(){super(...arguments),this.transformerConstructor=Z$,this.type="boxPlot",this.seriesType=xR.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}J$.type="boxPlot",J$.seriesType=xR.boxPlot,J$.transformerConstructor=Z$;class Q$ extends lH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class tK extends aH{constructor(){super(...arguments),this.transformerConstructor=Q$,this.type="sankey",this.seriesType=xR.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=vI(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}tK.type="sankey",tK.seriesType=xR.sankey,tK.transformerConstructor=Q$;class eK extends hH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),eD(t)}}class iK extends aH{constructor(){super(...arguments),this.transformerConstructor=eK,this.type="rangeArea",this.seriesType=xR.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=AH,this._modelOption.getDimensionInfoByValue=MH,this._modelOption.getRectByDimensionData=PH}}iK.type="rangeArea",iK.seriesType=xR.rangeArea,iK.transformerConstructor=eK;class sK extends hH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class nK extends aH{constructor(){super(...arguments),this.transformerConstructor=sK,this.type="heatmap",this.seriesType=xR.heatmap}}nK.type="heatmap",nK.seriesType=xR.heatmap,nK.transformerConstructor=sK;class rK extends lH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class aK extends aH{constructor(){super(...arguments),this.transformerConstructor=rK,this.type="correlation",this.seriesType=xR.correlation}}aK.type="correlation",aK.seriesType=xR.correlation,aK.transformerConstructor=rK;function oK(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=fI(t.style)),P(t.textStyle)||iO(s.textStyle,fI(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&fI(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&fI(s.background.style),s}const lK=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},hK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:RO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class cK extends dj{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{fR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),fR(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=HR(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new OD(this._option,e),this._initSelectedData(),fR(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(fR(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(iO({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(iO({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(iO({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}cK.specKey="legends";class dK extends cK{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),fR(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){EI(this._option.dataSet,"discreteLegendFilter",hK),EI(this._option.dataSet,"discreteLegendDataMake",lK);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return fR(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!hb(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=iI(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=oK(n):l.title={visible:!1},P(r.focusIconStyle)||fI(r.focusIconStyle),r.shape&&(r.shape=uI(r.shape)),r.label&&(r.label=uI(r.label)),r.value&&(r.value=uI(r.value)),r.background&&(r.background=uI(r.background)),VR(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),VR(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),VR(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(P(a.railStyle)||fI(a.railStyle),P(a.sliderStyle)||fI(a.sliderStyle)):(P(a.textStyle)||fI(a.textStyle),a.handler&&uI(a.handler)),l.pager=a,o.visible&&!P(o.style)&&(iO(l,o.style),p(o.padding)&&(l.padding=o.padding)),l}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return AL}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(mL.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(mL.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(mL.legendItemUnHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=mF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=mF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}dK.specKey="legends",dK.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},dK.type=r.discreteLegend;const uK=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},pK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?dI(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function gK(t){const i=iO({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:_,data:y,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:M,seriesId:T,padding:w}=i,C=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?C.title=oK(s):C.title={visible:!1},C.showHandler=!1!==n.visible,P(n.style)||(C.handlerStyle=fI(n.style)),p(r.width)&&(C.railWidth=r.width),p(r.height)&&(C.railHeight=r.height),P(r.style)||(C.railStyle=fI(r.style)),P(a.style)||(C.trackStyle=fI(a.style)),C.startText=uI(o),C.endText=uI(l),C.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>fI(i(t,e,s)):P(i)||(e.style=fI(i)),e}(h),P(c)||(C.sizeBackground=fI(c)),u.visible&&!P(u.style)&&(iO(C,u.style),p(u.padding)&&(C.padding=u.padding)),C}const fK={color:CL,size:BL},mK={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},vK=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},mK),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},_K={horizontal:vK(!0),vertical:vK(!1)},yK=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},mK),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},bK={horizontal:yK(!0),vertical:yK(!1)},xK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],SK=[2,10];class AK extends cK{static getSpecInfo(t){const e=vF(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),fR(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){EI(this._option.dataSet,"continuousLegendFilter",pK),EI(this._option.dataSet,"continuousLegendDataMake",uK);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>mR(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=iI(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!hb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=iI(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?xK:SK);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 h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},gK(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return fK[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}AK.specKey="legends",AK.builtInTheme={colorLegend:_K,sizeLegend:bK},AK.type=r.continuousLegend;const kK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,MK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),TK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function wK(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=CK(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>MK(i,s)(t)&&MK(n,r)(t)&&(u(a)||MK([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:AI.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return dF.globalConfig.uniqueTooltip&&dF.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:AI.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return dF.globalConfig.uniqueTooltip&&dF.hideTooltip(a.id),m}return"none"}const CK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=kK(c,t);let _=kK(d,t);const y=TK(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(MK(c,v));if(!y&&(_=kK(d,i),!TK(_)))return;const n=e.type===xR.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=tE(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(MK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=kK(d,o),!TK(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(MK(c,n));if(!y&&(_=kK(d,r),!TK(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===xR.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(MK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=kK(d,i),!TK(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(MK(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=kK(d,a),h=_,!TK(_)&&!a)return;TK(_)||(_=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},EK=t=>p(t)&&!y(t),BK=t=>p(t)&&y(t),PK=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class LK extends cj{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=iO({},...PK.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=iO({},s);PK.forEach((t=>{delete r[t]})),delete r.style;const a=iO({},r,i);return a.style=iO({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:rb(this._option.mode)||!sb(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=I_.getElementById(t.parentElement)):sb(this._option.mode)&&(t.parentElement=null==ib?void 0:ib.body)}}const RK={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class OK extends dj{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=LK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=sb(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&EK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&dF.globalConfig.uniqueTooltip&&l&&dF.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:AI.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:AI.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?IH.canvas:IH.dom,n=sO.getComponentPluginInType(t);n||Qy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=sO.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(nb(s)||rb(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=wK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(BK(t)){if(EK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>gz(t,e[i])))}if(BK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}OK.type=r.tooltip,OK.transformerConstructor=LK,OK.builtInTheme={tooltip:RK},OK.specKey="tooltip";var IK,DK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(IK||(IK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(DK||(DK={}));const FK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class zK extends dj{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{tE(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:kI.chart}:{source:AI.chart};y(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:nb(e)||rb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:AI.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:AI.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:AI.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{FK[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}zK.specKey="crosshair";const jK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class HK extends zK{static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=rz(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){rz(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:az(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=vR(this._regions,"cartesian");e&&(TH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=EH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new yT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new bT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}HK.specKey="crosshair",HK.builtInTheme={crosshair:jK},HK.type=r.cartesianCrosshair;class VK extends zK{static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=vR(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Nz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=mF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=_e([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=_t(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new yT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new ST(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new AT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new xT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}VK.specKey="crosshair",VK.builtInTheme={crosshair:jK},VK.type=r.polarCrosshair;const NK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},UK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},WK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},GK=(t,e,i)=>{const s=e.domain();if(JC(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},YK=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&JC(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},XK=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},$K=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},KK=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),qK=(t,e,i)=>{if(JC(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class ZK{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=_t(this.getState().start+f,0,1),_=_t(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ut(s/n)>=.5:Ut(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===hz(lz(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(ZK,VV);class JK extends dj{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:YK(t,this._stateScale,this._isHorizontal),a="percent"===n?e:YK(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=XK(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=qK(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&$K(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else fR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),fR(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=lz(t),this._isHorizontal="horizontal"===hz(this._orient),this._dataFilterEvent=new ZK(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(JC(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>hz(t._orient)===hz(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!JC(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};fR(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=JC(d.getScale(0).type),p=JC(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else fR(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;BI(r,"dataview",wa),EI(r,"dataFilterComputeDomain",WK);const a=new Pa(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new OD(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(EI(this._option.dataSet,"dataFilterWithNewDomain",UK),EI(this._option.dataSet,"lockStatisticsFilter",NK),fR(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>JC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>JC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(JC(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;KK("start",i,this._spec)&&KK("end",s,this._spec)&&(t="percent"===i?this._spec.start:YK(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:YK(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?YK(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?YK(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=GK(this._start,this._stateScale,XK(i,this._isHorizontal)),this._endValue=GK(this._end,this._stateScale,XK(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,JC(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=qK(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&fR(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new NE:new xE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),$(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=$K(h);if(!this._dataUpdating&&tE(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,tE(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(JK,VV);class QK extends cj{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=iO({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const tq=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),eq={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:tq(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:tq(!0)};class iq extends JK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=QK,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=GK(e,this._stateScale,XK(s,this._isHorizontal)),a=GK(i,this._stateScale,XK(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new NE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(XK(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=XK(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new NE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(XK(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),$(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!JC(t.type)||e[0]!==X(e))&&(!tE(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:XK(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>GK(t,this._stateScale,XK(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new vP(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>GK(t,this._stateScale,XK(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:fI(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:fI(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:fI(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:fI(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:fI(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:fI(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:fI(g.style)},selectedBackgroundStyle:fI(this._spec.selectedBackground.style),dragMaskStyle:fI(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:iO(fI(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},fI(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:iO(fI(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},fI(null===(d=m.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=mF(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(XK(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}iq.type=r.dataZoom,iq.transformerConstructor=QK,iq.builtInTheme={dataZoom:eq},iq.specKey="dataZoom";const sq={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class nq extends JK{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=aR(this._start,e)&&aR(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=XK(n,this._isHorizontal),a=GK(e,this._stateScale,r),o=GK(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new kM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=fI(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=fI(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}nq.type=r.scrollBar,nq.builtInTheme={scrollBar:sq},nq.specKey="scrollBar";const rq=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},aq=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),oq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:aq("l1FontSize","primaryFontColor")},content:{visible:!0,style:aq("l2FontSize","tertiaryFontColor")}};class lq extends dj{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(vI(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(vI(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){EI(this._option.dataSet,"indicatorFilter",rq);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new OD(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=iO({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},gI(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?$R(l,this._computeLayoutRadius()):0,dy:h?$R(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},gI(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new RL(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}lq.type=r.indicator,lq.builtInTheme={indicator:oq},lq.specKey="indicator";const hq=["sum","average","min","max","variance","standardDeviation","median"];function cq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=$(s);return er}function dq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&cq(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=VR(t.x)?fq(t.x,n)+r.x:mq(l.getXAxisHelper(),[t.x])+r.x,h}function uq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&cq(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=VR(t.y)?fq(t.y,n)+r.y:mq(l.getYAxisHelper(),[t.y])+r.y,h}function pq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&cq(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),mq(a.angleAxisHelper,[t.angle])}function gq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&cq(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),mq(a.radiusAxisHelper,[t.radius])}function fq(t,e){return Number(t.substring(0,t.length-1))*e/100}function mq(t,e){const i=t.getScale(0);return JC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function vq(t){return hq.includes(t)}function _q(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=dq(t,_,n,u,c,o),r=uq(t,y,n,u,d,o),yq(s,b,S,g.length),yq(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=dq(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);yq(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=uq(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);yq(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function yq(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=pq(t,l,n,r),i=gq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=pq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=gq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function xq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=VR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=VR(i)?Number(i.substring(0,i.length-1))*f/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&cq(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&cq(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:mq(d.getXAxisHelper(),b)+p.x+m,y:mq(d.getYAxisHelper(),x)+p.y+v})})),n}function Sq(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&cq(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&cq(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:mq(l.angleAxisHelper,d),radius:mq(l.radiusAxisHelper,u)})})),s}function Aq(t,e,i){let{x:s,y:n}=t;return VR(s)&&(s=fq(s,e)),VR(n)&&(n=fq(n,i)),{x:s,y:n}}function kq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=Aq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>Aq(t,n,r)))}function Mq(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function Tq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},fI(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Cq(fI(n.style),i,s)),p(n.padding)&&(t.padding=ai(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Cq(fI(r),i,s)),t}return{visible:!1}}function wq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function Cq(t,e,i){return d(t)?t(e,i):t}function Eq(t,e){return d(t)?t(e):t}function Bq(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function Pq(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function Lq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=Pq(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function Rq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=Pq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function Oq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function Iq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&vq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&vq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&vq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&vq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Fq(i,t,e))):i.x=Fq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Fq(i,t,e))):i.y=Fq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Fq(i,t,e))):i.angle=Fq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Fq(i,t,e))):i.radius=Fq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Fq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const Dq={min:(t,e)=>oR(t[0].latestData,e.field),max:(t,e)=>lR(t[0].latestData,e.field),sum:function(t,e){return hR(t[0].latestData,e.field)},average:function(t,e){return cR(t[0].latestData,e.field)},variance:function(t,e){return dR(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(dR(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Fq(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(m(t)){const{aggrType:i,field:s}=t;return Dq[i](e,{field:s})}return t}function zq(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class jq extends dj{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&vq(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ba;return e.registerParser("array",s),new Pa(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=vR(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=UR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=UR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();EI(this._option.dataSet,"markerAggregation",Iq),EI(this._option.dataSet,"markerFilter",zq);const i=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function Hq(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=oR(t,e),r=lR(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Vq extends jq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=Lq(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Cq(fI(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>Tq(t,this._markerData,this._markAttributeContext))),state:{line:wq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:wq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:wq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return wq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return wq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:Cq(fI(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:Cq(fI(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=Mq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=Lq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;EI(this._option.dataSet,"markerAggregation",Iq),EI(this._option.dataSet,"markerRegression",Hq),EI(this._option.dataSet,"markerFilter",zq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Pa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}Vq.specKey="markLine";const Nq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Uq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},Wq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:Nq(!1),endSymbol:Nq(!0),label:Uq};class Gq extends Vq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new iL(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=Lq(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=_q(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=xq(i,r,d,e.coordinatesOffset):c&&(y=kq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(VR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=Lq(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}Gq.type=r.markLine,Gq.coordinateType="cartesian",Gq.builtInTheme={markLine:Wq};class Yq extends Vq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=Lq(this._spec);return e||i?new rL(t):new iL(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=Lq(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=bq(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=Sq(i,r,a),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=Lq(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}Yq.type=r.polarMarkLine,Yq.coordinateType="polar",Yq.builtInTheme={polarMarkLine:Wq};class Xq extends dj{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=HR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return vF(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=UR(this._spec.width,a.width,null,a.width),l=UR(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new PL(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}Xq.type=r.title,Xq.specKey=r.title,Xq.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class $q extends jq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=Rq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:Cq(fI(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>Tq(t,this._markerData,this._markAttributeContext))),state:{area:wq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>wq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return wq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=Mq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=Rq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}$q.specKey="markArea";const Kq={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class qq extends $q{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new nL(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=Rq(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=_q(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=_q(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=xq(s,a,u,i.coordinatesOffset):d&&(f=kq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=Rq(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}qq.type=r.markArea,qq.coordinateType="cartesian",qq.builtInTheme={markArea:Kq};class Zq extends $q{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=Rq(this._spec);return i||e||s?new aL(t):new nL(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=Rq(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=bq(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=Sq(i,r,c),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=Rq(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Zq.type=r.polarMarkArea,Zq.coordinateType="polar",Zq.builtInTheme={polarMarkArea:Kq};const Jq=t=>fI(Object.assign({},t)),Qq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},fI(t.style))}),tZ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=Jq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Jq(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},fI(Object.assign({},y)));var y;const b=Qq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Qq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Qq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=Qq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},eZ=t=>"left"===t||"right"===t,iZ=t=>"top"===t||"bottom"===t,sZ={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class nZ extends dj{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},tZ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},tZ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new XL(t):this._playerComponent=new qL(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=eZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=eZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(VL.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(VL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(VL.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(VL.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(VL.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(VL.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=eZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=iZ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):eZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):iZ(this._orient)?this._maxSize():t.height}_computeDx(t){return eZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return iZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}nZ.builtInTheme={player:sZ},nZ.specKey="player",nZ.type=r.player;class rZ extends dj{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=ER({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==lD.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}rZ.type=r.label;class aZ extends WN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}aZ.type="text",aZ.constructorType="label";const oZ=()=>{GN(),sO.registerMark(aZ.constructorType,aZ)};class lZ extends cj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class hZ extends rZ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=lZ,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(bI.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(bI.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),fR(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=iO({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},hN(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[GO])):t=>t.filter((t=>t.data[WO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?cN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}hZ.type=r.label,hZ.specKey="label",hZ.transformerConstructor=lZ;class cZ extends rZ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[NO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return iO({textStyle:{pickable:!0===this._spec.interactive},position:dZ(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[GO]:t.data[WO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>cN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function dZ(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}cZ.type=r.totalLabel,cZ.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},cZ.specKey="totalLabel";class uZ extends jq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Oq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R,O;const{itemContent:I={},itemLine:D={},targetSymbol:F={}}=this._spec,z=I,{type:H="text",text:V,symbol:N,image:U,richText:W,customMark:G,textStyle:Y,symbolStyle:X,imageStyle:$,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=z,Q=e(z,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:J,it={dx:0,dy:0},et=Tq(Object.assign(Object.assign({},V),{style:j(it,null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==W?void 0:W.state)&&void 0!==r?r:J,it={width:100,height:100},et=Cq(j(it,null!==(o=null!==(a=null==W?void 0:W.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==N?void 0:N.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=fI(Cq(j(it,null!==(c=null!==(h=null==N?void 0:N.style)&&void 0!==h?h:X)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==U?void 0:U.state)&&void 0!==d?d:J,it={width:80,height:80},et=Cq(j(it,null!==(p=null!==(u=null==U?void 0:U.style)&&void 0!==u?u:$)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=Cq(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:Eq(I.offsetX,this._relativeSeries.getRegion()),offsetY:Eq(I.offsetX,this._relativeSeries.getRegion())},Q),{style:Cq(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(A=F.size)&&void 0!==A?A:20,style:Cq(F.style,this._markerData,this._markAttributeContext)},state:{line:wq(null!==(M=null===(k=this._spec.itemLine.line)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:wq(null!==(w=null===(T=this._spec.itemLine.startSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:wq(null!==(E=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext),itemContent:wq(tt,this._markerData,this._markAttributeContext),textBackground:wq(null===(P=null===(B=this._spec.itemContent.text)||void 0===B?void 0:B.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:wq(null!==(R=null===(L=this._spec.targetSymbol)||void 0===L?void 0:L.state)&&void 0!==R?R:{},this._markerData,this._markAttributeContext)},animation:null!==(O=this._spec.animation)&&void 0!==O&&O,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=e(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:fI(rt.style)}):{visible:!1};return new lL(st)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Mq([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:Bq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:Bq(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=Oq(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}uZ.specKey="markPoint";const pZ={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class gZ extends uZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=_q(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=xq(n,r,h,s.coordinatesOffset)[0]:l&&(c=kq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Oq(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}gZ.type=r.markPoint,gZ.coordinateType="cartesian",gZ.builtInTheme={markPoint:pZ};class fZ extends uZ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=bq(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}fZ.type=r.polarMarkPoint,fZ.coordinateType="polar",fZ.builtInTheme={polarMarkPoint:pZ};class mZ extends uZ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}mZ.type=r.geoMarkPoint,mZ.coordinateType="geo",mZ.builtInTheme={geoMarkPoint:pZ};const vZ="inBrush",_Z="outOfBrush";class yZ extends dj{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return vF(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),vZ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),_Z,t.AttributeLevel.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new tR(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:fI(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener($L.brushActive,(s=>{this._initMarkBrushState(i,_Z),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener($L.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($L.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($L.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($L.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($L.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener($L.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener($L.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},fI(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(vZ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(vZ),i.addState(_Z,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(vZ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(vZ),i.addState(_Z,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(vZ),s.removeState(_Z),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}yZ.type=r.brush,yZ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},yZ.specKey="brush";class bZ extends dj{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${wO}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=YF({},XF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ve).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ve;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}bZ.type=r.customMark,bZ.specKey="customMark";class xZ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>SZ(t))),a=n.filter((t=>!SZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>SZ(t))),h=o.filter((t=>!SZ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function SZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}xZ.type="grid";const AZ="vchart-tooltip",kZ=`${AZ}-container`,MZ=`${AZ}-title`,TZ=`${AZ}-content-box`,wZ={offsetX:10,offsetY:10},CZ="99999999999999";function EZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const BZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,PZ=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?EZ(t):"",LZ=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},RZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},OZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=RZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class IZ extends jz{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=xF(null==T?void 0:T.position,b,e),C=null!==(r=xF(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:CO,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:EO;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=sb(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=BZ(e,F),V=BZ(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(OZ(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},$=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=LZ(t,_),W.top=LZ(i,_),W.right=LZ(e,_),W.bottom=LZ(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&$.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=LZ(e,_):X(e,t)}));else p(w)&&(X({orient:w,mode:C},"x"),X({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=OZ(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",FZ=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=DZ(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=DZ(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},zZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?UR(e,t.fontSize):0},jZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=ai(r),a.padding=DZ(o)),{panelStyle:a,panelPadding:o}};function HZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class VZ extends IZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(VZ.type),this.type=IH.dom,this._tooltipContainer=null==ib?void 0:ib.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(ib&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=jZ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:DZ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=FZ(h),x=FZ(d),S=FZ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=DZ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=DZ(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=DZ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(zZ(p),zZ(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(MZ))),l=a.find((t=>t.className.includes(TZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(MZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(HZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${AZ}-column`),e.classList.add(`${AZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(TZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];HZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));HZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${AZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=PZ(e.key),e.keyStyle&&FZ(e.keyStyle,l)):"value"===i?(o.innerHTML=PZ(e.value),e.valueStyle&&FZ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?EZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?EZ(c):m,y=p,b=t=>new Cg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ve));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=vh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?EZ(u):"currentColor",`\n \n \n \n `;const w=T?vh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),HZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(TZ))),h=[...o.children].find((t=>t.className.includes(MZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(MZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=UR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,HZ(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},ff||(ff=pf.CreateGraphic("richtext",{})),ff.setAttributes(a),ff.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function WZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:NZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const GZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class YZ extends IZ{constructor(){super(YZ.type),this.type=IH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new rR({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ai(d.padding),b=YR(d.padding),x=WZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=WZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=WZ(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},M={panel:GZ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=iO({},S,WZ(b,void 0,{})),{width:s,height:n,text:r}=UZ(h,i);T.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(m)){const t=iO({},A,WZ(x,void 0,{})),{width:e,height:s,text:n}=UZ(m,t);T.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=iO({},x,WZ(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=UZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-I-L-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}YZ.type=IH.canvas;const XZ=/\{([^}]+)\}/,$Z=/\{([^}]+)\}/g,KZ=/:/;class qZ extends jz{constructor(){super(qZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:mi.getInstance().timeUTCFormat,local:mi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=ki.getInstance().format,this._numericSpecifier=ki.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[qZ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),sO.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=XZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace($Z,((t,i)=>{if(!KZ.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(xi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}qZ.pluginType="chart",qZ.specKey="formatter",qZ.type="formatterPlugin";dF.useRegisters([()=>{HH(),NH(),WH(),vH(),mH(),eH(),Yj(),Cz(),Bz(),tF(),ZD(),jj(),Ij(),sO.registerSeries(iH.type,iH),sO.registerChart(GH.type,GH)},()=>{HH(),NH(),WH(),mH(),eH(),Yj(),Cz(),$H(),Bz(),ZH(),jj(),Ij(),sO.registerSeries(QH.type,QH),vH(),sO.registerChart(eV.type,eV)},()=>{HH(),NH(),WH(),mH(),fV(),vH(),sO.registerChart(vV.type,vV)},()=>{HH(),NH(),vH(),mH(),wV(),sO.registerChart(EV.type,EV)},()=>{NH(),kU(),sO.registerChart(_$.type,_$)},()=>{HH(),NH(),vH(),mH(),NU(),sO.registerChart(x$.type,x$)},()=>{HH(),NH(),WH(),vH(),mH(),ZU(),sO.registerChart(A$.type,A$)},()=>{HH(),NH(),WH(),vH(),mH(),fV(),sO.registerTransform("bin",Kr),sO.registerChart(E$.type,E$)},()=>{NH(),WV(),OV(),sO.registerSeries(YV.type,YV),sO.registerImplement("registerMap",OI),sO.registerImplement("unregisterMap",II),JD(),sO.registerChart(u$.type,u$)},()=>{NH(),BX(),sO.registerSeries(LX.type,LX),_U(),uW(),zU(),fW(),sO.registerChart(R$.type,R$)},()=>{NH(),sY(),sO.registerChart(D$.type,D$)},()=>{NH(),AY(),sO.registerChart(z$.type,z$)},()=>{HH(),NH(),WH(),vH(),mH(),xN(),sO.registerChart(q$.type,q$)},()=>{HH(),NH(),vH(),mH(),UN(),sO.registerTransform("boxplot",qr),sO.registerChart(J$.type,J$)},()=>{HH(),NH(),vH(),mH(),fW(),sO.registerChart(P$.type,P$)},()=>{HH(),NH(),vH(),mH(),SW(),sO.registerChart(H$.type,H$)},()=>{HH(),NH(),vH(),mH(),tU(),sO.registerChart(N$.type,N$)},()=>{HH(),NH(),WH(),vH(),mH(),$H(),jj(),Ij(),sO.registerSeries(rU.type,rU),sO.registerChart(iK.type,iK)},()=>{NH(),VY(),sO.registerChart(W$.type,W$)},()=>{NH(),XY(),sO.registerChart(Y$.type,Y$)},()=>{NH(),bX(),sO.registerChart($$.type,$$)},()=>{NH(),xo.load(CM),uX(),sO.registerChart(tK.type,tK)},()=>{NH(),jX(),sO.registerChart(nK.type,nK)},()=>{NH(),JX(),sO.registerChart(aK.type,aK)},()=>{HH(),NH(),WH(),vH(),sO.registerChart(M$.type,M$),mH()},Ij,jj,()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),_j(),sO.registerComponent(Hj.type,Hj)},()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),_j(),sO.registerComponent(Vj.type,Vj)},()=>{sO.registerGraphicComponent(uj.lineAxis,((t,e)=>new jC(t,e))),sO.registerGraphicComponent(pj.lineAxisGrid,((t,e)=>new KB(t,e))),_j(),sO.registerComponent(Nj.type,Nj)},HU,zU,()=>{sO.registerComponent(dK.type,dK)},()=>{sO.registerComponent(AK.type,AK)},()=>{sO.registerComponent(OK.type,OK)},()=>{sO.registerComponent(HK.type,HK)},()=>{sO.registerComponent(VK.type,VK)},()=>{sO.registerComponent(iq.type,iq)},()=>{sO.registerComponent(nq.type,nq)},()=>{sO.registerComponent(lq.type,lq)},WV,()=>{sO.registerComponent(Gq.type,Gq),eL()},()=>{sO.registerComponent(qq.type,qq),sL()},()=>{sO.registerComponent(gZ.type,gZ),oL()},()=>{sO.registerComponent(Yq.type,Yq),rL._animate=DP,eL()},()=>{sO.registerComponent(Zq.type,Zq),aL._animate=zP,sL()},()=>{sO.registerComponent(fZ.type,fZ),oL()},()=>{sO.registerComponent(mZ.type,mZ),oL()},()=>{sO.registerComponent(Xq.type,Xq)},()=>{sO.registerComponent(nZ.type,nZ)},()=>{sO.registerGraphicComponent(hZ.type,(t=>new GB(t))),oZ(),fj(),sO.registerComponent(hZ.type,hZ,!0,1/0)},()=>{sO.registerGraphicComponent(cZ.type,(t=>new GB(t))),oZ(),fj(),sO.registerComponent(cZ.type,cZ,!0)},()=>{sO.registerComponent(yZ.type,yZ)},()=>{sO.registerComponent(bZ.type,bZ)},()=>{xo.load(vT)},()=>{sO.registerLayout(xZ.type,xZ)},()=>{var t;t=YZ,sO.registerComponentPlugin(t.type,t)},()=>{var t;t=qZ,sO.registerChartPlugin(t.type,t)},aF,hF]),dF.useRegisters([()=>{iA(xo)}]),t.DEFAULT_CHART_HEIGHT=EO,t.DEFAULT_CHART_WIDTH=CO,t.DEFAULT_CLOSE_STROKE_JOIN=gF,t.DEFAULT_DATA_INDEX=PO,t.DEFAULT_DATA_KEY=LO,t.DEFAULT_DATA_SERIES_FIELD=RO,t.DEFAULT_KEY=JO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=pF,t.DEFAULT_MAP_LOOK_UP_KEY=QO,t.DEFAULT_MEASURE_CANVAS_ID=BO,t.DEFAULT_SERIES_STYLE_NAME=OO,t.DEFAULT_SMOOTH_INTERPOLATE=uF,t.Factory=sO,t.MOSAIC_CAT_END_PERCENT=KO,t.MOSAIC_CAT_START_PERCENT=$O,t.MOSAIC_VALUE_END_PERCENT=XO,t.MOSAIC_VALUE_START_PERCENT=YO,t.ManualTicker=class extends bw{constructor(t){super(t),this.lastFrameTime=0,this.status=Ro.RUNNING}setupTickHandler(){const t=new xw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,!0}},t.PREFIX=wO,t.SEGMENT_FIELD_END=ZO,t.SEGMENT_FIELD_START=qO,t.STACK_FIELD_END=FO,t.STACK_FIELD_END_OffsetSilhouette=VO,t.STACK_FIELD_END_PERCENT=jO,t.STACK_FIELD_KEY=IO,t.STACK_FIELD_START=DO,t.STACK_FIELD_START_OffsetSilhouette=HO,t.STACK_FIELD_START_PERCENT=zO,t.STACK_FIELD_TOTAL=NO,t.STACK_FIELD_TOTAL_BOTTOM=GO,t.STACK_FIELD_TOTAL_PERCENT=UO,t.STACK_FIELD_TOTAL_TOP=WO,t.StreamLight=class extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Ao.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Wl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Ao.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=cl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=cl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),y=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=y*this.gridSize;const _=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,_,b);const C=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let M,w=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;w--;)for(M=x;M--;)B(w,M,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:_,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?EJ(t,o,l.width,l.height,h):"geometric"===t.type&&RJ(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=vJ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};OJ.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class IJ extends xJ{constructor(t){super(H({},IJ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}IJ.defaultOptions={enlarge:!1};const DJ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},FJ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.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?zJ(t.fontFamily):"sans-serif",d=t.fontStyle?zJ(t.fontStyle):"normal",u=t.fontWeight?zJ(t.fontWeight):"normal",p=t.rotate?zJ(t.rotate):0,g=zJ(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?zJ(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",y=null!==(r=t.shrink)&&void 0!==r&&r,_=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},DJ),t.as):DJ,C=t.depth_3d,T=t.postProjection;let M=t.fontSize?zJ(t.fontSize):14;const w=t.fontSizeRange;if(w&&!S(M)){const t=M,e=jJ(NJ(t,l),w);M=i=>e(t(i))}let E=AJ;"fast"===t.layoutType?E=IJ:"grid"===t.layoutType&&(E=OJ);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:M,shrink:y,clip:b,enlarge:_,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},zJ=t=>y(t)||S(t)||d(t)||_(t)?t:e=>e[t.field],HJ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),jJ=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=HJ(t[0]),n=HJ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(HJ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},NJ=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function UJ(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{oT.registerGrammarTransform("wordcloud",{transform:FJ}),A$(),oT.registerAnimation("wordCloud",((t,e)=>({appear:bZ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:Ez.disappear.duration}}))),oT.registerSeries(VJ.type,VJ)},GJ=t=>d(t)?t():t,YJ=(t,e)=>{var i,s,n,r;const a=t.map((t=>Object.assign({},t)));if(!a||0===a.length)return a;const{asTransformRatio:o,asReachRatio:l,asHeightRatio:h,asValueRatio:c,asNextValueRatio:d,asLastValueRatio:u,asLastValue:p,asCurrentValue:g,asNextValue:f}=e,m=GJ(e.valueField),v=null!==(i=GJ(e.heightVisual))&&void 0!==i&&i,y=null===(s=GJ(e.isCone))||void 0===s||s,_=GJ(e.range),b=a.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[m])||-1/0)),-1/0),x=a.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[m])||1/0)),1/0),S=[null!==(n=null==_?void 0:_.min)&&void 0!==n?n:x,null!==(r=null==_?void 0:_.max)&&void 0!==r?r:b];return a.forEach(((t,e)=>{var i,s;const n=Number.parseFloat(t[m]),r=Number.parseFloat(null===(i=a[e-1])||void 0===i?void 0:i[m]),_=Number.parseFloat(null===(s=a[e+1])||void 0===s?void 0:s[m]),b=k(_*n)&&0!==n?_/n:0,x=k(n*r)&&0!==r?n/r:0;p&&(t[p]=r),f&&(t[f]=_),o&&(t[o]=b),l&&(t[l]=0===e?1:x),h&&(t[h]=!0===v?b:1/a.length),c&&(t[c]=n/S[1]),d&&(t[d]=e===a.length-1?y?0:t[c]:_/S[1]),u&&(t[u]=0===e?1:r/S[1]),g&&(t[g]=n)})),a},XJ=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},KJ=`${PT}_FUNNEL_TRANSFORM_RATIO`,$J=`${PT}_FUNNEL_REACH_RATIO`,qJ=`${PT}_FUNNEL_HEIGHT_RATIO`,ZJ=`${PT}_FUNNEL_VALUE_RATIO`,JJ=`${PT}_FUNNEL_LAST_VALUE_RATIO`,QJ=`${PT}_FUNNEL_NEXT_VALUE_RATIO`,tQ=`${PT}_FUNNEL_LAST_VALUE`,eQ=`${PT}_FUNNEL_CURRENT_VALUE`,iQ=`${PT}_FUNNEL_NEXT_VALUE`,sQ=`${PT}_FUNNEL_TRANSFORM_LEVEL`;class nQ extends dH{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[$J])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class rQ extends pz{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class aQ extends rQ{constructor(){super(...arguments),this.type=aQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}aQ.type="polygon";const oQ=()=>{oT.registerMark(aQ.type,aQ),XO(),FO(),sI.registerBuiltInAnimate("growPointsOut",WI),oT.registerGraphicComponent("polygon",af)},lQ=Object.assign(Object.assign({},AH),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class hQ extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class cQ extends YH{constructor(){super(...arguments),this.type=CC.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=hQ,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;DM(this._dataSet,"funnel",YJ),DM(this._dataSet,"funnelTransform",XJ);const t=new Oa(this._dataSet,{name:`${PT}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new VF(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:()=>this.getValueField(),isCone:()=>this._spec.isCone,asCurrentValue:eQ,asTransformRatio:KJ,asReachRatio:$J,asHeightRatio:qJ,asValueRatio:ZJ,asNextValueRatio:QJ,asLastValueRatio:JJ,asLastValue:tQ,asNextValue:iQ,range:()=>this._spec.range}}),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.transform({type:"funnelTransform",options:{asIsTransformLevel:sQ}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},cQ.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:LH(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},cQ.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(cQ.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(cQ.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new nQ(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&oA(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&oA(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*Ak($J).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),RH("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(PH(oT.getAnimationInKey("fadeInOut")(),RH(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(PH(oT.getAnimationInKey("funnel")({},o),RH(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(PH(null===(a=oT.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),RH("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[JJ])/2:this._getSecondaryAxisLength(t[ZJ])/2,n=this._getSecondaryAxisLength(t[ZJ])/2):(s=this._getSecondaryAxisLength(t[ZJ])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[QJ])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[sQ])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[DT]===t[DT]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_{oQ(),A$(),PK(),oT.registerSeries(cQ.type,cQ),oT.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},Pz))),oT.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Cz,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),Oz()},uQ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},pQ=t=>{const e=t.filter((t=>t.context.diffState===vF.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},gQ=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},fQ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pQ(i.parent.children),a=gQ(r,s,n);return uQ(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pQ(i.parent.children),a=gQ(r,s,n);return uQ(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),mQ=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},vQ=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pQ(i.parent.children),a=mQ(r);return uQ(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pQ(i.parent.children),a=mQ(r);return uQ(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),yQ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},_Q=(t,e={})=>{if(!t)return[];const i=[];return kZ(t,i,e),i},bQ=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new JZ(i).layout(t,{width:s,height:n})};class xQ extends dH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var SQ;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(SQ||(SQ={}));const AQ=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===SQ.DrillDown){return Y(pM(t,n,s,"children"))}if(i.type===SQ.DrillUp){const e=gM(t,n,s,"children");if(e)return Y(e)}return t};class kQ{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=fK(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;DM(t,"drillFilter",AQ),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!_(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:SQ.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:SQ.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!_(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:SQ.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:SQ.DrillUp},model:this}),r}}const CQ=Object.assign(Object.assign({},AH),{sunburst:{name:"sunburst",type:"arc"}}),TQ=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:mH,operations:["max","min","values"]}),t.push({key:vH,operations:["values"]}),t),MQ={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class wQ extends z${constructor(){super(...arguments),this.type=CC.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:vH),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:DT},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(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),DM(this._dataSet,"sunburstLayout",bQ),DM(this._dataSet,"flatten",_Q),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return TQ(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(DM(t.dataSet,"addVChartProperty",nH),t.transform({type:"addVChartProperty",options:{beforeCall:xH.bind(this),call:SH}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(wQ.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(wQ.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new xQ(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),RH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),RH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}wQ.type=CC.sunburst,wQ.mark=CQ,wQ.builtInTheme={sunburst:MQ},G(wQ,kQ);const EQ=()=>{oT.registerSeries(wQ.type,wQ),q$(),A$(),Oz(),oT.registerAnimation("sunburst",((t,e)=>({appear:yQ(0,e),enter:fQ(t),exit:vQ(t),disappear:{duration:Ez.disappear.duration}})))},BQ=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new jZ(i).layout(t,{width:s,height:n})};class PQ extends dH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const RQ=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},OQ=Object.assign(Object.assign({},AH),{circlePacking:{name:"circlePacking",type:"arc"}});class IQ extends $H{constructor(){super(...arguments),this.type=CC.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:vH),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:DT},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),DM(this._dataSet,"circlePackingLayout",BQ),DM(this._dataSet,"flatten",_Q),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(DM(t.dataSet,"addVChartProperty",nH),t.transform({type:"addVChartProperty",options:{beforeCall:xH.bind(this),call:SH}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(IQ.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(IQ.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return TQ(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new PQ(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),RH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),RH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}IQ.type=CC.circlePacking,IQ.mark=OQ,IQ.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(IQ,kQ);const LQ=()=>{oT.registerSeries(IQ.type,IQ),q$(),A$(),Rz(),oT.registerAnimation("circlePacking",((t,e)=>({appear:RQ(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:Ez.disappear.duration}})))},DQ=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&DQ(t,e.children,i)}))},FQ=t=>{var e;if(!t||!_(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},zQ=(t,e)=>{const i=d(e)?e():e;if(!t||!(null==i?void 0:i.view)||!t.length)return[];const s=i.view();if(s.x1-s.x0==0||s.y1-s.y0==0||s.x1-s.x0==-1/0||s.x1-s.x0==1/0||s.y1-s.y0==-1/0||s.y1-s.y0==1/0)return[];const n=t[0],r=HQ(n,i),a=new $Z(i),o=[];return o.push(a.layout(r,s)),o},HQ=(t,e)=>{if("source"===e.sourceField&&"target"===e.targetField&&"value"===e.valueField)return t;const i=t.links;return i?Object.assign(Object.assign({},t),{links:i.map((t=>{const i={};return Object.keys(t).forEach((s=>{s===e.sourceField?i.source=t[e.sourceField]:s===e.targetField?i.target=t[e.targetField]:s===e.valueField?i.value=t[e.valueField]:i[s]=t[s]})),i}))}):t},jQ=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},NQ=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class UQ extends dH{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const VQ=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),WQ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:VQ(t),GQ=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class YQ extends SI{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class XQ extends SI{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const KQ=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},$Q=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class qQ extends s${constructor(){super(...arguments),this.type=qQ.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?$Q:KQ,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}qQ.type="linkPath";const ZQ=Object.assign(Object.assign({},AH),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class JQ extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const QQ=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&dz(t,e),cz(t,e,s,n)};class t0 extends $H{constructor(){super(...arguments),this.type=CC.sankey,this.transformerConstructor=JQ,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ue,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{dz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),n.forEach((e=>{dz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=kM(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=kM(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=kM(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(dz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),QQ(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(dz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),cz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=kM(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=kM(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=kM(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=kM(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=kM(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return dz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QQ(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),dz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QQ(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});dz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),cz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(kM(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{dz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._nodeMark&&i.forEach((e=>{dz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])}));else{const n=kM(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=kM(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QQ(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QQ(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QQ(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});dz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){super.initData();const e=this.getViewData(),i=this.getRawData();if(i&&e){DM(this._dataSet,"sankeyLayout",zQ),DM(this._dataSet,"sankeyFormat",FQ),i.transform({type:"sankeyFormat"},!1),e.transform({type:"sankeyLayout",options:()=>{var t,e,i,s;return{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse}},level:t.TransformLevel.sankeyLayout});const{dataSet:s}=this._option;DM(s,"sankeyNodes",jQ),DM(s,"flatten",_Q);const n=new Oa(s,{name:`sankey-node-${this.id}-data`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyNodes"}),n.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),n.transform({type:"addVChartProperty",options:{beforeCall:_H.bind(this),call:bH}},!1),this._nodesSeriesData=n,DM(s,"sankeyLinks",NQ);const r=new Oa(s,{name:`sankey-link-${this.id}-data`});r.parse([this.getViewData()],{type:"dataview"}),r.transform({type:"sankeyLinks"}),r.transform({type:"addVChartProperty",options:{beforeCall:_H.bind(this),call:bH}},!1),this._linksSeriesData=r}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(t0.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(t0.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=eH(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),RH("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),RH("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:PM.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{dz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(kM(e).key)?cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):cz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new UQ(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new zC;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return DQ(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}t0.type=CC.sankey,t0.transformerConstructor=JQ,t0.mark=ZQ,t0.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const e0=()=>{FX(),n$(),LO(),oT.registerGraphicComponent("path",(t=>Ug(t))),oT.registerMark(qQ.type,qQ),A$(),oT.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:WQ(t,e)},Pz))),oT.registerAnimation("sankeyLinkPath",((t,e)=>({appear:GQ(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:Ez.disappear.duration}}))),sI.registerBuiltInAnimate("linkPathGrowOut",XQ),sI.registerBuiltInAnimate("linkPathGrowIn",YQ),Oz(),oT.registerSeries(t0.type,t0)},i0=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=_Q(n);return i=pH([{latestData:r}],e),i};class s0 extends dH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const n0=Object.assign(Object.assign({},AH),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),r0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class a0 extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const o0=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();if(s){const e=new iJ(i).layout(t,s),n=[];return kZ(e,n,{maxDepth:null==i?void 0:i.maxDepth}),n.forEach((t=>{t&&[vH,"name"].forEach((e=>{t[e]=t.datum[t.depth][i.nameField]}))})),n}return[]};class l0 extends $H{constructor(){super(...arguments),this.type=CC.treemap,this.transformerConstructor=a0,this._categoryField="name",this._valueField="value",this._viewBox=new Ue,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:vH),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ge),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:DT},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t;super.initData(),DM(this._dataSet,"treemap",o0),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:()=>{var t,e,i,s;return{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(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!==(s=this._spec.minVisibleArea)&&void 0!==s?s:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(DM(this._rawData.dataSet,"addVChartProperty",nH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:xH.bind(this),call:SH}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=i0([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=H(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){DM(this._dataSet,"hierarchyDimensionStatistics",i0),DM(this._dataSet,"flatten",_Q);const i=new Oa(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 TQ(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(l0.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(l0.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("treemap"))||void 0===e?void 0:e(),RH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new s0(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(MM.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(MM.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}l0.type=CC.treemap,l0.mark=n0,l0.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},l0.transformerConstructor=a0,G(l0,kQ),G(l0,vK);const h0=()=>{oT.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),oT.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),FX(),A$(),oT.registerAnimation("treemap",((t,e)=>({appear:r0(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:Ez.disappear.duration}}))),Oz(),oT.registerSeries(l0.type,l0)},c0=Object.assign(Object.assign({},Wq),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),d0=Object.assign(Object.assign({},AH),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),u0={type:"fadeIn"};function p0(t,e){return"fadeIn"===e?u0:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class g0 extends HH{constructor(){super(...arguments),this._supportStack=!1}}class f0 extends dH{enableByType(t){return"dimension"!==t}}const m0="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",v0={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:m0,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:m0,fill:"#ddd"}}};class y0 extends Yq{constructor(){super(...arguments),this.type=CC.gaugePointer,this.transformerConstructor=g0,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(y0.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},y0.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(y0.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new f0(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=K(e),s=$(e),n=yt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),RH("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}y0.type=CC.gaugePointer,y0.mark=d0,y0.builtInTheme={gaugePointer:v0},y0.transformerConstructor=g0;const _0=()=>{oT.registerSeries(y0.type,y0),cK(),FX(),oT.registerAnimation("gaugePointer",((t,e)=>{const i=p0(t,e);return{appear:i,enter:i,disappear:{duration:Ez.disappear.duration}}})),xq(),_q()};class b0 extends HH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class x0 extends Yq{constructor(){super(...arguments),this.type=CC.gauge,this.transformerConstructor=b0,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();DM(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[eM]=t[this._angleField[0]],t[tM]=e>0?i[e-1][eM]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(x0.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(x0.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?NC(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?NC(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[tM])?this.angleAxisHelper.dataToPosition([t[tM]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[eM]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),RH("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}x0.type=CC.gauge,x0.mark=c0,x0.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},x0.transformerConstructor=b0;class S0 extends pz{constructor(){super(...arguments),this.type=S0.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return tg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}S0.type="cell";function A0(t){return!1===t?{}:{type:"fadeIn"}}class k0 extends dH{enableByType(t){return"dimension"!==t}}const C0=Object.assign(Object.assign({},AH),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class T0 extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}const M0={valueField:!0};class w0 extends $H{constructor(){super(...arguments),this.type=CC.heatmap,this.transformerConstructor=T0}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),M0)})}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(w0.mark.cell,{isSeriesMark:!0},{morph:LH(this._spec,w0.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(w0.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=oi(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=KH(this);this._cellMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),RH("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new k0(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}w0.type=CC.heatmap,w0.mark=C0,w0.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},w0.transformerConstructor=T0;const E0=()=>{A$(),oT.registerMark(S0.type,S0),oT.registerGraphicComponent("symbol",tg),XO(),ZO(),sN(),oT.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},Pz),{appear:A0(e)}))),qU(),uV(),oT.registerSeries(w0.type,w0)},B0=Object.assign(Object.assign({},AH),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),P0=`${PT}_CORRELATION_X`,R0=`${PT}_CORRELATION_Y`,O0=`${PT}_CORRELATION_SIZE`,I0=t=>d(t)?t():t,L0=(t,e)=>{var i,s,n,r,a,o,l,h;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const c=t,d=e.view();if(d.x1-d.x0==0||d.y1-d.y0==0||d.x1-d.x0==-1/0||d.x1-d.x0==1/0||d.y1-d.y0==-1/0||d.y1-d.y0==1/0)return t;const p=oe(null!==(i=I0(e.startAngle))&&void 0!==i?i:-90),g=oe(null!==(s=I0(e.endAngle))&&void 0!==s?s:270),f=Math.max((d.x1-d.x0)/2,(d.y1-d.y0)/2),m=Rt(null!==(n=I0(e.innerRadius))&&void 0!==n?n:0,f),v=Rt(I0(e.outerRadius),f),y=I0(e.center),b=[S(null==y?void 0:y[0])?y[0]:d.x0+Rt(null!==(r=null==y?void 0:y[0])&&void 0!==r?r:"50%",d.x1-d.x0),S(null==y?void 0:y[1])?y[1]:d.y0+Rt(null!==(a=null==y?void 0:y[1])&&void 0!==a?a:"50%",d.y1-d.y0)],x=Pt(I0(e.field)),A=c.map(x),[k,C]=It(A),T=k===C?t=>(m+v)/2:t=>m+(v-m)*(t-k)/(C-k),M=I0(e.radiusField),w=I0(e.radiusRange),E=u(M)?x:Pt(M),B=null!==(o=null==w?void 0:w[1])&&void 0!==o?o:5;let P=t=>B;if(E){const[t,e]=E!==x?It(c.map(E)):[k,C],i=null!==(l=null==w?void 0:w[0])&&void 0!==l?l:5,s=null!==(h=null==w?void 0:w[1])&&void 0!==h?h:5;t!==e&&(P=n=>i+(s-i)*(E(n)-t)/(e-t))}const R=Math.min(p,g),O=Math.max(p,g),I=D0(R,O,c.length),L=[],D=(O-R)/60;return c.forEach(((t,e)=>{const i=T(A[e]),s=P(t);let n,r,a=I[e];for(let t=0;t<60&&(n=b[0]+i*Math.cos(a),r=b[1]+i*Math.sin(a),F0({x:n,y:r,size:s},L)||n-sd.x1||r-sd.y1);t++)t<59&&(a+=D,a>O?a=R:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},F0=(t,e)=>!(!e||!e.length)&&e.some((e=>{const i=e.x,s=e.y,n=e.size;return Math.pow(t.x-i,2)+Math.pow(t.y-s,2)d(t)?t():t,H0=(t,e)=>{if(!t||!_(t))return[];const i=z0(e.keyword),s=z0(e.categoryField),n=t[0].latestData[0];return{[s]:i,[LT]:null==n?void 0:n[LT],[FT]:null==n?void 0:n[FT]}};class j0 extends s${constructor(){super(...arguments),this.type=j0.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=yt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}j0.type="ripple";const N0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class U0 extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class V0 extends z${constructor(){super(...arguments),this.type=CC.correlation,this.transformerConstructor=U0,this._viewBox=new Ue}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){if(super.initData(),!this._data)return;DM(this._dataSet,"correlation",L0);const t=new Ra;FM(t,"dataview",Ea),DM(t,"correlationCenter",H0);const e=new Oa(t,{name:`${this.type}_${this.id}_center`});e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"correlationCenter",options:{keyword:()=>{var t,e,i;return null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:""},categoryField:()=>this._spec.categoryField}}),this._centerSeriesData=new VF(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:()=>this._spec.valueField,radiusRange:()=>this._spec.sizeRange,radiusField:()=>this._spec.sizeField,center:()=>[this._spec.centerX,this._spec.centerY],innerRadius:()=>this._spec.innerRadius,outerRadius:()=>this._spec.outerRadius,startAngle:()=>this._spec.startAngle,endAngle:()=>this._spec.endAngle}})}initMark(){const e=this._createMark(V0.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:LT});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(V0.mark.ripplePoint,{key:LT,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(V0.mark.centerPoint,{key:LT,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[P0],y:t=>t[R0],size:t=>t[O0],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),RH("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}V0.type=CC.correlation,V0.mark=B0,V0.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},V0.transformerConstructor=U0;const W0=()=>{oN(),n$(),ZO(),oT.registerMark(j0.type,j0),oT.registerGraphicComponent("symbol",(t=>tg(t))),oT.registerSeries(V0.type,V0),oT.registerAnimation("correlation",((t,e)=>Object.assign({appear:N0(0,e)},Bz)))},G0=Object.assign(Object.assign({},AH),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class Y0 extends s${constructor(){super(...arguments),this.type=Y0.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}Y0.type="liquid";const X0=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class K0 extends dH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class $0 extends YH{constructor(){super(...arguments),this.type=CC.liquid,this.transformerConstructor=lN,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=og({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=tg({x:s,y:n,size:r,symbolType:X0(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=qC(this._spec.outlineMargin),this._paddingSpec=qC(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark($0.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark($0.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark($0.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark($0.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new K0(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(PH(null===(i=oT.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),RH("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(PH(null===(s=oT.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),RH("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=MA(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}$0.type=CC.liquid,$0.mark=G0,$0.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},$0.transformerConstructor=lN;const q0=t=>Y(t).join(",");class Z0 extends dH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>q0(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>q0(null==t?void 0:t[this.series.getDimensionField()[0]])}}const J0=Object.assign(Object.assign({},AH),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class Q0 extends HH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const t1=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();return s&&(null==t?void 0:t.length)?gJ(Object.assign({setField:i.setField,valueField:i.valueField},s),t):[]};class e1 extends YH{constructor(){super(...arguments),this.type=CC.venn,this.transformerConstructor=Q0,this._viewBox=new Ue}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:DT)}initData(){var t;super.initData(),DM(this._dataSet,"venn",t1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:()=>({getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField})})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(e1.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(e1.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>q0(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>q0(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Z0(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:q0(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return q0(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[q0(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(q0(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),RH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(PH(null===(e=oT.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),RH(t.name,this._spec,this._markAttributeContext)))}))}}e1.type=CC.venn,e1.mark=J0,e1.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},e1.transformerConstructor=Q0;class i1 extends VX{constructor(){super(...arguments),this.type=CC.mosaic,this.transformerConstructor=NX}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(ZT),this.setFieldX2(qT)),this.setFieldY(QT),this.setFieldY2(JT)):(t&&(this.setFieldY(ZT),this.setFieldY2(qT)),this.setFieldX(QT),this.setFieldX2(JT)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}i1.type=CC.mosaic,i1.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},i1.transformerConstructor=NX;class s1 extends LV{_isValidSeries(t){return t===CC.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class n1 extends RV{constructor(){super(...arguments),this.transformerConstructor=s1,this.type="map",this.seriesType=CC.map}}n1.type="map",n1.seriesType=CC.map,n1.transformerConstructor=s1;class r1 extends LV{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class a1 extends r1{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY","clamp"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=kN(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,aT({},s,l)),n&&Object.assign(o,aT({},n,o))}}class o1 extends r1{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class l1 extends r1{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class h1 extends RV{constructor(){super(...arguments),this.transformerConstructor=l1}}h1.transformerConstructor=l1;class c1 extends h1{constructor(){super(...arguments),this.transformerConstructor=l1,this.type="pie",this.seriesType=CC.pie}}c1.type="pie",c1.seriesType=CC.pie,c1.transformerConstructor=l1;class d1 extends o1{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["radius","outerRadius","innerRadius"]),n.radius=null!==(e=t.radius)&&void 0!==e?e:jN,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:jN,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>aT({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const u1=(t,e)=>{if(!t)return null;const i=hj(t,(t=>"angle"===t.getOrient()),e),s=hj(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Ek(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=vk({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=K(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=yk(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=oj(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Ek(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=vk({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=yk(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=oj(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class p1 extends RV{constructor(){super(...arguments),this.transformerConstructor=d1,this.type="rose",this.seriesType=CC.rose}_setModelOption(){this._modelOption.getDimensionInfo=u1}}p1.type="rose",p1.seriesType=CC.rose,p1.transformerConstructor=d1,G(p1,jV);class g1 extends o1{_getDefaultSeriesSpec(t){var e,i,s,n;const r=super._getDefaultSeriesSpec(t),a=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e,"series","radar","area");return this._addSeriesRelatedSpecKeys(["line","point","area"]),r.line=t.line,r.point=t.point,r.stack=t.stack,r.percent=t.percent,r.area=aT({visible:null!==(s=null==a?void 0:a.visible)&&void 0!==s&&s},t.area),r.seriesMark=null!==(n=t.seriesMark)&&void 0!==n?n:"area",r.activePoint=t.activePoint,r.pointDis=t.pointDis,r.pointDisMul=t.pointDisMul,r.markOverlap=t.markOverlap,r}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>aT({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class f1 extends RV{constructor(){super(...arguments),this.transformerConstructor=g1,this.type="radar",this.seriesType=CC.radar}_setModelOption(){this._modelOption.getDimensionInfo=u1}}f1.type="radar",f1.seriesType=CC.radar,f1.transformerConstructor=g1,G(f1,jV);class m1 extends LV{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&aT(e,pF(this.type,t))})),this._transformAxisSpec(t)}}class v1 extends RV{constructor(){super(...arguments),this.transformerConstructor=m1,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=qV(t,e,i))&&void 0!==s?s:[],...null!==(n=u1(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}v1.type="common",v1.transformerConstructor=m1,G(v1,jV);class y1 extends DV{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class _1 extends RV{constructor(){super(...arguments),this.transformerConstructor=y1}}_1.transformerConstructor=y1,G(_1,jV);class b1 extends y1{transformSpec(t){super.transformSpec(t),oF(t)}}class x1 extends _1{constructor(){super(...arguments),this.transformerConstructor=b1,this.type="histogram",this.seriesType=CC.bar}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}x1.type="histogram",x1.seriesType=CC.bar,x1.transformerConstructor=b1;class S1 extends a1{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["cornerRadius","progress","track","roundCap"]),s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class A1 extends RV{constructor(){super(...arguments),this.transformerConstructor=S1,this.type="circularProgress",this.seriesType=CC.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=u1}}A1.type="circularProgress",A1.seriesType=CC.circularProgress,A1.transformerConstructor=S1,G(A1,jV);class k1 extends a1{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["pin","pinBackground","pointer"]),e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=CC.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===CC.gauge||t.type===CC.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===CC.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class C1 extends RV{constructor(){super(...arguments),this.transformerConstructor=k1,this.type="gauge",this.seriesType=CC.gaugePointer}}C1.type="gauge",C1.seriesType=CC.gaugePointer,C1.transformerConstructor=k1;class T1 extends LV{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class M1 extends RV{constructor(){super(...arguments),this.transformerConstructor=T1,this.type="wordCloud",this.seriesType=CC.wordCloud}}M1.transformerConstructor=T1;class w1 extends M1{constructor(){super(...arguments),this.transformerConstructor=T1,this.type="wordCloud",this.seriesType=CC.wordCloud}}w1.type="wordCloud",w1.seriesType=CC.wordCloud,w1.transformerConstructor=T1;class E1 extends LV{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class B1 extends RV{constructor(){super(...arguments),this.transformerConstructor=E1,this.type="funnel",this.seriesType=CC.funnel}}B1.type="funnel",B1.seriesType=CC.funnel,B1.transformerConstructor=E1;class P1 extends DV{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",this._addSeriesRelatedSpecKeys(["cornerRadius"]),s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=kN(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=kN(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class R1 extends RV{constructor(){super(...arguments),this.transformerConstructor=P1,this.type="linearProgress",this.seriesType=CC.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}R1.type="linearProgress",R1.seriesType=CC.linearProgress,R1.transformerConstructor=P1,G(R1,jV);class O1 extends DV{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),oF(t)}}class I1 extends RV{constructor(){super(...arguments),this.transformerConstructor=O1,this.type="rangeColumn",this.seriesType=CC.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}I1.type="rangeColumn",I1.seriesType=CC.rangeColumn,I1.transformerConstructor=O1;class L1 extends LV{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class D1 extends RV{constructor(){super(...arguments),this.transformerConstructor=L1,this.type="sunburst",this.seriesType=CC.sunburst}}D1.type="sunburst",D1.seriesType=CC.sunburst,D1.transformerConstructor=L1;class F1 extends LV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class z1 extends RV{constructor(){super(...arguments),this.transformerConstructor=F1,this.type="circlePacking",this.seriesType=CC.circlePacking}}z1.type="circlePacking",z1.seriesType=CC.circlePacking,z1.transformerConstructor=F1;class H1 extends LV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class j1 extends RV{constructor(){super(...arguments),this.transformerConstructor=H1,this.type="treemap",this.seriesType=CC.treemap}}j1.type="treemap",j1.seriesType=CC.treemap,j1.transformerConstructor=H1;class N1 extends GX{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),oF(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["bar","stackLabel","leaderLine","total","calculationMode"]),e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class U1 extends YX{constructor(){super(...arguments),this.transformerConstructor=N1,this.type="waterfall",this.seriesType=CC.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}U1.type="waterfall",U1.seriesType=CC.waterfall,U1.transformerConstructor=N1;class V1 extends DV{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),oF(t)}}class W1 extends RV{constructor(){super(...arguments),this.transformerConstructor=V1,this.type="boxPlot",this.seriesType=CC.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}W1.type="boxPlot",W1.seriesType=CC.boxPlot,W1.transformerConstructor=V1;class G1 extends LV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class Y1 extends RV{constructor(){super(...arguments),this.transformerConstructor=G1,this.type="sankey",this.seriesType=CC.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=kM(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}Y1.type="sankey",Y1.seriesType=CC.sankey,Y1.transformerConstructor=G1;class X1 extends DV{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["area","point","line"]),s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),oF(t)}}class K1 extends RV{constructor(){super(...arguments),this.transformerConstructor=X1,this.type="rangeArea",this.seriesType=CC.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=qV,this._modelOption.getDimensionInfoByValue=JV,this._modelOption.getRectByDimensionData=nW}}K1.type="rangeArea",K1.seriesType=CC.rangeArea,K1.transformerConstructor=X1;class $1 extends DV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class q1 extends RV{constructor(){super(...arguments),this.transformerConstructor=$1,this.type="heatmap",this.seriesType=CC.heatmap}}q1.type="heatmap",q1.seriesType=CC.heatmap,q1.transformerConstructor=$1;class Z1 extends LV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class J1 extends RV{constructor(){super(...arguments),this.transformerConstructor=Z1,this.type="correlation",this.seriesType=CC.correlation}}J1.type="correlation",J1.seriesType=CC.correlation,J1.transformerConstructor=Z1;function Q1(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=xM(t.style)),P(t.textStyle)||aT(s.textStyle,xM(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&xM(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&xM(s.background.style),s}function t2(t){const e=t=>function(t){return p(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:p(t.texturePadding)?t.texturePadding:1,textureSize:p(t.textureSize)?t.textureSize:4}):t}(t);if(d(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else P(t.style)||(t.style=e(t.style));return P(t.state)||Object.keys(t.state).forEach((i=>{if(d(t.state[i])){const s=t.state[i];t.state[i]=(...t)=>e(s(...t))}else P(t.state[i])||(t.state[i]=e(t.state[i]))})),t}const e2=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},i2=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:FT;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)},s2={position:!0,item:!0,title:!0,pager:!0,background:!0};class n2 extends YN{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{bk(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),bk(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=WC(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const s=!V(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):s&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(s&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,s=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>V(null==i?void 0:i[t],null==s?void 0:s[t])||s2[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new VF(this._option,e),this._initSelectedData(),bk(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(bk(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(aT({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(aT({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(aT({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}n2.specKey="legends";class r2 extends n2{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),bk(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){DM(this._option.dataSet,"discreteLegendFilter",i2),DM(this._option.dataSet,"discreteLegendDataMake",e2);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return bk(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!bA(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=aM(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i,s){const{title:n={},item:r={},pager:a={},background:o={},type:l,id:h,visible:c,orient:u,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=t,S=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:k={},pager:C={},background:T={}}=t;A=L(A),k=L(k),C=L(C),T=L(T);const M=S;if(d(M.maxRow)||d(M.maxCol)){const t=WC(s)?s:WC(u)?u:"left";d(M.maxRow)&&(M.maxRow=M.maxRow({rect:i,orient:t,id:h})),d(M.maxCol)&&(M.maxCol=M.maxCol({rect:i,orient:t,id:h}))}return A.visible?M.title=Q1(A):M.title={visible:!1},P(k.focusIconStyle)||xM(k.focusIconStyle),k.shape&&(k.shape=t2(yM(k.shape))),k.label&&(k.label=yM(k.label)),k.value&&(k.value=yM(k.value)),k.background&&(k.background=yM(k.background)),GC(k.maxWidth)&&(k.maxWidth=Number(k.maxWidth.substring(0,k.maxWidth.length-1))*i.width/100),GC(k.width)&&(k.width=Number(k.width.substring(0,k.width.length-1))*i.width/100),GC(k.height)&&(k.height=Number(k.height.substring(0,k.height.length-1))*i.width/100),M.item=k,"scrollbar"===C.type?(P(C.railStyle)||xM(C.railStyle),P(C.sliderStyle)||xM(C.sliderStyle)):(P(C.textStyle)||xM(C.textStyle),C.handler&&yM(C.handler)),M.pager=C,T.visible&&!P(T.style)&&(aT(M,T.style),p(T.padding)&&(M.padding=T.padding)),M}(this._spec,t,this.layoutOrient)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return NY}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(IY.legendItemClick,(i=>{const s=R(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(IY.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(IY.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,datum:t.datum,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=eH(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=eH(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}r2.specKey="legends",r2.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},r2.type=r.discreteLegend;const a2=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},o2=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?fM(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function l2(t){const i=aT({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:y,data:_,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:C,seriesId:T,padding:M}=i,w=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?w.title=Q1(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=xM(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=xM(r.style)),P(a.style)||(w.trackStyle=xM(a.style)),w.startText=yM(o),w.endText=yM(l),w.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>xM(i(t,e,s)):P(i)||(e.style=xM(i)),e}(h),P(c)||(w.sizeBackground=xM(c)),u.visible&&!P(u.style)&&(aT(w,u.style),p(u.padding)&&(w.padding=u.padding)),w}const h2={color:YY,size:KY},c2={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},d2=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},c2),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},u2={horizontal:d2(!0),vertical:d2(!1)},p2=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},c2),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},g2={horizontal:p2(!0),vertical:p2(!1)},f2=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],m2=[2,10];class v2 extends n2{static getSpecInfo(t){const e=iH(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),bk(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){DM(this._option.dataSet,"continuousLegendFilter",o2),DM(this._option.dataSet,"continuousLegendDataMake",a2);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>xk(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=aM(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!bA(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=aM(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?f2:m2);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 h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},l2(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return h2[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}v2.specKey="legends",v2.builtInTheme={colorLegend:u2,sizeLegend:g2},v2.type=r.continuousLegend;const y2=(t,e)=>p(e)?t.map((t=>e[t])):void 0,_2=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),b2=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function x2(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=S2(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>_2(i,s)(t)&&_2(n,r)(t)&&(u(a)||_2([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:BM.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return $z.globalConfig.uniqueTooltip&&$z.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:BM.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return $z.globalConfig.uniqueTooltip&&$z.hideTooltip(a.id),m}return"none"}const S2=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=y2(c,t);let y=y2(d,t);const _=b2(y),b=!_&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(_2(c,v));if(!_&&(y=y2(d,i),!b2(y)))return;const n=e.type===CC.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=Ek(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(_2(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=y2(d,o),!b2(y))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(_2(c,n));if(!_&&(y=y2(d,r),!b2(y)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===CC.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(_2(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=y2(d,i),!b2(y))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(_2(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=y2(d,a),h=y,!b2(y)&&!a)return;b2(y)||(y=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},A2=t=>p(t)&&!_(t),k2=t=>p(t)&&_(t),C2=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class T2 extends GN{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=aT({},...C2.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=aT({},s);C2.forEach((t=>{delete r[t]})),delete r.style;const a=aT({},r,i);return a.style=aT({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:mA(this._option.mode)||!gA(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=e_.getElementById(t.parentElement)):gA(this._option.mode)&&(t.parentElement=null==pA?void 0:pA.body)}}const M2={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class w2 extends YN{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=T2,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=gA(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&A2(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&$z.globalConfig.uniqueTooltip&&l&&$z.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:BM.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:BM.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?lW.canvas:lW.dom,n=oT.getComponentPluginInType(t);n||cA("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=oT.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(fA(s)||mA(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=x2(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(k2(t)){if(A2(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>rj(t,e[i])))}if(k2(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}w2.type=r.tooltip,w2.transformerConstructor=T2,w2.builtInTheme={tooltip:M2},w2.specKey="tooltip";var E2,B2;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(E2||(E2={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(B2||(B2={}));const P2={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},R2={labelZIndex:!0,gridZIndex:!0},O2={xField:!0,yField:!0,categoryField:!0,valueField:!0},I2={visible:!0,width:!0,style:!0};class L2 extends YN{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Ek(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!V(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||R2[i]||O2[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||I2[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:PM.chart}:{source:BM.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:fA(e)||mA(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:BM.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:BM.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:BM.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{P2[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}L2.specKey="crosshair";const D2={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class F2 extends L2{static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=qH(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){qH(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:ZH(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=Sk(this._regions,"cartesian");e&&(QV(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=iW(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new YW(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new XW(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}F2.specKey="crosshair",F2.builtInTheme={crosshair:D2},F2.type=r.cartesianCrosshair;class z2 extends L2{static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=Sk(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=AN(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=eH(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=ye([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=yt(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new YW(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new $W(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new qW(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new KW(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}z2.specKey="crosshair",z2.builtInTheme={crosshair:D2},z2.type=r.polarCrosshair;const H2=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},j2=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},N2=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},U2=(t,e,i)=>{const s=e.domain();if(Mk(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},V2=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&Mk(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},W2=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},G2=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},Y2=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),X2=(t,e,i)=>{if(Mk(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class K2{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=yt(this.getState().start+f,0,1),y=yt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===tj(QH(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=H({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=H({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=H({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(K2,vK);class $2 extends YN{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:V2(t,this._stateScale,this._isHorizontal),a="percent"===n?e:V2(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=W2(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=X2(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&G2(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else bk(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),bk(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=QH(t),this._isHorizontal="horizontal"===tj(this._orient),this._dataFilterEvent=new K2(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.change=!0,i.reRender=!0,!i.reCompile&&this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0),i}_getComponentOnlySpecKeys(){return null}_isComponentOnlySpecChange(t,e){const i=this._getComponentOnlySpecKeys();if(!i)return!1;return Object.keys(Object.assign(Object.assign({},e),t)).every((s=>V(null==e?void 0:e[s],null==t?void 0:t[s])||i[s]))}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(Mk(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>tj(t._orient)===tj(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Mk(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};bk(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=Mk(d.getScale(0).type),p=Mk(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else bk(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;FM(r,"dataview",Ea),DM(r,"dataFilterComputeDomain",N2);const a=new Oa(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new VF(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(DM(this._option.dataSet,"dataFilterWithNewDomain",j2),DM(this._option.dataSet,"lockStatisticsFilter",H2),bk(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Mk(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Mk(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(Mk(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!V(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;Y2("start",i,this._spec)&&Y2("end",s,this._spec)&&(t="percent"===i?this._spec.start:V2(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:V2(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?V2(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?V2(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=U2(this._start,this._stateScale,W2(i,this._isHorizontal)),this._endValue=U2(this._end,this._stateScale,W2(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Mk(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=X2(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&bk(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new vC:new qk,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),K(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=G2(h);if(!this._dataUpdating&&Ek(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,Ek(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G($2,vK);class q2 extends GN{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=aT({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const Z2=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),J2={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:Z2(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:Z2(!0)},Q2={width:!0,height:!0,showDetail:!0,middleHandler:!0,background:!0,startHandler:!0,endHandler:!0,startText:!0,endText:!0,dragMask:!0,selectedBackground:!0,backgroundChart:!0,selectedBackgroundChart:!0,showBackgroundChart:!0};class t5 extends $2{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=q2,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=U2(e,this._stateScale,W2(s,this._isHorizontal)),a=U2(i,this._stateScale,W2(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new vC),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(W2(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=W2(t,this._isHorizontal),this.effect.onZoomChange())}_getComponentOnlySpecKeys(){return Q2}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new vC;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(W2(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),K(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Mk(t.type)||e[0]!==X(e))&&(!Ek(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:W2(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>U2(t,this._stateScale,W2(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new IG(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>U2(t,this._stateScale,W2(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:xM(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:xM(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:xM(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:xM(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:xM(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:xM(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:xM(g.style)},selectedBackgroundStyle:xM(this._spec.selectedBackground.style),dragMaskStyle:xM(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:aT(xM(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},xM(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:aT(xM(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},xM(null===(d=m.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=eH(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(W2(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}t5.type=r.dataZoom,t5.transformerConstructor=q2,t5.builtInTheme={dataZoom:J2},t5.specKey="dataZoom";const e5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},i5={width:!0,height:!0,rail:!0,slider:!0,round:!0,innerPadding:!0,minSliderSize:!0};class s5 extends $2{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=dk(this._start,e)&&dk(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=W2(n,this._isHorizontal),a=U2(e,this._stateScale,r),o=U2(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentOnlySpecKeys(){return i5}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new EW(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=xM(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=xM(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}s5.type=r.scrollBar,s5.builtInTheme={scrollBar:e5},s5.specKey="scrollBar";const n5=(t,e)=>{const{datum:i,title:s,content:n}=d(e)?e():e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},r5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),a5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:r5("l1FontSize","primaryFontColor")},content:{visible:!0,style:r5("l2FontSize","tertiaryFontColor")}};class o5 extends YN{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(kM(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(kM(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){DM(this._option.dataSet,"indicatorFilter",n5);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:()=>({title:this._title,content:this._content,datum:()=>this._activeDatum})}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new VF(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=aT({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},bM(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?JC(l,this._computeLayoutRadius()):0,dy:h?JC(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},bM(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)V(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new ZY(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}o5.type=r.indicator,o5.builtInTheme={indicator:a5},o5.specKey="indicator";const l5=["sum","average","min","max","variance","standardDeviation","median"];function h5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=K(s);return er}function c5(t,e){return t?`${t}_${e}_extend`:`marker_${e}_extend`}function d5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.x)&&h5(e,t.x,i)&&(null===(l=null==h?void 0:(o=h.getXAxisHelper()).setExtendDomain)||void 0===l||l.call(o,c5(a,"xAxis"),t.x)),c=GC(t.x)?f5(t.x,n)+r.x:m5(h.getXAxisHelper(),[t.x])+r.x,c}function u5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.y)&&h5(e,t.y,i)&&(null===(l=null===(o=h.getYAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,c5(a,"yAxis"),t.y)),c=GC(t.y)?f5(t.y,n)+r.y:m5(h.getYAxisHelper(),[t.y])+r.y,c}function p5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.angle)&&h5(e,t.angle,i)&&(null===(a=null===(r=o.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,c5(n,"angleAxis"),t.angle)),m5(o.angleAxisHelper,[t.angle])}function g5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.radius)&&h5(e,t.radius,i)&&(null===(a=null===(r=o.radiusAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,c5(n,"radiusAxis"),t.radius)),m5(o.radiusAxisHelper,[t.radius])}function f5(t,e){return Number(t.substring(0,t.length-1))*e/100}function m5(t,e){const i=t.getScale(0);return Mk(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function v5(t){return l5.includes(t)}function y5(t,e,i,s,n,r=!1,a){const o=e.getRegion(),l=o.getLayoutStartPoint(),h=i.getRegion(),c=h.getLayoutStartPoint(),d=Math.abs(Math.min(l.x,c.x)-Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width)),u=Math.abs(Math.min(l.y,c.y)-Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height)),g={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},f=[],m=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,v=s.getXAxisHelper(),y=s.getYAxisHelper(),_=v.getScale(0).domain(),b=y.getScale(0).domain(),x=r&&!v.isContinuous&&!!v.getBandwidth,S=r&&!y.isContinuous&&!!y.getBandwidth,A={min:null,max:null},k={min:null,max:null};return m.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=d5(t,_,n,g,d,l,a),r=u5(t,b,n,g,u,l,a),_5(s,x,A,f.length),_5(r,S,k,f.length),f.push([{x:s,y:r}]);else if(e){s=d5(t,_,n,g,d,l,a),r=Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height);const e=Math.min(l.y,c.y);_5(s,x,A,f.length),f.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(l.x,c.x),r=u5(t,b,n,g,u,l,a);const e=Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width);_5(r,S,k,f.length),f.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(f,v,y,A,k),f}function _5(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=p5(t,h,n,a,r),i=g5(t,c,n,a,r);o.push([{angle:e,radius:i}])}else if(e){const e=p5(t,h,n,a,r);o.push([{angle:e,radius:-d},{angle:e,radius:d}])}else if(i){const e=g5(t,c,n,a,r);o.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),o}function x5(t,e){return(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e}function S5(t,e,i,s,n){const r=[],a=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,o=_(s);return i&&a.forEach((t=>{!function(t,e,i,s){var n,r,a,o;const l=e.getXAxisHelper().getScale(0).domain(),h=e.getYAxisHelper().getScale(0).domain(),c=Y(t.x),d=Y(t.y);1===c.length&&S(c[0])&&h5(l,c[0],i)&&(null===(r=null===(n=e.getXAxisHelper())||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,c5(s,"xAxis"),c[0])),1===d.length&&S(d[0])&&h5(h,d[0],i)&&(null===(o=null===(a=e.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,c5(s,"yAxis"),d[0]))}(t,x5(t,e),i,n)})),a.forEach(((t,i)=>{const n=x5(t,e),a=n.getRegion(),l=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();let d=0,u=0;if(s){const t=o?s[i]:s,e=t.x,n=t.y;e&&(d=GC(e)?Number(e.substring(0,e.length-1))*h/100:e),n&&(u=GC(n)?Number(n.substring(0,n.length-1))*c/100:n)}const p=Y(t.x),g=Y(t.y);r.push({x:m5(n.getXAxisHelper(),p)+l.x+d,y:m5(n.getYAxisHelper(),g)+l.y+u})})),r}function A5(t,e,i,s){const n=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var r,a,o,l;const h=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,c=h.angleAxisHelper.getScale(0).domain(),d=h.radiusAxisHelper.getScale(0).domain(),u=Y(t.angle),p=Y(t.radius);1===u.length&&S(u[0])&&h5(c,u[0],i)&&(null===(a=null===(r=h.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,c5(s,"angleAxis"),u[0])),1===p.length&&S(p[0])&&h5(d,p[0],i)&&(null===(l=null===(o=h.radiusAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,c5(s,"radiusAxis"),p[0])),n.push({angle:m5(h.angleAxisHelper,u),radius:m5(h.radiusAxisHelper,p)})})),n}function k5(t,e,i){let{x:s,y:n}=t;return GC(s)&&(s=f5(s,e)),GC(n)&&(n=f5(n,i)),{x:s,y:n}}function C5(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=k5(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>k5(t,n,r)))}function T5(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function M5(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},xM(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},E5(xM(n.style),i,s)),p(n.padding)&&(t.padding=oi(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=E5(xM(r),i,s)),t}return{visible:!1}}function w5(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function E5(t,e,i){return d(t)?t(e,i):t}function B5(t,e){return d(t)?t(e):t}function P5(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function R5(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function O5(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=R5(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function I5(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=R5(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function L5(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function D5(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),y(t[c])&&v5(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),y(t[d])&&v5(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),y(t[a])&&v5(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),y(t[l])&&v5(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;_(s)?i.x=s.map((i=>z5(i,t,e))):i.x=z5(s,t,e)}if(p(e.y)){const s=e.y;_(s)?i.y=s.map((i=>z5(i,t,e))):i.y=z5(s,t,e)}if(p(e.angle)){const s=e.angle;_(s)?i.angle=s.map((i=>z5(i,t,e))):i.angle=z5(s,t,e)}if(p(e.radius)){const s=e.radius;_(s)?i.radius=s.map((i=>z5(i,t,e))):i.radius=z5(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=z5(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const F5={min:(t,e)=>uk(t[0].latestData,e.field),max:(t,e)=>pk(t[0].latestData,e.field),sum:function(t,e){return gk(t[0].latestData,e.field)},average:function(t,e){return fk(t[0].latestData,e.field)},variance:function(t,e){return mk(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(mk(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function z5(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(m(t)){const{aggrType:i,field:s}=t;return F5[i](e,{field:s})}return t}function H5(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}const j5=t=>{var e;const i=null===(e=null==t?void 0:t.dataSet)||void 0===e?void 0:e.dataViewMap;return i?Object.values(i).filter(Boolean):[]},N5=(t,e)=>{var i,s;null===(i=null==t?void 0:t.target)||void 0===i||i.removeListener("change",e.reRunAllTransform),null===(s=null==t?void 0:t.target)||void 0===s||s.removeListener("markRunning",e.markRunning)},U5=t=>{if(!t)return;j5(t).forEach((e=>{N5(e,t)}));const e=null==t?void 0:t.rawData;Array.isArray(e)&&e.forEach((e=>{N5(e,t)}))},V5=(t,e)=>{if(!t)return;const i=new Set(j5(t)),s=[],n=t=>{const r=null==t?void 0:t.rawData;Array.isArray(r)&&r.forEach((t=>{i.has(t)&&e(t)&&!s.includes(t)&&(s.push(t),n(t))}))};n(t),(t=>{const e=Array.from(new Set(t.filter(Boolean)));e.length&&(e.forEach(U5),e.forEach((t=>{var e;null===(e=t.destroy)||void 0===e||e.call(t)})))})([t,...s])},W5="__vchart_marker_coordinate__",G5=["coordinate","coordinates","x","y","x1","y1","angle","angle1","radius","radius1"],Y5=["position","positions","coordinatesOffset","regionRelative"],X5=["offsetX","offsetY","confine"],K5=t=>Array.isArray(t)?t.map(K5):t&&"object"==typeof t?"function"!=typeof t.formatMethod?t:Object.assign(Object.assign({},t),{formatMethod:"__vchart_marker_format_method__"}):t,$5=t=>{if(Array.isArray(t))return t.map($5);if(!t||"object"!=typeof t)return t;const e=Object.assign({},t);return Object.keys(e).forEach((t=>{"style"===t||t.endsWith("Style")?e[t]="__vchart_marker_style__":e[t]=$5(e[t])})),e},q5=(t,e)=>{if(!t||"object"!=typeof t)return t;const i=Object.assign({},t);e.normalizeDomainPosition&&G5.forEach((t=>{i[t]=W5})),e.normalizeAutoRange&&"autoRange"in i&&(i.autoRange="__vchart_marker_auto_range__"),Y5.forEach((t=>{t in i&&(i[t]=W5)})),"label"in i&&(i.label=K5(i.label)),Object.keys(i).forEach((t=>{i[t]=$5(i[t])}));const s=i.itemContent;if(s&&"object"==typeof s){i.itemContent=Object.assign({},s),X5.forEach((t=>{t in i.itemContent&&(i.itemContent[t]=W5)}));const t=i.itemContent.text;t&&"object"==typeof t&&(i.itemContent.text=Object.assign(Object.assign({},K5(t)),{text:"__vchart_marker_text__"}))}return i};class Z5 extends YN{constructor(){super(...arguments),this.layoutType="none",this._markerDataChangeHandler=null,this._markerDataOwned=!1,this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getAutoRangeExtendDomainKeyPrefix(){return`marker_${this.type}_${this.id}`}_getAutoRangeExtendDomainKey(t){return`${this._getAutoRangeExtendDomainKeyPrefix()}_${t}_extend`}_clearAutoRangeExtendDomain(){var t,e;Y(null===(e=(t=this._option).getAllSeries)||void 0===e?void 0:e.call(t)).forEach((t=>{var e,i,s,n,r,a,o,l,h,c;null===(s=null===(i=null===(e=null==t?void 0:t.getXAxisHelper)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.setExtendDomain)||void 0===s||s.call(i,this._getAutoRangeExtendDomainKey("xAxis"),void 0),null===(a=null===(r=null===(n=null==t?void 0:t.getYAxisHelper)||void 0===n?void 0:n.call(t))||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,this._getAutoRangeExtendDomainKey("yAxis"),void 0),null===(l=null===(o=null==t?void 0:t.angleAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,this._getAutoRangeExtendDomainKey("angleAxis"),void 0),null===(c=null===(h=null==t?void 0:t.radiusAxisHelper)||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,this._getAutoRangeExtendDomainKey("radiusAxis"),void 0)}))}_updateMarkerLayout(){this._clearAutoRangeExtendDomain(),this._markerLayout()}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return y(e)&&v5(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ra;return e.registerParser("array",s),new Oa(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}_setMarkerData(t,e=!1){this._releaseMarkerData(),this._markerData=t,this._markerDataOwned=e}_bindMarkerDataChange(){var t;(null===(t=this._markerData)||void 0===t?void 0:t.target)&&(this._markerDataChangeHandler=()=>{this._updateMarkerLayout()},this._markerData.target.on("change",this._markerDataChangeHandler))}_releaseMarkerData(){const t=this._markerData;(null==t?void 0:t.target)&&this._markerDataChangeHandler&&t.target.removeListener("change",this._markerDataChangeHandler),this._markerDataChangeHandler=null,this._markerDataOwned&&V5(t,(t=>t.name===`${this.type}_${this.id}_data`)),this._markerData=null,this._markerDataOwned=!1}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._updateMarkerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._updateMarkerLayout.bind(this)))}clear(){super.clear(),this._markerComponent=null,this._firstSeries=null}release(){this._releaseMarkerData(),super.release()}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=Sk(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=XC(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=XC(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reRender=!0,i.change=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake||i.reCompile||!this._isAutoRangeSpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,scaleDomain:!0,layout:!0,render:!0}):i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){const i=!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange);return V(q5(e,{normalizeDomainPosition:i}),q5(t,{normalizeDomainPosition:i}))}_isAutoRangeSpecChange(t,e){return!(!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange))&&V(q5(e,{normalizeDomainPosition:!0,normalizeAutoRange:!0}),q5(t,{normalizeDomainPosition:!0,normalizeAutoRange:!0}))}reInit(t){super.reInit(t),this._releaseMarkerData(),this._bindSeries(),this._initDataView(),this._buildMarkerAttributeContext(),this._markerComponent&&this._updateMarkerLayout()}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();DM(this._option.dataSet,"markerAggregation",D5),DM(this._option.dataSet,"markerFilter",H5),this._releaseMarkerData();const i=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(i,!0),this._bindMarkerDataChange()}}function J5(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=uk(t,e),r=pk(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Q5 extends Z5{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=O5(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:E5(xM(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>M5(t,this._markerData,this._markAttributeContext))),state:{line:w5(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:w5(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:w5(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return w5(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return w5(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:E5(xM(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:E5(xM(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=T5([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=O5(t);if(this._setMarkerData(this._getRelativeDataView()),!(i||s||n||r||a||o||l||h||c||d||e))return;DM(this._option.dataSet,"markerAggregation",D5),DM(this._option.dataSet,"markerRegression",J5),DM(this._option.dataSet,"markerFilter",H5);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Oa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(m,!0),this._bindMarkerDataChange()}}Q5.specKey="markLine";const t3=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),e3={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},i3={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:t3(!1),endSymbol:t3(!0),label:e3};class s3 extends Q5{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new bY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:y}=O5(e);let _=[];if(u||f||g||m||v||a&&l||a&&h){const t=y5(i,s,n,r,d,!1,this._getAutoRangeExtendDomainKeyPrefix());_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=S5(i,r,d,e.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):c&&(_=C5(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n,r,a,o,l;const h=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const l=this._startRelativeSeries,c=this._endRelativeSeries,{multiSegment:u,mainSegmentIndex:g}=this._spec.line||{},{connectDirection:f}=this._spec;let{expandDistance:m=0}=this._spec;const{points:v,limitRect:y}=h,_=Y(v).filter(Boolean);if(d(m)){const n=null===(t=null==l?void 0:l.getRegion)||void 0===t?void 0:t.call(l),r=null===(e=null==c?void 0:c.getRegion)||void 0===e?void 0:e.call(c);m=m(this._markerData,Object.assign(Object.assign({},this.getMarkAttributeContext()),{region:null===(s=null===(i=this._relativeSeries)||void 0===i?void 0:i.getRegion)||void 0===s?void 0:s.call(i),startRegion:n,endRegion:r,coordinatePoints:_}))}let b;if(GC(m)){const t=l.getRegion(),e=t.getLayoutStartPoint(),i=c.getRegion(),s=i.getLayoutStartPoint();if("bottom"===f||"top"===f){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));b=Number(m.substring(0,m.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));b=Number(m.substring(0,m.length-1))*n/100}}else b=m;if(!v||v.length<2)return void(null===(n=this._markerComponent)||void 0===n||n.setAttributes(h));const x=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(v[0],v[1],f,b);let S;S=u&&p(g)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(v[0],v[1],f,b));const A=Y((null!==(a=null===(r=this._markerComponent)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{}).label),C=Y(h.label),T=Y(this._spec.label);null===(o=this._markerComponent)||void 0===o||o.setAttributes({points:u?[[x[0],x[1]],[x[1],x[2]],[x[2],x[3]]]:x,label:C.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=S.dx)&&void 0!==i?i:0,h=null!==(s=S.dy)&&void 0!==s?s:0;const c=null!==(n=T[e])&&void 0!==n?n:T[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),S),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=A[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:y,multiSegment:u,mainSegmentIndex:g,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(l=this._markerComponent)||void 0===l||l.setAttributes(h)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=O5(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}s3.type=r.markLine,s3.coordinateType="cartesian",s3.builtInTheme={markLine:i3};class n3 extends Q5{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=O5(this._spec);return e||i?new AY(t):new bY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=O5(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=b5(i,s,n,r,a,this._getAutoRangeExtendDomainKeyPrefix());p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=A5(i,r,a,this._getAutoRangeExtendDomainKeyPrefix()),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=O5(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}n3.type=r.polarMarkLine,n3.coordinateType="polar",n3.builtInTheme={polarMarkLine:i3};class r3 extends YN{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=WC(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return iH(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,s&&!i.reMake&&(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=XC(this._spec.width,a.width,null,a.width),l=XC(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)V(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new $Y(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}r3.type=r.title,r3.specKey=r.title,r3.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class a3 extends Z5{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=I5(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:E5(xM(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>M5(t,this._markerData,this._markAttributeContext))),state:{area:w5(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>w5(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return w5(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=T5([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=I5(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}a3.specKey="markArea";const o3={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class l3 extends a3{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new SY(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=I5(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=y5(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=y5(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=S5(s,a,u,i.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):d&&(f=C5(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=I5(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}l3.type=r.markArea,l3.coordinateType="cartesian",l3.builtInTheme={markArea:o3};class h3 extends a3{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=I5(this._spec);return i||e||s?new kY(t):new SY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=I5(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=b5(i,s,n,r,c,this._getAutoRangeExtendDomainKeyPrefix());l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=A5(i,r,c,this._getAutoRangeExtendDomainKeyPrefix()),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=I5(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}h3.type=r.polarMarkArea,h3.coordinateType="polar",h3.builtInTheme={polarMarkArea:o3};const c3=t=>xM(Object.assign({},t)),d3=t=>Object.assign(Object.assign({},t),{style:Object.assign({},xM(t.style))}),u3=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=c3(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=c3(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),y=(_=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},xM(Object.assign({},_)));var _;const b=d3(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=d3(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=d3(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=d3(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:y}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},p3=t=>"left"===t||"right"===t,g3=t=>"top"===t||"bottom"===t,f3={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class m3 extends YN{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},u3(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},u3(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?V(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new dX(t):this._playerComponent=new gX(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=p3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=p3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(rX.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(rX.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(rX.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(rX.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(rX.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(rX.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.type)!==(null==t?void 0:t.type)?(i.reMake=!0,i):(!s||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i)}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=p3(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=g3(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):p3(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):g3(this._orient)?this._maxSize():t.height}_computeDx(t){return p3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return g3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}m3.builtInTheme={player:f3},m3.specKey="player",m3.type=r.player;class v3 extends YN{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,V(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=OC({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==vF.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}v3.type=r.label;class y3 extends S${constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}y3.type="text",y3.constructorType="label";const _3=()=>{A$(),oT.registerMark(y3.constructorType,y3)};class b3 extends GN{_initTheme(t,e){return{spec:t,theme:this._theme}}}class x3 extends v3{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=b3,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(MM.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(MM.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),bk(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=aT({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},zK(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[$T])):t=>t.filter((t=>t.data[KT]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?HK(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}x3.type=r.label,x3.specKey="label",x3.transformerConstructor=b3;class S3 extends v3{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[YT]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return aT({textStyle:{pickable:!0===this._spec.interactive},position:A3(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[$T]:t.data[KT]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>HK({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function A3(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}S3.type=r.totalLabel,S3.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},S3.specKey="totalLabel";class k3 extends Z5{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=L5(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b,x,S,A,k,C,T,M,w,E,B,P,R,O,I,L;const{itemContent:D={},itemLine:F={},targetSymbol:z={}}=this._spec,j=this._relativeSeries.getRegion(),N=D,{type:U="text",text:V,symbol:W,image:G,richText:Y,customMark:X,textStyle:K,symbolStyle:$,imageStyle:q,richTextStyle:Z,customMarkStyle:J,style:Q={},state:tt={}}=N,et=e(N,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let it=null,st=null,nt=U,rt={};if("text"===U){it=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:tt;const r=null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:K)&&void 0!==n?n:Q;(t=>"rich"===(null==t?void 0:t.type))(r)?(nt="richText",rt={width:100,height:100},st=E5(H(rt,(t=>{if(!t)return t;const{type:i,text:s,textConfig:n}=t,r=e(t,["type","text","textConfig"]),a=Object.assign({},r),o=p(n)?n:s;return p(o)&&(a.textConfig=o),a})(r)),this._markerData,this._markAttributeContext)):(rt={dx:0,dy:0},st=M5(Object.assign(Object.assign({},V),{style:H(rt,r)}),this._markerData,this._markAttributeContext))}else"richText"===U?(it=null!==(r=null==Y?void 0:Y.state)&&void 0!==r?r:tt,rt={width:100,height:100},st=E5(H(rt,null!==(o=null!==(a=null==Y?void 0:Y.style)&&void 0!==a?a:Z)&&void 0!==o?o:Q),this._markerData,this._markAttributeContext)):"symbol"===U?(it=null!==(l=null==W?void 0:W.state)&&void 0!==l?l:tt,rt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},st=xM(E5(H(rt,null!==(c=null!==(h=null==W?void 0:W.style)&&void 0!==h?h:$)&&void 0!==c?c:Q),this._markerData,this._markAttributeContext))):"image"===U?(it=null!==(d=null==G?void 0:G.state)&&void 0!==d?d:tt,rt={width:80,height:80},st=E5(H(rt,null!==(g=null!==(u=null==G?void 0:G.style)&&void 0!==u?u:q)&&void 0!==g?g:Q),this._markerData,this._markAttributeContext)):"custom"===U&&(it=null!==(f=null==X?void 0:X.state)&&void 0!==f?f:tt,st=E5(null!==(v=null!==(m=null==X?void 0:X.style)&&void 0!==m?m:J)&&void 0!==v?v:Q,this._markerData,this._markAttributeContext));const at={zIndex:this.layoutZIndex,interactive:null===(y=this._spec.interactive)||void 0===y||y,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(b=this._spec.interactive)||void 0===b||b,position:{x:0,y:0},clipInRange:null!==(x=this._spec.clip)&&void 0!==x&&x,itemContent:Object.assign(Object.assign({type:nt,offsetX:B5(D.offsetX,j),offsetY:B5(D.offsetY,j)},et),{style:E5(st,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(S=z.offset)&&void 0!==S?S:0,visible:null!==(A=z.visible)&&void 0!==A&&A,size:null!==(k=z.size)&&void 0!==k?k:20,style:E5(z.style,this._markerData,this._markAttributeContext)},state:{line:w5(null!==(T=null===(C=this._spec.itemLine.line)||void 0===C?void 0:C.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineStartSymbol:w5(null!==(w=null===(M=this._spec.itemLine.startSymbol)||void 0===M?void 0:M.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:w5(null!==(B=null===(E=this._spec.itemLine.endSymbol)||void 0===E?void 0:E.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:w5(it,this._markerData,this._markAttributeContext),textBackground:w5(null===(R=null===(P=this._spec.itemContent.text)||void 0===P?void 0:P.labelBackground)||void 0===R?void 0:R.state,this._markerData,this._markAttributeContext),targetItem:w5(null!==(I=null===(O=this._spec.targetSymbol)||void 0===O?void 0:O.state)&&void 0!==I?I:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:ot,line:lt={}}=F,ht=e(F,["visible","line"]);at.itemLine=!1!==ot?Object.assign(Object.assign({},ht),{visible:!0,lineStyle:xM(lt.style)}):{visible:!1};return new TY(at)}_markerLayout(){var t,i,s,n,r,a,o,l,h,c,d,u,g;const f=this._spec,m=this._markerData,v=this._relativeSeries,{point:y}=this._computePointsAttr(),_=this._getRelativeDataView().latestData,b=m?m.latestData[0]&&m.latestData[0].latestData?m.latestData[0].latestData:m.latestData:_,{itemLine:x={},itemContent:S={}}=this._spec,A=this._relativeSeries.getRegion(),{visible:k,line:C={}}=x,T=e(x,["visible","line"]),M=!1!==k?Object.assign(Object.assign({},T),{visible:!0,lineStyle:xM(C.style)}):{visible:!1},w=M5(Object.assign(Object.assign({},S.text),{style:H({dx:0,dy:0},null!==(i=null===(t=S.text)||void 0===t?void 0:t.style)&&void 0!==i?i:S.style)}),m,this._markAttributeContext);let E;if(f.clip||(null===(s=f.itemContent)||void 0===s?void 0:s.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=T5([v.getRegion()]);E={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(n=this._markerComponent.attribute)&&void 0!==n?n:{},e=null!==(a=null===(r=t.itemContent)||void 0===r?void 0:r.textStyle)&&void 0!==a?a:{},i=null===(o=this._spec.itemContent.text)||void 0===o?void 0:o.text,s=B5(S.offsetX,A),f=B5(S.offsetY,A);this._markerComponent.setAttributes({position:void 0===y?{x:null,y:null}:y,itemContent:Object.assign(Object.assign({},t.itemContent),{panel:null!==(l=w.panel)&&void 0!==l?l:null===(h=t.itemContent)||void 0===h?void 0:h.panel,padding:null!==(c=w.padding)&&void 0!==c?c:null===(d=t.itemContent)||void 0===d?void 0:d.padding,textStyle:Object.assign(Object.assign(Object.assign({},e),null!==(u=w.textStyle)&&void 0!==u?u:{}),{text:(null===(g=this._spec.itemContent.text)||void 0===g?void 0:g.formatMethod)?this._spec.itemContent.text.formatMethod(b,_):p(i)?i:e.text}),offsetX:P5(y,s,A),offsetY:P5(y,f,A)}),itemLine:M,limitRect:E,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=L5(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}k3.specKey="markPoint";const C3={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class T3 extends k3{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=y5(n,r,r,r,h,!1,this._getAutoRangeExtendDomainKeyPrefix()))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=S5(n,r,h,s.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix())[0]:l&&(c=C5(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=L5(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}T3.type=r.markPoint,T3.coordinateType="cartesian",T3.builtInTheme={markPoint:C3};class M3 extends k3{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=b5(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e,this._getAutoRangeExtendDomainKeyPrefix())[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}M3.type=r.polarMarkPoint,M3.coordinateType="polar",M3.builtInTheme={polarMarkPoint:C3};class w3 extends k3{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}w3.type=r.geoMarkPoint,w3.coordinateType="geo",w3.builtInTheme={geoMarkPoint:C3};const E3="inBrush",B3="outOfBrush",P3={style:!0,inBrush:!0,outOfBrush:!0};class R3 extends YN{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return iH(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),E3,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),B3,t.AttributeLevel.Series))}))}))}reInit(t){super.reInit(t),this.init()}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return V(e,t)||(i.change=!0,i.reRender=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||P3[i]))}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){var i;const s=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(Object.assign({brushStyle:xM(null===(i=this._spec)||void 0===i?void 0:i.style)},s)),this._initMarkBrushState(e,""),n.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new yX(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:xM(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(uX.brushActive,(s=>{this._initMarkBrushState(i,B3),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(uX.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(uX.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(uX.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(uX.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(uX.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(uX.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(a&&this._handleBrushChange(e,s),null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(uX.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec;n&&this._handleBrushChange(e,i);const r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},xM(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_setBrushState(t,e){var i;const s=null!==(i=t.currentStates)&&void 0!==i?i:[];hz(t,[...s.filter((t=>t!==E3&&t!==B3)),e])}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(this._setBrushState(i,E3),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(this._setBrushState(i,B3),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(this._setBrushState(i,E3),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(this._setBrushState(i,B3),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;dz(s,[E3,B3]),i&&cz(s,i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}R3.type=r.brush,R3.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},R3.specKey="brush";const O3={style:!0,state:!0};class I3 extends YN{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${PT}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=PH({},RH(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i.change=!0,i.reRender=!0,i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||O3[i]))}reInit(t){super.reInit(t),this._updateMarkStyleWithSpec(this._spec,this.getMarks()[0]),this.getMarks().forEach((t=>{t.commit(!1,!0)}))}_updateMarkStyleWithSpec(t,e){var i,s,n,r;if(t&&e&&(this.initMarkStyleWithSpec(e,t),"group"===t.type)){const a=null!==(n=null===(s=(i=e).getMarks)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[];null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._updateMarkStyleWithSpec(t,a[e])}))}}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ue).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ue;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}I3.type=r.customMark,I3.specKey="customMark";class L3{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>D3(t))),a=n.filter((t=>!D3(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>D3(t))),h=o.filter((t=>!D3(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function D3(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}L3.type="grid";const F3="vchart-tooltip",z3=`${F3}-container`,H3=`${F3}-title`,j3=`${F3}-content-box`,N3={offsetX:10,offsetY:10},U3="99999999999999";function V3(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const W3=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,G3=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?V3(t):"",Y3=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},X3={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},K3=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=X3[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class $3 extends bN{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:C}=this._option,T=m[_],M=aH(null==T?void 0:T.position,b,e),w=null!==(r=aH(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:RT,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:OT;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},H={x:0,y:0},j=1,N=1;const U=gA(this._env);if(U&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),U&&!P){const t=this._getParentElement(m);H=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-H.x,y:F.y-H.y},j=W3(e,F),N=W3(t,H)}const V=N/j,W={},G={x:M,y:M},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:C;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?E:B;switch(K3(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},K=["x","y"];if(g(M))if((t=>g(t)&&(p(t.left)||p(t.right)||p(t.top)||p(t.bottom)))(M)){const{left:t,right:e,top:i,bottom:s}=M;W.left=Y3(t,y),W.top=Y3(i,y),W.right=Y3(e,y),W.bottom=Y3(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(M)&&K.forEach((t=>{const e=M[t];S(e)||d(e)?W[Y[t][0]]=Y3(e,y):X(e,t)}));else p(M)&&(X({orient:M,mode:w},"x"),X({orient:M,mode:w},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?O:I,n="x"===t?A:C,r=K3(G[t],t);if(k(W[Y[t][0]]))$[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))$[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}$[t]*=j,U&&($[t]+=z[t]),$[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(H[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/N:-H[t]/N,l=a/N+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(L?$[t]=l:($[t]-=0===r?n+i/2:2*n+i,$[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",Z3=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=q3(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=q3(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},J3=(t={})=>{const{lineHeight:e}=t;return t.fontSize?XC(e,t.fontSize):0},Q3=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=oi(r),a.padding=q3(o)),{panelStyle:a,panelPadding:o}};function t4(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class e4 extends $3{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(e4.type),this.type=lW.dom,this._tooltipContainer=null==pA?void 0:pA.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(pA&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=Q3(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(y.marginBottom=`${g}px`);const _={width:q3(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=Z3(h),x=Z3(d),S=Z3(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[A]=q3(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=q3(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=q3(null!==(n=p.spacing)&&void 0!==n?n:0);const C=Math.max(J3(p),J3(d));return y.lineHeight=C>0?`${C}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(H3))),l=a.find((t=>t.className.includes(j3)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(H3),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(t4(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${F3}-column`),e.classList.add(`${F3}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(j3),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];t4(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));t4(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${F3}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=G3(e.key),e.keyStyle&&Z3(e.keyStyle,l)):"value"===i?(o.innerHTML=G3(e.value),e.valueStyle&&Z3(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?V3(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?V3(c):m,_=p,b=t=>new Qp({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ue));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=nu.IsGradientStr(u);if(!u||y(u)&&!T||d)return m=d?"none":u?V3(u):"currentColor",`\n \n \n \n `;const M=T?nu.Parse(u):g(u)?u:null;if(M){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=M.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===M.gradient?t=`\n ${i}\n `:"linear"===M.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),t4(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(j3))),h=[...o.children].find((t=>t.className.includes(H3)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(H3)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=XC(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,t4(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=Sf({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n});return{width:r.width(),height:r.height(),text:s}};function n4(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:i4),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const r4=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class a4 extends $3{constructor(){super(a4.type),this.type=lW.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new AX({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=oi(d.padding),b=qC(d.padding),x=n4(Object.assign({textAlign:"right"===y?"right":"left"},u),i),S=n4(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=n4(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},C={panel:r4(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:M=[]}=t;let w=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!M.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;C.content=M.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:C}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=aT({},S,n4(b,void 0,{})),{width:s,height:n,text:r}=s4(h,i);T.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),y?e.push(s):t.push(s),o=Math.max(o,n)}if(p(m)){const t=aT({},A,n4(x,void 0,{})),{width:e,height:s,text:n}=s4(m,t);T.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};C?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(H){V=aT({},x,n4(N,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=s4(j,V);C.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=C.title.value.width,F=C.title.value.height,z=F+(P?C.title.spaceRow:0)}return E+=z,C.title.width=D,C.title.height=F,W()?w+=B||D:w+=Math.max(D,B),P&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=w-b.left-b.right-L-R-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=w,C.panel.height=E,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}a4.type=lW.canvas;const o4=/\{([^}]+)\}/,l4=/\{([^}]+)\}/g,h4=/:/;class c4 extends bN{constructor(){super(c4.type),this.type="formatterPlugin",this._timeModeFormat={utc:yi.getInstance().timeUTCFormat,local:yi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ti.getInstance().format,this._numericSpecifier=Ti.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[c4.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),oT.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=o4.test(i),this._isNumericFormatterCache.set(i,s))),s){return i.replace(l4,((t,i)=>{if(!h4.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}))}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ai.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}c4.pluginType="chart",c4.specKey="formatter",c4.type="formatterPlugin";$z.useRegisters([()=>{pW(),fW(),vW(),WV(),VV(),CV(),mV(),rN(),oN(),Lz(),Rz(),qU(),uV(),oT.registerSeries(TV.type,TV),oT.registerChart(yW.type,yW)},()=>{pW(),fW(),vW(),VV(),CV(),mV(),rN(),xW(),oN(),kW(),qU(),uV(),oT.registerSeries(MX.type,MX),WV(),oT.registerChart(EX.type,EX)},()=>{pW(),fW(),vW(),VV(),WX(),WV(),oT.registerChart(YX.type,YX)},()=>{pW(),fW(),WV(),VV(),sK(),oT.registerChart(rK.type,rK)},()=>{fW(),nq(),oT.registerChart(c1.type,c1)},()=>{pW(),fW(),WV(),VV(),Aq(),oT.registerChart(p1.type,p1)},()=>{pW(),fW(),vW(),WV(),VV(),Rq(),oT.registerChart(f1.type,f1)},()=>{pW(),fW(),vW(),WV(),VV(),WX(),oT.registerTransform("bin",Zr),oT.registerChart(x1.type,x1)},()=>{fW(),_K(),cK(),oT.registerSeries(xK.type,xK),oT.registerImplement("registerMap",NM),oT.registerImplement("unregisterMap",UM),Oz(),oT.registerChart(n1.type,n1)},()=>{fW(),_0(),oT.registerSeries(x0.type,x0),q$(),qq(),_q(),tZ(),oT.registerChart(C1.type,C1)},()=>{fW(),WJ(),oT.registerChart(w1.type,w1)},()=>{fW(),dQ(),oT.registerChart(B1.type,B1)},()=>{pW(),fW(),vW(),WV(),VV(),ZK(),oT.registerChart(U1.type,U1)},()=>{pW(),fW(),WV(),VV(),x$(),oT.registerTransform("boxplot",Jr),oT.registerChart(W1.type,W1)},()=>{pW(),fW(),WV(),VV(),tZ(),oT.registerChart(A1.type,A1)},()=>{pW(),fW(),WV(),VV(),hZ(),oT.registerChart(R1.type,R1)},()=>{pW(),fW(),WV(),VV(),R$(),oT.registerChart(I1.type,I1)},()=>{pW(),fW(),vW(),WV(),VV(),xW(),qU(),uV(),oT.registerSeries(F$.type,F$),oT.registerChart(K1.type,K1)},()=>{fW(),EQ(),oT.registerChart(D1.type,D1)},()=>{fW(),LQ(),oT.registerChart(z1.type,z1)},()=>{fW(),h0(),oT.registerChart(j1.type,j1)},()=>{fW(),PW(),e0(),oT.registerChart(Y1.type,Y1)},()=>{fW(),E0(),oT.registerChart(q1.type,q1)},()=>{fW(),W0(),oT.registerChart(J1.type,J1)},()=>{pW(),fW(),vW(),WV(),oT.registerChart(v1.type,v1),VV()},uV,qU,()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),sU(),oT.registerComponent(kX.type,kX)},()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),sU(),oT.registerComponent(CX.type,CX)},()=>{oT.registerGraphicComponent(XN.lineAxis,((t,e)=>new WU(t,e))),oT.registerGraphicComponent(KN.lineAxisGrid,((t,e)=>new _U(t,e))),sU(),oT.registerComponent(TX.type,TX)},xq,_q,()=>{oT.registerComponent(r2.type,r2)},()=>{oT.registerComponent(v2.type,v2)},()=>{oT.registerComponent(w2.type,w2)},()=>{oT.registerComponent(F2.type,F2)},()=>{oT.registerComponent(z2.type,z2)},()=>{oT.registerComponent(t5.type,t5)},()=>{oT.registerComponent(s5.type,s5)},()=>{oT.registerComponent(o5.type,o5)},_K,()=>{oT.registerComponent(s3.type,s3),_Y()},()=>{oT.registerComponent(l3.type,l3),xY()},()=>{oT.registerComponent(T3.type,T3),CY()},()=>{oT.registerComponent(n3.type,n3),AY._animate=tY,_Y()},()=>{oT.registerComponent(h3.type,h3),kY._animate=iY,xY()},()=>{oT.registerComponent(M3.type,M3),CY()},()=>{oT.registerComponent(w3.type,w3),CY()},()=>{oT.registerComponent(r3.type,r3)},()=>{oT.registerComponent(m3.type,m3)},()=>{oT.registerGraphicComponent(x3.type,(t=>new uG(t))),_3(),qN(),oT.registerComponent(x3.type,x3,!0,1/0)},()=>{oT.registerGraphicComponent(S3.type,(t=>new uG(t))),_3(),qN(),oT.registerComponent(S3.type,S3,!0)},()=>{oT.registerComponent(R3.type,R3)},()=>{oT.registerComponent(I3.type,I3)},()=>{WW(Zy()),WW(vb()),yb()},()=>{oT.registerLayout(L3.type,L3)},()=>{var t;t=a4,oT.registerComponentPlugin(t.type,t)},()=>{var t;t=c4,oT.registerChartPlugin(t.type,t)},Nz,Wz]),$z.useRegisters([()=>{wP(i_)}]),t.DEFAULT_CHART_HEIGHT=OT,t.DEFAULT_CHART_WIDTH=RT,t.DEFAULT_CLOSE_STROKE_JOIN=Jz,t.DEFAULT_DATA_INDEX=LT,t.DEFAULT_DATA_KEY=DT,t.DEFAULT_DATA_SERIES_FIELD=FT,t.DEFAULT_KEY=iM,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=Zz,t.DEFAULT_MAP_LOOK_UP_KEY=sM,t.DEFAULT_MEASURE_CANVAS_ID=IT,t.DEFAULT_SERIES_STYLE_NAME=zT,t.DEFAULT_SMOOTH_INTERPOLATE=qz,t.Factory=oT,t.MOSAIC_CAT_END_PERCENT=QT,t.MOSAIC_CAT_START_PERCENT=JT,t.MOSAIC_VALUE_END_PERCENT=ZT,t.MOSAIC_VALUE_START_PERCENT=qT,t.ManualTicker=class extends bD{constructor(t){super(t),this.lastFrameTime=0,this.status=Rl.RUNNING}setupTickHandler(){const t=new Qz;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Rl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Rl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Rl.RUNNING,!0}},t.PREFIX=PT,t.SEGMENT_FIELD_END=eM,t.SEGMENT_FIELD_START=tM,t.STACK_FIELD_END=NT,t.STACK_FIELD_END_OffsetSilhouette=GT,t.STACK_FIELD_END_PERCENT=VT,t.STACK_FIELD_KEY=HT,t.STACK_FIELD_START=jT,t.STACK_FIELD_START_OffsetSilhouette=WT,t.STACK_FIELD_START_PERCENT=UT,t.STACK_FIELD_TOTAL=YT,t.STACK_FIELD_TOTAL_BOTTOM=$T,t.STACK_FIELD_TOTAL_PERCENT=XT,t.STACK_FIELD_TOTAL_TOP=KT,t.StreamLight=sD,t.ThemeManager=AT,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=$z,t.boundsInRect=$C,t.builtinThemes=uT,t.calcLayoutNumber=XC,t.calcPadding=KC,t.computeActualDataScheme=PC,t.convertPoint=ZC,t.createArc=Kg,t.createArea=Gg,t.createGroup=sf,t.createLine=sg,t.createRect=og,t.createRichText=Hg,t.createSymbol=tg,t.createText=Kp,t.darkTheme=nT,t.dataScheme=QC,t.default=$z,t.defaultThemeName=pT,t.getActualColor=OC,t.getActualNumValue=JC,t.getColorSchemeBySeries=FC,t.getDataScheme=BC,t.getFunnelTheme=cT,t.getMergedTheme=xT,t.getSpecInfo=iH,t.getTheme=yT,t.hasThemeMerged=mT,t.isColorKey=IC,t.isPercent=GC,t.isPercentOffset=YC,t.isProgressiveDataColorScheme=LC,t.isTokenKey=eT,t.isValidOrient=WC,t.lightTheme=sT,t.lookup=sH,t.measureText=BT,t.normalizeLayoutPaddingSpec=qC,t.queryColorFromColorScheme=RC,t.queryToken=tT,t.registerDataSetInstanceParser=FM,t.registerDataSetInstanceTransform=DM,t.registerTheme=vT,t.removeTheme=_T,t.themeExist=bT,t.themes=gT,t.token=iT,t.transformColorSchemeToStandardStruct=DC,t.transformToGraphic=xM,t.version="2.1.0",t.vglobal=e_,t.warn=hA,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/vchart-extension/package.json b/packages/vchart-extension/package.json index 97c8ac4f4b..af83837c2e 100644 --- a/packages/vchart-extension/package.json +++ b/packages/vchart-extension/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-extension", - "version": "2.0.22", + "version": "2.1.0", "description": "vchart extension package, including extension plugins and components", "sideEffects": false, "main": "cjs/index.js", @@ -30,7 +30,7 @@ "@visactor/vrender-kits": "1.1.0", "@visactor/vrender-components": "1.1.0", "@visactor/vrender-animate": "1.1.0", - "@visactor/vchart": "workspace:2.0.22", + "@visactor/vchart": "workspace:2.1.0", "@visactor/vutils": "~1.0.23", "@visactor/vdataset": "~1.0.23", "@visactor/vlayouts": "~1.0.23" @@ -71,4 +71,4 @@ "directory": "packages/vchart-extension" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/packages/vchart-schema/package.json b/packages/vchart-schema/package.json index 0a6cfe3d57..96694cc771 100644 --- a/packages/vchart-schema/package.json +++ b/packages/vchart-schema/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-schema", - "version": "2.0.22", + "version": "2.1.0", "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 56953df7d0..235c50398c 100644 --- a/packages/vchart-schema/vchart.json +++ b/packages/vchart-schema/vchart.json @@ -9029,6 +9029,17 @@ ], "type": "string" }, + "DiscreteLegendArrangeCount": { + "anyOf": [ + { + "typeof": "function" + }, + { + "type": "number" + } + ], + "description": "The max row / col count of a discrete legend. Either a fixed number, or a callback that returns a\nnumber, evaluated during layout against {@link IDiscreteLegendArrangeContext}." + }, "Document": { "properties": { "ATTRIBUTE_NODE": { @@ -20379,8 +20390,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -22636,8 +22646,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -24443,8 +24452,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -27119,8 +27127,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -27525,8 +27532,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -28342,8 +28348,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -29551,8 +29556,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -31508,8 +31512,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -34351,7 +34354,9 @@ "type": "number" }, "maxCol": { - "type": "number" + "$ref": "#/definitions/DiscreteLegendArrangeCount", + "description": "The maximum number of columns displayed (for vertical legend). Besides a fixed number, a\ncallback `(ctx) => number` is also supported (see {@link maxRow}).", + "since": "2.0.23" }, "maxHeight": { "anyOf": [ @@ -34382,7 +34387,9 @@ "description": "模块的布局最大高度" }, "maxRow": { - "type": "number" + "$ref": "#/definitions/DiscreteLegendArrangeCount", + "description": "The maximum number of rows displayed (for horizontal legend). Besides a fixed number, a\ncallback `(ctx) => number` is also supported, which is evaluated during layout so the row\ncount can adapt to the space allocated to the legend.", + "since": "2.0.23" }, "maxWidth": { "anyOf": [ @@ -34951,10 +34958,9 @@ "typeof": "function" }, { - "$ref": "#/definitions/Omit" + "$ref": "#/definitions/Omit" } - ], - "description": "spec" + ] }, "IDiscreteLegendTheme": { "allOf": [ @@ -36424,8 +36430,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -37685,8 +37690,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -42341,8 +42345,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -43879,8 +43882,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -46816,8 +46818,7 @@ "ILegendSpec": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -47083,8 +47084,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -49099,8 +49099,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -50108,8 +50107,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -51520,8 +51518,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -57229,8 +57226,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -60194,8 +60190,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -61221,8 +61216,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -62795,8 +62789,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -65125,8 +65118,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -66399,8 +66391,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -67437,8 +67428,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -69369,8 +69359,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -72212,8 +72201,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -75732,8 +75720,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -79421,8 +79408,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -81393,8 +81379,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -82203,7 +82188,7 @@ }, "Mapvoid>": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -82211,14 +82196,14 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -82226,14 +82211,14 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -82241,14 +82226,14 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" }, "Map>": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -82256,14 +82241,14 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" }, "Map>": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -82271,14 +82256,14 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" }, "Map>>": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -82286,14 +82271,14 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" }, "Map>>": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -82301,14 +82286,14 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" }, "Map>": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -82316,14 +82301,14 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" }, "Map>": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -82331,14 +82316,14 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -82346,14 +82331,14 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -82361,14 +82346,14 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -82376,7 +82361,7 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" @@ -82817,7 +82802,7 @@ ], "type": "object" }, - "Omit": { + "Omit": { "properties": { "_debug_bounds": { "anyOf": [ @@ -83250,15 +83235,9 @@ "lineWidth": { "type": "number" }, - "maxCol": { - "type": "number" - }, "maxHeight": { "type": "number" }, - "maxRow": { - "type": "number" - }, "maxWidth": { "type": "number" }, @@ -99756,8 +99735,7 @@ "legends": { "anyOf": [ { - "$ref": "#/definitions/IDiscreteLegendSpec", - "description": "spec" + "$ref": "#/definitions/IDiscreteLegendSpec" }, { "$ref": "#/definitions/IColorLegendSpec" @@ -104217,34 +104195,34 @@ }, "Promise": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" } }, "required": [ - "__@toStringTag@12807" + "__@toStringTag@12805" ], "type": "object" }, "Promise": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" } }, "required": [ - "__@toStringTag@12807" + "__@toStringTag@12805" ], "type": "object" }, "Promise": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" } }, "required": [ - "__@toStringTag@12807" + "__@toStringTag@12805" ], "type": "object" }, @@ -118074,7 +118052,7 @@ }, "Set>>": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -118082,14 +118060,14 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" }, "Set>": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -118097,14 +118075,14 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" }, "Set>": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -118112,14 +118090,14 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" }, "Set>>": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -118127,14 +118105,14 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" }, "Set>": { "properties": { - "__@toStringTag@12807": { + "__@toStringTag@12805": { "type": "string" }, "size": { @@ -118142,7 +118120,7 @@ } }, "required": [ - "__@toStringTag@12807", + "__@toStringTag@12805", "size" ], "type": "object" diff --git a/packages/vchart-types/package.json b/packages/vchart-types/package.json index 9afb5aba8b..fa3263622c 100644 --- a/packages/vchart-types/package.json +++ b/packages/vchart-types/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-types", - "version": "2.0.22", + "version": "2.1.0", "description": "Provide the type declarations of VChart.", "sideEffects": false, "main": "types/index.d.ts", diff --git a/packages/vchart-types/types/animation/callback-disappear.d.ts b/packages/vchart-types/types/animation/callback-disappear.d.ts index 61b4280cd1..ce6add6d1a 100644 --- a/packages/vchart-types/types/animation/callback-disappear.d.ts +++ b/packages/vchart-types/types/animation/callback-disappear.d.ts @@ -1,4 +1,4 @@ -import { AStageAnimate } from '@visactor/vrender-animate'; +import { AStageAnimate } from '@visactor/vrender-animate/custom/custom-animate'; import { EasingType } from '@visactor/vrender-core'; export declare class CallbackDisappearAnimate extends AStageAnimate { protected currentAnimationRatio: number; diff --git a/packages/vchart-types/types/chart/base/base-chart-transformer.d.ts b/packages/vchart-types/types/chart/base/base-chart-transformer.d.ts index e2821f69ce..a7c059ee15 100644 --- a/packages/vchart-types/types/chart/base/base-chart-transformer.d.ts +++ b/packages/vchart-types/types/chart/base/base-chart-transformer.d.ts @@ -8,6 +8,7 @@ import type { ICartesianBandAxisSpec } from '../..//component/axis/cartesian/int export declare class BaseChartSpecTransformer implements IChartSpecTransformer { readonly type: string; readonly seriesType: string; + protected _seriesRelatedSpecKeys: Record; protected _option: IChartSpecTransformerOption; constructor(option: IChartSpecTransformerOption); initChartSpec(chartSpec: T): IChartSpecInfo; @@ -16,6 +17,8 @@ export declare class BaseChartSpecTransformer implements I transformModelSpec(chartSpec: T): IChartSpecInfo; createSpecInfo(chartSpec: T, transform?: (constructor: IModelConstructor, specInfo: IModelSpecInfo, chartSpecInfo?: IChartSpecInfo) => void): IChartSpecInfo; protected _isValidSeries(seriesType: string): boolean; + getSeriesRelatedSpecKeys(): Record; + protected _addSeriesRelatedSpecKeys(...keysList: Array): void; protected _getDefaultSeriesSpec(chartSpec: any, pickKeys?: string[], pickKeys2?: string[]): any; forEachRegionInSpec(chartSpec: T, callbackfn: (constructor: IRegionConstructor, specInfo: IModelSpecInfo, chartSpecInfo?: IChartSpecInfo) => K, chartSpecInfo?: IChartSpecInfo): K[]; forEachSeriesInSpec(chartSpec: T, callbackfn: (constructor: ISeriesConstructor, specInfo: IModelSpecInfo, chartSpecInfo?: IChartSpecInfo) => K, chartSpecInfo?: IChartSpecInfo): K[]; diff --git a/packages/vchart-types/types/chart/base/base-chart.d.ts b/packages/vchart-types/types/chart/base/base-chart.d.ts index 6319b4cdd7..9324ae300c 100644 --- a/packages/vchart-types/types/chart/base/base-chart.d.ts +++ b/packages/vchart-types/types/chart/base/base-chart.d.ts @@ -30,6 +30,7 @@ export declare class BaseChart extends CompilableBase impl protected _regions: IRegion[]; protected _series: ISeries[]; protected _components: IComponent[]; + protected _specTransformer: Maybe; protected _layoutFunc: LayoutCallBack; protected _layoutRect: IRect; getLayoutRect(): IRect; @@ -118,17 +119,34 @@ export declare class BaseChart extends CompilableBase impl updateGlobalScale(result: IUpdateSpecResult): void; updateGlobalScaleTheme(): void; private _getSpecKeys; - updateSpec(spec: T): { - change: boolean; - reMake: boolean; - reRender: boolean; - reSize: boolean; - reCompile: boolean; - }; + private _isSeriesRelatedSpecKey; + private _canChangeSpecKeysWithoutRemake; + updateSpec(spec: T): IUpdateSpecResult; updateChartConfig(result: IUpdateSpecResult, oldSpec: IChartSpec): void; updateDataSpec(): void; updateRegionSpec(result: IUpdateSpecResult): void; - updateComponentSpec(result: IUpdateSpecResult): void; + updateComponentSpec(result: IUpdateSpecResult): { + componentOnlyUpdatedComponents: IComponent[]; + hasNonComponentOnlyUpdate: boolean; + }; + private _canChangeMarkerComponentsWithoutRemake; + private _canAddMarkerComponentsWithoutRemake; + private _isMarkerAdditionSpecSafeWithoutRemake; + private _isAutoRangeMarkerSpec; + private _canRemoveMarkerComponentsWithoutRemake; + private _isOnlyMarkerComponentsRemoved; + private _isComponentSpecKey; + private _isOnlyComponentSpecsChanged; + private _isOnlySeriesSpecsChanged; + private _isOnlyComponentOrSeriesSpecsChanged; + private _canSkipChartDataStages; + private _isComponentScaleDomainOnlyUpdate; + private _reRunStackDataFlow; + private _getModelSpecIndex; + private _hasComponentForSpecInfo; + private _createMissingMarkerComponentsForSpecs; + private _removeMarkerComponentsForEmptySpecs; + private _removeComponent; updateSeriesSpec(result: IUpdateSpecResult): void; getCanvas(): HTMLCanvasElement; private _updateLayoutRect; @@ -142,7 +160,7 @@ export declare class BaseChart extends CompilableBase impl compileRegions(): void; compileSeries(): void; compileComponents(): void; - release(): void; + release(forceReleaseVRenderComponents?: boolean): void; onLayout(): void; updateState(state: Record, 'style'>>, filter?: (series: ISeries, mark: IMark, stateKey: string) => boolean): void; setSelected(datum: MaybeArray | null, filter?: (series: ISeries, mark: IMark) => boolean, region?: IRegionQuerier): void; diff --git a/packages/vchart-types/types/chart/interface/chart.d.ts b/packages/vchart-types/types/chart/interface/chart.d.ts index de43a93875..a5c79b28eb 100644 --- a/packages/vchart-types/types/chart/interface/chart.d.ts +++ b/packages/vchart-types/types/chart/interface/chart.d.ts @@ -112,6 +112,7 @@ export interface IChartSpecTransformer { transformSpec: (spec: any) => void; transformModelSpec: (spec: any) => IChartSpecInfo; createSpecInfo: (chartSpec: any, transform?: (constructor: IModelConstructor, specInfo: IModelSpecInfo, chartSpecInfo?: IChartSpecInfo) => void) => IChartSpecInfo; + getSeriesRelatedSpecKeys: () => Record; forEachRegionInSpec: (spec: any, callbackfn: (constructor: IRegionConstructor, specInfo: IModelSpecInfo, chartSpecInfo?: IChartSpecInfo) => K, chartSpecInfo?: IChartSpecInfo) => K[]; forEachSeriesInSpec: (spec: any, callbackfn: (constructor: ISeriesConstructor, specInfo: IModelSpecInfo, chartSpecInfo?: IChartSpecInfo) => K, chartSpecInfo?: IChartSpecInfo) => K[]; forEachComponentInSpec: (spec: any, callbackfn: (constructor: IComponentConstructor, specInfo: IModelSpecInfo, chartSpecInfo?: IChartSpecInfo) => K, chartSpecInfo?: IChartSpecInfo) => K[]; diff --git a/packages/vchart-types/types/chart/util.d.ts b/packages/vchart-types/types/chart/util.d.ts index 01a7d8479d..fa1f34b1cf 100644 --- a/packages/vchart-types/types/chart/util.d.ts +++ b/packages/vchart-types/types/chart/util.d.ts @@ -1,7 +1,7 @@ import type { IChartSpec } from '../typings'; import type { ICartesianChartSpec } from './cartesian/interface'; import type { IChartOption } from './interface/common'; -import type { IUpdateSpecResult } from '../model/interface'; +import type { IUpdateSpecEffects, IUpdateSpecResult } from '../model/interface'; export declare function setDefaultCrosshairForCartesianChart(spec: ICartesianChartSpec): void; export declare function calculateChartSize(spec: { width?: number; @@ -13,6 +13,9 @@ export declare function calculateChartSize(spec: { width: number; height: number; }; +export declare function normalizeUpdateSpecEffects(result: IUpdateSpecResult): IUpdateSpecEffects; +export declare function isUpdateSpecResultLocalOnly(result: IUpdateSpecResult): boolean; +export declare function isUpdateSpecResultComponentOnly(result: IUpdateSpecResult): boolean; export declare function mergeUpdateResult(target: IUpdateSpecResult, ...sources: IUpdateSpecResult[]): IUpdateSpecResult; export declare function getTrimPaddingConfig(chartType: string, spec: IChartSpec): { paddingInner: number; diff --git a/packages/vchart-types/types/compile/compiler.d.ts b/packages/vchart-types/types/compile/compiler.d.ts index 533e19dce7..a3896f679c 100644 --- a/packages/vchart-types/types/compile/compiler.d.ts +++ b/packages/vchart-types/types/compile/compiler.d.ts @@ -20,6 +20,8 @@ export declare class Compiler implements ICompiler { private _progressiveRafId?; protected _rootMarks: IMark[]; protected _stage: IStage; + private _isExternalStage; + private _releaseVRenderAppRef?; protected _stateAnimationConfig: Partial; get stateAnimationConfig(): Partial; protected _rootGroup: IGroup; @@ -47,6 +49,8 @@ export declare class Compiler implements ICompiler { updateLayoutTag(): void; protected handleLayoutEnd: () => void; protected handleStageRender: () => void; + private _isGeoRegionRoamDragEnabled; + private _shouldDisableCanvasTouchAction; private _setCanvasStyle; compile(ctx: { chart: IChart; diff --git a/packages/vchart-types/types/compile/data/compilable-data.d.ts b/packages/vchart-types/types/compile/data/compilable-data.d.ts index 72d38ff67d..ffb84e865b 100644 --- a/packages/vchart-types/types/compile/data/compilable-data.d.ts +++ b/packages/vchart-types/types/compile/data/compilable-data.d.ts @@ -13,7 +13,7 @@ export declare class CompilableData extends GrammarItem implements ICompilableDa setDataView(d?: DataView): void; getLatestData(): any; constructor(option: GrammarItemInitOption, dataView?: DataView); - removeProduct(): void; + removeProduct(_releaseDetach?: boolean): void; release(): void; protected _relatedMarks?: Record; addRelatedMark(mark: ICompilableMark): void; diff --git a/packages/vchart-types/types/compile/grammar-item.d.ts b/packages/vchart-types/types/compile/grammar-item.d.ts index 3d08d45443..b87a037326 100644 --- a/packages/vchart-types/types/compile/grammar-item.d.ts +++ b/packages/vchart-types/types/compile/grammar-item.d.ts @@ -11,7 +11,7 @@ export declare abstract class GrammarItem extends CompilableBase implements IGra getProductId(): string; compile(option?: GrammarItemCompileOption): void; protected abstract _compileProduct(option?: GrammarItemCompileOption): void; - abstract removeProduct(): void; + abstract removeProduct(releaseDetach?: boolean): void; protected _transform: ITransformSpec[]; setTransform(transform: ITransformSpec[]): void; runTransforms(transforms: ITransformSpec[], data: T): T; diff --git a/packages/vchart-types/types/compile/interface/compilable-item.d.ts b/packages/vchart-types/types/compile/interface/compilable-item.d.ts index 6751e95a01..aeb21749b4 100644 --- a/packages/vchart-types/types/compile/interface/compilable-item.d.ts +++ b/packages/vchart-types/types/compile/interface/compilable-item.d.ts @@ -85,7 +85,7 @@ export interface IGrammarItem extends ICompilable { id: number; generateProductId: () => string; getProductId: () => string; - removeProduct: () => void; + removeProduct: (releaseDetach?: boolean) => void; setTransform: (transform: ITransformSpec[]) => void; } export type GrammarItemInitOption = ICompilableInitOption; diff --git a/packages/vchart-types/types/compile/interface/compiler.d.ts b/packages/vchart-types/types/compile/interface/compiler.d.ts index ee261c1ba1..c75bd88a93 100644 --- a/packages/vchart-types/types/compile/interface/compiler.d.ts +++ b/packages/vchart-types/types/compile/interface/compiler.d.ts @@ -1,4 +1,4 @@ -import type { IColor, IStageParams, IStage, ILayer, IOption3D, ITicker } from '@visactor/vrender-core'; +import type { IApp, IColor, IStageParams, IStage, ILayer, IOption3D, ITicker } from '@visactor/vrender-core'; import type { IPerformanceHook, RenderMode } from '../../typings/spec/common'; import type { IBoundsLike } from '@visactor/vutils'; import type { StringOrNumber } from '../../typings'; @@ -42,6 +42,7 @@ export interface IRenderOption { viewBox?: IBoundsLike; canvasControled?: boolean; stage?: IStage; + app?: IApp; layer?: ILayer; beforeRender?: IStageParams['beforeRender']; afterRender?: IStageParams['afterRender']; diff --git a/packages/vchart-types/types/compile/stage-app.d.ts b/packages/vchart-types/types/compile/stage-app.d.ts new file mode 100644 index 0000000000..92ebe6c684 --- /dev/null +++ b/packages/vchart-types/types/compile/stage-app.d.ts @@ -0,0 +1,17 @@ +import type { IApp, IStage, IStageParams } from '@visactor/vrender-core'; +import { type RenderMode } from '../typings/spec/common'; +type VRenderAppEnv = 'browser' | 'node' | 'feishu' | 'tt' | 'wx' | 'lynx' | 'harmony'; +export type ResolveVRenderAppOptions = { + app?: IApp; + mode?: RenderMode; + modeParams?: unknown; +}; +export type ResolvedVRenderApp = { + app: IApp; + releaseAppRef?: () => void; +}; +export declare const getVRenderAppEnv: (mode?: RenderMode) => VRenderAppEnv; +export declare const getVRenderAppEnvParams: (mode?: RenderMode, modeParams?: unknown) => unknown; +export declare const resolveVRenderApp: (appOrOptions?: IApp | ResolveVRenderAppOptions, mode?: RenderMode) => ResolvedVRenderApp; +export declare const createStageFromApp: (app: IApp, params: Partial) => IStage; +export {}; diff --git a/packages/vchart-types/types/component/axis/base-axis.d.ts b/packages/vchart-types/types/component/axis/base-axis.d.ts index 2c0bdfe499..a3882edef8 100644 --- a/packages/vchart-types/types/component/axis/base-axis.d.ts +++ b/packages/vchart-types/types/component/axis/base-axis.d.ts @@ -1,5 +1,5 @@ import type { IGroup } from '@visactor/vrender-core'; -import type { ITickDataOpt } from '@visactor/vrender-components'; +import type { ITickDataOpt } from '@visactor/vrender-components/axis/type'; import type { IBaseScale } from '@visactor/vscale'; import type { IGraphic } from '@visactor/vrender-core'; import type { IOrientType, IPolarOrientType, StringOrNumber, CoordinateType } from '../../typings'; @@ -82,13 +82,8 @@ export declare abstract class AxisComponent void; diff --git a/packages/vchart-types/types/component/axis/cartesian/linear-axis.d.ts b/packages/vchart-types/types/component/axis/cartesian/linear-axis.d.ts index 63484287fd..f7ea45ca39 100644 --- a/packages/vchart-types/types/component/axis/cartesian/linear-axis.d.ts +++ b/packages/vchart-types/types/component/axis/cartesian/linear-axis.d.ts @@ -4,8 +4,8 @@ import { CartesianAxis } from './axis'; import type { IAxisHelper, ICartesianAxisCommonTheme, ICartesianLinearAxisSpec } from './interface'; import { ComponentTypeEnum } from '../../interface/type'; import { LinearAxisMixin } from '../mixin/linear-axis-mixin'; -import type { ICartesianTickDataOpt } from '@visactor/vrender-components'; -export interface CartesianLinearAxis extends Pick, CartesianAxis { +import type { ICartesianTickDataOpt } from '@visactor/vrender-components/axis/type'; +export interface CartesianLinearAxis extends Pick, CartesianAxis { } export declare class CartesianLinearAxis extends CartesianAxis { static type: ComponentTypeEnum; @@ -21,6 +21,7 @@ export declare class CartesianLinearAxis { @@ -56,6 +57,7 @@ export declare class LinearAxisMixin { setLinearScaleNice(): false | LinearScale; setLogScaleNice(): false | LinearScale; setScaleNice(): false | LinearScale; + reTransformDomainByLayout(): void; dataToPosition(values: any[], cfg?: IAxisLocationCfg): number; valueToPosition(value: any): number; computeLinearDomain(data: { diff --git a/packages/vchart-types/types/component/axis/polar/band-axis.d.ts b/packages/vchart-types/types/component/axis/polar/band-axis.d.ts index 9d918197b8..28bcce4ae3 100644 --- a/packages/vchart-types/types/component/axis/polar/band-axis.d.ts +++ b/packages/vchart-types/types/component/axis/polar/band-axis.d.ts @@ -18,6 +18,7 @@ export declare class PolarBandAxis void; protected computeDomain(data: { min: number; max: number; @@ -37,6 +38,7 @@ export declare class PolarBandAxis T; }; protected initScales(): void; + reInit(spec?: T): void; protected registerTicksTransform(): string; transformScaleDomain(): void; } diff --git a/packages/vchart-types/types/component/base/base-component.d.ts b/packages/vchart-types/types/component/base/base-component.d.ts index 687e746397..88d31b3515 100644 --- a/packages/vchart-types/types/component/base/base-component.d.ts +++ b/packages/vchart-types/types/component/base/base-component.d.ts @@ -19,20 +19,20 @@ export declare class BaseComponent ex protected _regions: IRegion[]; getRegions(): IRegion[]; protected _container: IGroup; + private _exitingVRenderComponents?; + private _forceReleaseVRenderComponents; created(): void; initLayout(): void; protected _getNeedClearVRenderComponents(): IGraphic[]; getVRenderComponents(): IGraphic>[]; protected callPlugin(cb: (plugin: IComponentPlugin) => void): void; protected getContainer(): IGroup; - _compareSpec(spec: T, prevSpec: T): { - change: boolean; - reMake: boolean; - reRender: boolean; - reSize: boolean; - reCompile: boolean; - }; + _compareSpec(spec: T, prevSpec: T): import("../../model/interface").IUpdateSpecResult; + beforeRelease(): void; release(): void; + protected _shouldReleaseVRenderComponentsImmediately(): boolean; + protected _forceReleaseExitingVRenderComponents(): void; + protected _releaseVRenderComponent(component: IGraphic): void; clear(): void; compile(): void; compileMarks(group?: IGroup): void; diff --git a/packages/vchart-types/types/component/base/release-vrender-component.d.ts b/packages/vchart-types/types/component/base/release-vrender-component.d.ts new file mode 100644 index 0000000000..7f7d41c814 --- /dev/null +++ b/packages/vchart-types/types/component/base/release-vrender-component.d.ts @@ -0,0 +1,10 @@ +import type { IGraphic } from '@visactor/vrender-core'; +type ReleaseVRenderComponentOptions = { + enableExitAnimation?: boolean; + removeFromParent?: boolean; + onComplete?: () => void; +}; +export declare const releaseVRenderComponentSync: (component: IGraphic, removeFromParent?: boolean) => void; +export declare const collectVRenderComponents: (component: IGraphic) => IGraphic[]; +export declare const releaseVRenderComponent: (component: IGraphic, options?: ReleaseVRenderComponentOptions) => boolean; +export {}; diff --git a/packages/vchart-types/types/component/brush/brush.d.ts b/packages/vchart-types/types/component/brush/brush.d.ts index 540a1ec63d..99f3f79c7e 100644 --- a/packages/vchart-types/types/component/brush/brush.d.ts +++ b/packages/vchart-types/types/component/brush/brush.d.ts @@ -48,6 +48,7 @@ export declare class Brush extends BaseCompon private _zoomRecord; static getSpecInfo(chartSpec: any): Maybe; init(): void; + reInit(spec?: T): void; private _initNeedOperatedItem; created(): void; protected _bindRegions(): void; @@ -55,13 +56,8 @@ export declare class Brush extends BaseCompon private _initRegionAxisMap; private _initAxisDataZoomMap; protected initEvent(): void; - _compareSpec(spec: T, prevSpec: T): { - change: boolean; - reMake: boolean; - reRender: boolean; - reSize: boolean; - reCompile: boolean; - }; + _compareSpec(spec: T, prevSpec: T): import("../../model/interface").IUpdateSpecResult; + protected _isComponentOnlySpecChange(spec: T, prevSpec: T): boolean; onLayoutEnd(): void; protected _updateBrushComponent(region: IRegion, componentIndex: number): void; protected _shouldEnableInteractive(): boolean; @@ -80,6 +76,7 @@ export declare class Brush extends BaseCompon [elementKey: string]: IMarkGraphic; }): import("../..").Datum[]; private _emitEvent; + private _setBrushState; private _reconfigItem; private _reconfigLinkedItem; private _isBrushContainItem; diff --git a/packages/vchart-types/types/component/crosshair/base.d.ts b/packages/vchart-types/types/component/crosshair/base.d.ts index f27175fa53..13263fbb63 100644 --- a/packages/vchart-types/types/component/crosshair/base.d.ts +++ b/packages/vchart-types/types/component/crosshair/base.d.ts @@ -1,5 +1,5 @@ import type { IBoundsLike } from '@visactor/vutils'; -import { Tag } from '@visactor/vrender-components'; +import { Tag } from '@visactor/vrender-components/tag'; import type { IGraphic } from '@visactor/vrender-core'; import { BaseComponent } from '../base/base-component'; import type { IPoint, StringOrNumber, TooltipActiveType, TooltipData } from '../../typings'; @@ -41,13 +41,10 @@ export declare abstract class BaseCrossHair, prevSpec: ICustomMarkSpec): { - change: boolean; - reMake: boolean; - reRender: boolean; - reSize: boolean; - reCompile: boolean; - }; + _compareSpec(spec: ICustomMarkSpec, prevSpec: ICustomMarkSpec): import("../..").IUpdateSpecResult; + protected _isComponentOnlySpecChange(spec: ICustomMarkSpec, prevSpec: ICustomMarkSpec): boolean; + reInit(spec?: ICustomMarkSpec): void; + private _updateMarkStyleWithSpec; private _getMarkAttributeContext; private _getLayoutRect; getBoundsInRect(rect: ILayoutRect): { diff --git a/packages/vchart-types/types/component/data-zoom/data-filter-base-component.d.ts b/packages/vchart-types/types/component/data-zoom/data-filter-base-component.d.ts index 4bb75e3a94..09c9401cc5 100644 --- a/packages/vchart-types/types/component/data-zoom/data-filter-base-component.d.ts +++ b/packages/vchart-types/types/component/data-zoom/data-filter-base-component.d.ts @@ -76,13 +76,9 @@ export declare abstract class DataFilterBaseComponent, prevSpec: AdaptiveSpec): { - change: boolean; - reMake: boolean; - reRender: boolean; - reSize: boolean; - reCompile: boolean; - }; + _compareSpec(spec: AdaptiveSpec, prevSpec: AdaptiveSpec): import("../../model/interface").IUpdateSpecResult; + protected _getComponentOnlySpecKeys(): Record; + protected _isComponentOnlySpecChange(spec: AdaptiveSpec, prevSpec: AdaptiveSpec): boolean; reInit(spec?: AdaptiveSpec): void; onLayoutStart(layoutRect: IRect, viewRect: ILayoutRect): void; updateLayoutAttribute(): void; diff --git a/packages/vchart-types/types/component/data-zoom/data-zoom/data-zoom.d.ts b/packages/vchart-types/types/component/data-zoom/data-zoom/data-zoom.d.ts index db782cd4ee..ab112795ad 100644 --- a/packages/vchart-types/types/component/data-zoom/data-zoom/data-zoom.d.ts +++ b/packages/vchart-types/types/component/data-zoom/data-zoom/data-zoom.d.ts @@ -36,6 +36,7 @@ export declare class DataZoom extends D created(): void; updateLayoutAttribute(): void; protected _beforeLayoutEnd(): void; + protected _getComponentOnlySpecKeys(): Record; clear(): void; getBoundsInRect(rect: ILayoutRect): IBoundsLike; setAttrFromSpec(): void; diff --git a/packages/vchart-types/types/component/data-zoom/scroll-bar/scroll-bar.d.ts b/packages/vchart-types/types/component/data-zoom/scroll-bar/scroll-bar.d.ts index e2e2a02ff9..2e2c653202 100644 --- a/packages/vchart-types/types/component/data-zoom/scroll-bar/scroll-bar.d.ts +++ b/packages/vchart-types/types/component/data-zoom/scroll-bar/scroll-bar.d.ts @@ -22,6 +22,7 @@ export declare class ScrollBar extend constructor(spec: T, options: IComponentOption); protected _handleChange(start: number, end: number, updateComponent?: boolean): void; protected _handleDataCollectionChange(): void; + protected _getComponentOnlySpecKeys(): Record; protected _beforeLayoutEnd(): void; onLayoutEnd(): void; protected _updateScaleRange(): void; diff --git a/packages/vchart-types/types/component/geo/geo-coordinate.d.ts b/packages/vchart-types/types/component/geo/geo-coordinate.d.ts index 2cac5810cc..ae7e3cfaf3 100644 --- a/packages/vchart-types/types/component/geo/geo-coordinate.d.ts +++ b/packages/vchart-types/types/component/geo/geo-coordinate.d.ts @@ -52,13 +52,7 @@ export declare class GeoCoordinate extends BaseComponent impleme invert(point: [number, number]): any; private evaluateProjection; protected _initCenterCache(): void; - _compareSpec(spec: IGeoRegionSpec, prevSpec: IGeoRegionSpec): { - change: boolean; - reMake: boolean; - reRender: boolean; - reSize: boolean; - reCompile: boolean; - }; + _compareSpec(spec: IGeoRegionSpec, prevSpec: IGeoRegionSpec): import("../../model/interface").IUpdateSpecResult; release(): void; } export declare const registerGeoCoordinate: () => void; diff --git a/packages/vchart-types/types/component/indicator/indicator.d.ts b/packages/vchart-types/types/component/indicator/indicator.d.ts index 06e9ab5db4..4844e92db2 100644 --- a/packages/vchart-types/types/component/indicator/indicator.d.ts +++ b/packages/vchart-types/types/component/indicator/indicator.d.ts @@ -27,6 +27,7 @@ export declare class Indicator extends BaseComponent; created(): void; setAttrFromSpec(): void; + _compareSpec(spec: T, prevSpec: T): import("../../model/interface").IUpdateSpecResult; protected initEvent(): void; updateDatum(datum: any): void; private initData; diff --git a/packages/vchart-types/types/component/indicator/util.d.ts b/packages/vchart-types/types/component/indicator/util.d.ts index d94ebc1ae9..a6ea4e7ecb 100644 --- a/packages/vchart-types/types/component/indicator/util.d.ts +++ b/packages/vchart-types/types/component/indicator/util.d.ts @@ -2,12 +2,13 @@ import type { IIndicatorItemSpec } from './interface'; export interface IIndicatorDatum { type: 'title' | 'content'; index: number; - datum: any; + datum: unknown; spec: IIndicatorItemSpec; } export interface IIndicatorMapper { title: IIndicatorItemSpec; content: IIndicatorItemSpec[]; - datum: () => any; + datum: () => unknown; } -export declare const indicatorMapper: (data: Array, op: IIndicatorMapper) => any[]; +export type IndicatorMapperOption = IIndicatorMapper | (() => IIndicatorMapper); +export declare const indicatorMapper: (data: Array, op: IndicatorMapperOption) => IIndicatorDatum[]; diff --git a/packages/vchart-types/types/component/label/base-label.d.ts b/packages/vchart-types/types/component/label/base-label.d.ts index c527b6bb58..509a76d3b2 100644 --- a/packages/vchart-types/types/component/label/base-label.d.ts +++ b/packages/vchart-types/types/component/label/base-label.d.ts @@ -22,13 +22,7 @@ export declare abstract class BaseLabelComponent extends BaseComponent< selected_reverse?: Partial; }; }; - _compareSpec(spec: T, prevSpec: T): { - change: boolean; - reMake: boolean; - reRender: boolean; - reSize: boolean; - reCompile: boolean; - }; + _compareSpec(spec: T, prevSpec: T): import("../../core").IUpdateSpecResult; _getDataLabelType(baseMark: ICompilableMark, type?: string): string; _setTransformOfComponent(labelComponent: IComponentMark, baseMark: IMark | IMark[]): void; getVRenderComponents(): any[]; diff --git a/packages/vchart-types/types/component/legend/base-legend.d.ts b/packages/vchart-types/types/component/legend/base-legend.d.ts index 65eda220fa..00c43e34c1 100644 --- a/packages/vchart-types/types/component/legend/base-legend.d.ts +++ b/packages/vchart-types/types/component/legend/base-legend.d.ts @@ -31,13 +31,8 @@ export declare abstract class BaseLegend extends Ba protected _regionUserIndex?: number[]; setAttrFromSpec(): void; created(): void; - _compareSpec(spec: T, prevSpec: T): { - change: boolean; - reMake: boolean; - reRender: boolean; - reSize: boolean; - reCompile: boolean; - }; + _compareSpec(spec: T, prevSpec: T): import("../../model/interface").IUpdateSpecResult; + private _isComponentOnlySpecChange; protected abstract _initLegendData(): DataView; protected abstract _initSelectedData(): void; protected abstract _getLegendAttributes(rect: ILayoutRect): any; diff --git a/packages/vchart-types/types/component/legend/discrete/interface.d.ts b/packages/vchart-types/types/component/legend/discrete/interface.d.ts index 641f13b421..d359ec23f1 100644 --- a/packages/vchart-types/types/component/legend/discrete/interface.d.ts +++ b/packages/vchart-types/types/component/legend/discrete/interface.d.ts @@ -2,6 +2,8 @@ import type { IRectMarkSpec, ISymbolMarkSpec, ITextMarkSpec } from '../../../typ import type { DiscreteLegendAttrs, LegendItemDatum, LegendItem, LegendPagerAttributes, LegendScrollbarAttributes } from '@visactor/vrender-components'; import type { ILegendCommonSpec, NoVisibleMarkStyle } from '../interface'; import type { IFormatMethod, StringOrNumber } from '../../../typings'; +import type { ILayoutRect } from '../../../typings/layout'; +import type { IOrientType } from '../../../typings/space'; import type { IBaseScale } from '@visactor/vscale'; import type { IGlobalScale } from '../../../scale/interface'; import type { ComponentThemeWithDirection } from '../../interface'; @@ -62,6 +64,12 @@ export type ILegendScrollbar = { railStyle?: Omit>, 'width' | 'height'>; sliderStyle?: Omit>, 'width' | 'height'>; } & Omit; +export interface IDiscreteLegendArrangeContext { + rect: ILayoutRect; + orient: IOrientType; + id?: StringOrNumber; +} +export type DiscreteLegendArrangeCount = number | ((ctx: IDiscreteLegendArrangeContext) => number); export type IDiscreteLegendSpec = ILegendCommonSpec & { type?: 'discrete'; data?: (data: LegendItemDatum[], colorScale: IBaseScale, globalScale: IGlobalScale) => LegendItemDatum[]; @@ -71,6 +79,8 @@ export type IDiscreteLegendSpec = ILegendCommonSpec & { scaleName?: string; field?: string; defaultSelected?: string[]; -} & Omit; + maxRow?: DiscreteLegendArrangeCount; + maxCol?: DiscreteLegendArrangeCount; +} & Omit; export type IDiscreteLegendCommonTheme = Omit; export type IDiscreteLegendTheme = ComponentThemeWithDirection; diff --git a/packages/vchart-types/types/component/legend/discrete/legend.d.ts b/packages/vchart-types/types/component/legend/discrete/legend.d.ts index c036cb07f4..469fed4dc5 100644 --- a/packages/vchart-types/types/component/legend/discrete/legend.d.ts +++ b/packages/vchart-types/types/component/legend/discrete/legend.d.ts @@ -4,7 +4,7 @@ import type { IDiscreteLegendSpec } from './interface'; import type { ISeries } from '../../../series/interface'; import type { IModelInitOption, IModelSpecInfo } from '../../../model/interface'; import { ComponentTypeEnum } from '../../interface/type'; -import { DiscreteLegend as LegendComponent } from '@visactor/vrender-components'; +import { DiscreteLegend as LegendComponent } from '@visactor/vrender-components/legend/discrete'; import { BaseLegend } from '../base-legend'; import type { ILayoutRect } from '../../../typings/layout'; import type { StringOrNumber } from '../../../typings'; diff --git a/packages/vchart-types/types/component/legend/discrete/util.d.ts b/packages/vchart-types/types/component/legend/discrete/util.d.ts index 68e92ad956..bf2628328b 100644 --- a/packages/vchart-types/types/component/legend/discrete/util.d.ts +++ b/packages/vchart-types/types/component/legend/discrete/util.d.ts @@ -1,3 +1,4 @@ import type { IDiscreteLegendSpec } from './interface'; import type { ILayoutRect } from '../../../typings/layout'; -export declare function getLegendAttributes(spec: IDiscreteLegendSpec, rect: ILayoutRect): any; +import type { IOrientType } from '../../../typings/space'; +export declare function getLegendAttributes(spec: IDiscreteLegendSpec, rect: ILayoutRect, layoutOrient?: IOrientType): any; diff --git a/packages/vchart-types/types/component/marker/base-marker.d.ts b/packages/vchart-types/types/component/marker/base-marker.d.ts index a69138f025..2974cca465 100644 --- a/packages/vchart-types/types/component/marker/base-marker.d.ts +++ b/packages/vchart-types/types/component/marker/base-marker.d.ts @@ -19,6 +19,8 @@ export declare abstract class BaseMarker extends BaseComp getRelativeSeries(): IMarkerSupportSeries; protected _markerData: DataView; getMarkerData(): DataView; + private _markerDataChangeHandler; + private _markerDataOwned; protected _markerComponent: any; protected _layoutOffsetX: number; protected _layoutOffsetY: number; @@ -38,6 +40,10 @@ export declare abstract class BaseMarker extends BaseComp getStartRelativeSeries: () => IMarkerSupportSeries; getEndRelativeSeries: () => IMarkerSupportSeries; }; + protected _getAutoRangeExtendDomainKeyPrefix(): string; + private _getAutoRangeExtendDomainKey; + private _clearAutoRangeExtendDomain; + private _updateMarkerLayout; private _getFieldInfoFromSpec; protected _processSpecByDims(dimSpec: { dim: 'x' | 'y' | 'angle' | 'radius' | 'areaName'; @@ -49,20 +55,21 @@ export declare abstract class BaseMarker extends BaseComp }; protected _processSpecCoo(spec: any): IOptionWithCoordinates; protected _getRelativeDataView(): DataView; + protected _setMarkerData(data: DataView, owned?: boolean): void; + protected _bindMarkerDataChange(): void; + private _releaseMarkerData; updateLayoutAttribute(): void; private _getSeriesByIdOrIndex; protected _bindSeries(): void; protected initEvent(): void; clear(): void; + release(): void; private _getFirstSeries; protected _getNeedClearVRenderComponents(): IGraphic[]; onLayoutStart(layoutRect: IRect, chartViewRect: ILayoutRect): void; - _compareSpec(spec: T, prevSpec: T): { - change: boolean; - reMake: boolean; - reRender: boolean; - reSize: boolean; - reCompile: boolean; - }; + _compareSpec(spec: T, prevSpec: T): import("../../model/interface").IUpdateSpecResult; + protected _isComponentOnlySpecChange(spec: T, prevSpec: T): boolean; + protected _isAutoRangeSpecChange(spec: T, prevSpec: T): boolean; + reInit(spec?: T): void; _initCommonDataView(): void; } diff --git a/packages/vchart-types/types/component/marker/mark-line/interface/spec.d.ts b/packages/vchart-types/types/component/marker/mark-line/interface/spec.d.ts index e2164894d0..3d5256554c 100644 --- a/packages/vchart-types/types/component/marker/mark-line/interface/spec.d.ts +++ b/packages/vchart-types/types/component/marker/mark-line/interface/spec.d.ts @@ -1,9 +1,11 @@ +import type { DataView } from '@visactor/vdataset'; import type { IComponent } from '../../../interface'; -import type { IAggrType, IMarkerPositionsSpec, IDataPointSpec, IMarkerSpec, IDataPos, IDataPosCallback, IMarkerLabelSpec, IMarkerCrossSeriesSpec, OffsetPoint, MarkerStateValue, MarkerStateCallback, IMarkerSupportSeries } from '../../interface'; +import type { IAggrType, IMarkerAttributeContext, IMarkerPositionsSpec, IDataPointSpec, IMarkerSpec, IDataPos, IDataPosCallback, IMarkerLabelSpec, IMarkerCrossSeriesSpec, OffsetPoint, MarkerStateValue, MarkerStateCallback, IMarkerSupportSeries } from '../../interface'; import type { IRegressType } from '../../mark-area/interface'; import type { IMarkLineTheme } from './theme'; import type { Datum, ILineMarkSpec, IPoint } from '../../../../typings'; import type { BaseMarkerAnimation, MarkCommonLineAnimationType } from '@visactor/vrender-components'; +import type { IRegion } from '../../../../region/interface'; export type IMarkLine = IComponent; export type IMarkLineSpec = (IMarkerSpec & (IMarkLineXSpec | IMarkLineYSpec | IMarkLineXYSpec | IMarkLineXYY1Spec | IMarkLineYXX1Spec | IMarkLineAngleSpec | IMarkLineRadiusSpec | IMarkLineAngRadRad1Spec | IMarkLineRadAngAng1Spec | IMarkLineAngRadSpec | IMarkLineCoordinateSpec | IMarkerPositionsSpec) & IMarkLineTheme & BaseMarkerAnimation) | (IStepMarkLineSpec & BaseMarkerAnimation); export interface IMarkLineXSpec extends IMarkerCrossSeriesSpec { @@ -64,7 +66,12 @@ export type IMarkLineCoordinateSpec = { export type IStepMarkLineSpec = IMarkerSpec & { type: 'type-step'; connectDirection: 'top' | 'bottom' | 'left' | 'right'; - expandDistance?: number | string; + expandDistance?: number | string | ((markerData: DataView, context: IMarkerAttributeContext & { + region: IRegion; + startRegion: IRegion; + endRegion: IRegion; + coordinatePoints: IPoint[]; + }) => number | string); label?: IMarkerLabelSpec; line?: { multiSegment?: boolean; diff --git a/packages/vchart-types/types/component/marker/utils.d.ts b/packages/vchart-types/types/component/marker/utils.d.ts index 020e980572..de64eeb419 100644 --- a/packages/vchart-types/types/component/marker/utils.d.ts +++ b/packages/vchart-types/types/component/marker/utils.d.ts @@ -5,11 +5,11 @@ import type { IDataPos, IMarkerAttributeContext, IMarkerLabelSpec, IMarkerState, import type { IRegion } from '../../region/interface'; import type { OffsetPoint } from './interface'; export declare function isAggrSpec(spec: IDataPos): boolean; -export declare function xyLayout(data: DataView, startRelativeSeries: IMarkerSupportSeries, endRelativeSeries: IMarkerSupportSeries, relativeSeries: IMarkerSupportSeries, autoRange: boolean, includeFullBand?: boolean): IPoint[][]; -export declare function polarLayout(data: DataView, startRelativeSeries: IMarkerSupportSeries, endRelativeSeries: IMarkerSupportSeries, relativeSeries: IMarkerSupportSeries, autoRange: boolean): IPolarPoint[][]; +export declare function xyLayout(data: DataView, startRelativeSeries: IMarkerSupportSeries, endRelativeSeries: IMarkerSupportSeries, relativeSeries: IMarkerSupportSeries, autoRange: boolean, includeFullBand?: boolean, autoRangeExtendDomainKeyPrefix?: string): IPoint[][]; +export declare function polarLayout(data: DataView, startRelativeSeries: IMarkerSupportSeries, endRelativeSeries: IMarkerSupportSeries, relativeSeries: IMarkerSupportSeries, autoRange: boolean, autoRangeExtendDomainKeyPrefix?: string): IPolarPoint[][]; export declare function geoLayout(data: DataView, relativeSeries: IMarkerSupportSeries): IPoint[][]; -export declare function cartesianCoordinateLayout(data: DataView, relativeSeries: IMarkerSupportSeries, autoRange: boolean, coordinatesOffset: OffsetPoint[] | OffsetPoint): IPoint[]; -export declare function polarCoordinateLayout(data: DataView, relativeSeries: IMarkerSupportSeries, autoRange: boolean): IPolarPoint[]; +export declare function cartesianCoordinateLayout(data: DataView, relativeSeries: IMarkerSupportSeries, autoRange: boolean, coordinatesOffset: OffsetPoint[] | OffsetPoint, autoRangeExtendDomainKeyPrefix?: string): IPoint[]; +export declare function polarCoordinateLayout(data: DataView, relativeSeries: IMarkerSupportSeries, autoRange: boolean, autoRangeExtendDomainKeyPrefix?: string): IPolarPoint[]; export declare function positionLayout(positions: MarkerPositionPoint | MarkerPositionPoint[] | ((seriesData: Datum[], relativeSeries: IMarkerSupportSeries) => MarkerPositionPoint) | ((seriesData: Datum[], relativeSeries: IMarkerSupportSeries) => MarkerPositionPoint[]), series: IMarkerSupportSeries, regionRelative: boolean): IPoint[]; export declare function computeClipRange(regions: IRegion[]): { minX: number; diff --git a/packages/vchart-types/types/component/player/player.d.ts b/packages/vchart-types/types/component/player/player.d.ts index 157d40c670..9c8c3095a9 100644 --- a/packages/vchart-types/types/component/player/player.d.ts +++ b/packages/vchart-types/types/component/player/player.d.ts @@ -29,6 +29,7 @@ export declare class Player extends BaseComponent implements IComponent get orient(): IOrientType; set layoutOrient(v: IOrientType); setAttrFromSpec(): void; + _compareSpec(spec: IPlayer, prevSpec: IPlayer): import("../../model/interface").IUpdateSpecResult; afterSetLayoutStartPoint(pos: IPoint): void; getBoundsInRect(rect: ILayoutRect, fullSpace: ILayoutRect): { x1: number; diff --git a/packages/vchart-types/types/component/title/title.d.ts b/packages/vchart-types/types/component/title/title.d.ts index 49e69e910e..718463f8c4 100644 --- a/packages/vchart-types/types/component/title/title.d.ts +++ b/packages/vchart-types/types/component/title/title.d.ts @@ -24,13 +24,7 @@ export declare class Title extends BaseCompon constructor(spec: T, options: IComponentOption); initLayout(): void; static getSpecInfo(chartSpec: any): Maybe; - _compareSpec(spec: T, prevSpec: T): { - change: boolean; - reMake: boolean; - reRender: boolean; - reSize: boolean; - reCompile: boolean; - }; + _compareSpec(spec: T, prevSpec: T): import("../../model/interface").IUpdateSpecResult; afterSetLayoutStartPoint(pos: IPoint): void; getBoundsInRect(rect: ILayoutRect): { x1: number; diff --git a/packages/vchart-types/types/component/tooltip/tooltip.d.ts b/packages/vchart-types/types/component/tooltip/tooltip.d.ts index 2da0db12c0..96584c16ce 100644 --- a/packages/vchart-types/types/component/tooltip/tooltip.d.ts +++ b/packages/vchart-types/types/component/tooltip/tooltip.d.ts @@ -45,6 +45,7 @@ export declare class Tooltip extends BaseComponent implements ITooltip { protected _releaseEvent(): void; onLayoutEnd(): void; created(): void; + _compareSpec(spec: ITooltipSpec, prevSpec: ITooltipSpec): import("../../model/interface").IUpdateSpecResult; release(): void; beforeRelease(): void; protected _initHandler(): void; diff --git a/packages/vchart-types/types/core/index.d.ts b/packages/vchart-types/types/core/index.d.ts index 72692a323e..8de03be876 100644 --- a/packages/vchart-types/types/core/index.d.ts +++ b/packages/vchart-types/types/core/index.d.ts @@ -23,7 +23,8 @@ export * from '../typings/visual'; export * from '../typings/tooltip'; export * from '../theme/index'; export { vglobal, createGroup, createRichText, createText, createArc, createArea, createRect, createLine, createSymbol } from '@visactor/vrender-core'; -export { ManualTicker, StreamLight } from '@visactor/vrender-animate'; +export { ManualTicker } from '@visactor/vrender-animate/ticker/manual-ticker'; +export { StreamLight } from '@visactor/vrender-animate/custom/streamLight'; export * from '../util/space'; export { transformToGraphic } from '../util/style'; export { getSpecInfo } from '../component/util'; diff --git a/packages/vchart-types/types/core/vchart.d.ts b/packages/vchart-types/types/core/vchart.d.ts index 77611932a1..730c991641 100644 --- a/packages/vchart-types/types/core/vchart.d.ts +++ b/packages/vchart-types/types/core/vchart.d.ts @@ -8,7 +8,7 @@ import type { IComponentConstructor } from '../component/interface'; import type { EventCallback, EventQuery, EventType, ExtendEventParam, IEvent } from '../event/interface'; import type { IParserOptions, Transform } from '@visactor/vdataset'; import { DataSet, DataView } from '@visactor/vdataset'; -import type { IStage } from '@visactor/vrender-core'; +import type { IGraphic, IStage } from '@visactor/vrender-core'; import type { GeoSourceType } from '../typings/geo'; import type { GeoSourceOption } from '../series/map/geo-source'; import type { IMark, MarkConstructor } from '../mark/interface'; @@ -78,6 +78,7 @@ export declare class VChart implements IVChart { private _onError?; private _context; private _isReleased; + private _exitingVRenderComponents?; private _chartPlugin?; private _vChartPlugin?; private _onResize?; @@ -110,6 +111,9 @@ export declare class VChart implements IVChart { protected _renderAsync(option?: IVChartRenderOption): Promise; private _updateAnimateState; release(): void; + _registerExitingVRenderComponent(component: IGraphic): void; + _unregisterExitingVRenderComponent(component: IGraphic): void; + private _forceReleaseExitingVRenderComponents; updateData(id: StringOrNumber, data: DataView | Datum[] | string, parserOptions?: IParserOptions, userUpdateOptions?: IUpdateDataResult): Promise; private _updateDataById; updateDataInBatches(list: { diff --git a/packages/vchart-types/types/data/data-view-utils.d.ts b/packages/vchart-types/types/data/data-view-utils.d.ts new file mode 100644 index 0000000000..80e64e512f --- /dev/null +++ b/packages/vchart-types/types/data/data-view-utils.d.ts @@ -0,0 +1,5 @@ +import type { DataView } from '@visactor/vdataset'; +export declare const detachDataViewDependencies: (dataView?: DataView | null) => void; +export declare const releaseDataViews: (dataViews: Array) => void; +export declare const releaseDataView: (dataView?: DataView | null) => void; +export declare const releaseDataViewWithDependencies: (dataView: DataView | null | undefined, shouldReleaseDependency: (dataView: DataView) => boolean) => void; diff --git a/packages/vchart-types/types/data/transforms/box-plot.d.ts b/packages/vchart-types/types/data/transforms/box-plot.d.ts index 7ac7c44b68..cc9e6a439b 100644 --- a/packages/vchart-types/types/data/transforms/box-plot.d.ts +++ b/packages/vchart-types/types/data/transforms/box-plot.d.ts @@ -1,6 +1,9 @@ +import type { DataView } from '@visactor/vdataset'; export interface IBoxPlotOutlierOpt { dimensionField: string[]; outliersField: string; seriesField?: string; } -export declare const foldOutlierData: (data: Array, op: IBoxPlotOutlierOpt) => any; +type BoxPlotOutlierOption = IBoxPlotOutlierOpt | (() => IBoxPlotOutlierOpt); +export declare const foldOutlierData: (data: Array, op: BoxPlotOutlierOption) => Record[]; +export {}; diff --git a/packages/vchart-types/types/data/transforms/correlation-center.d.ts b/packages/vchart-types/types/data/transforms/correlation-center.d.ts index 6a5d3439a7..58ba5555da 100644 --- a/packages/vchart-types/types/data/transforms/correlation-center.d.ts +++ b/packages/vchart-types/types/data/transforms/correlation-center.d.ts @@ -1,4 +1,10 @@ -export declare const correlationCenter: (data: any, options: any) => { - [x: string]: any; - [x: number]: any; -}; +type CorrelationCenterOptionValue = T | (() => T); +type CorrelationCenterData = Array<{ + latestData: Array>; +}>; +export interface ICorrelationCenterOpt { + keyword: CorrelationCenterOptionValue; + categoryField: CorrelationCenterOptionValue; +} +export declare const correlationCenter: (data: CorrelationCenterData, options: ICorrelationCenterOpt) => Record | []; +export {}; diff --git a/packages/vchart-types/types/data/transforms/correlation.d.ts b/packages/vchart-types/types/data/transforms/correlation.d.ts index 78f56e207d..44e56b33ac 100644 --- a/packages/vchart-types/types/data/transforms/correlation.d.ts +++ b/packages/vchart-types/types/data/transforms/correlation.d.ts @@ -1,17 +1,20 @@ +type CorrelationOptionValue = T | (() => T); export interface ICorrelationOpt { - field: string; - radiusField?: string; - radiusRange?: [number, number]; - center?: [string | number, string | number]; - startAngle?: number; - endAngle?: number; - innerRadius?: string | number; - outerRadius?: string | number; + view: () => { + x0: number; + x1: number; + y0: number; + y1: number; + }; + field: CorrelationOptionValue; + radiusField?: CorrelationOptionValue; + radiusRange?: CorrelationOptionValue<[number, number] | undefined>; + center?: CorrelationOptionValue<[string | number, string | number] | undefined>; + startAngle?: CorrelationOptionValue; + endAngle?: CorrelationOptionValue; + innerRadius?: CorrelationOptionValue; + outerRadius?: CorrelationOptionValue; } -export interface CircularRelationItem { - x: number; - y: number; - size: number; - datum: any; -} -export declare const correlation: (data: any, options: any) => any; +export type CircularRelationItem = Record; +export declare const correlation: (data: unknown, options: ICorrelationOpt) => unknown; +export {}; diff --git a/packages/vchart-types/types/data/transforms/funnel.d.ts b/packages/vchart-types/types/data/transforms/funnel.d.ts index 1f891fdd31..df438d9e13 100644 --- a/packages/vchart-types/types/data/transforms/funnel.d.ts +++ b/packages/vchart-types/types/data/transforms/funnel.d.ts @@ -1,6 +1,7 @@ import type { DataView } from '@visactor/vdataset'; +type FunnelOptionValue = T | (() => T); export interface IFunnelOpt { - valueField: string; + valueField: FunnelOptionValue; asTransformRatio: string; asReachRatio: string; asHeightRatio: string; @@ -10,12 +11,12 @@ export interface IFunnelOpt { asCurrentValue: string; asLastValue: string; asNextValue: string; - isCone?: boolean; - heightVisual?: boolean; - range?: { - min: number; - max: number; - }; + isCone?: FunnelOptionValue; + heightVisual?: FunnelOptionValue; + range?: FunnelOptionValue<{ + min?: number; + max?: number; + } | undefined>; } export declare const funnel: (originData: Array, op: IFunnelOpt) => { dataSet: import("@visactor/vdataset").DataSet; @@ -43,4 +44,5 @@ export declare const funnel: (originData: Array, op: IFunnelOpt) => { export interface IFunnelTransformOpt { asIsTransformLevel: string; } -export declare const funnelTransform: (originData: Array, op: IFunnelTransformOpt) => any; +export declare const funnelTransform: (originData: Array, op: IFunnelTransformOpt) => Record[]; +export {}; diff --git a/packages/vchart-types/types/data/transforms/lookup.d.ts b/packages/vchart-types/types/data/transforms/lookup.d.ts index 2abb915dee..9aa59e6357 100644 --- a/packages/vchart-types/types/data/transforms/lookup.d.ts +++ b/packages/vchart-types/types/data/transforms/lookup.d.ts @@ -3,10 +3,10 @@ import type { Datum } from '../../typings'; export interface ILookUpOpt { from: () => object[]; key: string; - fields: string; + fields: string | (() => string); values?: string[]; as?: string[]; - default?: any; - set?: (A: Datum, B: Datum) => void; + default?: unknown; + set?: (A: Datum, B?: Datum) => void; } export declare const lookup: (data: Array, opt: ILookUpOpt) => DataView[]; diff --git a/packages/vchart-types/types/data/transforms/map.d.ts b/packages/vchart-types/types/data/transforms/map.d.ts index 2d1f30bb98..395e610ba6 100644 --- a/packages/vchart-types/types/data/transforms/map.d.ts +++ b/packages/vchart-types/types/data/transforms/map.d.ts @@ -1,6 +1,12 @@ import type { GeoSourceType } from '../../typings/geo'; export interface IMapOpt { - nameMap: Record; + nameMap: Record; nameProperty: string; } -export declare const map: (data: GeoSourceType, opt: IMapOpt) => any; +type MapFeature = { + properties?: Record; + [key: string]: unknown; +}; +type MapOption = IMapOpt | (() => IMapOpt); +export declare const map: (data: GeoSourceType, opt: MapOption) => MapFeature[]; +export {}; diff --git a/packages/vchart-types/types/data/transforms/sankey.d.ts b/packages/vchart-types/types/data/transforms/sankey.d.ts index cfa24ccb78..50c0feb076 100644 --- a/packages/vchart-types/types/data/transforms/sankey.d.ts +++ b/packages/vchart-types/types/data/transforms/sankey.d.ts @@ -1,4 +1,4 @@ -import type { SankeyOptions, SankeyData } from '@visactor/vlayouts'; +import { type SankeyOptions, type SankeyData } from '@visactor/vlayouts'; export interface ISankeyOpt extends SankeyOptions { targetField: string; sourceField: string; @@ -10,10 +10,18 @@ export interface ISankeyOpt extends SankeyOptions { y1: number; }; } -export declare const collectHierarchyField: (set: Set, data: any[], field: string) => void; -export declare const sankeyFormat: (data: any[]) => SankeyData[]; -export declare const sankeyLayout: (data: SankeyData[], op: ISankeyOpt) => { +type SankeyLayoutOption = ISankeyOpt | (() => ISankeyOpt); +type SankeyFormatDatum = Record & { + id?: 'links' | 'nodes'; + values?: unknown; + latestData?: SankeyData[]; + children?: SankeyFormatDatum[]; +}; +export declare const collectHierarchyField: (set: Set, data: SankeyFormatDatum[], field: string) => void; +export declare const sankeyFormat: (data: SankeyFormatDatum[]) => SankeyData[]; +export declare const sankeyLayout: (data: SankeyData[], op: SankeyLayoutOption) => { nodes: import("@visactor/vlayouts").SankeyNodeElement[]; links: import("@visactor/vlayouts").SankeyLinkElement[]; columns: import("@visactor/vlayouts").SankeyNodeElement[][]; }[]; +export {}; diff --git a/packages/vchart-types/types/data/transforms/stack-split.d.ts b/packages/vchart-types/types/data/transforms/stack-split.d.ts index ffc69679ae..164f33f837 100644 --- a/packages/vchart-types/types/data/transforms/stack-split.d.ts +++ b/packages/vchart-types/types/data/transforms/stack-split.d.ts @@ -3,4 +3,5 @@ import type { DataView } from '@visactor/vdataset'; export interface IStackOption { fields: string[]; } -export declare const stackSplit: (data: Array, op: IStackOption) => ISeriesStackDataNode; +export type StackOption = IStackOption | (() => IStackOption); +export declare const stackSplit: (data: Array, op: StackOption) => ISeriesStackDataNode; diff --git a/packages/vchart-types/types/data/transforms/treemap.d.ts b/packages/vchart-types/types/data/transforms/treemap.d.ts index e3539af22e..4793a22f0e 100644 --- a/packages/vchart-types/types/data/transforms/treemap.d.ts +++ b/packages/vchart-types/types/data/transforms/treemap.d.ts @@ -1,5 +1,5 @@ -import type { TreemapNodeElement, TreemapOptions } from '@visactor/vlayouts'; -export declare const treemapLayout: (data: Array, op: TreemapOptions & { +import { type TreemapNodeElement, type TreemapOptions } from '@visactor/vlayouts'; +interface ITreemapLayoutOptions extends TreemapOptions { getViewBox: () => { x0: number; x1: number; @@ -7,4 +7,6 @@ export declare const treemapLayout: (data: Array, op: TreemapOptions & { y1: number; }; nameField: string; -}) => TreemapNodeElement[]; +} +export declare const treemapLayout: (data: Array>, op: ITreemapLayoutOptions | (() => ITreemapLayoutOptions)) => TreemapNodeElement[]; +export {}; diff --git a/packages/vchart-types/types/data/transforms/venn.d.ts b/packages/vchart-types/types/data/transforms/venn.d.ts index d07d8c4c80..1ad5f1c53e 100644 --- a/packages/vchart-types/types/data/transforms/venn.d.ts +++ b/packages/vchart-types/types/data/transforms/venn.d.ts @@ -1,4 +1,4 @@ -export declare const vennLayout: (data: Array, op: { +interface IVennLayoutOptions { setField: string; valueField: string; getViewBox: () => { @@ -7,4 +7,6 @@ export declare const vennLayout: (data: Array, op: { y0: number; y1: number; }; -}) => (import("@visactor/vlayouts").IVennCircleDatum | import("@visactor/vlayouts").IVennOverlapDatum)[]; +} +export declare const vennLayout: (data: Array>, op: IVennLayoutOptions | (() => IVennLayoutOptions)) => (import("@visactor/vlayouts").IVennCircleDatum | import("@visactor/vlayouts").IVennOverlapDatum)[]; +export {}; diff --git a/packages/vchart-types/types/data/transforms/waterfall.d.ts b/packages/vchart-types/types/data/transforms/waterfall.d.ts index dbac6f85cf..f67d53c4d3 100644 --- a/packages/vchart-types/types/data/transforms/waterfall.d.ts +++ b/packages/vchart-types/types/data/transforms/waterfall.d.ts @@ -17,7 +17,8 @@ export interface IWaterfallOpt { stackInverse: boolean; groupData: () => DataView; } -export declare const waterfall: (lastData: Array, op: IWaterfallOpt) => Datum[]; +export type WaterfallOption = IWaterfallOpt | (() => IWaterfallOpt); +export declare const waterfall: (lastData: Array, op: WaterfallOption) => Datum[]; export interface IWaterfallFillEndOpt { indexField: string; valueField: string; @@ -25,4 +26,5 @@ export interface IWaterfallFillEndOpt { total: IWaterfallSeriesSpec['total']; calculationMode: IWaterfallSeriesSpec['calculationMode']; } -export declare const waterfallFillTotal: (data: Array, op: IWaterfallFillEndOpt) => Datum[]; +export type WaterfallFillEndOption = IWaterfallFillEndOpt | (() => IWaterfallFillEndOpt); +export declare const waterfallFillTotal: (data: Array, op: WaterfallFillEndOption) => Datum[]; diff --git a/packages/vchart-types/types/event/event.d.ts b/packages/vchart-types/types/event/event.d.ts index 87f654bd27..38d4720dab 100644 --- a/packages/vchart-types/types/event/event.d.ts +++ b/packages/vchart-types/types/event/event.d.ts @@ -4,6 +4,7 @@ export declare class Event implements IEvent { private _eventDispatcher; private _mode; private _composedEventMap; + private _eventHandlerMap; getComposedEventMap(): Map, { eventType: string; event: IComposedEvent; @@ -20,4 +21,7 @@ export declare class Event implements IEvent { }): this; allow(eType: Evt): this; release(): void; + private _addEventHandler; + private _getEventHandler; + private _removeEventHandler; } diff --git a/packages/vchart-types/types/mark/base/base-mark.d.ts b/packages/vchart-types/types/mark/base/base-mark.d.ts index 466387422a..e45db1055e 100644 --- a/packages/vchart-types/types/mark/base/base-mark.d.ts +++ b/packages/vchart-types/types/mark/base/base-mark.d.ts @@ -5,7 +5,7 @@ import { MarkTypeEnum } from '../interface'; import type { IMarkRaw, IMarkStateStyle, IMarkStyle, IMark, IMarkOption, StyleConvert, MarkInputStyle, GroupedData, IAttrs, IMarkGraphic, ProgressiveContext, IProgressiveTransformResult, MarkType, AnimationStateValues } from '../interface'; import type { ICompilableMark, IMarkCompileOption, IMarkConfig, IMarkStateManager, StateValueType } from '../../compile/mark/interface'; import type { ICompilableInitOption } from '../../compile/interface'; -import type { IGroupGraphicAttribute, IGroup, IGraphic } from '@visactor/vrender-core'; +import type { IGroupGraphicAttribute, IGroup, IGraphic, StateDefinitionsInput } from '@visactor/vrender-core'; import { GrammarItem } from '../../compile/grammar-item'; import type { IModel } from '../../model/interface'; import type { ICompilableData } from '../../compile/data/interface'; @@ -74,7 +74,7 @@ export declare class BaseMark extends GrammarItem impleme stopAnimationByState(state?: string): void; pauseAnimationByState(state?: string): void; resumeAnimationByState(state?: string): void; - removeProduct(): void; + removeProduct(releaseDetach?: boolean): void; release(): void; protected _simpleStyle: T; setSimpleStyle(s: T): void; @@ -82,6 +82,10 @@ export declare class BaseMark extends GrammarItem impleme protected _option: IMarkOption; protected _attributeContext: IModelMarkAttributeContext; protected _encoderOfState: Record any>>; + protected _sharedStateDefinitionsCacheKey?: string; + protected _sharedStateDefinitionsCache?: StateDefinitionsInput>; + protected _sharedStateDefinitionRefIds: WeakMap; + protected _sharedStateDefinitionRefId: number; _extensionChannel: { [key: string | number | symbol]: string[]; }; @@ -155,8 +159,14 @@ export declare class BaseMark extends GrammarItem impleme protected _getEncoderOfStyle: (stateName: string, style: Partial>) => Record any>; protected _setGraphicFromMarkConfig: (g: IMarkGraphic) => void; protected _setStateOfGraphic: (g: IMarkGraphic, hasAnimation?: boolean) => void; + protected _getSharedStateDefinitionRefId(value: unknown): string; + protected _getSharedStateDefinitionValueKey(value: unknown): string; + protected _isStaticSharedStateAttribute(stateName: string, key: string): boolean; + protected _applySharedStateDefinitions(): void; protected _addProgressiveGraphic(parent: IGroup, g: IMarkGraphic): void; protected _runEncoder(graphics: IMarkGraphic[], noGroupEncode?: boolean): void; + protected _excludeStateControlledDiffAttrs(g: IMarkGraphic, diffAttrs: Record): Record; + protected _hasDiffAttrs(g: IMarkGraphic): boolean; protected _runApplyGraphic(graphics: IMarkGraphic[]): void; protected _updateEncoderByState(): void; protected _runState(graphics: IMarkGraphic[]): void; diff --git a/packages/vchart-types/types/mark/component.d.ts b/packages/vchart-types/types/mark/component.d.ts index a63a291bd8..3054f93028 100644 --- a/packages/vchart-types/types/mark/component.d.ts +++ b/packages/vchart-types/types/mark/component.d.ts @@ -8,11 +8,20 @@ export declare class ComponentMark extends BaseMark implements ICom type: string; private _componentType; private _component; + private _exitingComponent?; + private _exitingProduct?; private _mode; constructor(name: string, option: IMarkOption); protected _getDefaultStyle(): IMarkStyle; getComponent(): IGraphic>; + private _clearExitingComponent; + private _removeProductAfterExit; + private _registerExitingComponent; + private _unregisterExitingComponent; + private _releaseComponentWithExitAnimation; clearComponent(): void; + releaseWithExitAnimation(): boolean; + forceReleaseExitAnimation(): void; protected _getAttrsFromConfig(attrs?: IGroupGraphicAttribute): IGroupGraphicAttribute; protected _attributesTransform: (attrs: any) => any; setAttributeTransform(t: (attrs: any) => any): void; diff --git a/packages/vchart-types/types/mark/glyph.d.ts b/packages/vchart-types/types/mark/glyph.d.ts index 5ddf1fccf5..13bcb64f50 100644 --- a/packages/vchart-types/types/mark/glyph.d.ts +++ b/packages/vchart-types/types/mark/glyph.d.ts @@ -22,6 +22,9 @@ export declare abstract class GlyphMark Record; protected _channelEncoder: Record Record>; + private _getInheritedStyleAttrs; + private _getInheritedStyleAttrsMap; + private _syncInheritedStyleAttrs; private _onGlyphAttributeUpdate; protected _setStateOfGraphic: (g: IMarkGraphic) => void; protected _createGraphic(attrs?: IGlyphGraphicAttribute): IGraphic; diff --git a/packages/vchart-types/types/mark/interface/mark.d.ts b/packages/vchart-types/types/mark/interface/mark.d.ts index 0d4eaea3c2..dba93d32ce 100644 --- a/packages/vchart-types/types/mark/interface/mark.d.ts +++ b/packages/vchart-types/types/mark/interface/mark.d.ts @@ -6,6 +6,8 @@ import type { MarkType } from './type'; export interface IComponentMark extends IMarkRaw { getComponent: () => IGraphic; clearComponent: () => void; + releaseWithExitAnimation: () => boolean; + forceReleaseExitAnimation: () => void; setAttributeTransform: (t: (attrs: any) => any) => any; } export interface IGlyphMark extends IMarkRaw { diff --git a/packages/vchart-types/types/model/base-model.d.ts b/packages/vchart-types/types/model/base-model.d.ts index 9e65321d0e..e6cc34d7d4 100644 --- a/packages/vchart-types/types/model/base-model.d.ts +++ b/packages/vchart-types/types/model/base-model.d.ts @@ -1,5 +1,5 @@ import type { IEvent } from '../event/interface'; -import type { IEffect, IModel, IModelInitOption, IModelOption, IModelEvaluateOption, IModelSpec, IModelMarkInfo, IModelSpecInfo } from './interface'; +import type { IEffect, IModel, IModelInitOption, IModelOption, IModelEvaluateOption, IModelSpec, IModelMarkInfo, IModelSpecInfo, IUpdateSpecResult } from './interface'; import type { CoordinateType } from '../typings/coordinate'; import type { AnimationStateValues, ICompileMarkConfig, IMark, IMarkGraphic, IMarkOption, IMarkRaw, IMarkStyle } from '../mark/interface'; import type { Datum, StateValueType, ConvertToMarkStyleSpec, ICommonSpec, StringOrNumber, IRect, ILayoutRect } from '../typings'; @@ -50,20 +50,8 @@ export declare abstract class BaseModel extends Compilable beforeRelease(): void; clear(): void; release(): void; - updateSpec(spec: T): { - change: boolean; - reMake: boolean; - reRender: boolean; - reSize: boolean; - reCompile: boolean; - }; - protected _compareSpec(spec: T, prevSpec: T): { - change: boolean; - reMake: boolean; - reRender: boolean; - reSize: boolean; - reCompile: boolean; - }; + updateSpec(spec: T): IUpdateSpecResult; + protected _compareSpec(spec: T, prevSpec: T): IUpdateSpecResult; reInit(spec?: T): void; updateLayoutAttribute(): void; setAttrFromSpec(): void; diff --git a/packages/vchart-types/types/model/interface.d.ts b/packages/vchart-types/types/model/interface.d.ts index 745dfaa998..de17cdcd32 100644 --- a/packages/vchart-types/types/model/interface.d.ts +++ b/packages/vchart-types/types/model/interface.d.ts @@ -33,6 +33,18 @@ export interface IModelRenderOption { export interface IEffect { [key: string]: (e?: any) => any; } +export interface IUpdateSpecEffects { + remake?: boolean; + compile?: boolean; + render?: boolean; + layout?: boolean; + data?: boolean; + scaleDomain?: boolean; + series?: boolean; + component?: boolean; + animation?: boolean; + localOnly?: boolean; +} export interface IMarkTreeGroup extends Partial> { type: 'group'; name: string; @@ -46,6 +58,7 @@ export interface IUpdateSpecResult { reSize?: boolean; reCompile?: boolean; reTransformSpec?: boolean; + effects?: IUpdateSpecEffects; reAnimate?: boolean; changeTheme?: boolean; changeBackground?: boolean; diff --git a/packages/vchart-types/types/plugin/components/tooltip-handler/canvas-tooltip-handler.d.ts b/packages/vchart-types/types/plugin/components/tooltip-handler/canvas-tooltip-handler.d.ts index eae26fe12e..fe0516b2c9 100644 --- a/packages/vchart-types/types/plugin/components/tooltip-handler/canvas-tooltip-handler.d.ts +++ b/packages/vchart-types/types/plugin/components/tooltip-handler/canvas-tooltip-handler.d.ts @@ -1,9 +1,9 @@ import { BaseTooltipHandler } from './base'; -import { Tooltip as TooltipComponent } from '@visactor/vrender-components'; +import { Tooltip as TooltipComponent } from '@visactor/vrender-components/tooltip'; import type { TooltipHandlerParams } from '../../../component/tooltip'; import type { IComponentPluginService } from '../interface'; import type { ITooltipActual } from '../../../typings'; -import type { IContainerSize } from '@visactor/vrender-components'; +import type { IContainerSize } from '@visactor/vrender-components/tooltip/type'; import type { ITooltipAttributes } from './interface'; export declare class CanvasTooltipHandler extends BaseTooltipHandler { static readonly type: string; diff --git a/packages/vchart-types/types/region/region.d.ts b/packages/vchart-types/types/region/region.d.ts index b7459db530..d9d737371b 100644 --- a/packages/vchart-types/types/region/region.d.ts +++ b/packages/vchart-types/types/region/region.d.ts @@ -39,13 +39,7 @@ export declare class Region extends LayoutM initMark(): void; protected _initBackgroundMarkStyle(): void; protected _initForegroundMarkStyle(): void; - _compareSpec(spec: T, prevSpec: T): { - change: boolean; - reMake: boolean; - reRender: boolean; - reSize: boolean; - reCompile: boolean; - }; + _compareSpec(spec: T, prevSpec: T): import("../model/interface").IUpdateSpecResult; reInit(spec?: T): void; addSeries(s: ISeries): void; removeSeries(s: ISeries): void; diff --git a/packages/vchart-types/types/scale/color-ordinal-scale.d.ts b/packages/vchart-types/types/scale/color-ordinal-scale.d.ts index aa0c5e0f71..437f30e459 100644 --- a/packages/vchart-types/types/scale/color-ordinal-scale.d.ts +++ b/packages/vchart-types/types/scale/color-ordinal-scale.d.ts @@ -2,6 +2,7 @@ import { OrdinalScale } from '@visactor/vscale'; import type { ColorSchemeItem, ProgressiveDataScheme } from '../theme/color-scheme/interface'; export declare class ColorOrdinalScale extends OrdinalScale { protected _range: Array | ProgressiveDataScheme; + setSpecified(value?: Record): this; range(value?: Array | ProgressiveDataScheme): this | any; domain(value?: any[]): this | any; protected _resetRange(): void; diff --git a/packages/vchart-types/types/series/area/area.d.ts b/packages/vchart-types/types/series/area/area.d.ts index 2f73cbd6e0..98b40d71c8 100644 --- a/packages/vchart-types/types/series/area/area.d.ts +++ b/packages/vchart-types/types/series/area/area.d.ts @@ -7,6 +7,7 @@ import { SeriesTypeEnum } from '../interface/type'; import type { IAreaSeriesSpec, IAreaSeriesTheme } from './interface'; import type { IMark, IAreaMark } from '../../mark/interface'; import { AreaSeriesSpecTransformer } from './area-transformer'; +import type { ISeriesSpecUpdatePolicy } from '../base/base-series'; export interface AreaSeries extends Pick, CartesianSeries { } export declare class AreaSeries extends CartesianSeries { @@ -18,6 +19,7 @@ export declare class AreaSeries ext readonly transformerConstructor: typeof AreaSeriesSpecTransformer; protected _areaMark: IAreaMark; protected _sortDataByAxis: boolean; + protected _getSpecUpdatePolicy(): ISeriesSpecUpdatePolicy; initMark(): void; initMarkStyle(): void; initAreaMarkStyle(): void; diff --git a/packages/vchart-types/types/series/bar/bar.d.ts b/packages/vchart-types/types/series/bar/bar.d.ts index bedaf9ddb1..0fece56737 100644 --- a/packages/vchart-types/types/series/bar/bar.d.ts +++ b/packages/vchart-types/types/series/bar/bar.d.ts @@ -1,5 +1,6 @@ import type { IBaseScale } from '@visactor/vscale'; import { CartesianSeries } from '../cartesian/cartesian'; +import type { ISeriesSpecUpdatePolicy } from '../base/base-series'; import type { IMark, IRectMark, ITextMark } from '../../mark/interface'; import type { Datum, DirectionType } from '../../typings'; import type { IBarSeriesSpec, IBarSeriesTheme } from './interface'; @@ -24,9 +25,11 @@ export declare class BarSeries extend protected _barMark: IRectMark; protected _barBackgroundMark: IRectMark; protected _barBackgroundViewData: ICompilableData; + protected _getSpecUpdatePolicy(): ISeriesSpecUpdatePolicy; initMark(): void; protected _initBarBackgroundMark(): void; initMarkStyle(): void; + protected initRectMarkStyle(): void; initLabelMarkStyle(textMark: ITextMark): void; protected initTooltip(): void; protected _statisticViewData(): void; diff --git a/packages/vchart-types/types/series/base/base-series.d.ts b/packages/vchart-types/types/series/base/base-series.d.ts index 7429f73660..6bd5e5f3b6 100644 --- a/packages/vchart-types/types/series/base/base-series.d.ts +++ b/packages/vchart-types/types/series/base/base-series.d.ts @@ -16,6 +16,14 @@ import type { StatisticOperations } from '../../data/transforms/interface'; import type { GraphicEventType } from '@visactor/vrender-core'; import type { ICompilableData } from '../../compile/data'; import type { IBaseTriggerOptions } from '../../interaction/interface/trigger'; +export interface ISeriesSpecUpdatePolicy { + compileOnlyKeys?: Record; + dataRelatedKeys?: Record; + compileOnlySubKeys?: Record>; + seriesOnlyKeys?: Record; +} +export declare function markSeriesCompileEffect(compareResult: IUpdateSpecResult, dataRelated?: boolean): void; +export declare function markSeriesOnlyEffect(compareResult: IUpdateSpecResult): void; export declare abstract class BaseSeries extends BaseModel implements ISeries { readonly specKey: string; readonly type: string; @@ -162,6 +170,7 @@ export declare abstract class BaseSeries extends BaseMode initSeriesStyleState(): void; afterInitMark(): void; getMarksWithoutRoot(): IMark[]; + protected _getMarkSpecNamesForCompare(): string[]; getMarksInType(type: string | string[]): IMark[]; getMarkInName(name: string): IMark | undefined; getMarkInId(markId: number): IMark | undefined; @@ -170,13 +179,8 @@ export declare abstract class BaseSeries extends BaseMode protected initTooltip(): void; _compareExtensionMarksSpec(newMarks: (IExtensionMarkSpec> | IExtensionGroupMarkSpec)[], prevMarks: (IExtensionMarkSpec> | IExtensionGroupMarkSpec)[], compareResult: IUpdateSpecResult): void; _compareLabelSpec(newLabels: ILabelSpec[], prevLabels: ILabelSpec[], compareResult: IUpdateSpecResult): void; - _compareSpec(spec: T, prevSpec: T, ignoreCheckKeys?: Record): { - change: boolean; - reMake: boolean; - reRender: boolean; - reSize: boolean; - reCompile: boolean; - }; + protected _getSpecUpdatePolicy(): ISeriesSpecUpdatePolicy; + _compareSpec(spec: T, prevSpec: T, ignoreCheckKeys?: Record): IUpdateSpecResult; _updateSpecData(): void; reInit(spec?: T): void; onEvaluateEnd(ctx: IModelEvaluateOption): void; diff --git a/packages/vchart-types/types/series/base/constant.d.ts b/packages/vchart-types/types/series/base/constant.d.ts index ab26bd5772..22a36bf512 100644 --- a/packages/vchart-types/types/series/base/constant.d.ts +++ b/packages/vchart-types/types/series/base/constant.d.ts @@ -10,3 +10,6 @@ export declare const defaultSeriesIgnoreCheckKeys: { export declare const defaultSeriesCompileCheckKeys: { [key: string]: true; }; +export declare const defaultSeriesCompileOnlyCheckKeys: { + [key: string]: true; +}; diff --git a/packages/vchart-types/types/series/box-plot/box-plot.d.ts b/packages/vchart-types/types/series/box-plot/box-plot.d.ts index ef0f2ce81c..58c162447a 100644 --- a/packages/vchart-types/types/series/box-plot/box-plot.d.ts +++ b/packages/vchart-types/types/series/box-plot/box-plot.d.ts @@ -8,6 +8,7 @@ import { DataView } from '@visactor/vdataset'; import type { IMark, ITextMark } from '../../mark/interface'; import type { ICompilableData } from '../../compile/data'; import { BoxPlotSeriesSpecTransformer } from './box-plot-transformer'; +import type { ISeriesSpecUpdatePolicy } from '../base/base-series'; export declare const DEFAULT_FILL_COLOR = "#FFF"; export declare const DEFAULT_STROKE_COLOR = "#000"; export declare class BoxPlotSeries extends CartesianSeries { @@ -46,6 +47,7 @@ export declare class BoxPlotSeries extend setHighLightSeriesGroup(field: string): void; protected _gridBackground?: IFillMarkSpec; setGridBackground(gridBackground: IFillMarkSpec): void; + protected _getSpecUpdatePolicy(): { + compileOnlyKeys: { + highLightSeriesGroup: true; + titleField: true; + subTitleField: true; + }; + compileOnlySubKeys: { + grid: Record<"background", true>; + }; + dataRelatedKeys?: Record; + seriesOnlyKeys?: Record; + }; initData(): void; getStatisticFields(): { key: string; diff --git a/packages/vchart-types/types/series/heatmap/heatmap.d.ts b/packages/vchart-types/types/series/heatmap/heatmap.d.ts index 194847104d..52981ba48d 100644 --- a/packages/vchart-types/types/series/heatmap/heatmap.d.ts +++ b/packages/vchart-types/types/series/heatmap/heatmap.d.ts @@ -5,6 +5,7 @@ import type { SeriesMarkMap } from '../interface'; import { SeriesTypeEnum } from '../interface/type'; import type { ICellMark, IMark, ITextMark } from '../../mark/interface'; import { HeatmapSeriesSpecTransformer } from './heatmap-transformer'; +import type { ISeriesSpecUpdatePolicy } from '../base/base-series'; export declare const DefaultBandWidth = 6; export declare class HeatmapSeries extends CartesianSeries { static readonly type: string; @@ -20,6 +21,7 @@ export declare class HeatmapSeries any; shapeType: string; diff --git a/packages/vchart-types/types/series/line/line.d.ts b/packages/vchart-types/types/series/line/line.d.ts index a4c9055918..6411cd0647 100644 --- a/packages/vchart-types/types/series/line/line.d.ts +++ b/packages/vchart-types/types/series/line/line.d.ts @@ -6,6 +6,7 @@ import type { Datum } from '../../typings'; import type { ILineSeriesSpec } from './interface'; import type { IMark } from '../../mark/interface'; import { LineLikeSeriesSpecTransformer } from '../mixin/line-mixin-transformer'; +import type { ISeriesSpecUpdatePolicy } from '../base/base-series'; export interface LineSeries extends Pick, CartesianSeries { } export declare class LineSeries extends CartesianSeries { @@ -18,6 +19,7 @@ export declare class LineSeries ext static readonly transformerConstructor: typeof LineLikeSeriesSpecTransformer; readonly transformerConstructor: typeof LineLikeSeriesSpecTransformer; protected _sortDataByAxis: boolean; + protected _getSpecUpdatePolicy(): ISeriesSpecUpdatePolicy; compile(): void; initMark(): void; protected initTooltip(): void; diff --git a/packages/vchart-types/types/series/mixin/line-mixin.d.ts b/packages/vchart-types/types/series/mixin/line-mixin.d.ts index 3659b5e3d4..7bb820e57a 100644 --- a/packages/vchart-types/types/series/mixin/line-mixin.d.ts +++ b/packages/vchart-types/types/series/mixin/line-mixin.d.ts @@ -7,6 +7,7 @@ import type { DimensionEventParams } from '../../event/events/dimension'; import type { IRegion } from '../../region/interface'; import type { ILineLikeSeriesTheme } from './interface'; import type { ICompilableData } from '../../compile/data'; +export declare const LINE_LIKE_SERIES_DATA_RELATED_KEYS: Record; export interface LineLikeSeriesMixin extends ISeries { _spec: any; _option: ISeriesOption; diff --git a/packages/vchart-types/types/series/pie/pie.d.ts b/packages/vchart-types/types/series/pie/pie.d.ts index f9b02a2684..641b986e39 100644 --- a/packages/vchart-types/types/series/pie/pie.d.ts +++ b/packages/vchart-types/types/series/pie/pie.d.ts @@ -1,5 +1,6 @@ import type { IPoint, Datum, StateValueType } from '../../typings'; import { PolarSeries } from '../polar/polar'; +import type { ISeriesSpecUpdatePolicy } from '../base/base-series'; import type { IArcMark, IMark, IPathMark, ITextMark } from '../../mark/interface'; import type { IArcSeries, SeriesMarkMap } from '../interface'; import { SeriesTypeEnum } from '../interface/type'; @@ -56,15 +57,10 @@ export declare class BasePieSeries extends PolarSe getInnerRadius(state?: StateValueType): number; computeRadius(r: number, k?: number): number; computeDatumRadius(datum: Datum, state?: string): number; + protected _getSpecUpdatePolicy(): ISeriesSpecUpdatePolicy; _compareSpec(spec: T, prevSpec: T, ignoreCheckKeys?: { [key: string]: true; - }): { - change: boolean; - reMake: boolean; - reRender: boolean; - reSize: boolean; - reCompile: boolean; - }; + }): import("../..").IUpdateSpecResult; computeDatumInnerRadius(datum: Datum, state?: string): number; dataToPosition(datum: Datum, checkInViewData?: boolean): IPoint | null; dataToCentralPosition: (datum: Datum) => IPoint | null; diff --git a/packages/vchart-types/types/series/polar/progress-like/progress-like.d.ts b/packages/vchart-types/types/series/polar/progress-like/progress-like.d.ts index 2b45b17809..4d9233f6a7 100644 --- a/packages/vchart-types/types/series/polar/progress-like/progress-like.d.ts +++ b/packages/vchart-types/types/series/polar/progress-like/progress-like.d.ts @@ -4,11 +4,13 @@ import { PolarSeries } from '../polar'; import type { IContinuousTickData, IProgressLikeSeriesSpec } from './interface'; import type { IPolarAxis } from '../../../component/axis'; import type { SeriesMarkMap } from '../../interface'; +import type { ISeriesSpecUpdatePolicy } from '../../base/base-series'; export declare abstract class ProgressLikeSeries extends PolarSeries { static readonly mark: SeriesMarkMap; protected _startAngle: number; protected _endAngle: number; protected _arcGroupMark: IGroupMark | null; + protected _getSpecUpdatePolicy(): ISeriesSpecUpdatePolicy; setAttrFromSpec(): void; getStackGroupFields(): string[]; getStackValueField(): string; diff --git a/packages/vchart-types/types/series/polar/rose-like/rose-like.d.ts b/packages/vchart-types/types/series/polar/rose-like/rose-like.d.ts index 2128fb5eb0..73217cc8eb 100644 --- a/packages/vchart-types/types/series/polar/rose-like/rose-like.d.ts +++ b/packages/vchart-types/types/series/polar/rose-like/rose-like.d.ts @@ -1,6 +1,8 @@ import { PolarSeries } from '../polar'; import type { IRoseLikeSeriesSpec } from './interface'; +import type { ISeriesSpecUpdatePolicy } from '../../base/base-series'; export declare abstract class RoseLikeSeries extends PolarSeries { + protected _getSpecUpdatePolicy(): ISeriesSpecUpdatePolicy; getStackGroupFields(): string[]; getStackValueField(): string; getGroupFields(): string[]; diff --git a/packages/vchart-types/types/series/progress/circular/circular.d.ts b/packages/vchart-types/types/series/progress/circular/circular.d.ts index 27bcdfb172..2feaf5ade2 100644 --- a/packages/vchart-types/types/series/progress/circular/circular.d.ts +++ b/packages/vchart-types/types/series/progress/circular/circular.d.ts @@ -1,6 +1,7 @@ import type { Datum } from '../../../typings'; import type { SeriesMarkMap } from '../../interface'; import { SeriesTypeEnum } from '../../interface/type'; +import type { ISeriesSpecUpdatePolicy } from '../../base/base-series'; import type { ICircularProgressSeriesSpec } from './interface'; import { ProgressLikeSeries } from '../../polar/progress-like/progress-like'; import type { IMark } from '../../../mark/interface'; @@ -16,6 +17,7 @@ export declare class CircularProgressSeries extends CartesianSeries { static readonly type: string; type: SeriesTypeEnum; @@ -12,6 +13,7 @@ export declare class LinearProgressSeries extends BarSeries { static readonly type: string; @@ -24,6 +25,7 @@ export declare class WaterfallSeries void; +export declare const addGraphicState: (graphic: IMarkGraphic, state: string, keepCurrentStates?: boolean, hasAnimation?: boolean) => void; +export declare const removeGraphicState: (graphic: IMarkGraphic, state: string | string[], hasAnimation?: boolean) => void; diff --git a/packages/vchart-types/types/util/math.d.ts b/packages/vchart-types/types/util/math.d.ts index 6cb89a64b1..d0ebf75d58 100644 --- a/packages/vchart-types/types/util/math.d.ts +++ b/packages/vchart-types/types/util/math.d.ts @@ -1,7 +1,7 @@ import type { IBoundsLike } from '@visactor/vutils'; import type { IPoint } from '../typings'; import { isNumberClose, isGreater, isLess, normalizeAngle } from '@visactor/vutils'; -import { angleLabelOrientAttribute } from '@visactor/vrender-components'; +import { angleLabelOrientAttribute } from '@visactor/vrender-components/axis/util'; export declare const isClose: typeof isNumberClose; export { isGreater, isLess, normalizeAngle, angleLabelOrientAttribute }; export declare function normalizeStartEndAngle(start: number | null, end: number | null): { diff --git a/packages/vchart-types/types/vchart-line.d.ts b/packages/vchart-types/types/vchart-line.d.ts new file mode 100644 index 0000000000..0c2f41202e --- /dev/null +++ b/packages/vchart-types/types/vchart-line.d.ts @@ -0,0 +1,4 @@ +import { VChart } from './core'; +export * from './core'; +export { VChart }; +export default VChart; diff --git a/packages/vchart-types/types/vchart-simple.d.ts b/packages/vchart-types/types/vchart-simple.d.ts index 0c2f41202e..a0212d8e5f 100644 --- a/packages/vchart-types/types/vchart-simple.d.ts +++ b/packages/vchart-types/types/vchart-simple.d.ts @@ -1,4 +1,8 @@ -import { VChart } from './core'; +import { VChart as BaseVChart } from './core'; +import type { IInitOption, ISpec } from './typings'; export * from './core'; +declare class VChart extends BaseVChart { + constructor(spec: ISpec, options: IInitOption); +} export { VChart }; export default VChart; diff --git a/packages/vchart/CHANGELOG.json b/packages/vchart/CHANGELOG.json index 4cd61dc7b7..ccafeb5569 100644 --- a/packages/vchart/CHANGELOG.json +++ b/packages/vchart/CHANGELOG.json @@ -1,6 +1,52 @@ { "name": "@visactor/vchart", "entries": [ + { + "version": "2.1.0", + "tag": "@visactor/vchart_v2.1.0", + "date": "Tue, 23 Jun 2026 08:17:08 GMT", + "comments": { + "none": [ + { + "comment": "update changes for 009-fix-map-roam-pointer-drag: This plan fixes a map roam drag bug where mobile browsers lose stable vertical dragging after supportsTouchEvents is forced to false" + }, + { + "comment": "feat: markLine expandDistancesupport callback. close#4568" + }, + { + "comment": "fix: waterfall lead line bug. fix#4580" + }, + { + "comment": "fix: vchart relayout api not work bug. fix#4537" + }, + { + "comment": "fix: label not follow when drag. fix#4547" + }, + { + "comment": "fix: prcoess render error. fix#4578" + } + ], + "minor": [ + { + "comment": "feat: support function type for `maxRow` / `maxCol` of the discrete legend, evaluated during layout against the legend's allocated rect, so the row / column count can adapt to the available space" + } + ], + "patch": [ + { + "comment": "fix: preserve discrete legend filtering after updateSpec when `legends.data` is a callback (Issue #4566)" + }, + { + "comment": "fix: re-nice the cartesian linear axis with the real plot-area length after layout when `tick.tickCount` is a function, so the length-based tick count and nice ceiling match the final plot area instead of the pre-layout chart viewRect" + }, + { + "comment": "refactor: introduce scoped updateSpec effects to make chart, component, series, data, layout, render, and animation update ranges explicit; local component updates such as marker exit, title text, legend appearance, axis appearance, mark style, field, label, animation, and layout-related series changes now avoid unnecessary chart remake/recompile paths when the existing chart model can be updated in place" + }, + { + "comment": "refactor: align VChart with the VRender 1.1.0 app-scoped runtime, state resolver, and animation contracts while keeping standard VChart spec usage compatible; consolidate mark shared-state handling, glyph sub-graphic state isolation, word-cloud scaleIn initialization, and interaction-state behavior for Sankey, brush, legend textures, marker rich text, and circular progress tick masks" + } + ] + } + }, { "version": "2.0.21", "tag": "@visactor/vchart_v2.0.21", diff --git a/packages/vchart/CHANGELOG.md b/packages/vchart/CHANGELOG.md index ea3824be99..3fc762ff0d 100644 --- a/packages/vchart/CHANGELOG.md +++ b/packages/vchart/CHANGELOG.md @@ -1,13 +1,32 @@ # Change Log - @visactor/vchart -This log was last generated on Mon, 13 Apr 2026 12:57:51 GMT and should not be manually modified. +This log was last generated on Tue, 23 Jun 2026 08:17:08 GMT and should not be manually modified. -## 2.0.21 -Mon, 13 Apr 2026 12:57:51 GMT -This log was last generated on Mon, 13 Apr 2026 12:34:47 GMT and should not be manually modified. +## 2.1.0 +Tue, 23 Jun 2026 08:17:08 GMT + +### Minor changes + +- feat: support function type for `maxRow` / `maxCol` of the discrete legend, evaluated during layout against the legend's allocated rect, so the row / column count can adapt to the available space + +### Patches + +- fix: preserve discrete legend filtering after updateSpec when `legends.data` is a callback (Issue #4566) +- fix: re-nice the cartesian linear axis with the real plot-area length after layout when `tick.tickCount` is a function, so the length-based tick count and nice ceiling match the final plot area instead of the pre-layout chart viewRect +- refactor: introduce scoped updateSpec effects to make chart, component, series, data, layout, render, and animation update ranges explicit; local component updates such as marker exit, title text, legend appearance, axis appearance, mark style, field, label, animation, and layout-related series changes now avoid unnecessary chart remake/recompile paths when the existing chart model can be updated in place +- refactor: align VChart with the VRender 1.1.0 app-scoped runtime, state resolver, and animation contracts while keeping standard VChart spec usage compatible; consolidate mark shared-state handling, glyph sub-graphic state isolation, word-cloud scaleIn initialization, and interaction-state behavior for Sankey, brush, legend textures, marker rich text, and circular progress tick masks + +### Updates + +- update changes for 009-fix-map-roam-pointer-drag: This plan fixes a map roam drag bug where mobile browsers lose stable vertical dragging after supportsTouchEvents is forced to false +- feat: markLine expandDistancesupport callback. close#4568 +- fix: waterfall lead line bug. fix#4580 +- fix: vchart relayout api not work bug. fix#4537 +- fix: label not follow when drag. fix#4547 +- fix: prcoess render error. fix#4578 ## 2.0.21 -Mon, 13 Apr 2026 12:34:47 GMT +Mon, 13 Apr 2026 12:57:51 GMT ### Patches diff --git a/packages/vchart/dist/index-wx-simple.min.js b/packages/vchart/dist/index-wx-simple.min.js index 665a2e52a7..e9309dc8f2 100644 --- a/packages/vchart/dist/index-wx-simple.min.js +++ b/packages/vchart/dist/index-wx-simple.min.js @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var 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 s,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(s=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",s["mobile-browser"]="mobile-browser",s.node="node",s.worker="worker",s.miniApp="miniApp",s.wx="wx",s.tt="tt",s.harmony="harmony",s["desktop-miniApp"]="desktop-miniApp",s.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new s(n,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},o.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,r=n.length,a=new Array(r);sObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var u=t=>"function"==typeof t;var d=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>S(t)&&Number.isFinite(t);var w=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var k=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var M=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(M(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var O=(t,e,i)=>{const n=y(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let n;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const s=_(t),r=t.length;n=s?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=s?void 0:Object.keys(Object(t));let o=-1;if(n)for(;++o<(a||t).length;){const s=a?a[o]:o,r=t[s];i&&i.includes(s.toString())?n[s]=r:n[s]=I(r,e,i)}return n}function L(t,e,i=!1,n=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),r=[];for(const t in s)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(s[a])||"object"!=typeof s[a]||n&&_(t[a])?F(t,a,s[a]):D(t,e,a,i,n)}}}}function D(t,e,i,n=!1,s=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(n)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const s=t[n];let r=!1;e.forEach((t=>{(y(t)&&t===n||t instanceof RegExp&&n.match(t))&&(r=!0)})),r||(i[n]=s)})),i}function U(t){return Object.prototype.toString.call(t)}function H(t){return Object.keys(t)}function z(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(U(t)!==U(e))return!1;if(u(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let n=t.length-1;n>=0;n--)if(!z(t[n],e[n],i))return!1;return!0}if(!m(t))return!1;const n=H(t),s=H(e);if(n.length!==s.length)return!1;n.sort(),s.sort();for(let t=n.length-1;t>=0;t--)if(n[t]!=s[t])return!1;for(let s=n.length-1;s>=0;s--){const r=n[s];if(!z(t[r],e[r],i))return!1}return!0}function V(t,e,i){const n=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let s=0;s{var i;if(0===t.length)return;let n=t[0];for(let s=1;s0&&(n=r)}return n},$=(t,e)=>{var i;if(0===t.length)return;let n=t[0];for(let s=1;se?1:t>=e?0:NaN}function J(t){return Number(t)}const Q="undefined"!=typeof console;function tt(t,e,i){const n=[e].concat([].slice.call(i));Q&&console[t].apply(console,n)}var et;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(et||(et={}));class it{static getInstance(t,e){return it._instance&&S(t)?it._instance.level(t):it._instance||(it._instance=new it(t,e)),it._instance}static setInstance(t){return it._instance=t}static setInstanceLevel(t){it._instance?it._instance.level(t):it._instance=new it(t)}static clearInstance(){it._instance=null}constructor(t=et.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=et.Info}canLogDebug(){return this._level>=et.Debug}canLogError(){return this._level>=et.Error}canLogWarn(){return this._level>=et.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=et.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):tt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=et.Warn&&tt(this._method||"warn","WARN",t),this}info(...t){return this._level>=et.Info&&tt(this._method||"log","INFO",t),this}debug(...t){return this._level>=et.Debug&&tt(this._method||"log","DEBUG",t),this}}function nt(t,e,i=0,n){for(d(n)&&(n=t.length);i>>1;Z(t[s],e)>0?n=s:i=s+1}return i}it._instance=null;const st=1e-10,rt=1e-10;function at(t,e,i=rt,n=st){const s=n,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(s,r)}function ot(t,e,i,n){return t>e&&!at(t,e,i,n)}function lt(t,e,i,n){return t{let e=null,i=null;return(...n)=>(e&&n.every(((t,i)=>t===e[i]))||(e=n,i=t(...n)),i)};var ct=function(t,e,i){return ti?i:t};var ut=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function dt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let pt=!1;try{pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){pt=!1}function gt(t,e,i){let n,s,r,a,o,l,h=0,c=!1,u=!1,d=!0;const p=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||u&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,n=e-(t-l);return u?Math.min(n,r-i):n}(t))}function _(t){return o=void 0,d&&n?f(t):(n=s=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(n=t,s=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(u)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,u="maxWait"in i,u&&(r=Math.max(A(i.maxWait)?i.maxWait:0,e)),d="trailing"in i?!!i.trailing:d),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,n=l=s=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function ft(t,e,i){let n=!0,s=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(n="leading"in i?!!i.leading:n,s="trailing"in i?!!i.trailing:s),gt(t,e,{leading:n,trailing:s,maxWait:e})}function mt(t,e){return i=>t*(1-i)+e*i}function vt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const yt=1e-12,_t=Math.PI,bt=_t/2,xt=2*_t,St=2*Math.PI,At=Math.abs,wt=Math.atan2,kt=Math.cos,Tt=Math.max,Ct=Math.min,Mt=Math.sin,Bt=Math.sqrt,Et=Math.pow;function Ot(t){return t>=1?bt:t<=-1?-bt:Math.asin(t)}function Rt(t,e,i,n,s){let r=i,a=n;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function Pt(t,e){return t[0]*e[1]-t[1]*e[0]}function It(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Lt(t,e){return function(t,e=10){return Math.round(t*e)/e}(t-e,10**Math.max(It(t),It(e)))}class Dt{constructor(t=0,e=0,i,n){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Dt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class Ft{static distancePP(t,e){return Bt(Et(t.x-e.x,2)+Et(t.y-e.y,2))}static distanceNN(t,e,i,n){return Bt(Et(t-i,2)+Et(e-n,2))}static distancePN(t,e,i){return Bt(Et(e-t.x,2)+Et(i-t.y,2))}static pointAtPP(t,e,i){return new Dt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function jt(t){return t*(Math.PI/180)}const Nt=(t=0)=>{if(t<0)for(;t<-xt;)t+=xt;else if(t>0)for(;t>xt;)t-=xt;return t};function Ut(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function Ht(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function zt(t,e,i,n){const{x:s,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const n=Ht(Math.min(t,e)),s=n+i,r=[n,s];let a=Math.floor(n/Math.PI)*Math.PI/2;for(;an&&r.push(a),a+=Math.PI/2;return r}(i,n),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-s):-1===i?h.push(s):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-s)/i)):h.push(Math.abs(s/i)))})),Math.min.apply(null,h)}function Vt(t){return(t=Ht(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function Wt(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function Gt(t,e,i,n){if(!function(t,e,i,n){let s=t[0],r=e[0],a=i[0],o=n[0];return r=0&&h<=1&&[t[0]+s[0]*h,t[1]+s[1]*h]}var Yt;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(Yt||(Yt={}));const Xt=(t,e,i)=>{let n=t.x1,s=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(n>s&&([n,s]=[s,n]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function $t(t,e,i){if(t&&e){if(!i)return!(t.x1>e.x2||t.x2e.y2||t.y2l||sc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let n=e.x1,s=e.x2,r=e.y1,a=e.y2;return n>s&&([n,s]=[s,n]),r>a&&([r,a]=[a,r]),t.x>=n&&t.x<=s&&t.y>=r&&t.y<=a}function qt(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Zt({x:t,y:e},i,n={x:0,y:0}){return{x:(t-n.x)*Math.cos(i)-(e-n.y)*Math.sin(i)+n.x,y:(t-n.x)*Math.sin(i)+(e-n.y)*Math.cos(i)+n.y}}function Jt(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Qt(t,e){const i=e?jt(t.angle):t.angle,n=Jt(t);return[Zt({x:t.x1,y:t.y1},i,n),Zt({x:t.x2,y:t.y1},i,n),Zt({x:t.x2,y:t.y2},i,n),Zt({x:t.x1,y:t.y2},i,n)]}function te(t,e,i=!1){const n=Qt(t,i),s=Qt(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Jt(t),Jt(e)),o=r(n[0],n[1]),l=r(n[1],n[2]),h=r(s[0],s[1]),c=r(s[1],s[2]),u=i?jt(t.angle):t.angle;let d=i?jt(90-t.angle):t.angle+bt;const p=i?jt(e.angle):e.angle;let g=i?jt(90-e.angle):e.angle+bt;d>St&&(d-=St),g>St&&(g-=St);const f=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(qt(s,i)+qt(s,n))/2>qt(s,a)};return f((t.x2-t.x1)/2,u,h,c)&&f((t.y2-t.y1)/2,d,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}function ee(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}const ie=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};function ne(t,e={},i){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")}class se{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=ne(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:u,textBaseline:d=(null!=u?u:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:d,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(d(t))return{width:0,height:0};if(d(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:n,lineHeight:s}=this.textSpec;return{width:i.width,height:null!==(e=s)&&void 0!==e?e:n,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=s)&&void 0!==i?i:n)+1)+1}}return e(t.toString())}_measureNumberChar(){if(d(this._numberCharSize)){const t=this._standardMethod(se.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/se.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(se.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(se.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/se.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}se.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",se.NUMBERS_CHAR_SET="0123456789",se.FULL_SIZE_CHAR="字";const re=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),ae=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function n(t,e,i){const n=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...n),max:Math.max(...n)}}let s=0;for(const r of i){const i=n(t,r.x,r.y),a=n(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(t=0,e=0,i=0,n=0){const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return oe(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*n-l*s+h,l*n+o*s+c,o*n-l*a+h,l*n+o*a+c,o*r-l*s+h,l*r+o*s+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,n){const{x1:s,y1:r,x2:a,y2:o}=this;return[t*s+(1-t)*i,e*r+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class he extends le{}class ce extends le{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return te(this,t)}setValue(t=0,e=0,i=0,n=0,s=0){return super.setValue(t,e,i,n),this.angle=s,this}clone(){return new ce(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Zt({x:this.x1,y:this.y1},this.angle,t),Zt({x:this.x2,y:this.y1},this.angle,t),Zt({x:this.x1,y:this.y2},this.angle,t),Zt({x:this.x2,y:this.y2},this.angle,t)]}}class ue{constructor(t=1,e=0,i=0,n=1,s=0,r=0){this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new ue,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,u=n*this.e-s*this.f+r,d=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=u,this.f=d,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,u=o*t+h*e,d=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=u,this.c=d,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new ue;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,u=-s/l,d=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*u+p,e.y=f*c+m*d+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new ue(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,s=t*n-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=s/a,r.skewX=(t*i+e*n)/s,r.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=s/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*n)/s}return r.rotateDeg=180*r.rotateDeg/Math.PI,r}}class de{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:n=this.L_TIME,R_COUNT:s=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=s)););if(in;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:n=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>n&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();t.forEach((t=>{for(;n-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();for(;n-t.timestamp[0]>i;)t.timestamp.shift()}}function pe(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function ge(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const fe=/^#([0-9a-f]{3,8})$/,me={transparent:4294967040},ve={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ye(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function _e(t){return S(t)?new we(t>>16,t>>8&255,255&t,1):_(t)?new we(t[0],t[1],t[2]):new we(255,255,255)}function be(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function xe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Se=(t,e)=>{const i=fe.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new we((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?_e(t):8===e?new we(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Ae{static Brighter(t,e=1){return 1===e?t:new Ae(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new Ae(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof Ae?t:new Ae(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(me[t]))return function(t){return S(t)?new we(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new we(t[0],t[1],t[2],t[3]):new we(255,255,255,1)}(me[t]);if(p(ve[t]))return _e(ve[t]);const e=`${t}`.trim().toLowerCase(),i=Se(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new we(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=pe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new we(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Ae.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new we(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}add(t){const{r:e,g:i,b:n}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,n+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=ge(this.color.r,this.color.g,this.color.b),r=pe(d(t)?s.h:ct(t,0,360),d(e)?s.s:e>=0&&e<=1?100*e:e,d(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new we(r.r,r.g,r.b,n),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Se(e,!0);return null!=i?i:this}setColorName(t){const e=ve[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let n,s,r;return n=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),s=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*n+.7152*s+.0722*r}clone(){return new Ae(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=be(t.color.r),this.color.g=be(t.color.g),this.color.b=be(t.color.b),this}copyLinearToSRGB(t){return this.color.r=xe(t.color.r),this.color.g=xe(t.color.g),this.color.b=xe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class we{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${ye(this.r)+ye(this.g)+ye(this.b)+(1===this.opacity?"":ye(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=ge(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ke(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),u=Math.round(a*(1-t)+o*t);return new we(e,c,u,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:ge});function Ce(t){if(A(t))return[t,t,t,t];if(_(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,n]=t;return[e,i,n,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:n=0,left:s=0}=t;return[e,i,n,s]}return[0,0,0,0]}function Me(t,e=0,i=0){if(!t)return{width:e,height:i};let n;try{n=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){n=()=>({})}const s=n(t);if(/^(\d*\.?\d+)(px)$/.exec(s.width)){const n=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,r=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:n<=0?e:n,height:r<=0?i:r}}return{width:e,height:i}}class Be{static getInstance(){return Be.instance||(Be.instance=new Be),Be.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const 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));++r1?s[0]+s.slice(2):s,+i.slice(n+1)]}let Oe;function Re(t,e){const i=Ee(t,e);if(!i)return t+"";const n=i[0],s=i[1];return s<0?"0."+new Array(-s).join("0")+n:n.length>s+1?n.slice(0,s+1)+"."+n.slice(s+1):n+new Array(s-n.length+2).join("0")}class Pe{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ie=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Le(t){let e;if(e=Ie.exec(t))return new Pe({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});it.getInstance().error("invalid format: "+t)}const De=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Fe{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,n){let s=t.length;const r=[];let a=0,o=e[0],l=0;for(;s>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),r.push(t.substring(s-=o,s+o)),!((l+=o+1)>n));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return Fe.instance||(Fe.instance=new Fe),Fe.instance}newFormat(t){const e=Le(t);let i=e.fill,n=e.align;const s=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,u=e.type;"n"===u?(l=!0,u="g"):je[u]||(void 0===h&&(h=12),c=!0,u="g"),(a||"0"===i&&"="===n)&&(a=!0,i="0",n="=");const d="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(u)?"0"+u.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(u)?this.percent:"",g=je[u],f=/[defgprstz%]/.test(u);h=void 0===h?6:/[gprs]/.test(u)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:y,group:_,numerals:b}=this;function x(t){let e,r,x,S=d,A=p,w=t;if("c"===u)A=g(w)+A,w="";else{w=+w;let t=w<0||1/w<0;if(w=isNaN(w)?m:g(Math.abs(w),h),c&&(w=function(t){const e=t.length;let i,n=-1;t:for(let s=1;s0&&(n=0)}return n>0?t.slice(0,n)+t.slice(i+1):t}(w)),t&&0==+w&&"+"!==s&&(t=!1),S=(t?"("===s?s:v:"-"===s||"("===s?"":s)+S,A=("s"===u?De[8+Oe/3]:"")+A+(t&&"("===s?")":""),f)for(e=-1,r=w.length;++ex||x>57){A=(46===x?y+w.slice(e+1):w.slice(e))+A,w=w.slice(0,e);break}}l&&!a&&(w=_(w,1/0));let k=S.length+w.length+A.length,T=k>1)+S+w+A+T.slice(k);break;default:w=T+S+w+A}return b(w)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Le(t);i.type="f";const n=this.newFormat(i.toString()),s=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=Ee(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-s),a=De[8+s/3];return function(t){return n(r*t)+a}}}const je={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Re(100*t,e),r:Re,s:function(t,e){const i=Ee(t,e);if(!i)return t+"";const n=i[0],s=i[1],r=s-(Oe=3*Math.max(-8,Math.min(8,Math.floor(s/3))))+1,a=n.length;return r===a?n:r>a?n+new Array(r-a+1).join("0"):r>0?n.slice(0,r)+"."+n.slice(r):"0."+new Array(1-r).join("0")+Ee(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};const Ne=function(t,...e){return function(t,...e){t||(t={});let i=-1;const n=e.length;for(;++i{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.sort&&(A(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+$e(e,6):$e(e,4))+"-"+$e(t.getUTCMonth()+1,2)+"-"+$e(t.getUTCDate(),2)+(r?"T"+$e(i,2)+":"+$e(n,2)+":"+$e(s,2)+"."+$e(r,3)+"Z":s?"T"+$e(i,2)+":"+$e(n,2)+":"+$e(s,2)+"Z":n||i?"T"+$e(i,2)+":"+$e(n,2)+"Z":"")}function qe(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 Ge;if(h)return h=!1,We;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(;a{const n=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!_(t))throw new TypeError("Invalid data: must be DataView array!");return _(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ei=0;function ii(t="dataset"){return ei>1e8&&(ei=0),t+"_"+ei++}class ni{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:ii("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:it.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let 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){if(this._callMap){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()}}class si{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&z(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:ii("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var 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){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,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:n,skipEqual:s}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===n||s&&z(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof si||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?j({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Ve),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class ri{static GenAutoIncrementId(){return ri.auto_increment_id++}}ri.auto_increment_id=0;class ai{constructor(t){this.id=ri.GenAutoIncrementId(),this.registry=t}}const oi="named",li="inject",hi="multi_inject",ci="inversify:tagged",ui="inversify:paramtypes";class di{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===oi?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var pi=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),n=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),s=new WeakMap;function r(t,e,i){let r=s.get(t);if(h(r)){if(!i)return;r=new n,s.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new n,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const n=f(e);return!c(n)&&a(t,n,i)}function o(t,e,i){const n=r(e,i,!1);return!h(n)&&!!n.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const n=r(e,i,!1);if(!h(n))return n.get(t)}(t,e,i);const n=f(e);return c(n)?void 0:l(t,n,i)}function h(t){return void 0===t}function c(t){return null===t}function u(t){return"object"==typeof t?null!==t:"function"==typeof t}function d(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const n=3===i?"string":5===i?"number":"default",s=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==s){const e=s.call(t,n);if(u(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!u(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!u(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!u(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!u(e))return e}}throw new TypeError}(t,"default"===n?"number":n)}function p(t){const e=d(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const n=t.prototype,s=n&&Object.getPrototypeOf(n);if(null==s||s===Object.prototype)return e;const r=s.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,n){if(!u(i))throw new TypeError;return s=t,a=e,void r(i,n,!0).set(s,a);var s,a})),t("hasMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function gi(t,e,i,n){!function(t,e,i,n){const s=[n];let r={};pi.hasOwnMetadata(t,e)&&(r=pi.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...s),r[i]=a,pi.defineMetadata(t,r,e)}(ci,t,i.toString(),n)}function fi(t){return(e,i,n)=>{gi(e,0,n,t)}}function mi(t){return e=>(i,n,s)=>fi(new di(t,e))(i,n,s)}const vi=mi(li),yi=mi(hi);function _i(){return function(t){return pi.defineMetadata(ui,null,t),t}}function bi(t){return fi(new di(oi,t))}const xi="Singleton",Si="Transient",Ai="ConstantValue",wi="DynamicValue",ki="Factory",Ti="Function",Ci="Instance",Mi="Invalid";class Bi{constructor(t,e){this.id=ri.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Mi,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Bi(this.serviceIdentifier,this.scope);return t.activated=t.scope===xi&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Ei{getConstructorMetadata(t){return{compilerGeneratedMetadata:pi.getMetadata(ui,t),userGeneratedMetadata:pi.getMetadata(ci,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Oi=(Ri=oi,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ri&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Li=Symbol("ContributionProvider");class Di{constructor(t,e){this.serviceIdentifier=t,this.container=e,ji.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function Fi(t,e){t(Li).toDynamicValue((({container:t})=>new Di(e,t))).inSingletonScope().whenTargetNamed(e)}class ji{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}ji.store=new Map;class Ni{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let 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 Ui extends Ni{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const Hi=Symbol.for("EnvContribution"),zi=Symbol.for("VGlobal"),Vi=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Si,this.options=e,this.id=ri.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Ei}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const n=this._getNotAllArgs(t,!1,e,i);return this._get(n)}getNamed(t,e){return this.getTagged(t,oi,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Bi(t,e),n=this._bindingDictionary.get(t)||[];return n.push(i),this._bindingDictionary.set(t,n),new Ii(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const n=this.bind(i);return t(n,e),n},i=()=>t=>this.unbind(t),n=()=>t=>this.isBound(t),s=e=>i=>{const n=this.rebind(i);return t(n,e),n};return t=>({bindFunction:e(t),isboundFunction:n(),rebindFunction:s(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,n){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:n}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),n=Object.keys(i),s=[];for(let t=0;t{n[t.key]=t.value}));const r={inject:n[li],multiInject:n[hi]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};s.push(t)}}return s}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ai:case Ti:e=t.cache;break;case Ci:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===xi&&(t.cache=e,t.activated=!0)}},Wi=Symbol.for("RenderService");const Gi=new class{get renderService(){return this._renderService||(this._renderService=Vi.get(Wi)),this._renderService}};let Yi=0;class Xi{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Gi.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Yi,t),this.tryRunAnimationFrameNextFrame(),Yi}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class $i{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const n=this._resolveCapture(i),s=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(n))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),s&&this._deleteListenerRecord(t,e,n)};a.set(n,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var n,s;if(!e)return;const r=this._resolveCapture(i),a=null===(s=null===(n=this._listenerMap.get(t))||void 0===n?void 0:n.get(e))||void 0===s?void 0:s.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const n=this._listenerMap.get(t);if(!n)return;const s=n.get(e);s&&(s.delete(i),0===s.size&&n.delete(e),0===n.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Ki=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qi=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zi=function(t,e){return function(i,n){e(i,n,t)}},Ji=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 Qi=class extends $i{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=ri.GenAutoIncrementId(),this.hooks={onSetEnv:new Ui(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const 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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Xi);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Ji(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var tn,en,nn,sn;Qi=Ki([_i(),Zi(0,vi(Li)),Zi(0,bi(Hi)),qi("design:paramtypes",[Object])],Qi),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(tn||(tn={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(en||(en={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(nn||(nn={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(sn||(sn={}));const rn=xt-1e-8;class an{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>rn)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,u=-1/0,d=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),lu&&(u=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=xt)<0&&(n+=xt),(s%=xt)<0&&(s+=xt),ss;++o,a-=bt)g(a);else for(a=n-n%bt+bt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ln=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,hn={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},cn={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let un,dn,pn,gn,fn,mn;var vn,yn,_n,bn,xn,Sn;function An(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,u=o*r,d=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),m=Math.sin(s),v=.5*(s-n),y=Math.sin(.5*v),_=8/3*y*y/Math.sin(v),b=e+p-_*g,x=i+g+_*p,S=e+f,A=i+m,w=S+_*m,k=A-_*f;return[h*b+c*x,u*b+d*x,h*w+c*k,u*w+d*k,h*S+c*A,u*S+d*A]}function wn(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=jt(a),c=Math.sin(h),u=Math.cos(h),d=u*(o-t)*.5+c*(l-e)*.5,p=u*(l-e)*.5-c*(o-t)*.5;let g=d*d/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=u/i,m=c/i,v=-c/n,y=u/n,_=f*o+m*l,b=v*o+y*l,x=f*t+m*e,S=v*t+y*e;let A=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;A<0&&(A=0);let w=Math.sqrt(A);r===s&&(w=-w);const k=.5*(_+x)-w*(S-b),T=.5*(b+S)+w*(x-_),C=Math.atan2(b-T,_-k);let M=Math.atan2(S-T,x-k)-C;M<0&&1===r?M+=xt:M>0&&0===r&&(M-=xt);const B=Math.ceil(Math.abs(M/(bt+.001))),E=[];for(let t=0;te.arc(t[1]*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 Tn(t,e,i=0,n=0,s=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*n+e,this.p1.y*s+i,this.p2.x*n+e,this.p2.y*s+i,this.p3.x*n+e,this.p3.y*s+i);else if(r>0){const[a]=Pn(this,r);t.bezierCurveTo(a.p1.x*n+e,a.p1.y*s+i,a.p2.x*n+e,a.p2.y*s+i,a.p3.x*n+e,a.p3.y*s+i)}}includeX(t){const e=Ct(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Tt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Ct(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Tt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Ln(t,e){const{p0:i,p1:n}=t,s=Ft.pointAtPP(i,n,e);return[new Dn(i,s),new Dn(s,n)]}class Dn extends Cn{constructor(t,e){super(),this.type=xn.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return Ft.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?Ft.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===bn.ROW?At(this.p0.x-this.p1.x):t===bn.COLUMN?At(this.p0.y-this.p1.y):0}draw(t,e,i,n,s,r){if(t.moveTo(this.p0.x*n+e,this.p0.y*s+i),r>=1)t.lineTo(this.p1.x*n+e,this.p1.y*s+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*n+e,a.y*s+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const n=(t-e.x)/(i.x-e.x);return e.y+n*(i.y-e.y)}return 1/0}}class Fn{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,n,s,r,a,o){const l=new In(new Dt(this._lastX,this._lastY),new Dt(t,e),new Dt(i,n),new Dt(s,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=s,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,n){const s=this.addLinearCurve(t,e,i,this._lastOriginP,n);this.curves.push(s),this._lastX=t,this._lastY=e,this._lastOriginP=n}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,n){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,n,s){const r=new Dn(new Dt(this._lastX,this._lastY),new Dt(t,e));return r.originP1=n,r.originP2=s,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===bn.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],n=null!==(e=i.p3)&&void 0!==e?e:i.p1;return At(t.p0.y-n.y)}if(t===bn.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],n=null!==(i=e.p3)&&void 0!==i?i:e.p1;return At(t.p0.x-n.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class jn extends Fn{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 Nn(t,e,i=1){let n=!1;for(let i=0,s=e.length;i<=s;i++)i>=s===n&&((n=!n)?t.lineStart():t.lineEnd()),n&&t.point(e[i])}function Un(t,e,i){const n=null!=e?e:At(i[i.length-1].x-i[0].x)>At(i[i.length-1].y-i[0].y)?bn.ROW:bn.COLUMN;return"monotoneY"===t?new jn(t,n):new Fn(t,n)}class Hn{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 zn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=Un("linear",i,t);return function(t,e){Nn(t,e,1)}(new Hn(s,n),t),s}function Vn(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 Wn{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&&Vn(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:Vn(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 Gn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return zn(t,e);const s=Un("basis",i,t);return function(t,e){Nn(t,e,2)}(new Wn(s,n),t),s}function Yn(t){return t<0?-1:1}function Xn(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(Yn(r)+Yn(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function $n(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Kn(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 qn{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Kn(this,this._t0,$n(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,n=t.y;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,Kn(this,$n(this,e=Xn(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Kn(this,this._t0,e=Xn(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 Zn extends qn{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Jn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return zn(t,e);const s=Un("monotoneX",i,t);return function(t,e){Nn(t,e,2)}(new qn(s,n),t),s}function Qn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return zn(t,e);const s=Un("monotoneY",i,t);return function(t,e){Nn(t,e,2)}(new Zn(s,n),t),s}let ts=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const n=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(n,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class es extends ts{lineEnd(){this.context.closePath()}}function is(t,e,i={}){const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new Fn("step",null!=n?n:At(t[t.length-1].x-t[0].x)>At(t[t.length-1].y-t[0].y)?bn.ROW:bn.COLUMN);return ns(new ts(r,e,s),t),r}function ns(t,e){return Nn(t,e,1)}class ss extends Hn{lineEnd(){this.context.closePath()}}function rs(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=Un("linear",i,t);return function(t,e){Nn(t,e,1)}(new ss(s,n),t),s}function as(t,e,i,n,s){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>yt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>yt){const n=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,s=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*n+t._x1*t._l23_2a-e*t._l12_2a)/s,l=(l*n+t._y1*t._l23_2a-i*t._l12_2a)/s}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,n,t.lastPoint1)}function os(t,e){return function(i,n,s={}){const{direction:r,startPoint:a}=s;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return zn(i,s);const o=Un(t,r,i);return Nn(new e(o,n,a),i,2),o}}const ls=os("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:as(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const hs=os("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:as(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class cs extends Cn{constructor(t,e,i){super(),this.type=xn.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Rn(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,Mn([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===bn.ROW?At(this.p0.x-this.p2.x):t===bn.COLUMN?At(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Tt(t-.01,0),i=Ct(t+.01,1),n=this.getPointAt(e),s=this.getPointAt(i);return wt(s.y-n.y,s.x-n.x)}draw(t,e,i,n,s,r){if(t.moveTo(this.p0.x*n+e,this.p0.y*s+i),r>=1)t.quadraticCurveTo(this.p1.x*n+e,this.p1.y*s+i,this.p2.x*n+e,this.p2.y*s+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:n,p2:s}=t,r=Rn(i,n,s,e),a=Ft.pointAtPP(i,n,e),o=Ft.pointAtPP(n,s,e);return[new cs(i,a,r),new cs(r,o,s)]}(this,r);t.quadraticCurveTo(a.p1.x*n+e,a.p1.y*s+i,a.p2.x*n+e,a.p2.y*s+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class us{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Dn(new Dt(this._lastX,this._lastY),new Dt(t,e))}quadraticCurveTo(t,e,i,n){const s=new cs(new Dt(this._lastX,this._lastY),new Dt(t,e),new Dt(i,n));this.path.addCurve(s),this._lastX=i,this._lastY=n}bezierCurveTo(t,e,i,n,s,r){const a=new In(new Dt(this._lastX,this._lastY),new Dt(t,e),new Dt(i,n),new Dt(s,r));this.path.addCurve(a),this._lastX=s,this._lastY=r}arcTo(t,e,i,n,s){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,n,s,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,n){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,n,s,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function ds(t,e,i){var n,s;switch(e){case"linear":default:return zn(t,i);case"basis":return Gn(t,i);case"monotoneX":return Jn(t,i);case"monotoneY":return Qn(t,i);case"step":return is(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new Fn("step",null!=n?n:At(t[t.length-1].x-t[0].x)>At(t[t.length-1].y-t[0].y)?bn.ROW:bn.COLUMN);return ns(new es(r,e,s),t),r}(t,.5,i);case"stepBefore":return is(t,0,i);case"stepAfter":return is(t,1,i);case"catmullRom":return ls(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"catmullRomClosed":return hs(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"linearClosed":return rs(t,i)}}class ps extends on{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new an(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([cn.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([cn.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([cn.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([cn.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([cn.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([cn.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([cn.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([cn.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([cn.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new us(this);Tn(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[cn.M]=t=>`M${t[1]} ${t[2]}`,t[cn.L]=t=>`L${t[1]} ${t[2]}`,t[cn.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[cn.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[cn.A]=t=>{const e=[],i=t[1],n=t[2],s=t[3];((t,e,i,n,s,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,u=(i%l+l)%l;o?(u>=h&&(u-=l),c=u-h):(u<=h&&(u+=l),c=u-h);const d=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/d;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[cn.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,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;tmn){let t,e=pn;for(let n=1,r=i.length;n{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,e=0,i=0,n=1,s=1){let r,a,o,l,h,c=null,u=0,d=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Tn(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===bn.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return At(t.p0.y-e.p1.y)}if(this.direction===bn.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return At(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}drawWithClipRange(t,e,i,n,s){this.tryBuildCurves();const r=this.getLength()*s;let a=0;for(let s=0;s{it.getInstance().warn("空函数")}}),Os=Object.assign(Object.assign({},As),{points:[],cornerRadius:0,closePath:!0}),Rs=Object.assign(Object.assign({},As),{width:100,height:100,spikes:5,thickness:.5}),Ps=Object.assign(Object.assign({},As),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},As),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const Is=Object.assign(Object.assign({},As),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),Ls=Object.assign(Object.assign(Object.assign({},As),bs),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Ds=Object.assign(Object.assign(Object.assign({},As),bs),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Fs=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},As),{fill:!0,cornerRadius:0,cornerType:"round"}),js=Object.assign(Object.assign({},Fs),{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}),Ns=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function n(){return s("linear",t.linearGradient,r)||s("radial",t.radialGradient,o)||s("conic",t.conicGradient,a)}function s(e,n,s){return function(n,r){const a=v(n);if(a){v(t.startCall)||i("Missing (");const n=function(n){const r=s();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:d(p)}}();return v(t.endCall)||i("Missing )"),n}}(n)}function r(){return m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("angular",t.fromAngleValue,1)}function o(){let i,n,s=l();return s&&(i=[],i.push(s),n=e,v(t.comma)&&(s=l(),s?i.push(s):e=n)),i}function l(){let t=function(){const t=m("shape",/^(circle)/i,0);return t&&(t.style=f()||h()),t}()||function(){const t=m("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=u();e&&(t={type:"default-radial",at:e})}}return t}function h(){return m("extent-keyword",t.extentKeywords,1)}function c(){if(m("position",/^at/,0)){const t=u();return t||i("Missing positioning value"),t}}function u(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function d(e){let n=e();const s=[];if(n)for(s.push(n);v(t.comma);)n=e(),n?s.push(n):i("One extra comma");return s}function p(){const e=m("hex",t.hexColor,1)||m("rgba",t.rgbaColor,1)||m("rgb",t.rgbColor,1)||m("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return m("%",t.percentageValue,1)||m("position-keyword",t.positionKeywords,1)||f()}function f(){return m("px",t.pixelValue,1)||m("em",t.emValue,1)}function m(t,e,i){const n=v(e);if(n)return{type:t,value:n[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&y(i[0].length);const n=t.exec(e);return n&&y(n[0].length),n}function y(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=d(n);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Us{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Us.IsGradientStr(t))try{const e=Ns(t)[0];if(e){if("linear"===e.type)return Us.ParseLinear(e);if("radial"===e.type)return Us.ParseRadial(e);if("conic"===e.type)return Us.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const n=t.length>1?i/(t.length-1):0;return{color:e.value,offset:n}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,n=_t/2,s=parseFloat(e.value)/180*_t-n;return{gradient:"conical",x:.5,y:.5,startAngle:s,endAngle:s+St,stops:Us.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:Us.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,n=_t/2;let s="angular"===e.type?parseFloat(e.value)/180*_t:0;for(;s<0;)s+=St;for(;s>=St;)s-=St;let r=0,a=0,o=0,l=0;return s{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,u,d):"conical"===c.gradient?h=function(t,e,i,n,s,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*s,n+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(s+i,r+n,void 0):l}(t,c,p,g,u,d):"radial"===c.gradient&&(h=function(t,e,i,n,s,r){var a,o,l,h,c,u;const d=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*s,n+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(s,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*s,n+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(s,r)*(null!==(u=e.r1)&&void 0!==u?u:.5));return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d}(t,c,p,g,u,d))}return h||"orange"}const Vs={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"}},Ws=!0,Gs=!1,Ys=/\w|\(|\)|-/,Xs=/[.?!,;:/,。?!、;:]/,$s=/\S/,Ks=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function qs(t,e,i,n,s){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Gi.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=Zs(t,a)),a}function Zs(t,e,i=!1){let n=e;for(;Ys.test(t[n-1])&&Ys.test(t[n])||Xs.test(t[n]);)if(n--,n<=0)return i?Js(t,e):e;return n}function Js(t,e){let i=e;for(;Ys.test(t[i+1])&&Ys.test(t[i])||Xs.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Qs(t,e,i="actual"){var n;if(""===t)return{ascent:0,height:0,descent:0,width:0};const s=Gi.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?s.actualBoundingBoxAscent:s.fontBoundingBoxAscent,o="actual"===i?s.actualBoundingBoxDescent:s.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(s.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(s.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(n=e.space)&&void 0!==n?n:0;return r.width+=l,r}var tr=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(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 er=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:n}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=n,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=n}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:n}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=n}return t}estimate(t,{fontSize:e=Ls.fontSize}){let i=0,n=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,"end",!1);if(n&&s.str!==t[o].text){let i="",n=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(n&&a.str!==t){let i=Zs(t,a.str.length,s);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,n,s,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,n,s),a&&(o.result=a+o.str);else if("middle"===r){const n=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:n.width,result:n.left+a+n.right}}else o=this._clipTextEnd(t,e,i,n,s),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,n,s){if(n===s){it.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${n}, ${s}`);const i=t.substring(0,s+1);return{str:i,width:this.measureTextWidth(i,e)}}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._clipTextEnd(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._clipTextEnd(t,e,i,r,s)}return{str:a,width:o}}_clipTextStart(t,e,i,n,s){const r=Math.ceil((n+s)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(r,t.length);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,n,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,n,s,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:n,right:s,width:r+a};const c=t.substring(t.length-o,t.length),u=this.measureTextWidth(c,e);return h+u>i?{left:l,right:s,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,u,o+1)}clipTextWithSuffixVertical(t,e,i,n,s,r){if(""===n)return this.clipTextVertical(t,e,i,s);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,s);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(n,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,s);const a=this.revertVerticalList(l.verticalList);a.unshift({text:n,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,s),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,s);r.verticalList.push({text:n,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,s),l.verticalList.push({text:n,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,n,s,r,a=!1){if(""===n)return this.clipText(t,e,i,s);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(n,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+n,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,n);if(s&&h.str!==t){const i=Zs(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+n);return h.str=h.result,h.width+=l,h}};er=tr([_i()],er);var ir=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(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 nr=Symbol.for("TextMeasureContribution");let sr=class extends er{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};sr=ir([_i()],sr);const rr=Symbol.for("CanvasFactory"),ar=Symbol.for("Context2dFactory");function or(t){return Vi.getNamed(rr,Gi.global.env)(t)}const lr=1e-4,hr=Math.sqrt(3),cr=1/3;function ur(t){return t>-wr&&twr||t<-wr}const pr=[0,0],gr=[0,0],fr=[0,0];function mr(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function vr(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function yr(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 _r(t){return(t%=St)<0&&(t+=St),t}function br(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+u&&c>n+u&&c>r+u&&c>o+u||ct+u&&h>i+u&&h>s+u&&h>a+u||h=0&&pi||c+hs&&(s+=St);let u=Math.atan2(l,o);return u<0&&(u+=St),u>=n&&u<=s||u+St>=n&&u+St<=s}function Ar(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(ur(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 Tr=[-1,-1,-1],Cr=[-1,-1];function Mr(){const t=Cr[0];Cr[0]=Cr[1],Cr[1]=t}function Br(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=u*u-4*c*d;if(ur(t)){const t=u/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-u+e),n=c*o+1.5*a*(-u-e);i=i<0?-Math.pow(-i,cr):Math.pow(i,cr),n=n<0?-Math.pow(-n,cr):Math.pow(n,cr);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*u)/(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+hr*Math.sin(e)))/(3*a),h=(-o+i*(n-hr*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,Tr);if(0===c)return 0;let u=0,d=-1,p=0,g=0;for(let h=0;h1&&Mr(),p=yr(e,n,r,o,Cr[0]),d>1&&(g=yr(e,n,r,o,Cr[1]))),2===d?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(ur(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,Tr);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=vr(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Tr[0]=-l,Tr[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=St-1e-4){n=0,s=St;const e=r?1:-1;return a>=Tr[0]+t&&a<=Tr[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=St,s+=St);let c=0;for(let e=0;e<2;e++){const i=Tr[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=St+t),(t>=n&&t<=s||t+St>=n&&t+St<=s)&&(t>_t/2&&t<1.5*_t&&(e=-e),c+=e)}}return c}function Rr(t){return Math.round(t/_t*1e8)/1e8%2*_t}function Pr(t,e){let i=Rr(t[0]);i<0&&(i+=St);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=St?s=i+St:e&&i-s>=St?s=i-St:!e&&i>s?s=i+(St-Rr(i-s)):e&&i1&&(i||(h+=ee(c,u,d,p,n,s))),g&&(c=a[1],u=a[2],d=c,p=u);const f=a[0],m=a[1],v=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,A=b;Ir[0]=S,Ir[1]=A,Pr(Ir,Boolean(a[6])),S=Ir[0],A=Ir[1];const w=S,k=A-S,T=!!(1-(a[6]?0:1)),C=(n-m)*y/y+m;switch(f){case cn.M:d=m,p=v,c=d,u=p;break;case cn.L:if(i){if(Ar(c,u,m,v,e,n,s))return!0}else h+=ee(c,u,m,v,n,s)||0;c=m,u=v;break;case cn.C:if(i){if(xr(c,u,m,v,y,_,b,x,e,n,s))return!0}else h+=Br(c,u,m,v,y,_,b,x,n,s)||0;c=b,u=x;break;case cn.Q:if(i){if(br(c,u,m,v,y,_,e,n,s))return!0}else h+=Er(c,u,m,v,y,_,n,s)||0;c=y,u=_;break;case cn.A:if(o=Math.cos(w)*y+m,l=Math.sin(w)*y+v,g?(d=o,p=l):h+=ee(c,u,o,l,n,s),i){if(Sr(m,v,y,w,w+k,T,e,C,s))return!0}else h+=Or(m,v,y,w,w+k,T,C,s);c=Math.cos(w+k)*y+m,u=Math.sin(w+k)*y+v;break;case cn.R:if(d=c=m,p=u=v,o=d+y,l=p+_,i){if(Ar(d,p,o,p,e,n,s)||Ar(o,p,o,l,e,n,s)||Ar(o,l,d,l,e,n,s)||Ar(d,l,d,p,e,n,s))return!0}else h+=ee(o,p,o,l,n,s),h+=ee(d,l,d,p,n,s);break;case cn.Z:if(i){if(Ar(c,u,d,p,e,n,s))return!0}else h+=ee(c,u,d,p,n,s);c=d,u=p}}return i||(g=u,f=p,Math.abs(g-f)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Nr=Symbol.for("VWindow"),Ur=Symbol.for("WindowHandlerContribution");let Hr=class extends $i{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){super(),this.hooks={onChange:new Ui(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Vi.getNamed(Ur,t.env).configure(this,t),this.actived=!0)},this._uid=ri.GenAutoIncrementId(),this.global=Gi.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const n=this._handler.getWH();this._width=n.width,this._height=n.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,n,s,r){this._handler.setViewBoxTransform(t,e,i,n,s,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),n={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},n),n.x-=i.x1,n.y-=i.y1,n}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&at(this.width,t.width())&&at(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};Hr=Fr([_i(),jr("design:paramtypes",[])],Hr);var zr=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wr=function(t,e){return function(i,n){e(i,n,t)}};let Gr=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Gi.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Dr.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var 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:bs.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new se(Object.assign({defaultFontParams:{fontFamily:bs.fontFamily,fontSize:bs.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+se.ALPHABET_CHAR_SET+se.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const n=Vi.get(Nr),s=t.AABBBounds,r=s.width(),a=s.height(),o=-s.x1,l=-s.y1;n.create({viewBox:{x1:o,y1:l,x2:s.x2,y2:s.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(n,[t],{transMatrix:n.getViewBoxTransform(),viewBox:n.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=n.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Yr;Gr=zr([_i(),Wr(0,vi(Li)),Wr(0,bi(nr)),Vr("design:paramtypes",[Object])],Gr),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Yr||(Yr={}));const Xr=new ue;let $r=class{constructor(){this.matrix=new ue}init(t){return this.mode=Yr.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Yr.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(Xr.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(Xr.a,Xr.b,Xr.c,Xr.d,Xr.e,Xr.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Xr.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:n}=e;this.outTargetMatrix.translate(i,n),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-n)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Xr.a,Xr.b,Xr.c,Xr.d,Xr.e,Xr.f),this}scale(t,e,i){return this.mode===Yr.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Yr.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Xr.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Xr.a,Xr.b,Xr.c,Xr.d,Xr.e,Xr.f),this}translate(t,e){return this.mode===Yr.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Yr.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};$r=zr([_i(),Vr("design:paramtypes",[])],$r);const Kr={arc:ws,area:ks,circle:Ts,line:Bs,path:Es,symbol:Is,text:Ls,rect:Ps,polygon:Os,star:Rs,richtext:Ds,richtextIcon:js,image:Fs,group:Cs,glyph:Ms},qr=Object.keys(Kr);function Zr(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Jr={arc:Object.assign({},Kr.arc),area:Object.assign({},Kr.area),circle:Object.assign({},Kr.circle),line:Object.assign({},Kr.line),path:Object.assign({},Kr.path),symbol:Object.assign({},Kr.symbol),text:Object.assign({},Kr.text),rect:Object.assign({},Kr.rect),polygon:Object.assign({},Kr.polygon),star:Object.assign({},Kr.star),richtext:Object.assign({},Kr.richtext),richtextIcon:Object.assign({},Kr.richtextIcon),image:Object.assign({},Kr.image),group:Object.assign({},Kr.group),glyph:Object.assign({},Kr.glyph)};class Qr{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},qr.forEach((t=>{this._defaultTheme[t]=Object.create(Jr[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0)}this.userTheme?this.doCombine(n&&n.theme.combinedTheme):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,it.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;qr.forEach((n=>{const s=Object.create(Jr[n]);t&&t[n]&&Zr(s,t[n]),i[n]&&Zr(s,i[n]),e[n]&&Zr(s,e[n]),this.combinedTheme[n]=s})),e.common&&qr.forEach((t=>{Zr(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const ta=new Qr;function ea(t,e){return t.glyphHost?ea(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):ta.getTheme()}return null}(t)||t.attachedThemeGraphic&&ea(t.attachedThemeGraphic)||ta.getTheme()}var ia=function(t,e,i,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 na extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=ri.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return ia(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let 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,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&it.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const 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(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof aa))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(ca(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,n;if(!(t instanceof aa))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=ca(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");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let n=o;for(;n&&n!==this.rootTarget;)i.add(n),n=n.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursorTarget=s.target,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 aa))return void it.getInstance().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=ca(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,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 aa))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=ca(t.pointerType),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.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof aa))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=ha.now(),s=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(s,"pointerup"),"touch"===s.pointerType)this.dispatchEvent(s,"touchend");else if(ca(s.pointerType)){const t=2===s.button;this.dispatchEvent(s,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!s.composedPath().includes(a)){let e=a;for(;e&&!s.composedPath().includes(e);){if(s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType)this.notifyTarget(s,"touchendoutside");else if(ca(s.pointerType)){const t=2===s.button;this.notifyTarget(s,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(s,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:n});const a=r.clicksByButton[t.button];a.target===e.target&&n-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=n,e.detail=a.clickCount,ca(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(s)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof aa))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),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"):ca(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 oa))return void it.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,n,s,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===n?void 0:n.stage)&&(null===(r=null===(s=this._prePointTargetCache)||void 0===s?void 0:s[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;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){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ha.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let n=0,s=i.length;n{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,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,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=s.supportsTouchEvents,supportsPointerEvents:l=s.supportsPointerEvents}=t;this.manager=new ua(n,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=s,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new aa,this.rootWheelEvent=new oa,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:n}=this;if(this.currentCursor===t)return;this.currentCursor=t;const s=this.cursorStyles[t];s?"string"==typeof s&&i?n.style.cursor=s:"function"==typeof s?s(t):"object"==typeof s&&i&&Object.assign(n.style,s):i&&y(t)&&!P(this.cursorStyles,t)&&(n.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const n=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(n)return n;let s=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};s=e.clientX||0,r=e.clientY||0}else s=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:s-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class fa{static GetImage(t,e){var i;const n=fa.cache.get(t);n?"fail"===n.loadState?Gi.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):fa.loadImage(t,e)}static GetSvg(t,e){var i;let n=fa.cache.get(t);n?"fail"===n.loadState?Gi.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):(n={type:"image",loadState:"init"},fa.cache.set(t,n),n.dataPromise=Gi.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.waitingMark&&(n.waitingMark=[])}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=fa.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},fa.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Gi.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Gi.global.loadBlob(t):"json"===e&&(i.dataPromise=Gi.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!fa.isLoading&&fa.toLoadAueue.length){fa.isLoading=!0;const t=fa.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:n}=t,s={type:"image",loadState:"init"};if(fa.cache.set(i,s),s.dataPromise=Gi.global.loadImage(i),s.dataPromise){s.waitingMark=n;const t=s.dataPromise.then((t=>{var e;s.loadState=(null==t?void 0:t.data)?"success":"fail",s.data=null==t?void 0:t.data,null===(e=s.waitingMark)||void 0===e||e.map(((e,n)=>{(null==t?void 0:t.data)?(s.loadState="success",s.data=t.data,e.imageLoadSuccess(i,t.data)):(s.loadState="fail",e.imageLoadFail(i))})),s.waitingMark&&(s.waitingMark=[])}));e.push(t)}else s.loadState="fail",n.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{fa.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),fa.loading()})).catch((t=>{console.error(t),fa.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),fa.loading()}))}}),0)}static loadImage(t,e){const i=ma(t,fa.toLoadAueue);if(-1!==i)return fa.toLoadAueue[i].marks.push(e),void fa.loading();fa.toLoadAueue.push({url:t,marks:[e]}),fa.loading()}static improveImageLoading(t){const e=ma(t,fa.toLoadAueue);if(-1!==e){const t=fa.toLoadAueue.splice(e,1);fa.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function ma(t,e){for(let i=0;it?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(_a[0]=t[0],_a[2]=t[0],_a[1]=t[1],_a[3]=t[1],_a):t:t:0,xa=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Sa=[1,2,3,0,1,2,3,0];function Aa(t,e,i,n){for(;t>=St;)t-=St;for(;t<0;)t+=St;for(;t>e;)e+=St;xa[0].x=i,xa[1].y=i,xa[2].x=-i,xa[3].y=-i;const s=Math.ceil(t/bt)%4,r=Math.ceil(e/bt)%4;if(n.add(kt(t)*i,Mt(t)*i),n.add(kt(e)*i,Mt(e)*i),s!==r||e-t>_t){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Dt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Dt(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)}}Ca.TimeOut=1e3/60;const Ma=new Ca,Ba=(t,e)=>{const i=((t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class Ea{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Oa(t,e,i,n,s){return s?t.arc(i,n,e,0,xt,!1,s):t.arc(i,n,e,0,xt),!1}var Ra=new class extends Ea{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,n,s){return Oa(t,this.parseSize(e)/2,i,n,s)}drawOffset(t,e,i,n,s,r){return Oa(t,this.parseSize(e)/2+s,i,n,r)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i} a ${s},${s} 0 1,0 ${2*s},0 a ${s},${s} 0 1,0 -${2*s},0`}};var Pa=new class extends Ea{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,n,s){return function(t,e,i,n,s){return t.moveTo(-3*e+i,-e+n,s),t.lineTo(-e+i,-e+n,s),t.lineTo(-e+i,-3*e+n,s),t.lineTo(e+i,-3*e+n,s),t.lineTo(e+i,-e+n,s),t.lineTo(3*e+i,-e+n,s),t.lineTo(3*e+i,e+n,s),t.lineTo(e+i,e+n,s),t.lineTo(e+i,3*e+n,s),t.lineTo(-e+i,3*e+n,s),t.lineTo(-e+i,e+n,s),t.lineTo(-3*e+i,e+n,s),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,s)}drawOffset(t,e,i,n,s,r){return function(t,e,i,n,s,r){return t.moveTo(-3*e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-3*e+n-s,r),t.lineTo(e+i+s,-3*e+n-s,r),t.lineTo(e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,e+n+s,r),t.lineTo(e+i+s,e+n+s,r),t.lineTo(e+i+s,3*e+n+s,r),t.lineTo(-e+i-s,3*e+n+s,r),t.lineTo(-e+i-s,e+n+s,r),t.lineTo(-3*e+i-s,e+n+s,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,s,r)}};function Ia(t,e,i,n,s){return t.moveTo(i,n-e,s),t.lineTo(e+i,n,s),t.lineTo(i,n+e,s),t.lineTo(i-e,n,s),t.closePath(),!0}var La=new class extends Ea{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,n,s){return Ia(t,this.parseSize(e)/2,i,n,s)}drawFitDir(t,e,i,n,s){return Ia(t,this.parseSize(e)/2,i,n,s)}drawOffset(t,e,i,n,s,r){return Ia(t,this.parseSize(e)/2+s,i,n,r)}};function Da(t,e,i,n){const s=2*e;return t.rect(i-e,n-e,s,s),!1}var Fa=new class extends Ea{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return Da(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return Da(t,this.parseSize(e)/2+s,i,n)}};function ja(t,e,i,n,s=0){return t.moveTo(i+e+2*s,e+n+s),t.lineTo(i-e-2*s,e+n+s),t.lineTo(i,n-e-2*s),t.closePath(),!0}class Na extends Ea{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,n){return ja(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return ja(t,this.parseSize(e)/2,i,n,s)}}var Ua=new Na;var Ha=new class extends Na{constructor(){super(...arguments),this.type="triangle"}};const za=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Va=Math.sin(xt/10)*za,Wa=-Math.cos(xt/10)*za;function Ga(t,e,i,n){const s=Va*e,r=Wa*e;t.moveTo(i,-e+n),t.lineTo(s+i,r+n);for(let a=1;a<5;++a){const o=xt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+n),t.lineTo(l*s-h*r+i,h*s+l*r+n)}return t.closePath(),!0}var Ya=new class extends Ea{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,n){return Ga(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return Ga(t,this.parseSize(e)/2+s,i,n)}};const Xa=Bt(3);function $a(t,e,i,n){const s=e,r=s/Xa,a=r/5,o=e;return t.moveTo(0+i,-s+n),t.lineTo(r/2+i,n),t.lineTo(a/2+i,n),t.lineTo(a/2+i,o+n),t.lineTo(-a/2+i,o+n),t.lineTo(-a/2+i,n),t.lineTo(-r/2+i,n),t.closePath(),!0}var Ka=new class extends Ea{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,n){return $a(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return $a(t,this.parseSize(e)/2+s,i,n)}};function qa(t,e,i,n){const s=2*e;return t.moveTo(i,-e+n),t.lineTo(s/3/2+i,e+n),t.lineTo(-s/3/2+i,e+n),t.closePath(),!0}var Za=new class extends Ea{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,n){return qa(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return qa(t,this.parseSize(e)/2+s,i,n)}};function Ja(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(i,e+n),!1}var Qa=new class extends Ea{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,n){return Ja(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return Ja(t,this.parseSize(e)/2+s,i,n)}};const to=-.5,eo=Bt(3)/2,io=1/Bt(12);function no(t,e,i,n){const s=e/2,r=e*io,a=s,o=e*io+e,l=-a,h=o;return t.moveTo(s+i,r+n),t.lineTo(a+i,o+n),t.lineTo(l+i,h+n),t.lineTo(to*s-eo*r+i,eo*s+to*r+n),t.lineTo(to*a-eo*o+i,eo*a+to*o+n),t.lineTo(to*l-eo*h+i,eo*l+to*h+n),t.lineTo(to*s+eo*r+i,to*r-eo*s+n),t.lineTo(to*a+eo*o+i,to*o-eo*a+n),t.lineTo(to*l+eo*h+i,to*h-eo*l+n),t.closePath(),!1}var so=new class extends Ea{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,n){return no(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return no(t,this.parseSize(e)/2+s,i,n)}};function ro(t,e,i,n,s){return t.moveTo(-e+i-2*s,n),t.lineTo(e+i+s,e+n+2*s),t.lineTo(e+i+s,n-e-2*s),t.closePath(),!0}var ao=new class extends Ea{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,n){return ro(t,this.parseSize(e)/2,i,n,0)}drawOffset(t,e,i,n,s){return ro(t,this.parseSize(e)/2,i,n,s)}};function oo(t,e,i,n,s=0){return t.moveTo(i-e-s,e+n+2*s),t.lineTo(e+i+2*s,n),t.lineTo(i-e-s,n-e-2*s),t.closePath(),!0}var lo=new class extends Ea{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,n){return oo(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return oo(t,this.parseSize(e)/2,i,n,s)}};function ho(t,e,i,n,s=0){return t.moveTo(i-e-2*s,n-e-s),t.lineTo(i+e+2*s,n-e-s),t.lineTo(i,n+e+2*s),t.closePath(),!0}var co=new class extends Ea{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,n){return ho(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return ho(t,this.parseSize(e)/2,i,n,s)}};const uo=Bt(3);function po(t,e,i,n){const s=e*uo;return t.moveTo(i,n+-s/3*2),t.lineTo(e+i,n+s),t.lineTo(i-e,n+s),t.closePath(),!0}var go=new class extends Ea{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,n){return po(t,this.parseSize(e)/2/uo,i,n)}drawOffset(t,e,i,n,s){return po(t,this.parseSize(e)/2/uo+s,i,n)}};function fo(t,e,i,n){const s=2*e;return t.moveTo(e+i,n-s),t.lineTo(i-e,n),t.lineTo(e+i,s+n),!0}var mo=new class extends Ea{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,n){return fo(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return fo(t,this.parseSize(e)/4+s,i,n)}};function vo(t,e,i,n){const s=2*e;return t.moveTo(i-e,n-s),t.lineTo(i+e,n),t.lineTo(i-e,s+n),!0}var yo=new class extends Ea{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,n){return vo(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return vo(t,this.parseSize(e)/4+s,i,n)}};function _o(t,e,i,n){const s=2*e;return t.moveTo(i-s,n+e),t.lineTo(i,n-e),t.lineTo(i+s,n+e),!0}var bo=new class extends Ea{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,n){return _o(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return _o(t,this.parseSize(e)/4+s,i,n)}};function xo(t,e,i,n){const s=2*e;return t.moveTo(i-s,n-e),t.lineTo(i,n+e),t.lineTo(i+s,n-e),!0}var So=new class extends Ea{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,n){return xo(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return xo(t,this.parseSize(e)/4+s,i,n)}};function Ao(t,e,i,n,s){return t.moveTo(i,n-e),t.lineTo(i,n+e),!0}var wo=new class extends Ea{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,n,s){return Ao(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Ao(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e}, ${i-s} L ${e},${i+s}`}};function ko(t,e,i,n,s){return t.moveTo(i-e,n),t.lineTo(i+e,n),!0}var To=new class extends Ea{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,n,s){return ko(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return ko(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i} L ${e+s},${i}`}};function Co(t,e,i,n,s){return t.moveTo(i-e,n-e),t.lineTo(i+e,n+e),t.moveTo(i+e,n-e),t.lineTo(i-e,n+e),!0}var Mo=new class extends Ea{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,n,s){return Co(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Co(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i-s} L ${e+s},${i+s} M ${e+s}, ${i-s} L ${e-s},${i+s}`}};function Bo(t,e,i,n){return t.rect(i-e[0]/2,n-e[1]/2,e[0],e[1]),!1}function Eo(t,e,i,n){const s=e,r=e/2;return t.rect(i-s/2,n-r/2,s,r),!1}var Oo=new class extends Ea{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,n){return S(e)?Eo(t,e,i,n):Bo(t,e,i,n)}drawWithClipRange(t,e,i,n,s,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*s,l=[{x:i+e[0]/2,y:n-e[1]/2},{x:i+e[0]/2,y:n+e[1]/2},{x:i-e[0]/2,y:n+e[1]/2},{x:i-e[0]/2,y:n-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/n,s=(i.y-c.y)*(o-h)/n;t.lineTo(c.x+e,c.y+s);break}t.lineTo(i.x,i.y),c=i,h+=n}return!1}drawOffset(t,e,i,n,s){return S(e)?Eo(t,e+2*s,i,n):Bo(t,[e[0]+2*s,e[1]+2*s],i,n)}};const Ro=new he;class Po{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,n,s,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((s=>{t.beginPath(),Tn(s.path.commandList,t,i,n,e,e),a&&a(s.path,s.attribute)})),!1):(Tn(this.path.commandList,t,i,n,e+s,e+s),!1)}draw(t,e,i,n,s,r){return e=this.parseSize(e),this.drawOffset(t,e,i,n,0,s,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,n,s,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,n,s),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,n,s),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Ro.x1=i.bounds.x1*t,Ro.y1=i.bounds.y1*t,Ro.x2=i.bounds.x2*t,Ro.y2=i.bounds.y2*t,e.union(Ro)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const Io={};[Ra,Pa,La,Fa,go,Ha,Ya,Ka,Za,Qa,so,ao,lo,Ua,co,mo,yo,bo,So,Oo,wo,To,Mo].forEach((t=>{Io[t.type]=t}));const Lo={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Do{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Fo(t,e,i,n){const s=t.indexOf(e,i);if(-1===s)throw new Error(n);return s+e.length-1}function jo(t,e,i,n=">"){const s=function(t,e,i=">"){let n,s="";for(let r=e;r",r,"Closing Tag is not closed."),a=s.lastIndexOf(".");s=s.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&n&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=n),n="",r=e}else if("?"===t[r+1])r=jo(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Fo(t,"--\x3e",r+4,"Comment is not closed.");else{const a=jo(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(s+=s?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),s=s.substr(0,s.length-1),l=o):l=l.substr(0,l.length-1);const t=new Do(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),s=s.substr(0,s.lastIndexOf("."))}else{const t=new Do(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),i=t}n="",r=c}else n+=t[r];return e.child}}function Ho(t,e){return zo(t)}function zo(t,e){const i={};for(let e=0;eZo.set(t,!0)));const Jo=new Map;function Qo(t){if(Zo.has(t))return!0;if(Jo.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Jo.set(t,!0)));const tl=Ko(),el=Ko(),il=Ko(),nl=Ko(),sl=Ko(),rl=Ko(),al=Ko(),ol=Ko(),ll=Ko(),hl=Ko();Ko();const cl=Ko();Ko();const ul=Ko();Ko();const dl=Ko(),pl=Ko(),gl=Symbol.for("GraphicService"),fl=Symbol.for("GraphicCreator"),ml={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},vl=Object.keys(ml),yl={duration:200,easing:"cubicOut"};function _l(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function bl(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,u,d,p,g,f,m,v;return e===t?(t[12]=e[0]*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],u=e[5],d=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=u,t[6]=d,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+u*s+f*r+e[13],t[14]=l*n+d*s+m*r+e[14],t[15]=h*n+p*s+v*r+e[15]),t}function xl(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function Sl(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],u=e[8],d=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*u+S*f,t[1]=_*s+b*l+x*d+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*u+S*f,t[5]=_*s+b*l+x*d+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*u+S*f,t[9]=_*s+b*l+x*d+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*u+S*f,t[13]=_*s+b*l+x*d+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function Al(t,e,i){const 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}class wl{constructor(){this.pools=[]}static identity(t){return _l(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return wl.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ml=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Bl=new ue(1,0,0,1,0,0),El={x:0,y:0};let Ol=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ue(1,0,0,1,0,0),this.path=new ps,this._clearMatrix=new ue(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return kl.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ue(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(kl.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(kl.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n,s=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,n=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,n=!0){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 Lr(t,0,!1,e,i)}(this.path.commandList,El.x,El.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},El);const i=Hs(this,this.lineWidth,this.dpr);return function(t,e,i,n){return Lr(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(t=!0,e=this.dpr){this.setTransformFromMatrix(Bl,t,e)}setClearMatrix(t,e,i,n,s,r){this._clearMatrix.setValue(t,e,i,n,s,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>kl.free(t))),this.stack.length=0}};Ol=Cl([_i(),Ml("design:paramtypes",[Object,Number])],Ol);const Rl={WIDTH:500,HEIGHT:500,DPR:1};class Pl{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:n=Rl.WIDTH,height:s=Rl.HEIGHT,dpr:r=Rl.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=n*r,this._pixelHeight=s*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=n,this._displayHeight=s,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Il;Pl.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Il||(Il={}));class Ll{static Get(t,e=Il.Color1,i=[0,0,0,1]){if(e===Il.Color1){const e=Ll.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const n=Ae.parseColorString(t);if(n){const e=[n.r/255,n.g/255,n.b/255,n.opacity];Ll.store1[t]=e,Ll.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const n=Ll.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;const s=Ae.parseColorString(t);return s&&(Ll.store1[t]=[s.r/255,s.g/255,s.b/255,s.opacity],Ll.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=s.r,i[1]=s.g,i[2]=s.b,i[3]=s.opacity),i}static Set(t,e,i){if(e===Il.Color1){if(Ll.store1[t])return;Ll.store1[t]=i,Ll.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Ll.store255[t])return;Ll.store255[t]=i,Ll.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Dl(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Fl(t,e,i,n,s){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((s,r)=>{var a,o;return jl(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,n)})):jl(t,e,i,n,s)}function jl(t,e,i,n,s){if(!t||!e)return t&&Dl(t)||e&&Dl(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Ll.Get(t,Il.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Ll.Get(e,Il.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:Dl(a)})))});return o?Fl(r,l,i,n,s):Fl(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:zl(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:zl(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:zl(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),Dl(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),n)}function Nl(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Ll.store255={},Ll.store1={};const Ul=[0,0,0,0],Hl=[0,0,0,0];function zl(t,e,i){return Ll.Get(t,Il.Color255,Ul),Ll.Get(e,Il.Color255,Hl),`rgba(${Math.round(Ul[0]+(Hl[0]-Ul[0])*i)},${Math.round(Ul[1]+(Hl[1]-Ul[1])*i)},${Math.round(Ul[2]+(Hl[2]-Ul[2])*i)},${Ul[3]+(Hl[3]-Ul[3])*i})`}class Vl{static GetCanvas(){try{return Vl.canvas||(Vl.canvas=Gi.global.createCanvas({})),Vl.canvas}catch(t){return null}}static GetCtx(){if(!Vl.ctx){const t=Vl.GetCanvas();Vl.ctx=t.getContext("2d")}return Vl.ctx}}class Wl extends de{static getInstance(){return Wl._instance||(Wl._instance=new Wl),Wl._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Vl.GetCanvas(),n=Vl.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})`}GetOrCreate(t,e,i,n,s=[],r=100){let a=`${t}${e}${i}${n}`;s.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Wl(s,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Gl{static GetSize(t){for(let e=0;e=t)return Gl.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=Gl.GenKey(t,e,i,n,s),l=Gl.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,n,s,r,a,o){const l=Gl.GenKey(t,e,i,n,s);Gl.cache[l]?Gl.cache[l].push({width:a,height:o,pattern:r}):Gl.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}Gl.cache={},Gl.ImageSize=[20,40,80,160,320,640,1280,2560];const Yl=new he,Xl=new ue;new he;const $l=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Kl=["x","y"],ql=["scaleX","scaleY"],Zl=["angle"],Jl=new Dt,Ql={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class th extends na{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Io[t];if(e)return e;if(e=th.userSymbolMap[t],e)return e;if(!0===((i=t=Lo[t]||t).startsWith("{const e=(new ps).fromString(t.d),i={};vl.forEach((e=>{t[e]&&(i[ml[e]]=t[e])})),s.push({path:e,attribute:i}),Yl.union(e.bounds)}));const r=Yl.width(),a=Yl.height(),o=1/Tt(r,a);s.forEach((t=>t.path.transform(0,0,o,o)));const l=new Po(t,s,!0);return th.userSymbolMap[t]=l,l}var i;const n=(new ps).fromString(t),s=n.bounds.width(),r=n.bounds.height(),a=1/Tt(s,r);n.transform(0,0,a,a);const o=new Po(t,n);return th.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,n=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:s=e.boundsPadding}=i,r=ba(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new an(t);return Tn(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&vn.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&vn.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&vn.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&vn.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&vn.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&vn.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=vn.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===yn.GLOBAL){const i=new Dt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,n){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||n)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i))}_setAttributes(t,e=!1,i){const n=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=n&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(s=this.context&&this.context.stateAnimateConfig)&&void 0!==s?s:this.stateAnimateConfig)&&void 0!==r?r:yl;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:_n.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:_n.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:_n.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const n=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=n?n:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if(this.currentStates){const i=_(t)?e=>!t.includes(e):e=>e!==t,n=this.currentStates.filter(i);n.length!==this.currentStates.length&&this.useStates(n,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;this.stateSort&&(t=t.sort(this.stateSort));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|=vn.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=vn.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=vn.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&vn.UPDATE_SHAPE_AND_BOUNDS)===vn.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=vn.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=vn.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=vn.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=vn.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=vn.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=vn.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=vn.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&vn.UPDATE_LAYOUT)}getAnchor(t,e,i){const n=[0,0],s=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=s();n[0]=i.x1+(i.x2-i.x1)*e}else n[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=s();n[1]=i.y1+(i.y2-i.y1)*e}else n[1]=t[1];return n}doUpdateLocalMatrix(){const{x:t=ms.x,y:e=ms.y,scaleX:i=ms.scaleX,scaleY:n=ms.scaleY,angle:s=ms.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&s&&(l=this.getAnchor(a,h)),!r||1===i&&1===n)!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,u=e.d,d=e.e,p=e.f,g=kt(a),f=Mt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=n);const y=m-i,_=v-n,b=l*g+c*f,x=h*g+u*f,S=c*g-l*f,A=u*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*A,t.e=d+l*m+c*v-b*y-S*_,t.f=p+h*m+u*v-x*y-A*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,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),l=this.getAnchor(r,h,!0),Gi.transformUtil.fromMatrix(a,a).scale(i,n,{x:l[0],y:l[1]})}const c=this.getOffsetXY(ms);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Xl.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:_n.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Gi.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new ps).fromString(t):this.pathProxy=new ps,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),Gi.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new la(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)}}toCustomPath(){var t,e,i;const n=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Gi.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(n){const t=new Ol(null,1);return n.drawShape(this,t,0,0,{},{}),t.path}return null}}var eh;th.userSymbolMap={},th.mixin(da),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(eh||(eh={}));class ih extends th{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=rl,this._childUpdateTag=vn.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Qr),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Qr)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===yn.GLOBAL){const i=new Dt(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&vn.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=ms.x,y:e=ms.y,dx:i=ms.dx,dy:n=ms.dy,scaleX:s=ms.scaleX,scaleY:r=ms.scaleY,angle:a=ms.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==n||1!==s||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return ea(this).group}updateAABBBounds(t,e,i){const n=i;i=i.clone();const{width:s,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,Math.max(0,s),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:n=0}=t;i.translate(e,n)}return Gi.graphicService.updateTempAABBBounds(i),Gi.graphicService.transformAABBBounds(t,i,e,!1,this),n.copy(i),n}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=vn.CLEAR_BOUNDS,this._childUpdateTag&=vn.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=vn.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&vn.UPDATE_BOUNDS||(this._childUpdateTag|=vn.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&vn.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=Gi.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new ih(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ih.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}}function nh(t){return new ih(t)}ih.NOWORK_ANIMATE_ATTR=Ql;class sh extends ih{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=n.layerHandler,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 Qr,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Gi.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Gi.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const rh=Symbol.for("TransformUtil"),ah=Symbol.for("GraphicUtil"),oh=Symbol.for("LayerService"),lh=Symbol.for("StaticLayerHandlerContribution"),hh=Symbol.for("DynamicLayerHandlerContribution"),ch=Symbol.for("VirtualLayerHandlerContribution");var uh,dh=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ph=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let gh=uh=class{static GenerateLayerId(){return`${uh.idprefix}_${uh.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Gi.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?Vi.get(lh):"dynamic"===t?Vi.get(hh):Vi.get(ch),e}createLayer(t,e={main:!1}){var i;this.tryInit();let n=this.getRecommendedLayerType(e.layerMode);n=e.main||e.canvasId?"static":n;const s=this.getLayerHandler(n),r=new sh(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:n,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:uh.GenerateLayerId(),layerHandler:s})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};gh.idprefix="visactor_layer",gh.prefix_count=0,gh=uh=dh([_i(),ph("design:paramtypes",[])],gh);var fh=new ai((t=>{t(zi).to(Qi).inSingletonScope(),t(Nr).to(Hr),t(ah).to(Gr).inSingletonScope(),t(rh).to($r).inSingletonScope(),t(oh).to(gh).inSingletonScope()}));function mh(t,e){return!(!t&&!e)}function vh(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function yh(t,e,i){return i&&t*e>0}function _h(t,e,i,n,s){return s&&t*e>0&&0!==i&&0!==n}function bh(t,e){return t*e>0}function xh(t,e,i,n,s){return s?t*e>0:t*e>0&&0!==i&&0!==n}function Sh(t,e,i,n,s,r,a){const o=t-i,l=e-n,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,u=-h*o,d=t+c,p=e+u,g=i+c,f=n+u,m=(d+g)/2,v=(p+f)/2,y=g-d,_=f-p,b=y*y+_*_,x=s-r,S=d*f-g*p,A=(_<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let w=(S*_-y*A)/b,k=(-S*y-_*A)/b;const T=(S*_+y*A)/b,C=(-S*y+_*A)/b,M=w-m,B=k-v,E=T-m,O=C-v;return M*M+B*B>E*E+O*O&&(w=T,k=C),{cx:w,cy:k,x01:-c,y01:-u,x11:w*(s/x-1),y11:k*(s/x-1)}}function Ah(t,e,i,n,s){const r=At(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:u,innerEndAngle:d,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=s*kt(c),w=s*Mt(c),k=n*kt(d),T=n*Mt(d);let C,M,B,E;if((b>yt||y>yt)&&(C=s*kt(u),M=s*Mt(u),B=n*kt(p),E=n*Mt(p),r<_t)){const t=function(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,u=o-r;let d=u*l-c*h;return d*d1?0:O<-1?_t:Math.acos(O))/2),l=Bt(t[0]*t[0]+t[1]*t[1]);S=Ct(b,(n-l)/(o-1)),x=Ct(y,(s-l)/(o+1))}}var O;return{outerDeltaAngle:l,xors:A,yors:w,xirs:B,yirs:E,xore:C,yore:M,xire:k,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:u,innerDeltaAngle:h,innerEndAngle:d,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function wh(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=At(l-o),c=l>o;let u=!1;if(s=St-yt)e.moveTo(i+s*kt(o),n+s*Mt(o)),e.arc(i,n,s,o,l,!c),r>yt&&(e.moveTo(i+r*kt(l),n+r*Mt(l)),e.arc(i,n,r,l,o,c));else{const{outerDeltaAngle:h,xors:d,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:w,outerEndAngle:k,limitedIcr:T,innerDeltaAngle:C,innerEndAngle:M,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:O,maxInnerCornerRadius:R}=Ah(t,o,l,r,s);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+d,n+p),u=!0;else if(m>yt){const t=Ct(v,m),r=Ct(y,m),o=Sh(g,f,d,p,s,t,Number(c)),l=Sh(b,x,S,A,s,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),e.arc(i+o.cx,n+o.cy,m,wt(o.y01,o.x01),wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*kt(wt(l.y01,l.x01)),n+o.cy+m*Mt(wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),t>0&&e.arc(i+o.cx,n+o.cy,t,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,n,s,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*kt(wt(l.y01,l.x01)),n+l.cy+r*Mt(wt(l.y01,l.x01))):e.moveTo(i+b,n+s*Mt(k))}else!a||a[0]?(e.moveTo(i+d,n+p),e.arc(i,n,s,w,k,!c)):e.moveTo(i+s*kt(k),n+s*Mt(k));if(!(r>yt)||C<.001)!a||a[1]?e.lineTo(i+S,n+A):e.moveTo(i+S,n+A),u=!0;else if(T>yt){const t=Ct(E,T),s=Ct(O,T),o=Sh(S,A,b,x,r,-s,Number(c)),l=Sh(d,p,g,f,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),T0&&e.arc(i+o.cx,n+o.cy,s,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,n,r,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*kt(wt(l.y01,l.x01)),n+l.cy+t*Mt(wt(l.y01,l.x01))):e.moveTo(i+g,n+f)}else!a||a[1]?e.lineTo(i+S,n+A):e.moveTo(i+S,n+A),!a||a[2]?e.arc(i,n,r,M,B,c):e.moveTo(i+r*kt(B),n+r*Mt(B))}return a?a[3]&&e.lineTo(i+s*kt(o),n+s*Mt(o)):e.closePath(),u}const kh=Symbol.for("ArcRenderContribution"),Th=Symbol.for("AreaRenderContribution"),Ch=Symbol.for("GroupRenderContribution"),Mh=Symbol.for("PathRenderContribution"),Bh=Symbol.for("PolygonRenderContribution"),Eh=Symbol.for("RectRenderContribution"),Oh=Symbol.for("SymbolRenderContribution"),Rh=Symbol.for("TextRenderContribution"),Ph=Symbol.for("InteractiveSubRenderContribution");function Ih(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Lh(t,e,i,n=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?n-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var Dh=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(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)}};function Nh(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:u=i.scaleY,scaleZ:d=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=m[1];y[2]=null!==(n=m[2])&&void 0!==n?n:0}if(_l(t),bl(t,t,[s+o,r+l,a+h]),bl(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],u=e[10],d=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+u*n,t[7]=l*s+d*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=u*s-o*n,t[11]=d*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],u=e[10],d=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-u*n,t[3]=l*s-d*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+u*s,t[11]=l*n+d*s}(t,t,p),bl(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,u,d]),f){const i=Tl.allocate(),n=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=m[1]}bl(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],u=e[6],d=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+u*n,t[3]=l*s+d*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=u*s-o*n,t[7]=d*s-l*n}(i,i,f),bl(i,i,[-n[0],-n[1],0]),Sl(t,t,i)}}let Uh=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new Ui(["graphic"]),onSetStage:new Ui(["graphic","stage"]),onRemove:new Ui(["graphic"]),onRelease:new Ui(["graphic"]),onAddIncremental:new Ui(["graphic","group","stage"]),onClearIncremental:new Ui(["graphic","group","stage"]),beforeUpdateAABBBounds:new Ui(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Ui(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new Ui(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new he,this.tempAABBBounds2=new he}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new an(t);return Tn(i.commandList,n,0,0),!0}updateHTMLTextAABBBounds(t,e,i,n){const{textAlign:s,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),n=Lh(r,e,e);i.set(i.x1,n,i.x2,n+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),n=Ih(s,e);i.set(n,i.y1,n+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){if(!e.empty()){const{scaleX:s=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,u=this.tempAABBBounds1,d=this.tempAABBBounds2;if(a&&l){Xo(u,(l+h)/Math.abs(s+r),n,c),e.union(u),u.setValue(d.x1,d.y1,d.x2,d.y2)}if(o){const{shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Xo(u,o/Math.abs(s+r)*2,!1,c+1),u.translate(n,a),e.union(u)}}if(this.combindShadowAABBBounds(e,s),e.empty())return;let r=!0;const a=s.transMatrix;s&&s.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&oe(e,e,a)}validCheck(t,e,i,n){if(!n)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(n.shadowRoot||n.isContainer)return!0;const{visible:s=e.visible}=t;return!(!n.valid||!s)||(i.empty()||(n.parent&&i.transformWithMatrix(n.parent.globalTransMatrix),this.clearAABBBounds(n,n.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Uh=Dh([_i(),jh(0,vi(fl)),Fh("design:paramtypes",[Object])],Uh);const Hh=(t,e,i)=>{const{outerBorder:n,shadowBlur:s=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(r+(s+a)/2)}return i};class zh{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,n){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===n.length){const t=n[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,n,s="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=tn.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const u=[],d=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,n=t.length;io){const n=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,s,r,l);a=n.str,e=n.width}else e=n.width;u.push({str:a,width:e,ascent:n.ascent,descent:n.descent,keepCenterInLine:c})}d[0]=o}else{let e,i,n=0;for(let s=0,r=t.length;sMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:d[0],height:d[1]};return this.LayoutBBox(p,e,i,u),this.layoutWithBBox(p,u,e,i,n)}layoutWithBBox(t,e,i,n,s){const r=[0,0],a=e.length*s;"top"===n||("middle"===n?r[1]=(t.height-a)/2:"bottom"===n&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===n.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=pl,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return ea(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Wh({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const n=this.obbText.AABBBounds,{x:s,y:r}=e,a={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},o=Zt(a,i,{x:s,y:r});return this._OBBBounds.copy(n),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:n=e.text}=this.attribute;Array.isArray(n)?this.updateMultilineAABBBounds(n):this.updateSingallineAABBBounds(n);const{tb1:s}=Gi.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Xo(s,o/Math.abs(r+a),!0,l),i.union(s)}return Gi.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Gi.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oe(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:n=e.underlineOffset}=this.attribute,s="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&n&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+n),s}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const n=this.getGraphicTheme(),s=this.attribute,{fontFamily:r=n.fontFamily,textAlign:a=n.textAlign,textBaseline:o=n.textBaseline,fontSize:l=n.fontSize,fontWeight:h=n.fontWeight,ellipsis:c=n.ellipsis,maxLineWidth:u,stroke:d=n.stroke,wrap:p=n.wrap,measureMode:g=n.measureMode,lineWidth:f=n.lineWidth,whiteSpace:m=n.whiteSpace,suffixPosition:v=n.suffixPosition,ignoreBuf:y=n.ignoreBuf,keepCenterInLine:_=n.keepCenterInLine}=s,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(s,n,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=Gi.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new zh(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?n.ellipsis:c||void 0,!1,{lineWidth:u,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:w}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(w.xOffset,w.yOffset,w.xOffset+w.width,w.yOffset+w.height),d&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,n,s;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:u,stroke:d=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),w=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}const k=Gi.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:w},C=new zh(a,T,k),M=_(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let O=1/0;if(b>0&&(O=Math.max(Math.floor(b/w),1)),x&&(O=Math.min(O,x)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let n=0,s=M.length;n{const e=t.reduce(((t,e)=>t+e.width),0);a=Tt(e,a)}));const t=Ih(y,a),e=this.cache.verticalList.length*v,i=Lh(_,e,u);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,n="";for(let s=0;s{if(Number.isFinite(l))if(h){const i=!0===h?s.ellipsis:h,n=r.clipTextWithSuffixVertical(t,{fontSize:u,fontWeight:d,fontFamily:c},l,i,!1,m);b[e]=n.verticalList,a=n.width}else{const i=r.clipTextVertical(t,{fontSize:u,fontWeight:d,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===qo.HORIZONTAL?u:r.measureTextWidth(t.text,{fontSize:u,fontWeight:d,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Tt(e,a)}));const x=Ih(y,a),S=this.cache.verticalList.length*v,A=Lh(_,S,u);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const n=this.attribute;return null!==(i=null!==(e=n.maxLineWidth)&&void 0!==e?e:n.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var n;return null!==(n=Ba(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==n?n:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Vh){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Vh){return super.needUpdateTag(t,e)}_interpolate(t,e,i,n,s){"text"===t&&(s.text=n)}clone(){return new Wh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wh.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Wh.baselineMapAlign}getAlignMapBaseline(){return Wh.alignMapBaseline}}function Gh(t){return new Wh(t)}Wh.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ql),Wh.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Wh.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Yh=["symbolType","size",...$l];let Xh=class t extends th{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=dl}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let n=null;try{n=new Path2D}catch(t){return null}const s=this.getParsedPath();if(!s)return null;s.draw(n,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return ea(this).symbol}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:s,tb2:r}=Gi.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:n,shadowBlur:s=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=n;Xo(i,a+(s+o)/2,!0,r)}})(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:n=e.size}=t;if(_(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:n=e.size}=t,s=this.getParsedPath();return s?(s.bounds(n,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Yh)}needUpdateTag(t){return super.needUpdateTag(t,Yh)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new ps).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new ps).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function $h(t){return new Xh(t)}Xh.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ql);const Kh=["segments","points","curveType","curveTension",...$l];let qh=class t extends th{constructor(t={}){super(t),this.type="line",this.numberType=ol}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=ka(i,n,e))}getGraphicTheme(){return ea(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Gi.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:n=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points,connectedType:r}=t,a=i;return s.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments,connectedType:r}=t,a=i;return s.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Kh)}needUpdateTag(t){return super.needUpdateTag(t,Kh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new ps;const i=e.segments,n=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):e.points&&n(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Zh(t){return new qh(t)}qh.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ql);const Jh=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(t.height)?t.y1-t.y:t.height,n=0,s=0;return e<0?(n=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(s=i,i=-i):Number.isNaN(i)&&(i=0),{x:n,y:s,width:e,height:i}},Qh=["width","x1","y1","height","cornerRadius",...$l];class tc extends th{constructor(t){super(t),this.type="rect",this.numberType=cl}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return ea(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:n}=t;const{x1:s,y1:r,x:a,y:o}=t;e=null!=e?e:s-a,n=null!=n?n:r-o,(isFinite(e)||isFinite(n)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,n||0)}const{tb1:n,tb2:s}=Gi.graphicService.updateTempAABBBounds(i);return Hh(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Gi.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Qh)}needUpdateTag(t){return super.needUpdateTag(t,Qh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:n,width:s,height:r}=Jh(e);return t=new ps,t.moveTo(i,n),t.rect(i,n,s,r),t}clone(){return new tc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tc.NOWORK_ANIMATE_ATTR}}function ec(t){return new tc(t)}tc.NOWORK_ANIMATE_ATTR=Ql;class ic{constructor(t,e,i,n,s,r,a,o,l,h,c,u,d,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=Vs[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=u,this.singleLine=d,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height: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;"right"===this.globalAlign||"end"===this.globalAlign?o=-s:"center"===this.globalAlign&&(o=-s/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let 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,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=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=!0===this.ellipsis?"...":this.ellipsis||"",s=this.lines[i].getWidthWithEllips(n);s>t&&(t=s),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=s),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=!0===this.ellipsis?"...":this.ellipsis||"",s=this.lines[i].getWidthWithEllips(n);s>t&&(t=s),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function nc(t,e,i,n){const s=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(n);return{left:t>s?s:s-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>n?o:o+.5}}class sc{constructor(t,e,i,n){var s,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=n;const a=Ba(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Qs(t,i,this.ascentDescentMode);let u=0,d=0,p=0;this.height>l&&(u=(this.height-l)/2,d=Math.ceil(u),p=Math.floor(u)),"top"===this.textBaseline?(this.ascent=u,this.descent=l-u):"bottom"===this.textBaseline?(this.ascent=l-u,this.descent=u):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+d,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(s=i.dx)&&void 0!==s?s:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Qs(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,n,s,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+n;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=qs(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Qs(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const u=nc(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},u),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,n,s,r,a){var o;let l=e+i,h=this.text,c=this.left+n+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let u=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,u="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=qs(h,("vertical"===u?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===u);else{const{width:e}=Qs(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===u&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:d=1}=this.character;if(this.character.stroke&&d&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=nc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=nc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=nc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=nc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===u&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=qs(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:n}=Qs(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-n}return i}}const rc=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...$l];class ac extends th{constructor(t){super(t),this.type="image",this.numberType=al,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,n){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,n)}getGraphicTheme(){return ea(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:n=e.maxWidth,maxHeight:s=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>n/s?(r=n,a=n/t):(a=s,r=s*t)}}else r=n,a=s}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:n,tb2:s}=Gi.graphicService.updateTempAABBBounds(i);return Hh(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Gi.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return Fs[t]}needUpdateTags(t){return super.needUpdateTags(t,rc)}needUpdateTag(t){return super.needUpdateTag(t,rc)}clone(){return new ac(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ac.NOWORK_ANIMATE_ATTR}}ac.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Ql);class oc extends ac{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=ba(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=ba(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Fs.width,height:e=Fs.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 lc{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 oc?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Vs[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof sc){const e=$s.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,n=this.height;let s=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const n=this.paragraphs[e];if(n.overflow)t=t&&""===n.text;else if(t){i=!0;break}}let n=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof oc)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===s?"...":s||"";i.ellipsisStr=r;const{width:a}=Qs(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+n){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+n+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+n;break}i.ellipsis="hide",n+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,s)=>{if(e instanceof oc)return;const r=e.drawBackground(t,n,this.ascent,i,0===s,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],n=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,n.right-i.left,n.bottom-i.top)})),this.paragraphs.forEach(((e,s)=>{if(e instanceof oc)return e.setAttributes({x:i+e._x,y:n+e._y}),void r(e,t,i+e._x,n+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Gs;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:n=1,opacity:s=1}=e;t.globalAlpha=n*s,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Ks(t,e)})(t,e.character),function(t,e,i){const n=e&&e.fill||Ws;if(!n)return void(t.globalAlpha=0);const{fillOpacity:s=1,opacity:r=1}=e;t.globalAlpha=s*r,t.fillStyle=i?zs(t,n,{AABBBounds:i}):n,Ks(t,e)}(t,e.character,a),e.draw(t,n,this.ascent,i,0===s,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const n=this.paragraphs[i];if(n instanceof oc)break;const{width:s}=Qs(t,n.character,n.ascentDescentMode),r=s||0;if(r<=this.blankWidth+e){n.ellipsis="add",n.ellipsisWidth=r;break}if(r<=this.blankWidth+e+n.width){n.ellipsis="replace",n.ellipsisWidth=r,n.ellipsisOtherParagraphWidth=this.blankWidth+e;break}n.ellipsis="hide",e+=n.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof oc?t.width:t.getWidthWithEllips(this.direction)})),i}}class hc{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=Vs[this.direction]}store(t){if(t instanceof oc){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new lc(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof oc?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,n=Math.ceil(i/t[this.directionKey.width]*t.length)||0,s=qs(t.text,i,t.character,n,"break-word"===this.frame.wordBreak);if(0!==s){const[i,n]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new sc(i,t.newLine,t.character,t.ascentDescentMode),new sc(n,!0,t.character,t.ascentDescentMode)]}(t,s);this.store(i),e?this.send():this.deal(n)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let cc=!1;try{cc=Intl&&"function"==typeof Intl.Segmenter}catch(t){cc=!1}const uc=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...$l];class dc extends th{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ul,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const n=this._frameCache.icons.get(t[i]);this.updateHoverIconState(n)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Ds.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:Ds.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:Ds.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:Ds.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:Ds.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:Ds.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:Ds.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:Ds.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return ea(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&dc.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&dc.splitText(t.text).length>1)))}static splitText(t){if(cc){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:n}of e.segment(t))i.push(n);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=dc.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let n=0;n0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:n}=t.getActualSize();let s=o||e||0,r=l||n||0;r="number"==typeof c&&r>c?c:r||0,s="number"==typeof h&&s>h?h:s||0,i.set(0,0,s,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(d){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(u){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Gi.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Gi.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Gi.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,uc)}needUpdateTag(t){return super.needUpdateTag(t,uc)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!dc.AllSingleCharacter(y)&&(y=dc.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let n=0;n0,A="number"==typeof n&&Number.isFinite(n)&&n>0,w="number"==typeof s&&Number.isFinite(s)&&s>0&&(!x||s<=i),k="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=n),T=new ic(0,0,(w?s:x?i:0)||0,(k?r:A?n:0)||0,a,o,l,h,c,u||"horizontal",!w&&x,!k&&A,d||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),C=new hc(T);if(C.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const n=_[i];e?(n.overflow=!0,n.left=1/0,n.top=1/0,!n.newLine&&T.lines[T.lines.length-1].paragraphs.push(n)):C.deal(n,!0),T.lines.length!==t&&(t=T.lines.length,C.lineBuffer.length=0,n.overflow=!0,n.left=1e3,n.top=1e3,T.lines[T.lines.length-1].paragraphs.push(n),e=!0),n.newLine&&(e=!1,C.lineWidth=0),C.send()}}else for(let t=0;t<_.length;t++)C.deal(_[t]);if(C.send(),!("horizontal"===T.layoutDirection?w:k)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:n)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new dc(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,n,s,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(a=s.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],s.globalY=(null!==(o=s.attribute.y)&&void 0!==o?o:0)+n+e._marginArray[0])})),s}getNoWorkAnimateAttr(){return dc.NOWORK_ANIMATE_ATTR}}function pc(t){return new dc(t)}dc.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ql);const gc=["path","customPath",...$l];class fc extends th{constructor(t){super(t),this.type="path",this.numberType=ll}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof ps?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof ps?this.cache:t.path)}getGraphicTheme(){return ea(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:n,tb2:s}=Gi.graphicService.updateTempAABBBounds(i);Hh(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new ps).fromString(t.path):t.customPath&&(this.cache=new ps,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,gc)}needUpdateTag(t){return super.needUpdateTag(t,gc)}toCustomPath(){return(new ps).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new fc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fc.NOWORK_ANIMATE_ATTR}}function mc(t){return new fc(t)}fc.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ql);const vc=["segments","points","curveType","curveTension",...$l];class yc extends th{constructor(t){super(t),this.type="area",this.numberType=il}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return ea(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Gi.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:n=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),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}_interpolate(t,e,i,n,s){"points"===t&&(s.points=ka(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,vc)}needUpdateTag(t){return super.needUpdateTag(t,vc)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new ps;const e=this.attribute,i=e.segments,n=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 yc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yc.NOWORK_ANIMATE_ATTR}}function _c(t){return new yc(t)}yc.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ql);const bc=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...$l];class xc extends th{constructor(t){super(t),this.type="arc",this.numberType=tl}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:n=t.outerPadding}=this.attribute;let{outerRadius:s=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(s+=n,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(s-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Nt(e),i=e+r,n&&At(r)yt&&o>yt)return{startAngle:e-s*d*r,endAngle:i+s*d*a,sc:s*d*r,ec:s*d*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:n=i.innerPadding,outerPadding:s=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=s,o-=n;const{padRadius:l=Bt(a*a+o*o)}=this.attribute,h=At(e-t);let c=t,u=e,d=t,p=e;const g=r/2;let f=h,m=h;if(g>yt&&l>yt){const i=e>t?1:-1;let n=Ot(Number(l)/o*Mt(g)),s=Ot(Number(l)/a*Mt(g));return(f-=2*n)>yt?(n*=i,d+=n,p-=n):(f=0,d=p=(t+e)/2),(m-=2*s)>yt?(s*=i,c+=s,u-=s):(m=0,c=u=(t+e)/2),{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return ea(this).arc}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:s,tb2:r}=Gi.graphicService.updateTempAABBBounds(i);Hh(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:n=e.outerRadius,innerRadius:s=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return n+=r,s-=a,no){const t=l;l=o,o=t}return n<=yt?i.set(0,0,0,0):Math.abs(o-l)>St-yt?i.set(-n,-n,n,n):(Aa(l,o,n,i),Aa(l,o,s,i)),i}needUpdateTags(t){return super.needUpdateTags(t,bc)}needUpdateTag(t){return super.needUpdateTag(t,bc)}toCustomPath(){var t,e,i,n;let s=super.toCustomPath();if(s)return s;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(n=r.outerPadding)&&void 0!==n?n:0);const c=At(o-a),u=o>a;if(h=St-yt)s.moveTo(0+h*kt(a),0+h*Mt(a)),s.arc(0,0,h,a,o,!u),l>yt&&(s.moveTo(0+l*kt(o),0+l*Mt(o)),s.arc(0,0,l,o,a,u));else{const t=h*kt(a),e=h*Mt(a),i=l*kt(o),n=l*Mt(o);s.moveTo(0+t,0+e),s.arc(0,0,h,a,o,!u),s.lineTo(0+i,0+n),s.arc(0,0,l,o,a,u),s.closePath()}return s}clone(){return new xc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xc.NOWORK_ANIMATE_ATTR}}function Sc(t){return new xc(t)}xc.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ql);const Ac=["points","cornerRadius",...$l];class wc extends th{constructor(t){super(t),this.type="polygon",this.numberType=hl}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return ea(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Gi.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:n=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,n,s){"points"===t&&(s.points=ka(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,Ac)}needUpdateTag(t){return super.needUpdateTag(t,Ac)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new ps,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new wc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return wc.NOWORK_ANIMATE_ATTR}}function kc(t){return new wc(t)}wc.NOWORK_ANIMATE_ATTR=Ql;class Tc extends ih{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Cc(t){return new Tc(t)}const Mc=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let Bc,Ec;function Oc(t){return Bc||(Bc=Mc.CreateGraphic("text",{})),Bc.initAttributes(t),Bc.AABBBounds}var Rc=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ic=function(t,e){return function(i,n){e(i,n,t)}};class Lc{constructor(){this.time=Sn.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:w=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const s=t.resources.get(jc(g));if(!s||"success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=ea(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*m,this.doDrawImage(e,s.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:w}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,n){Wc(t,e,i,n)}}const Dc=new Lc,Fc=new Set(["top","center","bottom"]);function jc(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Nc({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Uc={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Hc(t,e,i,n,s){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===n)return e/2;if(r===s)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function zc(t,e,i){const[n,s]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const n=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===n.length)return["left","top"];if(1===n.length){const t=n[0];return"center"===t?["center","center"]:Fc.has(t)?["center",t]:[t,"center"]}let s,r;const a=[];for(let t=0;t<2;t++){const e=n[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:s=e}return null==s&&a.length&&(s=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=s?s:"left",null!=r?r:"top"]}(t);return{x:Hc(n,e,"left","center","right"),y:Hc(s,i,"top","center","bottom")}}function Vc(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Wc(t,e,i,n){var s,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:u=0,backgroundPosition:d="top-left"}=n,p=i.width(),g=i.height(),f=function(t){if(!t)return null;const e=Vc(t.naturalWidth,t.videoWidth,t.width),i=Vc(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}(e),{backgroundRepeatMode:m,backgroundSizing:v}=function({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const n=Uc[t];return n?{backgroundRepeatMode:"no-repeat",backgroundSizing:n}:{backgroundRepeatMode:t,backgroundSizing:Nc({backgroundFit:e,backgroundKeepAspectRatio:i})}}({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let n=null!==(s=null==f?void 0:f.width)&&void 0!==s?s:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(n=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);n=f.width*t,a=f.height*t}n*=h,a*=h;const{x:o,y:l}=zc(d,p-n,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+u,n,a)}if(o&&"repeat"!==m&&f){const i=f.width,n=f.height;"repeat-x"===m?(y=i*(g/n),_=g):"repeat-y"===m&&(_=n*(p/i),y=p);const s=t.dpr,r=Dr.allocate({width:y,height:_,dpr:s}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),Dr.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}let Gc=class{constructor(t){this.subRenderContribitions=t,this.time=Sn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,u,d)}))}};Gc=Rc([_i(),Ic(0,vi(Li)),Ic(0,bi(Ph)),Pc("design:paramtypes",[Object])],Gc);const Yc=new class{constructor(){this.time=Sn.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||u),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,n+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Xc=new class{constructor(){this.time=Sn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||u||e.restore())}};class $c{constructor(){this.time=Sn.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=n.dpr,o=Dr.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),s(r,l);const h=n.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Dr.free(o),h}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,St),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,u,d){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,n,l,g,f,m)}drawTexture(t,e,i,n,s,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:u=null}=e.attribute;let d=this.textureMap.get(t);if(!d)switch(t){case"circle":d=this.createCirclePattern(o,l,a,i);break;case"diamond":d=this.createDiamondPattern(o,l,a,i);break;case"rect":d=this.createRectPattern(o,l,a,i);break;case"vertical-line":d=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":d=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":d=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":d=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":d=this.createGridPattern(o,l,a,i)}if(u&&u.dynamicTexture){const{gridConfig:d={},useNewCanvas:p}=u,g=e.AABBBounds;n=g.x1,s=g.y1;const f=i;let m;if(p){m=Dr.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),n=0,s=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,n,s,r),f.clip();const v=g.width(),y=g.height(),_=l,b=o,x=d.columns?d.columns:Math.ceil(v/b),S=d.rows?d.rows:Math.ceil(y/b),A=d.gutterColumn?d.gutterColumn:2*_,w=d.gutterRow?d.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=$h({}));const k=d.columns?v/d.columns:b,T=d.rows?y/d.rows:b;this._tempSymbolGraphic.setAttributes({size:[k-A,T-w],symbolType:t});const C=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!s||!s.stroke),{distance:o=l[r].distance}=s,h=k?o:Hs(e,o,e.dpr),c=o/C,d="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:C+d*h,innerRadius:T-d*h,startAngle:y-d*c,endAngle:_+d*c}),e.beginPath(),wh(t,e,i,n,C+d*h,T-d*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,s,(x-i)/A,(S-n)/w,l[r]),l[r].opacity=a,e.stroke()}};g&&M(d,"outerBorder"),f&&M(p,"innerBorder"),t.setAttributes({outerRadius:C,innerRadius:T,startAngle:y,endAngle:_})}},Zc=Kc,Jc=Dc;const Qc=new class extends Lc{constructor(){super(...arguments),this.time=Sn.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{background:d,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(d)if(t.backgroundImg&&t.resources){const i=t.resources.get(jc(d));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,n,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=d,e.fill(),e.highPerformanceRestore()}},tu=_t/2;function eu(t,e,i,n,s,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),n<0&&(e+=n,n=-n),s<0&&(i+=s,s=-s),S(r,!0))l=[r=At(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=At(t[0]),l=[e,e,e,e];break;case 2:case 3:e=At(t[0]),i=At(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=At(l[0]),l[1]=At(l[1]),l[2]=At(l[2]),l[3]=At(l[3])}}else l=[0,0,0,0];if(n<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,n,s);const[h,c,u,d]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],p=Math.min(n/2,s/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[u[0]-g[2],u[1]],b=[u[0],u[1]-g[2]],x=[d[0]+g[3],d[1]],A=[d[0],d[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!K(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-tu,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,tu,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!K(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],tu,_t,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],_t,_t+tu,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var iu=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(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 nu=class{constructor(){this.time=Sn.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(d.doStroke=!1)}};nu=iu([_i()],nu);let su=class{constructor(){this.time=Sn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{x1:d,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:d-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),!(0===v||_(v)&&v.every((t=>0===t)))){let s,r=0;return eu(e,i,n,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,u)=>{m[o]&&(r===o-1&&m[o]===s||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,n,l),e.beginPath(),e.moveTo(a,h),s=m[o]),r=o,e.lineTo(c,u),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,n),m[0]?e.lineTo(i+b,n):e.moveTo(i+b,n),m[1]?e.lineTo(i+b,n+x):e.moveTo(i+b,n+x),m[2]?e.lineTo(i,n+x):e.moveTo(i,n+x),m[3]){const t=m[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};su=iu([_i()],su);const ru=new class{constructor(){this.time=Sn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,g=d&&!1!==d.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:w,y1:k,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:C,height:M}=t.attribute;C=(null!=C?C:w-i)||0,M=(null!=M?M:k-n)||0;const B=(s,r)=>{const a=!(!s||!s.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=s,c=T?h:Hs(e,h,e.dpr),d=i+o*c,p=n+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(d,p,C-o*g,M-o*g)):(e.beginPath(),eu(e,d,p,C-o*g,M-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,s,(b-i)/S,(x-n)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&B(d,"outerBorder"),f&&B(p,"innerBorder")}},au=Kc,ou=Dc;const lu=new class{constructor(){this.time=Sn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const d=t.getParsedPath();if(!d)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,w=(s,r)=>{const a=!(!s||!s.stroke),{distance:o=l[r].distance}=s,h=A?o:Hs(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===d.drawOffset(e,v,i,n,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,s,(_-i)/x,(b-n)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&w(p,"outerBorder"),m&&w(g,"innerBorder")}},hu=new class{constructor(){this.time=Sn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,n,p,m,((s,r)=>{var a,h,c,d;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(d=r.lineWidth)&&void 0!==d?d:t.attribute.lineWidth,r=e}r.stroke&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-n)/_,l),e.stroke()))})),r&&!b.isSvg&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-n)/_,l),e.stroke())))}},cu=Kc,uu=Dc;const du={x:0,y:0,z:0,lastModelMatrix:null};class pu{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Yc),this.builtinContributions.push(Xc),this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Sn.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Sn.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,n,s,r,a,o,l,h,c,u,d){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d)}))}afterRenderStep(t,e,i,n,s,r,a,o,l,h,c,u,d){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d)}))}drawPathProxy(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=ea(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:u=l.opacity,fillOpacity:d=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,y=yh(u,d,h),_=bh(u,g),b=mh(h),x=vh(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Tn(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,b,x,y,_,l,s,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,n-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,n-v,l),e.fill())),this.afterRenderStep(t,e,i,n,b,x,y,_,l,s,a,o),!0}valid(t,e,i,n){const{fill:s=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:u=e.visible}=t.attribute,d=yh(o,l,s),p=bh(o,c),g=mh(s,r),f=vh(a,h);return!(!t.valid||!u)&&!(!g&&!f)&&!!(d||p||i||n||r)&&{fVisible:d,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,n=!1){const{x:s=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,u=i.modelMatrix,d=i.camera;du.x=s,du.y=r,du.z=a,du.lastModelMatrix=u;const p=d&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const n=Tl.allocate(),s=Tl.allocate();Nh(s,t,e),Sl(n,u||n,s),du.x=0,du.y=0,du.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),Tl.free(s)}if(g&&!u){const n=t.getOffsetXY(e);du.x+=n.x,du.y+=n.y,du.z=a,i.setTransformForCurrent()}else if(p)du.x=0,du.y=0,du.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(d&&i.project){const n=t.getOffsetXY(e);du.x+=n.x,du.y+=n.y,this.transformWithoutTranslate(i,du.x,du.y,du.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),du.x=0,du.y=0,du.z=0;return du}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},u={x:s,y:r};n.camera=null;const d=1/(h.x*(u.y-c.y)-c.x*u.y+u.x*c.y+(c.x-u.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+u.y*o.x+(c.y-u.y)*a.x)*d,g=(c.y*l.y+h.y*(o.y-l.y)-u.y*o.y+(u.y-c.y)*a.y)*d,f=(h.x*(l.x-o.x)-c.x*l.x+u.x*o.x+(c.x-u.x)*a.x)*d,m=-(c.x*l.y+h.x*(o.y-l.y)-u.x*o.y+(u.x-c.x)*a.y)*d,v=(h.x*(u.y*o.x-c.y*l.x)+h.y*(c.x*l.x-u.x*o.x)+(u.x*c.y-c.x*u.y)*a.x)*d,y=(h.x*(u.y*o.y-c.y*l.y)+h.y*(c.x*l.y-u.x*o.y)+(u.x*c.y-c.x*u.y)*a.y)*d;n.setTransform(p,g,f,m,v,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()}_draw(t,e,i,n,s,r){const{context:a}=n;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.z=u,this.drawPathProxy(t,a,h,c,n,s)||(this.drawShape(t,a,h,c,n,s,null,null,r),this.z=0,a.modelMatrix!==d&&Tl.free(a.modelMatrix),a.modelMatrix=d),a.highPerformanceRestore()}}var gu=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mu=function(t,e){return function(i,n){e(i,n,t)}};let vu=class extends pu{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=tl,this.builtinContributions=[qc,Jc,Zc],this.init(t)}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let u=h.endAngle;u=o;const d=u>c;let p=!1;if(syt){const t=Ct(b,_),r=Ct(x,_),a=Sh(v,y,f,m,s,t,Number(d)),o=Sh(A,w,k,T,s,r,Number(d));if(_0&&e.arc(i+o.cx,n+o.cy,r,wt(o.y11,o.x11),wt(o.y01,o.x01),!d)}}else e.moveTo(i+f,n+m);if(!(r>yt)||M<.001)e.lineTo(i+k,n+T),p=!0;else if(C>yt){const t=Ct(E,C),s=Ct(O,C),a=Sh(k,T,A,w,r,-s,Number(d)),o=Sh(f,m,v,y,r,-t,Number(d));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),C0&&e.arc(i+a.cx,n+a.cy,s,wt(a.y01,a.x01),wt(a.y11,a.x11),!d);const t=wt(a.cy+a.y11,a.cx+a.x11),o=u-l-.03;e.arc(i,n,r,t,o,d)}}else e.lineTo(i+r*kt(B),n+r*Mt(B));return p}drawShape(t,e,i,n,s,r,a,o,l){l=null!=l?l:ea(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:u=l.stroke,x:d=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:w=l.outerRadius,innerRadius:k=l.innerRadius}=t.attribute;w+=b,k-=x;let T=0;const C=(c(S)&&S||S[0])&&"conical"===h.gradient;if(C){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();At(n-i){var e;let i=!0;if(c(t,!0)){for(let n=0;n<4;n++)ya[n]=t,i&&(i=!(null!==(e=ya[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)ya[e]=!!t[e],i&&(i=!!ya[e]);else ya[0]=!1,ya[1]=!1,ya[2]=!1,ya[3]=!1;return{isFullStroke:i,stroke:ya}})(u);if((y||B)&&(e.beginPath(),wh(t,e,i,n,w,k),M=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,y,_,m,v,l,s,a,o),g?(this._runStroke(t,e,i,n,l,_,B,v,o),this._runFill(t,e,i,n,l,y,m,d,p,a)):(this._runFill(t,e,i,n,l,y,m,d,p,a),this._runStroke(t,e,i,n,l,_,B,v,o))),!B&&_&&(e.beginPath(),wh(t,e,i,n,w,k,E),M||this.beforeRenderStep(t,e,i,n,y,_,m,v,l,s,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(At(h-r)>=St-yt){e.beginPath();const r=Math.abs(w-k)/2/w,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,u=h;this.drawArcTailCapPath(t,e,i,n,w,k,u,u+r),M||this.beforeRenderStep(t,e,i,n,y,_,m,v,l,s,a,o);const d=()=>{if(y){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+=St;for(;i>St;)i-=St;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),Fl(o.color,l.color,h,!1)}(0,0,h,s);a||yh&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=r,e.fill())}}},p=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke()))};d(),p()}}this.afterRenderStep(t,e,i,n,y,_,m,v,l,s,a,o),C&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,n,s,r,a,o,l,h){r&&(h?h(e,t.attribute,s):a&&(e.setCommonStyle(t,t.attribute,o-i,l-n,s),e.fill()))}_runStroke(t,e,i,n,s,r,a,o,l){r&&a&&(l?l(e,t.attribute,s):o&&(e.setStrokeStyle(t,t.attribute,i,n,s),e.stroke()))}draw(t,e,i,n){const s=ea(t,null==n?void 0:n.theme).arc;this._draw(t,s,!1,i,n,s)}};function yu(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]=Pn(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)}}function _u(t,e,i,n,s,r,a){var o;let l=e.p0,h=n;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)n||(t.lineTo(l.x+s,l.y+r,a),h=!n);else{const{originP1:c,originP2:u}=e;let d;if(c&&!1!==c.defined&&!i?d=l:c&&!1!==u.defined&&(d=null!==(o=e.p3)&&void 0!==o?o:e.p1),n){h=!n;const i=d?d.x:e.p0.x,o=d?d.y:e.p0.y;t.moveTo(i+s,o+r,a)}else d&&(h=!n,t.lineTo(d.x+s,d.y+r,a))}return h}function bu(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=s||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:u}=e;if(i>=1){if(h){let e,i=!0;u.forEach(((n,s)=>{n.originP1!==n.originP2?(i=_u(t,n,e,i,r,a,o),e=n):e=n}))}else u.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),yu(t,e,1,s),c=!1):c=!0}));return}if(i<=0)return;let d;"x"===n?d=bn.ROW:"y"===n?d=bn.COLUMN:"auto"===n&&(d=e.direction);const p=i*e.tryUpdateLength(d);let g=0,f=!0,m=null;for(let e=0,i=u.length;e=0;o--)(s=t[o])&&(a=(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 Su=class extends pu{constructor(){super(...arguments),this.numberType=ol}draw(t,e,i,n){const s=ea(t,null==n?void 0:n.theme).line;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g){var f;if(!e)return;t.beginPath();bu(t,e,l,h,{offsetX:c,offsetY:u,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),d.cache&&!_(d.cache)&&d.cache.curves.every((t=>t.defined))&&d.attribute.curveType&&d.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(d,a,m-c,v-u,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(d,a,m-c,v-u,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,n,s,r,a,o,l,h,c,u,d){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,u,d,i,n,l,s,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,n=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 s=ds(x(t.points,v),y,{startPoint:e,curveTension:m});return n=s,s})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===s[0].points.length&&s.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,u,d,s[g],[l,t.attribute],_,b,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,u,d,s[m],[l,t.attribute],Ct(y,1),b,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,d,t.attribute,l,_,b,i,n,t,a,o)}};function Au(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),yu(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),yu(t,l,1,n),o=!1):o=!0}t.closePath()}Su=xu([_i()],Su);const wu=new class extends $c{constructor(){super(...arguments),this.time=Sn.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=d||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:Ta(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Ta(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Ta(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Ta(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,n,l,_,b,x)}},ku=Dc;var Tu=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mu=function(t,e){return function(i,n){e(i,n,t)}};let Bu=class extends pu{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=il,this.builtinContributions=[wu,ku],this.init(t)}drawLinearAreaHighPerformance(t,e,i,n,s,r,a,o,l,h,c,u,d){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,u,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(u?u(e,t.attribute,l):s&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,u,null,{attribute:t.attribute}),(()=>{var i,s;if(n){const{stroke:n=l&&l.stroke}=t.attribute;if(_(n)&&(n[0]||n[2])&&!1===n[1])if(e.beginPath(),n[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const n=m[t];e.lineTo((null!==(i=n.x1)&&void 0!==i?i:n.x)+a,(null!==(s=n.y1)&&void 0!==s?s:n.y)+o,v)}}d?d(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,n,s,r,a,o){var l,h,c,u,d,p;const g=ea(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,w=S.doStroke&&S.sVisible,{clipRange:k=g.clipRange,closePath:T,points:C,segments:M}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===B&&(B="linearClosed"),1===k&&!M&&!C.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,w,v,_,i,n,g,s,r,a,o);if(t.shouldUpdateShape()){if(M&&M.length){let e,i;const n=M.map(((t,n)=>{if(t.points.length<=1&&0===n)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===n?e={x:i.endX,y:i.endY}:n>1&&(e.x=i.endX,e.y=i.endY);const s=ds(E(t.points,x),B,{startPoint:e,curveTension:b});return i=s,s})).filter((t=>!!t));let s;const r=[];for(let t=M.length-1;t>=0;t--){const e=M[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=M[t-1].points,n=e[e.length-1];n&&i.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(u=n.y1)&&void 0!==u?u:n.y})}i.length>1&&(s=ds(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(s))}t.cacheArea=r.map(((t,e)=>({top:n[e],bottom:t})))}else{if(!C||!C.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(C,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(d=e[t].x1)&&void 0!==d?d:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const n=ds(e,B,{curveTension:b}),s=ds(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:n,bottom:s}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,w,_,r[c],[g,t.attribute],k,i,n,y,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,u=!1;t.cacheArea.forEach(((l,d)=>{if(u)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(u=this.drawSegmentItem(e,l,A,v,w,_,r[d],[g,t.attribute],Ct(f,1),i,n,y,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,w,_,t.attribute,g,k,i,n,y,t,s,a,o)}draw(t,e,i,n){const s=ea(t,null==n?void 0:n.theme).area;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f){return this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f)}_drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=d.attribute;let y,b,x=bn.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=At(y.x-b.x),A=At(y.y-b.y);x=null==y.x1?bn.ROW:null==y.y1?bn.COLUMN:Number.isFinite(S+A)?S>A?bn.ROW:bn.COLUMN:bn.ROW,function(t,e,i,n){var s;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;ou?bn.ROW:bn.COLUMN,Number.isFinite(c)||(o=bn.COLUMN),Number.isFinite(u)||(o=bn.ROW);const d=i*(o===bn.ROW?c:u);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==s)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),bu(t,i[0]?e.top:e.bottom,l,x===bn.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:u})),t.setStrokeStyle(d,a,w-h,k-c,o),t.stroke()}})(),!1}};Bu=Tu([_i(),Mu(0,vi(Li)),Mu(0,bi(Th)),Cu("design:paramtypes",[Object])],Bu);const Eu=Kc,Ou=Dc;var Ru=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Iu=function(t,e){return function(i,n){e(i,n,t)}};let Lu=class extends pu{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ll,this.builtinContributions=[Ou,Eu],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,c;const u=null!==(l=this.tempTheme)&&void 0!==l?l:ea(t,null==r?void 0:r.theme).path,{x:d=u.x,y:p=u.y,fillStrokeOrder:g=u.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,u,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)Tn(t.pathShape.commandList,e,i,n,1,1,f);else{Tn((null!==(c=t.attribute.path)&&void 0!==c?c:u.path).commandList,e,i,n,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,n,_,b,v,y,u,s,a,o);const x=()=>{b&&(o?o(e,t.attribute,u):y&&(e.setStrokeStyle(t,t.attribute,d-i,p-n,u),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,u):v&&(e.setCommonStyle(t,t.attribute,d-i,p-n,u),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,n,_,b,v,y,u,s,a,o)}draw(t,e,i,n){const s=ea(t,null==n?void 0:n.theme).path;this.tempTheme=s,this._draw(t,s,!1,i,n),this.tempTheme=null}};Lu=Ru([_i(),Iu(0,vi(Li)),Iu(0,bi(Mh)),Pu("design:paramtypes",[Object])],Lu);var Du=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ju=function(t,e){return function(i,n){e(i,n,t)}};let Nu=class extends pu{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=cl,this.builtinContributions=[ru,ou,au],this.init(t)}drawShape(t,e,i,n,s,r,a,o,l){l=null!=l?l:ea(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:u=l.stroke,cornerRadius:d=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:w=l.fillStrokeOrder,drawStrokeWhenZeroWH:k=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:b-S)||0,C=(null!=C?C:x-A)||0;const M=_h(g,f,T,C,h),B=xh(g,v,T,C,k),E=mh(h,c),O=vh(u,m);if(!t.valid||!y)return;if(!E&&!O)return;if(!(M||B||a||o||c))return;0===d||_(d)&&d.every((t=>0===t))?(e.beginPath(),e.rect(i,n,T,C)):(e.beginPath(),eu(e,i,n,T,C,d,"bevel"!==p));const R={doFill:E,doStroke:O};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,E,O,M,B,l,s,a,o,R),w?(this._runStroke(t,e,i,n,l,R,B,S,A,o),this._runFill(t,e,i,n,l,R,M,S,A,a)):(this._runFill(t,e,i,n,l,R,M,S,A,a),this._runStroke(t,e,i,n,l,R,B,S,A,o)),this.afterRenderStep(t,e,i,n,E,O,M,B,l,s,a,o)}_runFill(t,e,i,n,s,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,s):a&&(e.setCommonStyle(t,t.attribute,o-i,l-n,s),e.fill()))}_runStroke(t,e,i,n,s,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,s):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-n,s),e.stroke()))}draw(t,e,i,n){const s=ea(t,null==n?void 0:n.theme).rect;this._draw(t,s,!1,i,n,s)}};Nu=Du([_i(),ju(0,vi(Li)),ju(0,bi(Eh)),Fu("design:paramtypes",[Object])],Nu);var Uu=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zu=function(t,e){return function(i,n){e(i,n,t)}};let Vu=class extends pu{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=dl,this.builtinContributions=[lu,uu,cu,hu],this.init(t)}drawShape(t,e,i,n,s,r,a,o,l){var h;l=null!=l?l:ea(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:u=l.x,y:d=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:w=l.keepDirIn3d}=t.attribute,k=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,C=n,M=k;const B=e.camera;if(w&&B&&e.project){const t=e.project(i,n,k);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,C=t.y,M=void 0}!1===A.draw(e,c,T,C,M,((s,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,u-i,d-n,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(u-i)/p,(d-n)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,x,S,y,b,l,s,a,o),f?(this._runStroke(t,e,i,n,l,S,b,u,d,A,m,p,g,o),this._runFill(t,e,i,n,l,x,y,u,d,A,a)):(this._runFill(t,e,i,n,l,x,y,u,d,A,a),this._runStroke(t,e,i,n,l,S,b,u,d,A,m,p,g,o)),this.afterRenderStep(t,e,i,n,x,S,y,b,l,s,a,o)}_runFill(t,e,i,n,s,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,s):a&&(e.setCommonStyle(t,t.attribute,o-i,l-n,s),e.fill()))}_runStroke(t,e,i,n,s,r,a,o,l,h,c,u,d,p){r&&!h.isSvg&&(p?p(e,t.attribute,s):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/u,(l-n)/d,s),e.stroke()))}draw(t,e,i,n){const s=ea(t,null==n?void 0:n.theme).symbol;this._draw(t,s,!1,i,n)}};Vu=Uu([_i(),zu(0,vi(Li)),zu(0,bi(Oh)),Hu("design:paramtypes",[Object])],Vu);const Wu=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new he)}allocate(t,e,i,n){if(!this.pools.length)return(new he).setValue(t,e,i,n);const s=this.pools.pop();return s.x1=t,s.y1=e,s.x2=i,s.y2=n,s}allocateByObj(t){if(!this.pools.length)return new he(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const Gu=new class extends Lc{constructor(){super(...arguments),this.time=Sn.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){var d,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:w=l.opacity,backgroundMode:k=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:C=l.backgroundKeepAspectRatio,backgroundScale:M=l.backgroundScale,backgroundOffsetX:B=l.backgroundOffsetX,backgroundOffsetY:E=l.backgroundOffsetY,backgroundPosition:O=l.backgroundPosition,backgroundClip:R=l.backgroundClip,backgroundCornerRadius:P=l.backgroundCornerRadius}=t.attribute;let I,{background:L}=t.attribute;if(!L)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const j=g(L)&&L.background?L:null,N=t.transMatrix.onlyTranslate();if(j){const e=t.AABBBounds,i=(null!==(d=j.x)&&void 0!==d?d:e.x1)+(null!==(p=j.dx)&&void 0!==p?p:0),n=(null!==(f=j.y)&&void 0!==f?f:e.y1)+(null!==(m=j.dy)&&void 0!==m?m:0),s=null!==(v=j.width)&&void 0!==v?v:e.width(),r=null!==(y=j.height)&&void 0!==y?y:e.height();if(F=Wu.allocate(i,n,i+s,n+r),L=j.background,!N){const t=F.width(),e=F.height();F.set((null!==(_=j.x)&&void 0!==_?_:0)+(null!==(b=j.dx)&&void 0!==b?b:0),(null!==(x=j.y)&&void 0!==x?x:0)+(null!==(S=j.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,N||(F=Oc(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const i=t.resources.get(L);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),N&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*w,R&&(e.beginPath(),P?eu(e,F.x1,F.y1,F.width(),F.height(),P,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:k,backgroundFit:T,backgroundKeepAspectRatio:C,backgroundScale:M,backgroundOffsetX:B,backgroundOffsetY:E,backgroundPosition:O}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=A*w,e.fillStyle=L,P?(eu(e,F.x1,F.y1,F.width(),F.height(),P,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();j&&Wu.free(F),D()}};var Yu=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$u=function(t,e){return function(i,n){e(i,n,t)}};let Ku=class extends pu{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=pl,this.builtinContributions=[Gu],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,c;const u=ea(t,null==r?void 0:r.theme).text,{text:d,underline:p=u.underline,lineThrough:g=u.lineThrough,keepDirIn3d:f=u.keepDirIn3d,direction:m=u.direction,fontSize:v=u.fontSize,verticalMode:y=u.verticalMode,x:_=u.x,y:b=u.y}=t.attribute,x=null!==(l=Ba(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,u,a,o);if(!S)return;const{fVisible:A,sVisible:w,doFill:k,doStroke:T}=S,C=!f,M=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,n,k,T,A,w,u,s,a,o),C&&this.transformUseContext2d(t,u,M,e);const B=(s,r,l,h)=>{let c=i+r;const d=n+l;if(h){e.highPerformanceSave(),c+=v;const t=kl.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,d),e.transformFromMatrix(t,!0),kl.free(t)}T&&(o?o(e,t.attribute,u):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-n,u),e.strokeText(s,c,d,M))),k&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-n,u),e.fillText(s,c,d,M))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,u,M),"horizontal"===m){const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;T&&(o?o(e,t.attribute,u):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-n,u),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,M)})))),k&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-n,u),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,M),this.drawUnderLine(p,g,t,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,s.descent,(s.descent-s.ascent)/2,M,u,e,{width:s.width})}))))}else{let{textAlign:i=u.textAlign,textBaseline:n=u.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[n])&&void 0!==h?h:"left",n=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const s=t.cache,{verticalList:r}=s;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Tt(e,o)}));let l=0,d=0;"bottom"===n?d=-a:"middle"===n&&(d=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const n=t.reduce(((t,e)=>t+(e.width||0)),0),s=o-n;let r=l;"center"===i?r+=s/2:"right"===i&&(r+=s),t.forEach((t=>{const{text:i,width:n,direction:s}=t;B(i,a-(e+1)*x+d,r,s),r+=n}))}))}C&&this.restoreTransformUseContext2d(t,u,M,e),this.afterRenderStep(t,e,i,n,k,T,A,w,u,s,a,o)}draw(t,e,i,n){const s=ea(t,null==n?void 0:n.theme).text,{keepDirIn3d:r=s.keepDirIn3d}=t.attribute,a=!r;this._draw(t,s,a,i,n)}drawUnderLine(t,e,i,n,s,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!d(c),_=y?c.width:i.clipedWidth,b=y?0:Ih(u,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,n,s,l),m&&h.setLineDash(m),h.beginPath();const e=s+r+f;h.moveTo(n+b,e,o),h.lineTo(n+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,n,s,l),h.beginPath();const t=s+a;h.moveTo(n+b,t,o),h.lineTo(n+b+_,t,o),h.stroke()}}};function qu(t,e,i,n){if(e&&e.length){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},id=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nd=function(t,e){return function(i,n){e(i,n,t)}};let sd=class extends pu{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=hl,this.builtinContributions=[td,Qu],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=ea(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:u=l.x,y:d=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:b}=f;e.beginPath(),c<=0||_(c)&&c.every((t=>0===t))?qu(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s,r=!0){var a;if(e.length<3)return void qu(t,e,i,n);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+n));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],u=h.x-o.x,d=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(d,u)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(s)?null!==(a=s[r%e.length])&&void 0!==a?a:0:s,y=v/m;const _=Zu(u,d),b=Zu(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Ju(h,y,_,u,d),A=Ju(h,y,b,p,g),w=2*h.x-S.x-A.x,k=2*h.y-S.y-A.y,T=Zu(w,k),C=Ju(h,Zu(y,v),T,w,k);let M=Math.atan2(S.y-C.y,S.x-C.x);const B=Math.atan2(A.y-C.y,A.x-C.x);let E=B-M;E<0&&(M=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+n):t.lineTo(S.x+i,S.y+n),E&&t.arcTo(h.x+i,h.y+n,A.x+i,A.y+n,v),t.lineTo(A.x+i,A.y+n)}r||t.lineTo(e[l+1].x+i,e[l+1].y+n)}(e.camera?e:e.nativeContext,h,i,n,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,y,b,m,v,l,s,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,d-n,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,d-n,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,n,y,b,m,v,l,s,a,o)}draw(t,e,i,n){const s=ea(t,null==n?void 0:n.theme).polygon;this._draw(t,s,!1,i,n)}};sd=ed([_i(),nd(0,vi(Li)),nd(0,bi(Bh)),id("design:paramtypes",[Object])],sd);var rd=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ad=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},od=function(t,e){return function(i,n){e(i,n,t)}};let ld=class{constructor(t){this.groupRenderContribitions=t,this.numberType=rl}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Qc)}drawShape(t,e,i,n,s,r,a,o,l){const{clip:h,fill:c,stroke:u,background:d}=t.attribute;if(!(h||c||u||d))return;l=null!=l?l:ea(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:w=l.cornerType,x:k=l.x,y:T=l.y}=t.attribute,C=_h(p,m,g,f,c),M=xh(p,v,g,f),B=mh(c,d),E=vh(u,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(C||M||a||o||d))return}if(b&&b.length&&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===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,n,g,f)):(e.beginPath(),eu(e,i,n,g,f,y,"bevel"!==w));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Qc));const O={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Sn.beforeFillStroke&&r.drawShape(t,e,i,n,B,E,C,M,l,s,a,o,O)})),h&&e.clip();const R=()=>{O.doFill&&(a?a(e,t.attribute,l):C&&(e.setCommonStyle(t,t.attribute,k-i,T-n,l),e.fill()))},P=()=>{O.doStroke&&(o?o(e,t.attribute,l):M&&(e.setStrokeStyle(t,t.attribute,k-i,T-n,l),e.stroke()))};A?(P(),R()):(R(),P()),this._groupRenderContribitions.forEach((r=>{r.time===Sn.afterFillStroke&&r.drawShape(t,e,i,n,B,E,C,M,l,s,a,o)}))}draw(t,e,i,n){var s,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,u=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:n,height:s}=t.attribute,r=a.canvas,o=Gi.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,n,s),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const d=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=ea(t,null==n?void 0:n.theme).group,i=Tl.allocate(),s=Tl.allocate();Nh(s,t,e),Sl(i,p||i,s),a.modelMatrix=i,Tl.free(s),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),n.skipDraw?this.drawShape(t,a,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),n&&n.renderInGroup&&(m=n.renderInGroup(null===(s=n.renderInGroupParams)||void 0===s?void 0:s.skipSort,t,i,null===(r=n.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Tl.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=d,h>0){const{x:e,y:i,width:n,height:s}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,n,s),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=u,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};ld=rd([_i(),od(0,vi(Li)),od(0,bi(Ch)),ad("design:paramtypes",[Object])],ld);const hd=Symbol.for("IncrementalDrawContribution"),cd=Symbol.for("ArcRender"),ud=Symbol.for("AreaRender"),dd=Symbol.for("CircleRender"),pd=Symbol.for("GraphicRender"),gd=Symbol.for("GroupRender"),fd=Symbol.for("LineRender"),md=Symbol.for("PathRender"),vd=Symbol.for("PolygonRender"),yd=Symbol.for("RectRender"),_d=Symbol.for("SymbolRender"),bd=Symbol.for("TextRender"),xd=Symbol.for("RichTextRender"),Sd=Symbol.for("GlyphRender"),Ad=Symbol.for("DrawContribution"),wd=(t,e,i,n)=>{let s,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===el,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,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+=St;for(;o<0;)o+=St;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),n.hack_pieFace="outside",s=i(r,a),s&&s.graphic||(n.hack_pieFace="inside",s=i(r,a)),s&&s.graphic||(n.hack_pieFace="top",s=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const n=e.getChildren(),o=n.map((e=>({ave_z:e.findFace().vertices.map((i=>{var n;return t.view(i[0],i[1],null!==(n=i[2]+e.attribute.z)&&void 0!==n?n:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),s=i(r,a),e.removeAllChild(),n.forEach((t=>{t._next=null,t._prev=null})),e.update(),n.forEach((t=>{e.add(t)}))}else s=i(r,a);return s};var kd=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(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)};const Cd=Symbol.for("DrawItemInterceptor"),Md=new he,Bd=new he;class Ed{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,n,s),!1}beforeDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,n,s),!1}drawItem(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){Md.copy(n.dirtyBounds),Bd.copy(n.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e),n.backupDirtyBounds.copy(n.dirtyBounds)}return n.renderGroup(t.shadowRoot,i,kl.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&(n.dirtyBounds.copy(Md),n.backupDirtyBounds.copy(Bd)),!0}}class Od{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return t.attribute._debug_bounds&&this.drawItem(t,e,i,n,s),!1}drawItem(t,e,i,n,s){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Rd=class{constructor(){this.order=1,this.interceptors=[new Ed,new Id,new Pd,new Od]}afterDrawItem(t,e,i,n,s){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rn.renderGroup(t,i,t.parent.globalTransMatrix,!e&&s)),i):n.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Tl.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Ld=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fd=function(t,e){return function(i,n){e(i,n,t)}};let jd=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};jd=Ld([_i(),Fd(0,vi(Ad)),Dd("design:paramtypes",[Object])],jd);var Nd=new ai((t=>{t(Wi).to(jd)}));const Ud=Symbol.for("PickerService"),Hd=Symbol.for("GlobalPickerService"),zd=Symbol.for("PickItemInterceptor"),Vd=Symbol.for("PickServiceInterceptor");var Wd=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(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 Gd=class{constructor(){this.order=1}afterPickItem(t,e,i,n,s){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Gd=Wd([_i()],Gd);let Yd=class{constructor(){this.order=1}afterPickItem(t,e,i,n,s){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,n,s):null}beforePickItem(t,e,i,n,s){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,n,s):null}_pickItem(t,e,i,n,s){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=s||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=ea(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,u=kl.allocateByObj(a),d=new Dt(u.a*i.x+u.c*i.y+u.e,u.b*i.x+u.d*i.y+u.f),p=e.pickGroup(c,d,u,n);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Yd=Wd([_i()],Yd);let Xd=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){const r=t.baseGraphic;if(r&&r.parent){const t=new Dt(i.x,i.y),s=e.pickContext;s.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,n):e.pickItem(r,t.clone(),a,n);return s.highPerformanceRestore(),o}return null}};Xd=Wd([_i()],Xd);let $d=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){const a=wd(r,t,(()=>e.pickGroup(t,i,s.parentMatrix,n)),n);return r.camera=null,n.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};$d=Wd([_i()],$d);var Kd=new ai(((t,e,i)=>{i(Ud)||(t(Hd).toSelf(),t(Ud).toService(Hd)),t($d).toSelf().inSingletonScope(),t(zd).toService($d),t(Yd).toSelf().inSingletonScope(),t(zd).toService(Yd),t(Xd).toSelf().inSingletonScope(),t(zd).toService(Xd),Fi(t,zd),t(Gd).toSelf().inSingletonScope(),t(Vd).toService(Gd),Fi(t,Vd)})),qd=new ai((t=>{t(gl).to(Uh),t(fl).toConstantValue(Mc)}));const Zd=Symbol.for("AutoEnablePlugins"),Jd=Symbol.for("PluginService");var Qd=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ep=function(t,e){return function(i,n){e(i,n,t)}};let ip=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Vi.isBound(Zd)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};ip=Qd([_i(),ep(0,vi(Li)),ep(0,bi(Zd)),tp("design:paramtypes",[Object])],ip);var np=new ai((t=>{t(Jd).to(ip),function(t,e){t(Li).toDynamicValue((({container:t})=>new Di(e,t))).whenTargetNamed(e)}(t,Zd)})),sp=new ai((t=>{Fi(t,Hi)})),rp=new ai((t=>{t(nr).to(sr).inSingletonScope(),Fi(t,nr)})),ap=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},op=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lp=class{constructor(){this.type="static",this.offscreen=!1,this.global=Gi.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=or({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,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()}};lp=ap([_i(),op("design:paramtypes",[])],lp);var hp=new ai((t=>{t(lp).toSelf(),t(lh).toService(lp)}));var cp=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 up(t,e,i){const n={},s=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;n[i]?n[i].push(t):(n[i]=[t],s.push(i))}),i),s.sort(((t,e)=>i?e-t:t-e)),{childMap:n,zIdxArray:s}}function dp(t,e,i,n=!1,s=!1){let r=!1;if(s)r=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return r=!0,!0;return!1}),n)}if(r){const{childMap:r,zIdxArray:a}=up(t,e,n);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;t{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return s=!0,!0;return!1}),n);let r=null,a=!1;if(s){const{childMap:s,zIdxArray:o}=up(t,i,n);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),n);return r}var fp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vp=function(t,e){return function(i,n){e(i,n,t)}};let yp=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,n)=>{var s;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,n):this.renderItem(t,i))})):dp(e,As.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,n):this.renderItem(t,i))}),!1,!!(null===(s=i.context)||void 0===s?void 0:s.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new le,this.backupDirtyBounds=new le,this.global=Gi.global,this.layerService=Gi.layerService,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:n,stage:s,viewBox:r,transMatrix:a}=e;if(!n)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=function(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=Xt(t,e,i);return n>=l||s<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(n,o),y1:Math.max(r,h),x2:Math.min(s,l),y2:Math.min(a,c)}}(o,s.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=n.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*n.dpr)/n.dpr,o.y1=Math.floor(o.y1*n.dpr)/n.dpr,o.x2=Math.ceil(o.x2*n.dpr)/n.dpr,o.y2=Math.ceil(o.y2*n.dpr)/n.dpr),this.backupDirtyBounds.copy(o),n.reset(!1),n.save(),n.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),n.clearMatrix(!1),n.translate(r.x1,r.y1,!0),n.beginPath(),n.rect(o.x1,o.y1,o.width(),o.height()),n.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,n,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:As.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:As.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,kl.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),n.restore(),n.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=gp(e,i,As.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,n){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!$t(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let s,r=i;if(this.useDirtyBounds){s=Wu.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=kl.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:n,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(s),Wu.free(s),kl.free(r))}_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||Vi.get(hd);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;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let 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 bp=class extends Su{constructor(){super(...arguments),this.numberType=ol}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=ea(t).line,{fill:c=h.fill,stroke:u=h.stroke,opacity:d=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=yh(d,p,c),y=bh(d,g),_=mh(c),b=vh(u,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||a||o))return;const{context:x}=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.setShadowBlendStyle&&e.setShadowBlendStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};bp=_p([_i()],bp);var xp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(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 Sp=class extends Bu{constructor(){super(...arguments),this.numberType=il}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=ea(t).area,{fill:c=h.fill,fillOpacity:u=h.fillOpacity,opacity:d=h.opacity,visible:p=h.visible}=t.attribute,g=yh(d,u,c),f=mh(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let 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.setShadowBlendStyle&&e.setShadowBlendStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};Sp=xp([_i()],Sp);var Ap,wp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kp=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)}},Cp=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"}(Ap||(Ap={}));let Mp=class extends yp{constructor(t,e,i,n){super(t,n),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=n,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=Ap.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Ui([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Cp(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,viewBox:s}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s.x1,s.y1,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:As.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:As.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 Cp(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Cp(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Cp(this,void 0,void 0,(function*(){if(2!==t.count)yield pp(t,As.zIndex,((i,n)=>{if(this.status===Ap.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Cp(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Cp(this,void 0,void 0,(function*(){this.rendering&&(this.status=Ap.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=Ap.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 Cp(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:()=>Cp(this,void 0,void 0,(function*(){yield pp(t,As.zIndex,(t=>Cp(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Mp=wp([_i(),Tp(0,yi(pd)),Tp(1,vi(bp)),Tp(2,vi(Sp)),Tp(3,vi(Li)),Tp(3,bi(Cd)),kp("design:paramtypes",[Array,Object,Object,Object])],Mp);var Bp=new ai((t=>{t(Lc).toSelf().inSingletonScope(),t($c).toSelf().inSingletonScope(),t(Ad).to(yp),t(hd).to(Mp),t(gd).to(ld).inSingletonScope(),t(pd).toService(gd),Fi(t,Ch),t(Gc).toSelf().inSingletonScope(),Fi(t,Ph),Fi(t,pd),t(Rd).toSelf().inSingletonScope(),t(Cd).toService(Rd),Fi(t,Cd)}));function Ep(){Ep.__loaded||(Ep.__loaded=!0,Vi.load(fh),Vi.load(qd),Vi.load(Nd),Vi.load(Kd),Vi.load(np),function(t){t.load(sp),t.load(rp),t.load(hp)}(Vi),function(t){t.load(Bp)}(Vi))}Ep.__loaded=!1,Ep();const Op=Vi.get(zi);Gi.global=Op;const Rp=Vi.get(ah);Gi.graphicUtil=Rp;const Pp=Vi.get(rh);Gi.transformUtil=Pp;const Ip=Vi.get(gl);Gi.graphicService=Ip;const Lp=Vi.get(oh);Gi.layerService=Lp;class Dp{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ri.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class Fp{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=ri.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Gi.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Gi.global.getRequestAnimationFrame();this.rafId=t((()=>{Gi.global.devicePixelRatio!==this.dpr&&(this.dpr=Gi.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Gi.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class jp{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ri.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Gi.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Np=new he;class Up{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ri.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()}));const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(Np.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(Np,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let Hp;function zp(){!function(){if(null==Hp)try{const t=document.createElement("canvas"),e=t.getContext("2d");Hp=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),Hp&&(Hp=!!document.createElement)}catch(t){Hp=!1}}();const t=Gi.global&&Gi.global.env;return t?"browser"===t:Hp}let Vp=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};Vp._pluginClasses={};const Wp="white";class Gp extends ih{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:Wp}set background(t){this._background=t,this.syncBackgroundImage(t)}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}syncBackgroundImage(t){var e;const i=null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t;this.backgroundImg=!1,this.isImageBackgroundSource(i)&&this.loadImage(i,!0)}isImageBackgroundSource(t){if(!t)return!1;if("string"==typeof t)return t.startsWith("{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Qr,this.hooks={beforeRender:new Ui(["stage"]),afterRender:new Ui(["stage"]),afterClearScreen:new Ui(["stage"]),afterClearRect:new Ui(["stage"])},this.global=Gi.global,!this.global.env&&zp()&&this.global.setEnv("browser"),this.window=Vi.get(Nr),this.renderService=Vi.get(Wi),this.pluginService=Vi.get(Jd),this.layerService=Vi.get(oh),this.graphicService=Vi.get(gl),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:Wp,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&this.syncBackgroundImage(this._background),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new ga(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha: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:u,beta:d,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(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,A=0;c||(x=Math.sin(u)+y,S=Math.sin(d)+_,A=Math.cos(u)*Math.cos(d)*1);const w=Vp.getPlugin("DirectionalLight");w&&(this.light=new w(f,m,v));const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=k;else{const t=Vp.getPlugin("OrthoCamera");t&&(this.camera=new t(k))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Vp.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new Dp))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new Fp))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new jp))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new le;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Up,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Vp.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Vp.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Vp.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,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,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Dt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=Vi.get(Nr),n=e?-e.x1:0,s=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:n,y1:s,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=Vi.get(Ud)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var Yp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xp=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 $p=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new he}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return Xp(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};$p=Yp([_i()],$p);var Kp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Zp=class{constructor(){this._uid=ri.GenAutoIncrementId(),this.viewBox=new he,this.modelMatrix=new ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,n,s,r){this.modelMatrix.setValue(t,e,i,n,s,r)}getViewBoxTransform(){return this.modelMatrix}};Zp=Kp([_i(),qp("design:paramtypes",[])],Zp);var Jp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tg=function(t,e){return function(i,n){e(i,n,t)}};let eg=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=Gi.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;const s=i.bounds.width(),r=i.bounds.height();if(!(new he).setValue(0,0,s,r).containsPoint(e))return n;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new ue(1,0,0,1,0,0);let o;for(let s=t.length-1;s>=0&&(n=t[s].isContainer?this.pickGroup(t[s],e,a,i):this.pickItem(t[s],e,a,i),!n.graphic);s--)o||(o=n.group);if(n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new Dt(e.x,e.y),a=ea(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,s=this.pickGroup(r,i,l,n)}else{const a=new Dt(e.x,e.y);l.transformPoint(a,a);const o=ea(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const u=this.pickItem(r,a,i,n);u&&u.graphic&&(s.graphic=u.graphic,s.params=u.params)}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&Tl.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),kl.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function ig(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,u=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=u,r[4]=u,r[5]=c,r[6]=l,r[7]=n}function ng(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const u=s.filter((t=>t.length>2));return 1===u.length?[u[0]]:u}function hg(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&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const 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}))),gg=(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,u=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)u.push({x:t[e].x,y:t[e].y});u.push({x:c.x,y:c.y});const d=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];d.push({x:i.x,y:i.y})}return d.push({x:h.x,y:h.y}),[u,d]},fg=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new le;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 gg(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return gg(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);fg(s[0],n,i),fg(s[1],e-n,i)}};let mg=!1;const vg=new ai((t=>{mg||(mg=!0,t(vu).toSelf().inSingletonScope(),t(cd).to(vu).inSingletonScope(),t(pd).toService(cd),t(kh).toService(Gc),Fi(t,kh))}));let yg=!1;const _g=new ai((t=>{yg||(yg=!0,t(Nu).toSelf().inSingletonScope(),t(yd).to(Nu).inSingletonScope(),t(pd).toService(yd),t(su).toSelf(),t(nu).toSelf(),t(Eh).toService(su),t(Eh).toService(nu),t(Eh).toService(Gc),Fi(t,Eh))}));let bg=!1;const xg=new ai((t=>{bg||(bg=!0,t(Su).toSelf().inSingletonScope(),t(bp).toSelf().inSingletonScope(),t(fd).to(Su).inSingletonScope(),t(pd).toService(fd))}));let Sg=!1;const Ag=new ai((t=>{Sg||(Sg=!0,t(Bu).toSelf().inSingletonScope(),t(ud).to(Bu).inSingletonScope(),t(pd).toService(ud),t(Th).toService(Gc),Fi(t,Th),t(Sp).toSelf().inSingletonScope())}));let wg=!1;const kg=new ai((t=>{wg||(wg=!0,t(Vu).toSelf().inSingletonScope(),t(_d).to(Vu).inSingletonScope(),t(pd).toService(_d),t(Oh).toService(Gc),Fi(t,Oh))}));let Tg=!1;const Cg=new ai((t=>{Tg||(Tg=!0,t(bd).to(Ku).inSingletonScope(),t(pd).toService(bd),t(Rh).toService(Gc),Fi(t,Rh))}));let Mg=!1;const Bg=new ai((t=>{Mg||(Mg=!0,t(Lu).toSelf().inSingletonScope(),t(md).to(Lu).inSingletonScope(),t(pd).toService(md),t(Mh).toService(Gc),Fi(t,Mh))}));let Eg=!1;const Og=new ai((t=>{Eg||(Eg=!0,t(vd).to(sd).inSingletonScope(),t(pd).toService(vd),t(Bh).toService(Gc),Fi(t,Bh))}));var Rg=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ig=class extends pu{constructor(){super(),this.numberType=ul,this.builtinContributions=[Gu],this.init()}drawShape(t,e,i,n,s){const r=ea(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=yh(o,l,!0),u=yh(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,n),this.beforeRenderStep(t,e,i,n,c,u,c,u,r,s),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,n,c,u,c,u,r,s))}drawIcon(t,e,i,n,s){var r;const a=ea(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:u=a.backgroundFill,backgroundFillOpacity:d=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(v-o)/2,s=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,v,y)):(e.beginPath(),eu(e,i-t,n-s,v,y,f,!0)),u&&(e.globalAlpha=d,e.fillStyle=u,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,n,o,l))}draw(t,e,i){const n=ea(t).richtext;this._draw(t,n,!1,i)}};Ig=Rg([_i(),Pg("design:paramtypes",[])],Ig);let Lg=!1;const Dg=new ai((t=>{Lg||(Lg=!0,t(xd).to(Ig).inSingletonScope(),t(pd).toService(xd))}));function Fg(t){const e=[];for(let i=0;iit.getInstance().info(`[VChart log]: ${t}`,...e),Ng=(t,e)=>(u(Hg.warnHandler)&&Hg.warnHandler.call(null,t,e),e?it.getInstance().warn(`[VChart warn]: ${t}`,e):it.getInstance().warn(`[VChart warn]: ${t}`)),Ug=(t,e,i)=>{if(!u(Hg.errorHandler))throw new Error(t);Hg.errorHandler.call(null,t,e)},Hg={silent:!1,warnHandler:!1,errorHandler:!1},zg=zp(),Vg=zg&&globalThis?globalThis.document:void 0;function Wg(t){return("desktop-browser"===t||"mobile-browser"===t)&&zg}function Gg(t){return Yg(t)||"mobile-browser"===t}function Yg(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Xg=0;function $g(){return Xg>=9999999&&(Xg=0),Xg++}function Kg(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function qg(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}const Zg=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Jg extends ih{constructor(t,e){super(t),this._skipRenderAttributes=Zg,(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i,n){const s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,n);if(s)return this._setAttributes(s,i);m(this.attribute[t])&&m(e)&&!u(this.attribute[t])&&!u(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){d(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},wf=(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 kf extends l{constructor(t,e={}){var i,n,s,r,a,o,l,h,c,u;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=ha.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,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.pressTimeout=null}),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=ha.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||Af(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,u=wf(l[0],l[1]);n.scale=u/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 i=ha.now(),s=this.lastMoveTime;if(i-s<100){const t=s-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=wf(i,s),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Af(i,s),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(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},tap:{interval:null!==(u=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==u?u:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if("press"===e)return e;let s;return s=ha.now()-i>this.config.press.time&&wf(n[0],t){Gi.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.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},Cf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Mf=[0,0,0];let Bf=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},vs),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},_s),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},bs),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ue(1,0,0,1,0,0),this._clearMatrix=new ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&it.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return kl.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(kl.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(kl.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n,s=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,n=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,n=!0){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-=St;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,u=ca);t++){const e=y.getColor(t);u.beginPath(),u.rotate(v),u.moveTo(0,0),u.lineTo(f,-2*_),u.lineTo(f,0),u.fillStyle=e,u.closePath(),u.fill()}const b=u.getImageData(0,0,d,p);return c.width=b.width,c.height=b.height,u.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Gl.Set(e,i,n,r,a,g,d,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&&(Al(Mf,[t,e,i],this.modelMatrix),t=Mf[0],e=Mf[1],i=Mf[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&&(Al(Mf,[t,e,i],this.modelMatrix),t=Mf[0],e=Mf[1],i=Mf[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(Al(Mf,[e,i,n],this.modelMatrix),e=Mf[0],i=Mf[1],n=Mf[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,e=Gi.global.measureTextMethod){var i,n;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Gi.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const s=null!==(i=this.fontFamily)&&void 0!==i?i:bs.fontFamily,r=null!==(n=this.fontSize)&&void 0!==n?n:bs.fontSize;return this.mathTextMeasure.textSpec.fontFamily===s&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=s,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(Al(Mf,[e,i,n],this.modelMatrix),e=Mf[0],i=Mf[1],n=Mf[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=Object.create(s[0]);return s.forEach(((t,e)=>{0!==e&&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;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=zs(this,l,t,i,n))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const n=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(n,t)})),this._setShadowBlendStyle(t,e,n)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(s<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;n.shadowBlur=r*this.dpr,n.shadowColor=t,n.shadowOffsetX=s*this.dpr,n.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0);l?(n.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1),h?(n.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(n.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!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=Object.create(s[0]);return s.forEach(((t,e)=>{0!==e&&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(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=s.lineWidth,stroke:o=s.stroke,lineJoin:l=s.lineJoin,lineDash:h=s.lineDash,lineDashOffset:c=s.lineDashOffset,lineCap:u=s.lineCap,miterLimit:d=s.miterLimit,keepStrokeScale:p=s.keepStrokeScale}=e;r.lineWidth=p?a:Hs(this,a,this.dpr),r.strokeStyle=zs(this,o,t,i,n),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=u,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=ne(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?this.font=t.font:this.font=ne(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(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,n,s,r){this._clearMatrix.setValue(t,e,i,n,s,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>kl.free(t))),this.stack.length=0}};Bf.env="browser",Bf=Tf([_i(),Cf("design:paramtypes",[Object,Number])],Bf);var Ef=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Of=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Rf=class extends Pl{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Gi.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Bf(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr: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.width=`${n}px`,t.style.height=`${s}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function Pf(t,e){return new ai((i=>{i(rr).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(ar).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Rf.env="browser",Rf=Ef([_i(),Of("design:paramtypes",[Object])],Rf);const If=Pf(Rf,Bf);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},Df=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ff=function(t,e){return function(i,n){e(i,n,t)}};let jf=class extends eg{constructor(t,e,i,n){super(i,n),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=n,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Dr.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let s=0;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};let Uf=class{constructor(){this.type="group",this.numberType=rl}contains(t,e,i){return!1}};Uf=Nf([_i()],Uf);const Hf=new ai(((t,e,i,n)=>{Hf.__vloaded||(Hf.__vloaded=!0,t(xf).to(Uf).inSingletonScope(),t(Sf).toService(xf),Fi(t,Sf))}));Hf.__vloaded=!1;var zf=Hf;const Vf=new ai(((t,e,i,n)=>{i(jf)||t(jf).toSelf().inSingletonScope(),i(Ud)?n(Ud).toService(jf):t(Ud).toService(jf)}));var Wf,Gf=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Xf=Wf=class extends Zp{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Wf.idprefix}_${Wf.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Gi.global,this.viewBox=new he,this.modelMatrix=new ue(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>n)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Wf.GenerateCanvasId(),canvasControled:!0};this.canvas=new Rf(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;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new Rf({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(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};Xf.env="browser",Xf.idprefix="visactor_window",Xf.prefix_count=0,Xf=Wf=Gf([_i(),Yf("design:paramtypes",[])],Xf);const $f=new ai((t=>{t(Xf).toSelf(),t(Ur).toDynamicValue((t=>t.container.get(Xf))).whenTargetNamed(Xf.env)}));var Kf=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zf=function(t,e,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 Jf{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function Qf(t,e=!1){const i=document.createElement("img");if(Gi.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let tm=class extends $p{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,n;let s=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};s=e.clientX||0,r=e.clientY||0,a=s,o=r}else s=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=s,i=r,a=e.getBoundingClientRect(),o=null===(n=e.getNativeHandler)||void 0===n?void 0:n.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Jf(t)}return new he}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:n,style:s}=e;return s&&(y(s)?t.setAttribute("style",s):Object.keys(s).forEach((e=>{t.style[e]=s[e]}))),null!=i&&(t.style.width=`${i}px`),null!=n&&(t.style.height=`${n}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,n=document.createElement(e);if(this.updateDom(n,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(n)}return n}loadImage(t){return Qf(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Qf(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:ri.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(...t){}getElementTop(t,e){let i=t.offsetTop,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,n=n.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetLeft,n=n.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,n=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,n+=s.offsetLeft,s=s.offsetParent;return{top:i,left:n}}loadFont(t,e,i){return Zf(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};tm=Kf([_i(),qf("design:paramtypes",[])],tm);const em=new ai((t=>{em.isBrowserBound||(em.isBrowserBound=!0,t(tm).toSelf().inSingletonScope(),t(Hi).toService(tm))}));function im(t,e=!0){im.__loaded||(im.__loaded=!0,t.load(em),t.load(If),t.load($f),e&&function(t){t.load(zf),t.load(Vf)}(t))}em.isBrowserBound=!1,im.__loaded=!1;var nm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rm=function(t,e){return function(i,n){e(i,n,t)}};let am=class extends eg{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Ol(null,1)}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;const s=this.pickerMap.get(t.numberType);if(!s)return null;const r=s.contains(t,e,n),a=r?t:null;return a?{graphic:a,params:r}:null}};am=nm([_i(),rm(0,vi(Li)),rm(0,bi(Qg)),rm(1,vi(Li)),rm(1,bi(zd)),rm(2,vi(Li)),rm(2,bi(Vd)),sm("design:paramtypes",[Object,Object,Object])],am);const om=new ai((t=>{om.__vloaded||(om.__vloaded=!0,Fi(t,Qg))}));om.__vloaded=!1;var lm=om;class hm{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme();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,l=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n,s)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=s||l,o)),((t,i,s,r)=>{if(o||l)return!0;const a=i.lineWidth||s.lineWidth,h=i.pickStrokeBuffer||s.pickStrokeBuffer,c=i.keepStrokeScale||s.keepStrokeScale;return n.lineWidth=c?a+h:Hs(n,a+h,n.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),n.highPerformanceRestore(),o}}var cm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},um=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dm=function(t,e){return function(i,n){e(i,n,t)}};let pm=class extends hm{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=tl}};pm=cm([_i(),dm(0,vi(cd)),um("design:paramtypes",[Object])],pm);let gm=!1;const fm=new ai(((t,e,i,n)=>{gm||(gm=!0,t(tf).to(pm).inSingletonScope(),t(Qg).toService(tf))}));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},vm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ym=function(t,e){return function(i,n){e(i,n,t)}};let _m=class extends hm{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=il}};_m=mm([_i(),ym(0,vi(ud)),vm("design:paramtypes",[Object])],_m);let bm=!1;const xm=new ai(((t,e,i,n)=>{bm||(bm=!0,t(ef).to(_m).inSingletonScope(),t(Qg).toService(ef))}));var Sm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Am=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wm=function(t,e){return function(i,n){e(i,n,t)}};let km=class extends hm{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=nl}};km=Sm([_i(),wm(0,vi(dd)),Am("design:paramtypes",[Object])],km);let Tm=!1;const Cm=new ai(((t,e,i,n)=>{Tm||(Tm=!0,t(nf).to(km).inSingletonScope(),t(Qg).toService(nf))}));class Mm{constructor(){this.type="glyph",this.numberType=sl}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=>{if(n)return;const r=s.pickItem(t,e,null,i);n=!(!r||!r.graphic)})),n}return!1}}var Bm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Em=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Om=function(t,e){return function(i,n){e(i,n,t)}};let Rm=class extends Mm{constructor(t){super(),this.canvasRenderer=t}};Rm=Bm([_i(),Om(0,vi(Sd)),Em("design:paramtypes",[Object])],Rm);let Pm=!1;const Im=new ai(((t,e,i,n)=>{Pm||(Pm=!0,t(uf).to(Rm).inSingletonScope(),t(Rm).toService(uf))}));var Lm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(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 Dm=class{constructor(){this.type="image",this.numberType=al}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Dm=Lm([_i()],Dm);let Fm=!1;const jm=new ai(((t,e,i,n)=>{Fm||(Fm=!0,t(sf).to(Dm).inSingletonScope(),t(Dm).toService(sf))}));var Nm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Um=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hm=function(t,e){return function(i,n){e(i,n,t)}};let zm=class extends hm{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ol}};zm=Nm([_i(),Hm(0,vi(fd)),Um("design:paramtypes",[Object])],zm);let Vm=!1;const Wm=new ai(((t,e,i,n)=>{Vm||(Vm=!0,t(rf).to(zm).inSingletonScope(),t(Qg).toService(rf))}));var Gm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ym=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xm=function(t,e){return function(i,n){e(i,n,t)}};let $m=class extends hm{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hl}};$m=Gm([_i(),Xm(0,vi(vd)),Ym("design:paramtypes",[Object])],$m);let Km=!1;const qm=new ai(((t,e,i,n)=>{Km||(Km=!0,t(cf).to($m).inSingletonScope(),t(Qg).toService(cf))}));var Zm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qm=function(t,e){return function(i,n){e(i,n,t)}};let tv=class extends hm{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ll}};tv=Zm([_i(),Qm(0,vi(md)),Jm("design:paramtypes",[Object])],tv);let ev=!1;const iv=new ai(((t,e,i,n)=>{ev||(ev=!0,t(af).to(tv).inSingletonScope(),t(Qg).toService(af))})),nv=new he;class sv{constructor(){this.type="rect",this.numberType=cl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme(),{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||t.shadowRoot||S(r,!0)&&0!==r||_(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,a=i.pickStrokeBuffer||s.pickStrokeBuffer,o=i.keepStrokeScale||s.keepStrokeScale;return n.lineWidth=o?r+a:Hs(n,r+a,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{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;nv.setValue(i.x1,i.y1,i.x2,i.y2),nv.expand(-r/2),h=!nv.containsPoint(e)}}return n.highPerformanceRestore(),h}}var rv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},av=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ov=function(t,e){return function(i,n){e(i,n,t)}};let lv=class extends sv{constructor(t){super(),this.canvasRenderer=t}};lv=rv([_i(),ov(0,vi(yd)),av("design:paramtypes",[Object])],lv);let hv=!1;const cv=new ai(((t,e,i,n)=>{hv||(hv=!0,t(of).to(lv).inSingletonScope(),t(Qg).toService(of))}));let uv=!1;const dv=new ai(((t,e,i,n)=>{uv||(uv=!0,t(sf).to(Dm).inSingletonScope(),t(Dm).toService(sf))}));var pv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fv=function(t,e){return function(i,n){e(i,n,t)}};let mv=class extends hm{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=dl}};mv=pv([_i(),fv(0,vi(_d)),gv("design:paramtypes",[Object])],mv);let vv=!1;const yv=new ai(((t,e,i,n)=>{vv||(vv=!0,t(lf).to(mv).inSingletonScope(),t(Qg).toService(lf))}));var _v=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(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 bv=class{constructor(){this.type="text",this.numberType=pl}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};bv=_v([_i()],bv);let xv=!1;const Sv=new ai(((t,e,i,n)=>{xv||(xv=!0,t(hf).to(bv).inSingletonScope(),t(Qg).toService(hf))})),Av=new ai(((t,e,i,n)=>{i(am)||t(am).toSelf().inSingletonScope(),i(Ud)?n(Ud).toService(am):t(Ud).toService(am)}));var wv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Tv=class extends Bf{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};Tv.env="node",Tv=wv([_i(),kv("design:paramtypes",[Object,Number])],Tv);var Cv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Bv=class extends Pl{constructor(t){super(t)}init(){this._context=new Tv(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&u(this._nativeCanvas.release)&&this._nativeCanvas.release()}};Bv.env="node",Bv=Cv([_i(),Mv("design:paramtypes",[Object])],Bv);const Ev=Pf(Bv,Tv);var Ov=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pv=function(t,e){return function(i,n){e(i,n,t)}};let Iv=class extends Zp{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ri.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new Bv(i)}createWindowByCanvas(t){var e;const i=t.canvas,n=null!==(e=t.dpr)&&void 0!==e?e:1;let s=t.width,r=t.height;null!=s&&null!=r&&t.canvasControled||(s=i.width/n,r=i.height/n),this.canvas=new Bv({width:s,height:r,dpr:n,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};Iv.env="node",Iv=Ov([_i(),Pv(0,vi(zi)),Rv("design:paramtypes",[Object])],Iv);const Lv=new ai((t=>{t(Iv).toSelf(),t(Ur).toDynamicValue((t=>t.container.get(Iv))).whenTargetNamed(Iv.env)}));var Dv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(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 Fv=class extends $p{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Ma.call(t)}}getCancelAnimationFrame(){return t=>{Ma.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};Fv=Dv([_i()],Fv);const jv=new ai((t=>{jv.isNodeBound||(jv.isNodeBound=!0,t(Fv).toSelf().inSingletonScope(),t(Hi).toService(Fv))}));function Nv(t,e=!0){Nv.__loaded||(Nv.__loaded=!0,t.load(jv),t.load(Ev),t.load(Lv))}jv.isNodeBound=!1,Nv.__loaded=!1;var Uv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(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 Hv=class extends Bf{draw(){}createPattern(t,e){return null}};Hv.env="wx",Hv=Uv([_i()],Hv);var zv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Wv=class extends Pl{constructor(t){super(t)}init(){this._context=new Hv(this,this._dpr)}release(...t){}};Wv.env="wx",Wv=zv([_i(),Vv("design:paramtypes",[Object])],Wv);const Gv=Pf(Wv,Hv);var Yv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$v=function(t,e){return function(i,n){e(i,n,t)}};class Kv{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 qv=class extends Zp{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new Kv}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ri.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Wv(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 Wv({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){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};qv.env="wx",qv=Yv([_i(),$v(0,vi(zi)),Xv("design:paramtypes",[Object])],qv);const Zv=new ai((t=>{t(qv).toSelf(),t(Ur).toDynamicValue((t=>t.container.get(qv))).whenTargetNamed(qv.env)}));var Jv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ty=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 ey=class extends $p{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,a){return ty(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let o=0;o{let a=wx.createSelectorQuery();r&&(a=a.in(r)),a.select(`#${l}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const a=r[0].node,h=r[0].width,c=r[0].height;a.width=h*t,a.height=c*t,i.set(l,a),o>=n&&s.push(a),e(null)}))})))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component,e.forceUpdate).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Ma.call(t)}}getCancelAnimationFrame(){return t=>{Ma.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};ey=Jv([_i(),Qv("design:paramtypes",[])],ey);const iy=new ai((t=>{iy._isWxBound||(iy._isWxBound=!0,t(ey).toSelf().inSingletonScope(),t(Hi).toService(ey))}));function ny(t,e=!0){ny.__loaded||(ny.__loaded=!0,t.load(iy),t.load(Gv),t.load(Zv),e&&function(t){t.load(lm),t.load(Av),t.load(fm),t.load(xm),t.load(Cm),t.load(Im),t.load(jm),t.load(Wm),t.load(qm),t.load(iv),t.load(cv),t.load(dv),t.load(yv),t.load(Sv)}(t))}iy._isWxBound=!1,ny.__loaded=!1;var sy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ry=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ay=function(t,e){return function(i,n){e(i,n,t)}};let oy=class extends hm{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=tl}};oy=sy([_i(),ay(0,vi(cd)),ry("design:paramtypes",[Object])],oy);let ly=!1;const hy=new ai(((t,e,i,n)=>{ly||(ly=!0,t(df).to(oy).inSingletonScope(),t(Sf).toService(df))}));var cy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dy=function(t,e){return function(i,n){e(i,n,t)}};let py=class extends sv{constructor(t){super(),this.canvasRenderer=t}};py=cy([_i(),dy(0,vi(yd)),uy("design:paramtypes",[Object])],py);let gy=!1;const fy=new ai(((t,e,i,n)=>{gy||(gy=!0,t(mf).to(py).inSingletonScope(),t(Sf).toService(mf))}));class my extends pu{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=t.getGraphicTheme(),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 u=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!u||(u=t.isPointInPath(c.x,c.y),u)),((t,e,i)=>{if(u)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return n.lineWidth=a?s+r:Hs(n,s+r,n.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==h&&Tl.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}}var vy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_y=function(t,e){return function(i,n){e(i,n,t)}};let by=class extends my{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ol}};by=vy([_i(),_y(0,vi(fd)),yy("design:paramtypes",[Object])],by);let xy=!1;const Sy=new ai(((t,e,i,n)=>{xy||(xy=!0,t(gf).to(by).inSingletonScope(),t(Sf).toService(gf))}));var Ay=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ky=function(t,e){return function(i,n){e(i,n,t)}};let Ty=class extends hm{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=il}};Ty=Ay([_i(),ky(0,vi(ud)),wy("design:paramtypes",[Object])],Ty);let Cy=!1;const My=new ai(((t,e,i,n)=>{Cy||(Cy=!0,t(pf).to(Ty).inSingletonScope(),t(Sf).toService(pf))}));class By extends pu{contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme();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 u=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u))),this.canvasRenderer.z=0,n.modelMatrix!==h&&Tl.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}}var Ey=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Oy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ry=function(t,e){return function(i,n){e(i,n,t)}};let Py=class extends By{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=dl}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getParsedPath();if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(s.isSvg||"imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,n),{x:o,y:l,z:h,lastModelMatrix:c}=a;let u=e;if(n.camera){u=e.clone();const i=t.parent.globalTransMatrix;u.x=i.a*e.x+i.c*e.y+i.e,u.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,n,o,l,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return n.lineWidth=a?s+r:Hs(n,s+r,n.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==c&&Tl.free(n.modelMatrix),n.modelMatrix=c,n.highPerformanceRestore(),d}};Py=Ey([_i(),Ry(0,vi(_d)),Oy("design:paramtypes",[Object])],Py);let Iy=!1;const Ly=new ai(((t,e,i,n)=>{Iy||(Iy=!0,t(vf).to(Py).inSingletonScope(),t(Sf).toService(vf))}));var Dy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jy=function(t,e){return function(i,n){e(i,n,t)}};let Ny=class extends By{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=pl}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=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.canvasRenderer.z=u;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,d=l.height(),f=l.width(),m=Lh(a,d,s),v=Ih(o,f);return e.rect(v+h,m+c,f,d,u),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==d&&Tl.free(n.modelMatrix),n.modelMatrix=d,n.highPerformanceRestore(),g}};Ny=Dy([_i(),jy(0,vi(bd)),Fy("design:paramtypes",[Object])],Ny);let Uy=!1;const Hy=new ai(((t,e,i,n)=>{Uy||(Uy=!0,t(yf).to(Ny).inSingletonScope(),t(Sf).toService(yf))}));var zy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wy=function(t,e){return function(i,n){e(i,n,t)}};let Gy=class extends my{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ll}};Gy=zy([_i(),Wy(0,vi(md)),Vy("design:paramtypes",[Object])],Gy);let Yy=!1;const Xy=new ai(((t,e,i,n)=>{Yy||(Yy=!0,t(ff).to(Gy).inSingletonScope(),t(Sf).toService(ff))}));var $y=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ky=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qy=function(t,e){return function(i,n){e(i,n,t)}};let Zy=class extends hm{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hl}};Zy=$y([_i(),qy(0,vi(vd)),Ky("design:paramtypes",[Object])],Zy);let Jy=!1;const Qy=new ai(((t,e,i,n)=>{Jy||(Jy=!0,t(_f).to(Zy).inSingletonScope(),t(Sf).toService(_f))}));var t_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},e_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},i_=function(t,e){return function(i,n){e(i,n,t)}};let n_=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ul}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};n_=t_([_i(),i_(0,vi(xd)),e_("design:paramtypes",[Object])],n_);let s_=!1;const r_=new ai(((t,e,i,n)=>{s_||(s_=!0,t(bf).to(n_).inSingletonScope(),t(Sf).toService(bf))})),a_=zp();function o_(){o_.__loaded||(o_.__loaded=!0,Mc.RegisterGraphicCreator("arc",Sc),Vi.load(vg),Vi.load(a_?hy:fm))}o_.__loaded=!1;const l_=o_;function h_(){h_.__loaded||(h_.__loaded=!0,Mc.RegisterGraphicCreator("area",_c),Vi.load(Ag),Vi.load(a_?My:xm))}h_.__loaded=!1;const c_=h_;function u_(){u_.__loaded||(u_.__loaded=!0,Mc.RegisterGraphicCreator("group",nh))}u_.__loaded=!1;const d_=u_;function p_(){p_.__loaded||(p_.__loaded=!0,Mc.RegisterGraphicCreator("line",Zh),Vi.load(xg),Vi.load(a_?Sy:Wm))}p_.__loaded=!1;const g_=p_;function f_(){f_.__loaded||(f_.__loaded=!0,Mc.RegisterGraphicCreator("path",mc),Vi.load(Bg),Vi.load(a_?Xy:iv))}f_.__loaded=!1;const m_=f_;function v_(){v_.__loaded||(v_.__loaded=!0,Mc.RegisterGraphicCreator("polygon",kc),Vi.load(Og),Vi.load(a_?Qy:qm))}v_.__loaded=!1;const y_=v_;function __(){__.__loaded||(__.__loaded=!0,Mc.RegisterGraphicCreator("rect",ec),Vi.load(_g),Vi.load(a_?fy:cv))}__.__loaded=!1;const b_=__;function x_(){x_.__loaded||(x_.__loaded=!0,Mc.RegisterGraphicCreator("richtext",pc),Vi.load(Dg),Vi.load(a_?r_:dv))}x_.__loaded=!1;const S_=x_;function A_(){A_.__loaded||(A_.__loaded=!0,Mc.RegisterGraphicCreator("shadowRoot",Cc))}A_.__loaded=!1;const w_=A_;function k_(){k_.__loaded||(k_.__loaded=!0,Mc.RegisterGraphicCreator("symbol",$h),Vi.load(kg),Vi.load(a_?Ly:yv))}k_.__loaded=!1;const T_=k_;function C_(){C_.__loaded||(C_.__loaded=!0,Mc.RegisterGraphicCreator("text",Gh),Vi.load(Cg),Vi.load(a_?Hy:Sv))}C_.__loaded=!1;const M_=C_;function B_(){d_(),b_()}const E_=-.5*Math.PI,O_=1.5*Math.PI,R_="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var P_;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(P_||(P_={}));const I_={[P_.selectedReverse]:{},[P_.selected]:{},[P_.hover]:{},[P_.hoverReverse]:{}},L_={container:"",width:30,height:30,style:{}};function D_(){return"browser"===Op.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const F_={debounce:gt,throttle:ft};B_();class j_ extends Jg{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},j_.defaultAttributes,t)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:n,width:s,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===n){const t=i-this._viewPosition.y,e=ct(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=ct(t-o/2,l,h);c=t/s,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:n,y:s}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?n:s,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=D_(),a="browser"===Op.env?Op:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:n}=this.stage.eventPointTransform(t);let s,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:u}=this.attribute,d=ct(u[1]-u[0],0,1);return"vertical"===e?(s=n,a=s-this._prePos):(s=i,a=s-this._prePos),r=c>0&&d<1?a/c*(1-d):0,[s,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[n,s]=this._computeScrollValue(t);this.setScrollRange([i[0]+s,i[1]+s],!0),this._prePos=n},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:F_[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,n=this.getScrollRange(),[s,r]=this._computeScrollValue(t),a=[n[0]+r,n[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:ut(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:n=[0,1],range:s,realTime:r=!0}=this.attribute,a=ut(t,n[0],n[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:s,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",F_[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===Op.env?Op:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(),u=this._getSliderPos(ut(n,s[0],s[1])),d=u[1]-u[0];let p;this._sliderSize=d,p="horizontal"===t?{x:u[0],y:c.y1,width:d,height:c.height}:{x:c.x1,y:u[0],width:c.width,height:d};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Ce(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[n,s,r,a]=Ce(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:Math.max(0,t-(a+s)),height:Math.max(0,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,minSliderSize:i=0}=this.attribute,{width:n,height:s,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?n:s,l="horizontal"===e?r:a,h=ct(t[0],0,1),c=ct(t[1],0,1),u=ct(c-h,0,1),d=Math.max(u*o,i),p=Math.max(o-d,0),g=l+h/Math.max(1-u,1e-12)*p;return[g,g+d]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=ut(t,0,1),{width:s,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?ut([a+i*s,a+n*s],a,s-l):ut([o+i*r,o+n*r],o,r-l)}_clearDragEvents(){const t=D_(),e="browser"===Op.env?Op:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===Op.env?Op:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}}function N_(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&N_(t,e)}))}j_.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};const U_=t=>!d(t)&&!1!==t.visible;const H_=["#ffffff","#000000"];function z_(t,e,i,n,s,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Ae(t).toHex(),o=new Ae(e).toHex();return V_(a,o,i,n,r)?a:function(t,e,i,n,s,r){const a=[];s&&(s instanceof Array?a.push(...s):a.push(s)),a.push(...H_);for(const s of a)if(t!==s&&V_(s,e,i,n,r))return s}(a,o,i,n,s,r)}function V_(t,e,i,n,s){if("lightness"===s){const i=Ae.getColorBrightness(new Ae(e));return Ae.getColorBrightness(new Ae(t))<.5?i>=.5:i<.5}return n?W_(t,e)>n:"largeText"===i?W_(t,e)>3:W_(t,e)>4.5}function W_(t,e){const i=G_(t),n=G_(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function G_(t){const e=ke(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 Y_(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 X_(t){let e=function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}function $_(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=Pt(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const K_=(t,e,i,n)=>new se(Object.assign({defaultFontParams:Object.assign({fontFamily:R_,fontSize:14},n),getTextBounds:i?void 0:Oc,specialCharSet:"-/: .,@%'\"~"+se.ALPHABET_CHAR_SET+se.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function q_(t,e,i={}){if(!t)return{width:0,height:0};const n=Oc({text:t,fontFamily:e.fontFamily||i.fontFamily||R_,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:n.width(),height:n.height()}}function Z_(t,e="type"){var i,n;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(n=t[e])&&void 0!==n?n:"text"}function J_(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function Q_(t,e="type"){const i=Z_(t,e);return"rich"===i?Mc.richtext(J_(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:n}=e;return t.html=n,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:n}=e;return t.react=n,t.text=i,t.renderable=!1,t}(t)),Mc.text(t))}function tb(t,e,i,n,s){"right"===t?"center"===i?e.setAttribute("x",n-s/2):"right"===i||"end"===i?e.setAttribute("x",n):e.setAttribute("x",n-s):"center"===i?e.setAttribute("x",n+s/2):"right"===i||"end"===i?e.setAttribute("x",n+s):e.setAttribute("x",n)}function eb(){d_(),b_(),T_(),S_(),M_()}var ib=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);sh&&(T=h,P.setAttribute("maxLineWidth",h-b[1]-b[2]))),w=0,k=0;let U=0;"left"===j||"start"===j?U=1:"right"===j||"end"===j?U=-1:"center"===j&&(U=0),U?U<0?(w-=T,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-B)):U>0&&x.setAttribute("x",b[3]):(w-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-B/2));const H="right"===_||"end"===_,z="left"===_||"start"===_,V=(t,e)=>{"richtext"===P.type?P.setAttributes({x:t,textAlign:e,textConfig:G(P.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):P.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&U){const t=T-b[1]-b[3],e=I+B,i=1===U?(t-e)/2+B+I/2:b[0]+B-(T/2+e/2-B)+I/2;if(V(i,"center"),A){const t=i-I/2-B+F/2;A.setAttributes({x:t})}}if(z&&1!==U){const t=T-b[1]-b[3],e=0===U?-t/2+B/2:-T+b[3]+b[1]+B;if(V(e+B,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(H&&-1!==U){const t=T-b[1]-b[3],e=0===U?t/2+B/2:t;if(V(e,"right"),A){const t=e-I-B+F/2;A.setAttributes({x:t})}}"middle"===N?(k-=C/2,A&&A.setAttribute("y",0)):"bottom"===N?(k-=C,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===N&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),E(null==m?void 0:m.text)||(P.states=m.text);const{visible:W}=a,Y=ib(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:W&&!!n,width:T,height:C,x:w,y:k}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new ps)}this._bgRect=t}this._textShape=P,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},nb.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(s=null===(n=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===n?void 0:n.slice())&&void 0!==s?s:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(u=this._bgRect)||void 0===u||u.clearStates(),null===(d=this._symbol)||void 0===d||d.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}nb.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const sb={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}},rb={poptip:j({},sb)};class ab extends Jg{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}d_(),g_();class ob extends ab{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ob.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})}}ob.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},d_(),b_();class lb extends ab{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lb.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})}}lb.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},d_(),g_(),y_(),T_();class hb extends Jg{getStartAngle(){return Ht(this._startAngle)}getEndAngle(){return Ht(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hb.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:n,visible:s=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!s)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(q(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var s,r;const a=Mc.line(Object.assign(Object.assign({points:t},_(i)?null!==(s=i[e])&&void 0!==s?s:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),E(null==n?void 0:n.line)||(a.states=_(n.line)?null!==(r=n.line[e])&&void 0!==r?r:n.line[n.line.length-1]:n.line),this.add(a),this.lines.push(a)}))}else{let t=Mc.line;G(i)[0].cornerRadius&&(t=Mc.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(null==n?void 0:n.line)||(e.states=[].concat(n.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:n=!0}=t;let s;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:u=0,refAngle:d=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+u*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+u*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+u*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+u*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),s=Mc.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:n?v+d:0,strokeBoundsBuffer:0}),p)),s.name=`${this.name}-${i}-symbol`,s.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(s.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(s.states=o.startSymbol):E(null==o?void 0:o.endSymbol)||(s.states=o.endSymbol),this.add(s)}return s}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let n;return n=e?A(i)?t[i]:q(t):t,this._mainSegmentPoints=n,n}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let n=t;if(e.visible){const i=e.clip?e.size||10:0;n=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...n.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,s={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)};n=[...n.slice(0,n.length-1),s]}return n}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],n=t[t.length-2],s=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[s.x-n.x,s.y-n.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}var cb,ub;hb.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.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(cb||(cb={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(ub||(ub={}));const db={[ub.selectedReverse]:{},[ub.selected]:{},[ub.hover]:{},[ub.hoverReverse]:{}},pb={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},gb={size:8,stroke:"#000",lineWidth:1,zIndex:1};const fb=Math.sin(Math.PI/10);function mb(t,e=fb){const i=!d(t)&&0!==t,n=i?Math.cos(t):1;return i&&Math.abs(n)<=e}function vb(t,e=fb){const i=!d(t)&&0!==t,n=i?Math.sin(t):0;return!i||Math.abs(n)<=e}function yb(t){const e={};return N_(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function _b(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function bb(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 xb(t,e,i){var n;if(vb(null===(n=t.attribute)||void 0===n?void 0:n.angle,Number.EPSILON))return i>re(t.AABBBounds,e.AABBBounds);const s=t.OBBBounds,r=e.OBBBounds;return!s||!r||s.empty()||r.empty()?i>re(t.AABBBounds,e.AABBBounds):s.intersects(r)||i>ae(s,r)}function Sb(t,e){for(let i,n=1,s=t.length,r=t[0];n{this._lastHover=((t,e,i)=>{const n=t.target;return n!==i&&n.name&&!E(n.states)?(n.addState(P_.hover,!0),N_(e,(t=>{t!==n&&t.name&&!E(t.states)&&t.addState(P_.hoverReverse,!0)})),n):i})(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=((t,e,i)=>i?(N_(e,(t=>{t.name&&!E(t.states)&&(t.removeState(P_.hoverReverse),t.removeState(P_.hover))})),null):i)(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=((t,e,i)=>{const n=t.target;return i===n&&n.hasState(P_.selected)?(N_(e,(t=>{t.name&&!E(t.states)&&(t.removeState(P_.selectedReverse),t.removeState(P_.selected))})),null):n.name&&!E(n.states)?(n.addState(P_.selected,!0),N_(e,(t=>{t!==n&&t.name&&!E(t.states)&&t.addState(P_.selectedReverse,!0)})),n):i})(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=Mc.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prepare(),this._prevInnerView=this._innerView&&yb(this._innerView),this.removeAllChild(!0),this._innerView=Mc.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(wb)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:n,line:s,items:r}=this.attribute,a=Mc.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=cb.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),s&&s.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),n&&n.visible&&this.renderTicks(a),i&&i.visible)){const t=Mc.group({x:0,y:0,pickable:!1});t.name=cb.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const n=this.renderLabels(t,e,i),s=n.getChildren();this.beforeLabelsOverlap(s,e,n,i,r.length),this.handleLabelsOverlap(s,e,n,i,r.length),this.afterLabelsOverlap(s,e,n,i,r.length);let a=0,o=0,l="center",h="middle",c=0;s.forEach(((t,e)=>{var i;const n=t.attribute,s=null!==(i=n.angle)&&void 0!==i?i:0,r=t.AABBBounds;let u=r.width(),d=r.height();s&&(u=Math.abs(u*Math.cos(s)),d=Math.abs(d*Math.sin(s))),a=Math.max(a,u),o=Math.max(o,d),l=n.textAlign,h=n.textBaseline,0===e&&(c=n.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=Mc.group({x:0,y:0,pickable:!1});i.name=cb.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=Mc.line(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=cb.tick,r.id=this._getNodeId(t.id),E(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=I_;else{const t=this.data[n],e=j({},I_,this.attribute.tick.state);Object.keys(e).forEach((i=>{u(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(n&&n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=Mc.line(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=cb.subTick,r.id=this._getNodeId(`${s}`),E(n.state))r.states=I_;else{const i=j({},I_,n.state);Object.keys(i).forEach((n=>{u(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&&u(n)&&(e=n(e,i));const s=this._transformItems(e),r=Mc.group({x:0,y:0,pickable:!1});return r.name=`${cb.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),s.forEach(((t,e)=>{var n;const a=Q_(this._getLabelAttribute(t,e,s,i));if(a.name=cb.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(n=this.attribute.label)||void 0===n?void 0:n.state))a.states=I_;else{const n=j({},I_,this.attribute.label.state);Object.keys(n).forEach((r=>{u(n[r])&&(n[r]=n[r](t,e,s,i))})),a.states=n}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new nb(Object.assign({},e));i.name=cb.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return _b(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&u(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let o=0,h=0;At(n[0])>At(n[1])?o=_t/2*(l.x>e.x?1:-1):h=_t/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?d+=(this.axisLabelLayerSize[n-1].height+O(this.attribute,"label.space",4))*n:d+=(this.axisLabelLayerSize[n-1].width+O(this.attribute,"label.space",4))*n);const f=this.getVerticalCoord(t.point,d,o),m=this.getVerticalVector(d||1,o,f),v=l?l(`${t.label}`,t,e,i,n):t.label;let{style:y}=this.attribute.label;y=u(y)?j({},pb.label.style,y(t,e,i,n)):y;y=j(this.getLabelAlign(m,o,y.angle),y),u(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:n}));let _=y.react;return u(_)&&(_=_(t,e,i,n)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,n){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const n=this._animationConfig;this._newElementAttrMap={},N_(e,(e=>{var s;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const n={};for(const i in e)i in t&&z(t[i],e[i])||(n[i]=e[i]);if(i)for(const s in t)if(!(s in e)){const t=i(s);void 0!==t&&(n[s]=t)}return n}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(s=a.opacity)&&void 0!==s?s:1,l=!0),n.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},n.update),{type:"axisUpdate",customParameters:{config:n.update,diffAttrs:o,lastScale:t}})}])}}else n.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},n.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:n.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Tb={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&&xb(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Cb(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function Mb(t,e,i,n,s=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;t{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Rb(t,e.attribute.angle)),{angle:Ob(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({},Pb(t,e.attribute.angle)),{angle:Ob(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Zt({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),n=i.x-e.centerX,s=i.y-e.centerY;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}function Ob(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Rb(t,e=0){let 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=Ob(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 Pb(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],n=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const s=(e=Ob(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 Ib(t,e){const{limitLength:i,verticalLimitLength:n,ellipsis:s="...",orient:r,axisLength:a}=e;if(E(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,p=c?Math.sin(h):0,f=vb(h),m=mb(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=n)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=n)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=n)return}}let r=null;if(f||m)r=v?f?n:i:"vertical"===y||m?n:i;else if(v){const{x1:e,x2:n}=t.AABBBounds,s=p/u,l=Math.abs(i/p);if(_&&s>0&&e<=a+o.right&&i/s+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(_&&s<0&&n>=-o.left&&i/s+n<-o.left){const t=(n+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:s})}))}function Lb(t,e,i){let n;return A(e)&&(n=Math.abs(e-t)),A(i)&&(n=A(n)?Math.min(Math.abs(t-i),n):Math.abs(t-i)),n}class Db{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:n=1}=this.attribute,s=X_(this.getRelativeVector());return function(t,e){return[t[0]*e,t[1]*e]}([s[1],-1*s[0]],t*(e?1:-1)*n)}}class Fb{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-Fb.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Fb.bounceIn(2*t):.5*Fb.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/St*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*St/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/St*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*St/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/St*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*St/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*St/e)*.5+1}}static registerFunc(t,e){Fb[t]=e}}function jb(t,e){const i=1/e;let n=1;for(;t>i;)t-=i,n*=-1;const s=n*t/i;return s>0?s:1+s}Fb.quadIn=Fb.getPowIn(2),Fb.quadOut=Fb.getPowOut(2),Fb.quadInOut=Fb.getPowInOut(2),Fb.cubicIn=Fb.getPowIn(3),Fb.cubicOut=Fb.getPowOut(3),Fb.cubicInOut=Fb.getPowInOut(3),Fb.quartIn=Fb.getPowIn(4),Fb.quartOut=Fb.getPowOut(4),Fb.quartInOut=Fb.getPowInOut(4),Fb.quintIn=Fb.getPowIn(5),Fb.quintOut=Fb.getPowOut(5),Fb.quintInOut=Fb.getPowInOut(5),Fb.backIn=Fb.getBackIn(1.7),Fb.backOut=Fb.getBackOut(1.7),Fb.backInOut=Fb.getBackInOut(1.7),Fb.elasticIn=Fb.getElasticIn(1,.3),Fb.elasticOut=Fb.getElasticOut(1,.3),Fb.elasticInOut=Fb.getElasticInOut(1,.3*1.5),Fb.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),Fb.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},Fb.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)Fb[`flicker${t}`]=e=>jb(e,t);for(let t=2;t<10;t++)Fb[`aIn${t}`]=e=>t*e*e+(1-t)*e;function Nb(t,e,i){return t+(e-t)*i}const Ub=new class{constructor(){this.opacity=(t,e,i,n,s,r)=>{r.attribute.opacity=Nb(e,i,n)},this.baseOpacity=(t,e,i,n,s,r)=>{r.attribute.baseOpacity=Nb(e,i,n)},this.fillOpacity=(t,e,i,n,s,r)=>{r.attribute.fillOpacity=Nb(e,i,n)},this.strokeOpacity=(t,e,i,n,s,r)=>{r.attribute.strokeOpacity=Nb(e,i,n)},this.zIndex=(t,e,i,n,s,r)=>{r.attribute.zIndex=Nb(e,i,n)},this.backgroundOpacity=(t,e,i,n,s,r)=>{r.attribute.backgroundOpacity=Nb(e,i,n)},this.shadowOffsetX=(t,e,i,n,s,r)=>{r.attribute.shadowOffsetX=Nb(e,i,n)},this.shadowOffsetY=(t,e,i,n,s,r)=>{r.attribute.shadowOffsetY=Nb(e,i,n)},this.shadowBlur=(t,e,i,n,s,r)=>{r.attribute.shadowBlur=Nb(e,i,n)},this.fill=(t,e,i,n,s,r)=>{r.attribute.fill=Fl(e,i,n,!1)},this.fillPure=(t,e,i,n,s,r)=>{r.attribute.fill=s.fromParsedProps.fill?Nl(s.fromParsedProps.fill,s.toParsedProps.fill,n):s.toParsedProps.fill},this.stroke=(t,e,i,n,s,r)=>{r.attribute.stroke=Fl(e,i,n,!1)},this.strokePure=(t,e,i,n,s,r)=>{r.attribute.stroke=s.fromParsedProps.stroke?Nl(s.fromParsedProps.stroke,s.toParsedProps.stroke,n):s.toParsedProps.stroke},this.width=(t,e,i,n,s,r)=>{r.attribute.width=Nb(e,i,n),r.addUpdateBoundTag()},this.height=(t,e,i,n,s,r)=>{r.attribute.height=Nb(e,i,n),r.addUpdateBoundTag()},this.x=(t,e,i,n,s,r)=>{r.attribute.x=Nb(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,n,s,r)=>{r.attribute.y=Nb(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,n,s,r)=>{r.attribute.dx=Nb(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,n,s,r)=>{r.attribute.dy=Nb(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,n,s,r)=>{r.attribute.angle=Nb(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,n,s,r)=>{r.attribute.scaleX=Nb(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,n,s,r)=>{r.attribute.scaleY=Nb(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,n,s,r)=>{r.attribute.lineWidth=Nb(e,i,n),r.addUpdateBoundTag()},this.startAngle=(t,e,i,n,s,r)=>{r.attribute.startAngle=Nb(e,i,n),r.addUpdateBoundTag()},this.endAngle=(t,e,i,n,s,r)=>{r.attribute.endAngle=Nb(e,i,n),r.addUpdateBoundTag()},this.radius=(t,e,i,n,s,r)=>{r.attribute.radius=Nb(e,i,n),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,n,s,r)=>{r.attribute.outerRadius=Nb(e,i,n),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,n,s,r)=>{r.attribute.innerRadius=Nb(e,i,n),r.addUpdateBoundTag()},this.size=(t,e,i,n,s,r)=>{r.attribute.size=Nb(e,i,n),r.addUpdateBoundTag()},this.points=(t,e,i,n,s,r)=>{r.attribute.points=ka(e,i,n),r.addUpdateBoundTag()}}};function Hb(t,e,i,n,s,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*n,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const s=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=n?"function"==typeof n?n:null!==(s=Fb[n])&&void 0!==s?s:Fb.linear:Fb.linear,"wait"===t&&(this.onUpdate=zb),this.id=ri.GenAutoIncrementId(),this.syncAttributeUpdate=zb}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],n=this.props[e];if(y(i)&&y(n)){const s=Ll.Get(i,Il.Color255),r=Ll.Get(n,Il.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=s,this.toParsedProps[e]=r,t.push(Ub["fill"===e?"fillPure":"strokePure"])}else Ub[e]?t.push(Ub[e]):t.push(Hb)}else Ub[e]?t.push(Ub[e]):t.push(Hb)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,n,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],n,this,this.target)})),this.onUpdate(t,n,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}const Wb=new Xi;class Gb{constructor(){this.released=!1}tick(t,e){Wb.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class Yb extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const n=t.getTime();this._lastTickTime=n,this.lastFrameTime<0&&(this.lastFrameTime=n-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const s=n-this.lastFrameTime,r=this.checkSkip(s);return r||(this._handlerTick(s),this.lastFrameTime=n,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===en.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=en.INITIAL,Gi.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Gi.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new Gb;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==en.INITIAL&&(this.status=en.PAUSE,!0)}resume(){return this.status!==en.INITIAL&&(this.status=en.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===en.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===en.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=en.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=en.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===en.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===en.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Gi.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,n;return"performance"!==(null===(n=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===n?void 0:n.tickRenderMode)&&t1)return 1}return 2}class Kb{static registerBuiltInAnimate(t,e){Kb.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var n,s;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const n=this.resolveValue(t.delay,i,0),s=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=n+r+s,Object.assign(Object.assign({},t),{delay:n,delayAfter:s,duration:r})}));let n=0;l&&(n="number"==typeof l?l:l?e:0),o.oneByOneDelay=n;let s=1;if(r){const t=e+n*(this._target.count-2);s=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*s,delayAfter:t.delayAfter*s,duration:t.duration*s,effects:e.map((t=>{var e,i;const n=null!==(e=t.custom)&&void 0!==e?e:Kb.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],s=$b(n);return Object.assign(Object.assign({},t),{custom:n,customType:s})}))})})),o.oneByOneDelay=n*s,o.startTime=a*s}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=u,o.custom=null!==(n=t.custom)&&void 0!==n?n:Kb.builtInAnimateMap[null!==(s=t.type)&&void 0!==s?s:"fromTo"];const d=$b(o.custom);o.customType=d;const p=e+h+c+u*(this._target.count-2),g=A(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=u*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,n;return t.partitioner(null===(n=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===n?void 0:n[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var n,s,r,a;return t.sort(null===(s=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===s?void 0:s[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const n=e?(i,n,s)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,n,s);a&&this._trackAnimation(a)}:(i,n,s)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,n,s);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>n(t,e,i.length))):this._target.count<=1?n(this._target,0,1):this._target.forEachChildren(((t,e)=>n(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,n){var s,r,a,o,l,h,c,d;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:w=0,options:k,custom:T,customType:C,controlOptions:M}=t,B=e.animate();B.priority=w;const E=u(v)?v(null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],e,{}):v,O=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;O&&R&&(i=null!==(h=O[R])&&void 0!==h?h:i),B.startAt(b);const P=i*x+E;P>0&&B.wait(P);let I=null,L=t.to,D=t.from;L||(I||(I=this.createPropsFromChannel(g,e)),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e)),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,T,C,D,L,_,m,f,M,k,p,e);let F=0;x&&(F=x*(n-i-1));const j=u(y)?y(null===(d=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===d?void 0:d[0],e,{}):y;return j>0&&(F+=j),F>0&&B.wait(F),S&&S>0&&B.loop(S),A&&B.bounce(!0),B}_handleRunAnimate(t,e,i,n,s,r,a,o,l,h,c,d){var p,g,f,m,v,y,_,b;if(e&&i){i=$b(e);let c=this.resolveValue(o,d);"function"==typeof c&&(c=c(null===(g=null===(p=d.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],d,{})),c=Object.assign({width:(null===(f=d.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=d.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=u(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=d.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],d,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,n,s,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,s,r,a,c)}else"to"===c?t.to(s,r,a):"from"===c&&t.from(s,r,a)}executeTimelineItem(t,e,i,n){var s,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:u,oneByOneDelay:d,priority:p,controlOptions:g}=t,f=null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*d),c&&c>0&&v.loop(c),u&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),d&&v.wait(d*(n-i-1)),v}applyTimeSliceToAnimate(t,e,i,n){var s,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:d=0}=t,p=u(c)?c(null===(r=null===(s=i.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],i,{}):c,g=u(d)?d(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):d;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var s;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let u=null,d=t.to,p=t.from;d||(u||(u=this.createPropsFromChannel(a,i)),d=u.props),p||(u||(u=this.createPropsFromChannel(a,i)),p=u.from),u.attrOutChannel&&i.setAttributes(u.attrOutChannel);const g=null!==(s=t.custom)&&void 0!==s?s:Kb.builtInAnimateMap[r],f=t.custom?t.customType:$b(g);this._handleRunAnimate(e,g,f,p,d,h,l,o,n,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,n,s,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,n,s,a,o)=>{e(s,i,n,a,o,t.target,r)},t.to(i,n,s)}createCustomAnimation(t,e,i,n,s,r,a){const o=new e(i,n,s,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const n={};let s=null;if(!t)return{from:s,props:n,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?n[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):n[i]=h.to),void 0!==h.from&&(s||(s={}),"function"==typeof h.from?s[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):s[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(n.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:s,props:n,attrOutChannel:a?r:null}}resolveValue(t,e,i){var n,s;return void 0===t?i:"function"==typeof t&&e?t(null===(s=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===s?void 0:s[0],e,{}):t}executeItem(t,e,i=0,n=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,n))).filter(Boolean):[this._executeItem(t,e,i,n)].filter(Boolean)}_executeItem(t,e,i=0,n=1){if(!e)return null;const s="timeSlices"in t;let r=null;const a=this.parseParams(t,s);return r=s?this.executeTimelineItem(a,e,i,n):this.executeTypeConfigItem(a,e,i,n),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=sn.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}Kb.builtInAnimateMap={};class qb extends Vb{constructor(t,e,i,n,s){super("customAnimate",e,i,n),this.type="customAnimate",this.customFrom=t,this.params=s,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.onUpdate(t,n,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Zb extends qb{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Jb{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new Kb(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function Qb(t){return new Jb(t)}class tx extends qb{constructor(t,e,i,n,s){super(t,e,i,n,s),this.formatTemplate=null,this.decimalLength=null==s?void 0:s.decimalLength,(null==s?void 0:s.formatTemplate)&&s.formatTemplate.includes("{{var}}")&&(this.formatTemplate=s.formatTemplate)}onFirstRun(){var t,e,i;const n=this.getLastProps(),s=this.getEndProps(),r=null!==(t=n.text)&&void 0!==t?t:0,a=null!==(e=s.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",u=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=u)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const n=this.fromNumber+(this.toNumber-this.fromNumber)*e;let s="";const r=this.format,a=("%"===r?100*n:n).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;s=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",s)}}const ex=1e3,ix="quadInOut",nx=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],sx=(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=Fl(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},rx=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?lg(t):[],s=lg(e);i&&n&&(i.fromTransform&&hg(n,i.fromTransform.clone().getInverse()),hg(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})))},ox=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],lx=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!ox.includes(s))return;const r=e[s];if(!d(r)&&!d(t[s])&&r!==t[s]){if("fill"===s||"stroke"===s){const e=t=>"string"==typeof t?Ll.Get(t,Il.Color255):t;i.push({from:_(t[s])?t[s].map(e):e(t[s]),to:_(r)?r.map(e):e(r),key:s})}else i.push({from:t[s],to:r,key:s});n=!0}})),n?i:null};class hx extends qb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;rx(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&sx(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const cx=(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=ax(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=lx(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const u=new hx({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:ex,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:ix);return c.play(u),c};class ux extends qb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;rx(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&&sx(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const dx=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>nx.includes(t))(i)||(e[i]=t[i])})),e},px=(t,e,i)=>{const n=dx(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=Gi.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});s.appendChild(i),e.push(i)}))}},gx=(t,e,i)=>{const n=[],s=i?null:dx(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:dx(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:n}=Jh(t.attribute),s=ug(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(Gi.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=ug(o*(r+a)/2,l,e),c=[],u=l/h.length,d=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(Gi.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=ug(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(Gi.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 dg(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 dg(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Gi.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:pg(i)}];const n=[];return fg(i,e,n),n})(t,e).forEach((t=>{n.push(Gi.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&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return fg(l,e,h),h})(t,e).forEach((t=>{n.push(Gi.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=lg(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(Gi.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Gi.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&px(t,n,e),n};class mx extends qb{constructor(t,e,i,n,s){var r,a;super(t,e,i,n,s),this.newPointAnimateType=null!==(r=null==s?void 0:s.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==s?void 0:s.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var n,s;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(s=null===(n=t.points)||void 0===n?void 0:n.length)&&void 0!==s?s:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:n}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:n},this.props=this.to;const s=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=s?Array.isArray(s)?s:[s]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),A(this.clipRange)?this.clipRange=ct(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let u=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(u=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[u,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Dt(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onFirstRun(){const t=this.target.attribute.clipRange;A(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const n=wa(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const n=t+this.segmentsCache[i],s=this.points.slice(t,n);return t=n,Object.assign(Object.assign({},e),{points:s})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class vx extends qb{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const n=this.target.getFinalAttribute(),s=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==n?void 0:n[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:s[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const n=this.target.attribute;this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yx extends qb{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((n=>{var s;e[n]=0,i[n]=null!==(s=t[n])&&void 0!==s?s:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n=this.target.attribute;this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class _x extends vx{constructor(t,e,i,n,s){super(t,e,i,n,s),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class bx extends yx{constructor(t,e,i,n,s){super(t,e,i,n,s),this.keys=["clipRange"]}}const xx=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==n?void 0:n.startAngle,endAngle:null==n?void 0:n.endAngle}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s,endAngle:s},to:{startAngle:null==n?void 0:n.startAngle,endAngle:null==n?void 0:n.endAngle}}})(t,e):((t,e,i)=>{const n=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==n?void 0:n.endAngle},to:{startAngle:null==n?void 0:n.startAngle}}:{from:{endAngle:null==n?void 0:n.startAngle},to:{endAngle:null==n?void 0:n.endAngle}}})(t,e)};class Sx extends qb{constructor(t,e,i,n,s){super(t,e,i,n,s)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class Ax extends Sx{onBind(){var t,e,i;super.onBind();const{from:n,to:s}=xx(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class kx extends Sx{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,n=this.params.options,this.params,!1!==(null!==(s=null==n?void 0:n.overall)&&void 0!==s&&s)?((t,e,i)=>{const n=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:n.startAngle,endAngle:n.endAngle},to:{startAngle:t,endAngle:t}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n.startAngle,endAngle:n.endAngle},to:{startAngle:s,endAngle:s}}})(i,n):((t,e,i)=>{const n=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:n.startAngle},to:{startAngle:null==n?void 0:n.endAngle}}:{from:{endAngle:n.endAngle},to:{endAngle:null==n?void 0:n.startAngle}}})(i,n));var i,n,s;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class Tx extends qb{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const{from:n,to:s}=((t,e,i)=>{const n=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=n.x,e=n.x1,i=n.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=n.y,e=n.y1,i=n.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=n.x,e=n.x1,i=n.width,s=n.y,r=n.y1,a=n.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=s+a/2,o.height=0,o.y1=void 0):(o.y=(s+r)/2,o.y1=(s+r)/2,o.height=void 0),{from:o,to:{x:t,y:s,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n=this.target.attribute;this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Cx extends qb{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const n=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=n.x,e=n.x1,i=n.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=n.y,e=n.y1,i=n.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=n.x,e=n.y,i=n.x1,s=n.y1,r=n.width,a=n.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+s)/2,o.y1=(e+s)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n=this.target.attribute;this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const Mx=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n,s,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(n=i.groupHeight)&&void 0!==n?n:null===(s=e.layoutRect)||void 0===s?void 0:s.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const n=t.getFinalAttribute(),s=n.y,r=n.y1,a=n.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:s,y1:r,height:a}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:s,y1:r,height:a}}}(t,e)};class Bx extends qb{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const{from:n,to:s}=Mx(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n=this.target.attribute;this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Ex extends qb{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,n=this.params.options,s=this.params,!1!==(null!==(r=null==n?void 0:n.overall)&&void 0!==r&&r)?function(t,e,i){var n,s,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(n=i.groupHeight)&&void 0!==n?n:null===(s=e.layoutRect)||void 0===s?void 0:s.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,n,s):function(t,e,i){const n=t.getFinalAttribute(),s=n.y,r=n.y1,a=n.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,n));var i,n,s,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n=this.target.attribute;this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const Ox=(t,e,i)=>{const n=t.getFinalAttribute().points,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,e&&e.center&&(A(e.center.x)&&(s.x=e.center.x),A(e.center.y)&&(s.y=e.center.y)),"area"===t.type&&(s.x1=s.x,s.y1=s.y),n.map((t=>Object.assign({},t,s)))};class Rx extends qb{constructor(t,e,i,n,s){super(t,e,i,n,s)}onUpdate(t,e,i){var n,s;const r=null===(n=this.from)||void 0===n?void 0:n.points,a=null===(s=this.to)||void 0===s?void 0:s.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>wa(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class Px extends Rx{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const n=t.getFinalAttribute();return{from:{points:Ox(t,e)},to:{points:n.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const n=this.target.getFinalAttribute();n&&this.target.setAttributes(n),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class Ix extends Rx{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:n,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:Ox(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=n||i,this.to=s}else this.valid=!1;var t,e}}const Lx=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class Dx extends Rx{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const n=t.getFinalAttribute();return{from:{points:Lx(t,e)},to:{points:n.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const n=this.target.getFinalAttribute();n&&this.target.setAttributes(n),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class Fx extends Rx{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:n,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:Lx(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=n||i,this.to=s}else this.valid=!1;var t,e}}const jx=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class Nx extends Rx{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const n=t.getFinalAttribute();return{from:{points:jx(t,e)},to:{points:n.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const n=this.target.getFinalAttribute();n&&this.target.setAttributes(n),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class Ux extends Rx{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:jx(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=null!=i?i:this.target.attribute,this.to=n}else this.valid=!1;var t,e}}const Hx=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAttribute(),s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:s,outerRadius:s},to:{innerRadius:null==n?void 0:n.innerRadius,outerRadius:null==n?void 0:n.outerRadius}}})(t,e):((t,e,i)=>{const n=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==n?void 0:n.outerRadius},to:{innerRadius:null==n?void 0:n.innerRadius}}:{from:{outerRadius:null==n?void 0:n.innerRadius},to:{outerRadius:null==n?void 0:n.outerRadius}}})(t,e)};class zx extends qb{constructor(t,e,i,n,s){super(t,e,i,n,s)}onUpdate(t,e,i){const n=this.target.attribute;this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Vx extends zx{onBind(){var t,e,i;super.onBind();const{from:n,to:s}=Hx(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class Wx extends zx{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(n=null==i?void 0:i.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAttribute(),s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==n?void 0:n.innerRadius,outerRadius:null==n?void 0:n.outerRadius},to:{innerRadius:s,outerRadius:s}}})(e,i):((t,e,i)=>{const n=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==n?void 0:n.innerRadius},to:{innerRadius:null==n?void 0:n.outerRadius}}:{from:{outerRadius:null==n?void 0:n.outerRadius},to:{outerRadius:null==n?void 0:n.innerRadius}}})(e,i));var e,i,n;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const Gx=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n;const s=t.getFinalAttribute(),r=s.x,a=s.x1,o=s.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const n=t.getFinalAttribute(),s=n.x,r=n.x1,a=n.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:s,x1:r,width:a}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:s,x1:r,width:a}}}(t,e)};class Yx extends qb{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const{from:n,to:s}=Gx(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n=this.target.attribute;this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Xx extends qb{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,n=this.params.options,s=this.params,!1!==(null!==(r=null==n?void 0:n.overall)&&void 0!==r&&r)?function(t,e,i){var n;const s=t.getFinalAttribute(),r=s.x1,a=s.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,n,s):function(t,e,i){const n=t.getFinalAttribute(),s=n.x,r=n.x1,a=n.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,n));var i,n,s,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n=this.target.attribute;this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class $x extends Zb{onBind(){var t;const e=Qb(this.target);this._animator=e;const i=this.duration,n=this.easing,{config:s,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),s=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:s,y:h},duration:i,easing:n})}e.animate(this.target,{type:null!==(t=s.type)&&void 0!==t?t:"fadeIn",to:s.to,duration:i*o,easing:n}),this.completeBind(e)}}class Kx extends Zb{onBind(){const t=Qb(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:n,diffAttrs:s}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function qx(){d_(),g_(),S_(),M_(),Kb.registerBuiltInAnimate("axisEnter",$x),Kb.registerBuiltInAnimate("axisUpdate",Kx)}var Zx=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{startPoint:n,endPoint:s,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=Mc.group({zIndex:999});e.name=cb.axisBreak,e.id=this._getNodeId(`${cb.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:n={},angle:s=.5*Math.PI}=t,r=j({},gb,n),a=null!==(e=r.size)&&void 0!==e?e:gb.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(s)} L ${a/2} ${-a*Math.sin(s)}`,symbolSize:a})}(r),l=Mc.symbol(Object.assign({x:n.x,y:n.y},o));l.name=cb.axisBreakSymbol;const h=Mc.symbol(Object.assign({x:s.x,y:s.y},o));h.name=cb.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,n=t.AABBBounds,s=Mc.rect(Object.assign({x:n.x1,y:n.y1,width:n.width(),height:n.height()},i.style));s.name=cb.background,s.id=this._getNodeId("background"),s.states=j({},db,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(s,t.firstChild)}const{labelHoverOnAxis:n}=this.attribute;n&&n.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new nb(Object.assign({},t));e.name=cb.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:n}=this.attribute,s=n,{startSymbol:r,endSymbol:a,style:o,state:l}=s,h=Zx(s,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let n=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:s}=e;t.push([n,i]),n=s})),t.push([n,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:j({},db,l),symbol:j({},db,l)});const u=new hb(c);u.name=cb.line,u.id=this._getNodeId("line"),t.add(u)}getTextAlign(t){let e="center";return at(t[0],0)?at(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const n=this.attribute.title,{position:s="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=n,p=Zx(n,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===s?g=0:"end"===s&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+O(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,n=this.axisLabelsContainer.AABBBounds;_+=(1===m?n.x2>i?Math.min(n.x2-i,n.width()):0:n.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),w=this.getVerticalCoord(v,S,!1),k=this.getVerticalVector(S,!1,{x:0,y:0});let T,C,{angle:M}=p;if(T="start"===s?"start":"end"===s?"end":"center",d(M)&&o){M=$_(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;C=1==-1*t?"bottom":"top"}else T=this.getTextAlign(k),C=this.getTextBaseline(k,!1);let B=u;if(d(B)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,n=Math.min(t||1/0,e||1/0);if(A(n))if("bottom"===i||"top"===i)if(M!==Math.PI/2){const t=Math.abs(Math.cos(null!=M?M:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=n-S;else if(M&&0!==M){const t=Math.abs(Math.sin(M));B=t<1e-6?1/0:this.attribute.end.y/t}else B=n-S}const E=Object.assign(Object.assign(Object.assign({},w),p),{maxWidth:B,textStyle:Object.assign({textAlign:T,textBaseline:C},a),state:{text:j({},db,c.text),shape:j({},db,c.shape),panel:j({},db,c.background)}});return E.angle=M,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,n=this.attribute.labelHoverOnAxis,{position:s=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=n,p=Zx(n,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=s:g.y=s;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(d(b)&&a){b=$_(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=u,A=h?h(c):c,w=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return w.angle=b,l&&l.visible&&(w.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),w}getTextBaseline(t,e){let i="middle";const{verticalFactor:n=1}=this.attribute,s=(e?1:-1)*n;return at(t[1],0)?i=!at(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===s?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const n=this.attribute.orient;if(["top","bottom","right","left"].includes(n)||0===t[0]&&0===t[1]){if("top"===n||"bottom"===n)return Rb(e?"bottom"===n?"top":"bottom":n,i);if("left"===n||"right"===n)return Pb(e?"left"===n?"right":"left":n,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,n,s){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:n}=this.attribute,s="bottom"===e||"top"===e,h=t[0],c=Y(t),u=s?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-d}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=u?c:h,e=u?h:c,s=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,d=n.y;rd&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+d-s}):t.setAttributes({y:d,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,n,s){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,s),{layoutFunc:h,autoRotate:c,autoRotateAngle:d,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(u(h))h(t,e,n,this);else{if(c)!function(t,e){if(E(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0,a=n;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);s{t.attribute.angle=jt(e)})),Eb(i,t),!Bb(t))break}}(t,{labelRotateAngle:d,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:n,ellipsis:s="...",orient:r}=e;if(E(t)||!A(i))return;const a=t[0].attribute.angle,o=vb(a),l=mb(a),h="top"===r||"bottom"===r;let c=n/t.length;t.forEach(((e,n)=>{var r,a,u,d,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=Lb(e.attribute.x,null===(r=t[n+1])||void 0===r?void 0:r.attribute.x,null===(a=t[n-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Ct(c,i))}}else{if(l){const i=Lb(e.attribute.y,null===(u=t[n+1])||void 0===u?void 0:u.attribute.y,null===(d=t[n-1])||void 0===d?void 0:d.attribute.y);A(i)&&(c=Ct(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:s,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);Ib(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&function(t,e){if(E(t))return;const i=t.filter(Cb);if(E(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=u(s)?s:Tb[s]||Tb.parity;if(n.length>=3&&Sb(n,r)){do{n=a(n,r)}while(n.length>=3&&Sb(n,r));const t=(t,e,i=!0)=>i&&t<3||e,s=t(n.length,e.firstVisible,!1);let o=t(n.length,e.lastVisible);const l=i[0],h=Y(i);xb(l,h,r)&&s&&o&&(h.setAttribute("opacity",0),o=!1),Mb(l,n,s,(t=>xb(t,l,r))),Mb(h,n,o,(t=>xb(t,h,r)||!(!s||t===l)&&xb(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,n,s){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,s);let e,n;h=Math.max(h,t),"left"===a?(e=l.x2-h,n=l.y1):"right"===a?(e=l.x1,n=l.y1):"top"===a?(e=l.x1,n=l.y2-h):"bottom"===a&&(e=l.x1,n=l.y1);const r=Mc.rect({x:e,y:n,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=cb.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,n,s){"left"===n||"right"===n?"left"===s?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===s?t.forEach((t=>{var n;t.setAttributes({dx:(null!==(n=t.attribute.dx)&&void 0!==n?n:0)+e+i-t.AABBBounds.x2})})):"center"===s&&t.forEach((t=>{var n;t.setAttributes({dx:(null!==(n=t.attribute.dx)&&void 0!==n?n:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==n&&"top"!==n||("top"===s?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===s?t.forEach((t=>{var n;t.setAttributes({dy:(null!==(n=t.attribute.dy)&&void 0!==n?n:0)+e+i-t.AABBBounds.y2})})):"middle"===s&&t.forEach((t=>{var n;t.setAttributes({dy:(null!==(n=t.attribute.dy)&&void 0!==n?n:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,n,s,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,u=null!==(i=o.space)&&void 0!==i?i:4;let d=t,p=0,g=0;const f=h&&h.visible?null!==(n=h.style.lineWidth)&&void 0!==n?n:1:0,m=c&&c.visible?null!==(s=c.length)&&void 0!==s?s:4:0;if(l&&l.visible&&"string"==typeof l.text){p=q_(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=Ce(l.padding);g=l.space+t[0]+t[2]}return d&&(d=(d-u-g-p-f-m)/e),d}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const n=this.axisContainer.AABBBounds,s=n.width(),r=n.height(),a=n.x1,o=n.y1,l=n.x2,h=n.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,n=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",n),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,n=i.width()-s,c=i.height()-r;n>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-n,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}Jx.defaultAttributes=pb,W(Jx,Db);const Qx=t=>t.map(((t,e)=>({index:e,value:t}))),tS=(t,e,i,n)=>it?Math.min(t-e/2,i-e):i{var n,s,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let u=null!==(n=a.angle)&&void 0!==n?n:0;"vertical"===a.direction&&(u+=jt(90));const d=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;d||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=K_(a),y=t.range();let _=[];for(let i=0;i{nS[t]=!0}));const lS=t=>-Math.log(-t),hS=t=>-Math.exp(-t),cS=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,uS=t=>10===t?cS:t===Math.E?Math.exp:e=>Math.pow(t,e),dS=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),pS=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),gS=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function fS(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 mS(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function vS(t,e,i){let n;return n=1===t?t+2*i:t-e+2*i,t?n>0?n:1:0}function yS(t,e,i,n){return 1===i&&(i=0),vS(t,i,n)*(e/(1-i))}function _S(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),n=t[0]-i*e[0];return[n,i+n]}function bS(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=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)};class SS{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=_S(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:n}=this._fishEyeOptions,s=this.range(),r=s[0],a=s[s.length-1],o=Math.min(r,a),l=Math.max(r,a),h=ct(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(n)?(l-o)*i:n;let u=Math.exp(e);u=u/(u-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const AS=Symbol("implicit");class wS extends SS{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=iS.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=AS}clone(){const t=(new wS).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let n=this._index.get(e);if(!n){if(this._unknown!==AS)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}const s=this._ordinalRange[(n-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(s):s}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return kS(t,e,r,s)}class CS extends wS{constructor(t){super(),this.type=iS.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),n=super.domain().length,s=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=yS(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),n=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const s=this._rangeFactorStart+n<=1,r=this._rangeFactorEnd-n>=0;if("rangeFactorStart"===e&&s?this._rangeFactorEnd=this._rangeFactorStart+n:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-n:t[0]<=t[1]?s?this._rangeFactorEnd=this._rangeFactorStart+n:r?this._rangeFactorStart=this._rangeFactorEnd-n:(this._rangeFactorStart=0,this._rangeFactorEnd=n):r?this._rangeFactorStart=this._rangeFactorEnd-n:s?this._rangeFactorEnd=this._rangeFactorStart+n:(this._rangeFactorStart=1-n,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,n=e+i;this._wholeRange=[e,n]}else{const e=t[1]+i*(1-this._rangeFactorEnd),n=e-i;this._wholeRange=[n,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=n,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),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=[J(t[0]),J(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[J(t[0]),J(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:TS(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return TS(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let n;if(i=dt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),n=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}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new CS(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:MS}=Te;function BS(t,e){const i=typeof e;let n;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(n=Ae.parseColorString(e)){const e=MS(Ae.parseColorString(t),n);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof we?MS(t,e):e instanceof Ae?MS(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):mt(Number(t),Number(e))}class ES extends SS{constructor(t=oS,e=oS){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=oS,this._piecewise=mS,this._interpolate=BS}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),mt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const n=Array.from(t,J);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=vt,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 this._autoClamp&&(this._clamp=dt(i[0],i[r-1])),this._piecewise=r>2?bS:mS,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:oS),this.rescale(i)):this._clamp!==oS}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const OS=Math.sqrt(50),RS=Math.sqrt(10),PS=Math.sqrt(2),IS=[1,2,5,10],LS=(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=NS(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)),function(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ns+t*n))):t>0?FS(0,-(e-1)/n,n):FS((e-1)/n,0,n)},DS=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 LS(t,i,null==n?void 0:n.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return LS(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=FS(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=FS(t,e,l);return s&&r.reverse(),r})),NS=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let n=IS[0];return i>=OS?n=IS[3]:i>=RS?n=IS[2]:i>=PS&&(n=IS[1]),e>=0?{step:n*10**e,gap:n,power:e}:{step:-(10**-e)/n,gap:n,power:e}};function US(t,e,i){const n=(e-t)/Math.max(0,i);return NS(n)}function HS(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;e0;){if(n=US(a,o,e).step,n===i)return t[s]=a,t[r]=o,t;if(n>0)a=Math.floor(a/n)*n,o=Math.ceil(o/n)*n;else{if(!(n<0))break;a=Math.ceil(a*n)/n,o=Math.floor(o*n)/n}i=n}}function VS(t,e){const i=S(e.forceMin),n=S(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:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),n?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):s=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:s,niceDomain:a,niceMinMax:r,domainValidator:o}}const WS=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),GS=ht(((t,e,i,n,s,r,a)=>{let o=t,l=e;const h=l0){for(;d<=p;++d)for(c=1;cl)break;g.push(u)}}else for(;d<=p;++d)for(c=n-1;c>=1;--c)if(u=d>0?c/r(-d):c*r(d),!(ul)break;g.push(u)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),YS=ht(((t,e,i,n,s,r)=>{const a=[],o={},l=s(t),h=s(e);let c=[];if(Number.isInteger(n))c=jS(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const s=r(i),l=Number.isInteger(n)?WS(t,e,s):WS(t,e,xS(s)),h=WS(t,e,((t,e)=>{let i,n;return e[0]1&&(o[h]=1,a.push(h))})),a})),XS=ht(((t,e,i,n,s)=>HS(n(t),n(e),i).map((t=>xS(s(t))))));class $S extends ES{constructor(){super(...arguments),this.type=iS.Linear}clone(){var t;const e=new $S;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return DS(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(u(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const n=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,s=this._domain,r=n[0],a=n[n.length-1];let o=jS(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(t=10){const e=this.calculateVisibleDomain(this._range);return HS(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let n,s,r=-1;if(i=+i,(s=(e=+e)<(t=+t))&&(n=t,t=e,e=n),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(s=o[1])&&void 0!==s?s:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function qS(t){return e=>-t(-e)}function ZS(t=Number.EPSILON){return e=>Math.max(e,t)}class JS extends ES{constructor(){super(dS(10),uS(10)),this.type=iS.Log,this._limit=ZS(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new JS).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=dS(this._base),n=uS(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=qS(i),this._pows=qS(n),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=lS,this.untransformer=hS):(this._logs=i,this._pows=n,this._limit=ZS(),this.transformer=this._logs,this.untransformer=n),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return oS}d3Ticks(t=10,e){const i=this.domain(),n=this._limit(i[0]),s=this._limit(i[i.length-1]);return GS(n,s,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return YS(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return XS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return XS(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}W(JS,KS);class QS extends $S{constructor(){super(pS(1),gS(1)),this.type=iS.Symlog,this._const=1}clone(){return(new QS).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=pS(t),this.untransformer=gS(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),n=i[0],s=i[i.length-1];return GS(n,s,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return YS(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return XS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return XS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}W(QS,KS);class tA{constructor(){this.type=iS.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!d(t)&&A(+t)?this._range[nt(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 tA).domain(this._domain).range(this._range).unknown(this._unknown)}}function eA(t,e,i,n){let s;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();s=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||s.push(e)}));e.domain(a)}else s=n(i);return s}function iA(t,e,i,n,s=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){s?e.push(t):e.unshift(t);for(let t=0;t{var i,n,s,r;if(!sS(t.type))return Qx(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return Qx([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:d=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=eA(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const n=null!==(i=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=eA(e,t,n,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:d}):t.d3Ticks(e,{noDecimals:d})))}else{const i=null!==(n=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==n?n:5,s=u(e.tickMode)?e.tickMode:void 0;m=eA(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:d,customTicks:s}):t.ticks(e,{noDecimals:d,customTicks:s})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e,a=6;let l;if(m.length*a>o){const i=[],n=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%n!=0&&e!==m.length-1||i.push(t)})),l=null===(s=eS(t,i,e))||void 0===s?void 0:s.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=eS(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],s=Y(l),r=f&&f()?sA.greedy:sA.parity;for(;l.length>=3&&Sb(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;xb(t,s,i)&&l.includes(s)&&l.length>1&&a&&o&&(l.splice(l.indexOf(s),1),o=!1),iA(t,l,a,(e=>xb(e,t,i))),iA(s,l,o,(e=>xb(e,s,i)||!(!a||e===t)&&xb(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&n&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return Qx(m)},sA={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>!(n&&xb(i,t,e)||(i=t,0))))}},rA=(t,e,i,n)=>{const s=eS(t,e,i);return s&&s.map((t=>n?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},aA=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,oA=(t,e)=>t[1]{var i;const n=t.domain();if(!n.length)return[];const{tickCount:s,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?Qx([n[n.length-1]]):Qx([n[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(s)){const e=u(s)?s({axisLength:f,labelStyle:h}):s;m=t.ticks(e)}else if(e.sampling){const s=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(g),a=X(g);if(n.length<=f/s){const i=rA(t,n,e,c);if(i){const s=Math.min(...i.map((t=>t[2]))),l=(a-r)/n.length,h=hA(n,i,o,e.labelLastVisible,Math.floor(s/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(n[n.length-1]))}}else{const i=[n[0],n[Math.floor(n.length/2)],n[n.length-1]],s=rA(t,i,e,c);if(s){let i=null;s.forEach((t=>{i?i[2]0?Math.ceil(n.length*(o+i[2])/(a-r-o)):n.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===n[n.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(n[n.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=n=>{let s=!0,r=0;do{r+n{let n=t,s=e;for(;n=0?s=t:n=t+1}return n})(s,t.length,(t=>c(t)?1:-1));let d=u;do{if(d>u&&!r&&!c(d))d++;else{if(!n){o=d;break}{const n=t.length-1;let s,r=0;s=t.length%d>0?t.length-t.length%d+d:t.length;do{if(s-=d,s!==n&&!aA(e[s],e[n],i))break;r++}while(s>0);if(s===n){o=d,a=r;break}{const i=Math.floor(t.length/d)-r+1;if(i=0?oA(e[s-d],e[s]):t,u=Math.abs(t-c);if(u~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function 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:({x1:n,y1:s,x2:r,y2:a})=>{if(r<0||a<0||n>t||s>e)return!0;let o,l,h,c,u=a;for(;u>=s;--u)if(o=u*t+n,l=u*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&cA[31&o]&uA[1+(31&l)])return!0}else{if(i[h]&cA[31&o])return!0;if(i[c]&uA[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||s>e)return;let o,l,h,c,u;for(;s<=a;++s)if(o=s*t+i,l=s*t+r,h=o>>>5,c=l>>>5,h===c)n(h,cA[31&o]&uA[1+(31&l)]);else for(n(h,cA[31&o]),n(c,uA[1+(31&l)]),u=h+1;u{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+n,l=a>>>5,h=o>>>5,l===h)s(l,uA[31&a]|cA[1+(31&o)]);else for(s(l,uA[31&a]),s(h,cA[1+(31&o)]),c=l+1;ci<0||n<0||r>=e||s>=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}}}(l,h),c.x=t=>~~((t+s)/o),c.y=t=>~~((t+n)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function pA(t,e){const{x1:i,x2:n,y1:s,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=ct(i,-o,t.width+l),u=ct(n,-o,t.width+l),d=ct(s,-a,t.height+h),p=ct(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(u),y1:t.y(d),y2:t.y(p)}}function gA(t,e,i=!1){return i?pA(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function fA(t,e,i,n=!0,s=0){let r=i;s>0&&(r={x1:i.x1-s,x2:i.x2+s,y1:i.y1-s,y2:i.y2+s}),r=gA(t,r);const a=e.outOfBounds(r);return!(n&&a||(a&&(r=pA(t,r)),e.getRange(r)))}function mA(t,e,i,n=[],s=!0,r=0,a=!1){var o,l,h,c;const u=n.filter((t=>p(t))),d=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(s.AABBBounds,r,t,n.offset))),l=!1===i.restorePosition;return mA(t,e,s,o,h,c,l)}return!1}var d;if("moveY"===i.type){const n=(i.offset?u(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return mA(t,e,s,n,h,c)}if("moveX"===i.type){const n=(i.offset?u(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return mA(t,e,s,n,h,c)}return!1}const yA=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],_A=["top","inside-top","inside"];function bA(t,e,i,n={}){const{x1:s,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:u=0}=n,d=Math.min(s,r),p=Math.max(s,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+u;let y=0,_=0;return d<0-h?y=-d:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const xA={mode:"same-time",duration:300,easing:"linear"};function SA(t){return 3===t||4===t}function AA(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)}const wA=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function kA(t,e,i,n,s,r){return Math.abs(e/t)0?s:-s),y:n+e*s/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:n+(e>0?r:-r)}}var TA=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?s&&s.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):n.animates&&n.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const BA=(t,e)=>Math.ceil(t)>Math.floor(e),EA=([t,e],[i,n])=>n>t&&e>i;function OA(t,e){const[i,n]=t,[s,r]=e,a=Math.max(i,s),o=Math.min(n,r);return Math.max(0,o-a)}var RA=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(e.states)||(e.addState(P_.hover,!0),N_(this,(t=>{t===e||E(t.states)||t.addState(P_.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(N_(this,(t=>{E(t.states)||(t.removeState(P_.hoverReverse),t.removeState(P_.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void N_(this,(t=>{E(t.states)||(t.removeState(P_.selectedReverse),t.removeState(P_.selected))}));E(e.states)||(e.addState(P_.selected,!0),N_(this,(t=>{t===e||E(t.states)||t.addState(P_.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,n,s,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_n.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_n.ANIMATE_UPDATE&&(null===(n=t.detail.animationState)||void 0===n?void 0:n.isFirstFrameOfStep)){const e=null!==(r=null===(s=t.target)||void 0===s?void 0:s.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,n){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if($t(t,e,!0))return;const i=Math.min(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-n)/2,l=Math.abs(e.x2-s)/2,h=Math.abs(e.y2-r)/2,c=i+a,u=n+o,d=s+l,p=r+h,g=d-c,f=p-u;return[kA(g,f,c,u,a,o),kA(-g,-f,d,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const n=Mc.line({points:i}),{line:s={}}=t.attribute;if(s.customShape){const i=s.customShape;n.pathProxy=n=>i({text:t,baseMark:e},n,new ps)}return e&&e.getAttributes(!0).fill&&n.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!E(this.attribute.line.style)&&n.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(n),n}}render(){if(this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:n,customLayoutFunc:s,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(u(n)&&(a=n(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=u(s)?s(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],h=o;if(!c(e)&&u(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?h.push(i):l.push(i)}))}u(r)?o=r(h,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(h).concat(l)),u(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return Q_(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let n;if(n=u(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),n.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:s}=this.attribute;if(s&&0!==s.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),s),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let n=0;nl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,s,h,c):this._overlapByStrategy(t,s,h,c)}_overlapGlobal(t,e,i,n){let s=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,u=t=>o.get(t).x,d=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let s=t.length-1;s>=0;s--){const r=t[s],a=t[s-1],l=t[s+1];if(a&&BA(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=n(r);l&&BA(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:n,x2:s}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:n,x2:s,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(n>=o&&s<=l)i.push(e),h=!0;else if(at(r,u(i[0]),void 0,5)){const r={start:Math.min(o,n),end:Math.max(l,s)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(OA([o,l],[n,s])/(l-o)>.5){const r={start:Math.min(o,n),end:Math.max(l,s)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:n,end:s},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==s.enable){const{maxIterations:e=10,maxError:n=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:u=Number.MAX_VALUE}=s;for(let s=0;sl(t)-l(e)));let e=0;for(let n=0;n=o)continue;let r,v=n+1;for(;(r=t[v])&&!EA([d(s),p(s)],[d(r),p(r)]);)v+=1;if(r){const t=c(s),n=h(s),o=c(r),d=o-(t+n);if(di){const e=t-(a-d),i=l(s)-e;Math.abs(i)<=u&&(f(s,e),m(s,g(s)+1))}else if(t-n<0){const t=o+(a-d),e=l(r)-t;Math.abs(e)<=u&&(f(r,t),m(r,g(r)+1))}else{const e=t-n,i=l(s)-e,a=o+n,h=l(r)-a;Math.abs(i)<=u&&Math.abs(h)<=u&&(f(s,e),f(r,a),m(s,g(s)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(s,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(s=this._baseMarks)||void 0===s||s.forEach((t=>{t.AABBBounds&&n.setRange(gA(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&n.setRange(gA(i,t.AABBBounds,!0))})):t.AABBBounds&&n.setRange(gA(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var n;if(t){if(!1!==t.attribute.visible){if(null===(n=t.context)||void 0===n?void 0:n.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:n=t,y1:s=i}=e;return{x1:(t+n)/2,x2:(t+n)/2,y1:(i+s)/2,y2:(i+s)/2}}const{x:s,y:r}=e;return{x1:s,x2:s,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,n=new Map,s=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,u=(null==s?void 0:s.get(c))?"update":"enter";let d;o&&(d=this._createLabelLine(t,h));const p=d?{text:t,labelLine:d}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u)r.push(t),n.set(c,p),this._addLabel(p,r,a,e);else if("update"===u){const t=s.get(c);s.delete(c),n.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(s),this._graphicToText=n}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:n}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var s;null===(s=e.setFinalAttributes)||void 0===s||s.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},n),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},n),{type:e===t?n.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:n}=t,{text:s,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:s,prevLabelLine:n,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,n){const{text:s,labelLine:r}=t,a=this.getRelatedGraphic(s.attribute);this._syncStateWithRelatedGraphic(a),s&&this.add(s),r&&this.add(r),this.runEnterAnimation(s,r)}_updateLabel(t,e){const{text:i,labelLine:n}=t,{text:s,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),n&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,n,s,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:u,mode:d,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(n=l.brightColor)&&void 0!==n?n:"#ffffff",y=null!==(s=l.darkColor)&&void 0!==s?s:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{IA[t]=e};var DA=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{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,u=(e.y1+e.y2)/2;let d=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":d=-1;break;case"right":d=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":d=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":d=0,p=0}return{x:c+d*(n+g)+Math.sign(d)*(l/2),y:u+p*(n+f)+Math.sign(p)*(h/2)}})(t,e,i,n)}}FA.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const jA=()=>{LA("symbol",FA),LA("line-data",FA)};var NA=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{x1:i,x2:n,y1:s,y2:r}=t,a=Math.abs(n-i),o=Math.abs(r-s);let l=(i+n)/2,h=(s+r)/2,c=0,u=0;switch(e){case"top":case"inside-top":u=-.5;break;case"bottom":case"inside-bottom":u=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,u=-.5;break;case"top-left":c=-.5,u=-.5;break;case"bottom-right":c=.5,u=.5;break;case"bottom-left":c=-.5,u=.5}return l+=c*a,h+=u*o,{x:l,y:h}})(e,i);let d=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?d=g?1:-1:i.includes("right")&&(d=g?-1:1),i){case"top-right":case"bottom-right":d=-1;break;case"top-left":case"bottom-left":d=1}return{x:c+d*n+d*l/2,y:u+p*n+p*h/2}}}UA.tag="rect-label",UA.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var HA=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),n&&0!==n.length||(n=[e]);const r="start"===i?0:n.length-1;return n[r]?{x1:n[r].x,x2:n[r].x,y1:n[r].y,y2:n[r].y}:void 0}labeling(t,e,i="end",n=0){return function(t,e,i="end",n=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:s,x2:r}=t,a=Math.abs(r-s),o=e.x1;let l=o;return"end"===i?l=o+a/2+n:"start"===i&&(l=o-a/2-n),{x:l,y:e.y1}}(t,e,i,n)}};zA.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const VA=()=>{LA("line",zA),LA("area",zA)};var WA=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);sthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=s.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=u(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=u(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===s[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:s[t].attribute.width:e.maxLineWidth=null!==(n=r.labelLimit)&&void 0!==n?n:s[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),s[t].setAttributes(e)}}return s}layoutArcLabels(t,e,i,n,s,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),n.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(n[i])&&!d(s[i])){const t=n[i]?n[i]:null,r=s[i]?s[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=Vt(h.endAngle-d/2),g=Ut(c,h.outerRadius,o),f=Ut(c,a+e.line.line1MinLength,o),m=new GA(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=Ut(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):SA(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var n,s;const r=e,a=r.spaceWidth,o=null!==(n=r.position)&&void 0!==n?n:"inside",l=null!==(s=r.offsetRadius)&&void 0!==s?s:-a;return t.forEach((t=>{var i,n,s;const{labelSize:h,radian:c}=t,u=t.innerRadius,d=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(d,h.height))p=0;else{let t;t=c>=Math.PI?u:Math.max(u,h.height/2/Math.tan(c/2)),p=d-t-a}!0!==r.rotate&&(p=d-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?u-l+y:"inside-center"===o?u+(d-u)/2:d+l-y,t.labelPosition=Ut(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ot(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(n=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:t.middleAngle;let a=null!==(s=r.offsetAngle)&&void 0!==s?s:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var n,s,r;const a=null!==(n=i[0].attribute.x)&&void 0!==n?n:0,o=2*(null!==(s=i[0].attribute.y)&&void 0!==s?s:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=SA(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const n of t){const{labelPosition:t,labelSize:s}=n;n.labelLimit=s.width,n.pointB=SA(n.quadrant)?{x:t.x+s.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-s.width/2-this._line2MinLength-h,y:t.y},this._computeX(n,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const n=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,n,e,i);const{minY:s,maxY:a}=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(o,Math.max(n,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-s),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const n of t)this._computePointB(n,h,e,i),this._computeX(n,e,i)}const c=2*a;return t.forEach((t=>{var i,n;t.labelVisible&&(lt(t.pointB.x,this._line2MinLength+h)||ot(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(n=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var n;const s=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(n=e.layout)||void 0===n?void 0:n.align,c=e.spaceWidth,{labelPosition:u,quadrant:d,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=SA(d)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+s.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):u.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,n,s,r,a,o;const l=e,h=null!==(n=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==n?n:null===(s=l.textStyle)||void 0===s?void 0:s.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?d(h)||"auto"===h?"edge"===c?SA(t.quadrant)?"left":"right":SA(t.quadrant)?"right":"left":h:d(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,n){var s;n[0].attribute.x;const r=2*(null!==(s=n[0].attribute.y)&&void 0!==s?s:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const n=t.length;if(n<=0)return;for(let s=0;s=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.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 o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,d)}else if(-1!==u&&-1===d){const i=p.labelPosition.y;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){const s=i;let r=0;n.forEach((t=>{t.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=s.line.line1MinLength;if("none"===s.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const n=t.circleCenter,s=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(s+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(n.y-r.y)**2)-h;A(c)?t.pointB={x:n.x+c*(SA(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const n=t.circleCenter,s={width:2*n.x,height:2*n.y};let r=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=s,c=this.computeRadius(a,e.width,e.height),u=this._computeLayoutRadius(h/2,e,i),d=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(at(l/2,d))g=0,f=1,m=-p;else if(at(h/2,p))g=1,f=0,m=-d;else{const t=-1/(p/d);g=t,f=-1,m=p-t*d}const v=function(t,e,i,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),u=-(e*h+i)/t;return 0===l?[{x:u,y:h}]:[{x:u,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-u,0,u);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?at(v[0].y,v[1].y)?ot(t.middleAngle,-Math.PI)&<(t.middleAngle,0)||ot(t.middleAngle,Math.PI)&<(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-s;return Math.max((h**2+t**2)/(2*h),l)}_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{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function KA(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=Ft.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 qA(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=bb(t,!!s),o=bb(r,!!s);const h=Ft.distancePP(n,l),c=Ft.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=KA(e,t,!1,!!s),o=KA(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=bb(t,!!s),o=bb(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}$A.defaultAttributes={pickable:!1};class ZA extends Jg{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&yb(this._innerView),this.removeAllChild(!0),this._innerView=Mc.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return _b(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=j({},this.attribute,this.getGridAttribute(t)),{type:n,items:s,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${cb.grid}-sub`:`${cb.grid}`;if(s.forEach(((t,i)=>{const{id:s,points:o}=t;let c="";if("line"===n||"polygon"===n)c=bb(o,!!a);else if("circle"===n){const{center:t}=this.attribute;c=KA(t,o,!1,!!a)}const d=Mc.path(Object.assign({path:c,z:l},u(r)?j({},this.skipDefault?null:ZA.defaultAttributes.style,r(t,i)):r));d.name=`${h}-line`,d.id=this._getNodeId(`${h}-path-${s}`),e.add(d)})),l&&"line"===n&&s.forEach(((t,i)=>{const{id:n,points:s}=t,o=[];o.push(s[0]);const c=s[1].x-s[0].x,d=s[1].y-s[0].y,p=Math.sqrt(c*c+d*d),g=l/p;o.push({x:s[0].x+c*g,y:s[0].y+d*g});const f=bb(o,!!a),m=At(o[0].x-o[1].x),v=At(o[0].y-o[1].y),y=Mc.path(Object.assign({path:f,z:0,alpha:m>v?(s[1].x-s[0].x>0?-1:1)*_t/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},u(r)?j({},this.skipDefault?null:ZA.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${n}`),e.add(y)})),s.length>1&&o){const t=_(o)?o:[o,"transparent"],n=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!at(a.value,0)&&!at(l.value,0),u=!at(a.value,1)&&!at(l.value,1),d=[],p=a.value>l.value;(p&&u||!p&&c)&&d.push(this.getGridPointsByValue(p?1:0)),s.forEach((t=>{d.push(t.points)})),(p&&c||!p&&u)&&d.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,n=[];return i>=2&&this.data.forEach((i=>{let s=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;s=e}n.push({value:s})})),n}release(){super.release(),this._prevInnerView=null,this._innerView=null}}ZA.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},d_(),m_();class JA extends ZA{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ZA.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n=6,startAngle:s=E_,endAngle:r=O_}=this.attribute;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2){const s=this._getPointsOfSubGrid(n,i);for(let i=0;i{let{point:r}=s;if(!i){const t=s.value-n/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:s.label,datum:s,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},s),{items:r})}}function QA(){d_(),T_(),M_()}W(JA,Db);const tw={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};QA();class ew extends Jg{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ew.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(ow.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,n,s;const r=t.target;if(r&&r.name&&r.name.startsWith(ow.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===ow.focus||"focus"===o){const n=a.hasState(rw.focus);a.toggleState(rw.focus),n?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[rw.unSelected,rw.unSelectedHover,rw.focus],t),this._setLegendItemState(e,rw.selected,t)})):(this._setLegendItemState(a,rw.selected,t),this._removeLegendItemState(a,[rw.unSelected,rw.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[rw.selected,rw.selectedHover,rw.focus],t),this._setLegendItemState(e,rw.unSelected,t))})))}else{null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((t=>{t.removeState(rw.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(rw.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(aw.legendItemClick,a,t);i?(this._removeLegendItemState(a,[rw.selected,rw.selectedHover],t),this._setLegendItemState(a,rw.unSelected,t)):(this._setLegendItemState(a,rw.selected,t),this._removeLegendItemState(a,[rw.unSelected,rw.unSelectedHover],t))}else this._setLegendItemState(a,rw.selected,t),this._removeLegendItemState(a,[rw.unSelected,rw.unSelectedHover],t),null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[rw.selected,rw.selectedHover],t),this._setLegendItemState(e,rw.unSelected,t))}))}this._dispatchLegendEvent(aw.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,rw.selected),this._removeLegendItemState(e,[rw.unSelected,rw.unSelectedHover])):(this._removeLegendItemState(e,[rw.selected,rw.selectedHover]),this._setLegendItemState(e,rw.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:n,defaultSelected:s,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=iw,spaceRow:l=nw,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:u,isHorizontal:d,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:d?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:w}=this._itemContext,k=0,T=0;const C=[];for(let t=g,e=u.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=u[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(s)&&(e=s.includes(y.label));const i=this._renderEachItem(y,e,t,u),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),d?(p(n)&&(f&&a?(w=Math.ceil((S+g)/n),b=w>1):S+g>n&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||C.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),w+=1,S=0,A+=T+l,T=0,C.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),C.push(i)):(p(v)&&(f&&a?(w=Math.ceil((A+m)/v),b=w>1):v<=m?(w+=1,b=!0,A=0,t>0&&(S+=k+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=w,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=w),r||(this._itemContext.startIndex=u.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:n,maxHeight:s}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,s-this._parsedPadding[0]-this._parsedPadding[2]);const a=Mc.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:u,height:d}=t,g=[];p(c)&&g.push(c),p(u)&&g.push(u),g.length&&(p(n)&&g.push(n),this._itemWidthByUser=$(g)),p(d)&&(this._itemHeightByUser=d);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+O(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,n){var s,r;const{label:a,value:o}=this.attribute.item,l=n.AABBBounds,h=i.AABBBounds,c=l.width(),u=h.width();let d=!1;"labelFirst"===t?u>e?d=!0:n.setAttribute("maxLineWidth",e-u):"valueFirst"===t?c>e?d=!0:i.setAttribute("maxLineWidth",e-c):c+u>e&&(d=!0),d&&(n.setAttribute("maxLineWidth",Math.max(e*(null!==(s=a.widthRatio)&&void 0!==s?s:.5),e-u)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,n){var s,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:u,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,n),A=this._handleStyle(y,t,e,i,n),w=this._handleStyle(b,t,e,i,n),k=this._handleStyle(x,t,e,i,n),T=Ce(c);let C;!1===x.visible?(C=Mc.group({x:0,y:0,cursor:null===(s=k.style)||void 0===s?void 0:s.cursor}),this._appendDataToShape(C,ow.item,t,C)):(C=Mc.group(Object.assign({x:0,y:0},k.style)),this._appendDataToShape(C,ow.item,t,C,k.state)),C.id=`${null!=a?a:o}-${i}`,C.addState(e?rw.selected:rw.unSelected);const M=Mc.group({x:0,y:0,pickable:!1});C.add(M);let B,E=0,R=0,P=0;if(v&&!1!==v.visible){const i=O(S,"style.size",10);R=_(i)?i[0]||0:i,P=O(v,"space",8);const n=Mc.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(n,ow.itemShape,t,C,S.state),n.addState(e?rw.selected:rw.unSelected),M.add(n)}let I=0;if(u){const e=O(g,"size",10);B=Mc.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,ow.focus,t,C),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=Q_(Object.assign(Object.assign({x:R/2+P,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,ow.itemLabel,t,C,A.state),D.addState(e?rw.selected:rw.unSelected),M.add(D);const F=O(y,"space",8);if(p(l)){const n=O(b,"space",u?8:0),s=b.formatMethod?b.formatMethod(l,t,i):l,r=Q_(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:w.style.fontSize},w.style),{text:s,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,ow.itemValue,t,C,w.state),r.addState(e?rw.selected:rw.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-R-P-F-I-n;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-R/2-T[1]-T[3]-I-n}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));E=n+(r.AABBBounds.empty()?0:r.AABBBounds.x2),M.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-R-P-I),E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);B&&(B.setAttribute("x",E),M.add(B));const j=M.AABBBounds,N=j.width();if("right"===f){const t=j.x2,e=j.x1;M.forEachChildren(((i,n)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const U=j.height(),H=p(this.attribute.item.width)?this.attribute.item.width:N+T[1]+T[3],z=this._itemHeightByUser||U+T[0]+T[2];return C.attribute.width=H,C.attribute.height=z,B&&B.setAttribute("visible",!1),M.translateTo(-j.x1+T[3],-j.y1+T[0]),C}_createPager(t){var e,i;const{disableTriggerEvent:n,maxRow:s}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new ew(Object.assign(Object.assign({layout:1===s?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:n})):new ew(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:n,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new j_(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new j_(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:n}=this.attribute,{totalPage:s,isHorizontal:r}=this._itemContext,a=n&&n.position||"middle";if(this._pagerComponent.setTotal(s),r){let n;n="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:n})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,n=e.AABBBounds;let s,r;return t?(r=n.width(),s=r/i.width()):(r=n.height(),s=r/i.height()),s}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:n,currentPage:s,totalPage:r}=this._itemContext,a=(s-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),n?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:n=!0,animationDuration:s=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:n}=e.attribute,{width:s,height:r}=e.getSliderRenderBounds(),a="vertical"===n?t.deltaY/r:t.deltaX/s;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",ft(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+O(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:n=2,item:s={},pager:r={}}=this.attribute,{spaceCol:a=iw,spaceRow:o=nw}=s,l=this._itemsContainer,{space:h=sw,defaultCurrent:c=1}=r,u=hw(r,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(d){if(m=(n-1)*o+this._itemHeight*n,f=e,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;v<_+i&&e>0&&(_=0,b+=n+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/n);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+n}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(d?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=Mc.group({x:0,y:t,width:d?v:f,height:d?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(d?m+o:f+a,d?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+O(this.attribute,"title.space",8):0,{maxWidth:i,item:n={},pager:s={}}=this.attribute,{spaceCol:r=iw,spaceRow:a=nw}=n,o=this._itemsContainer,{space:l=sw,defaultCurrent:h=1}=s,c=hw(s,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,d=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(u)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=d-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],n=f,s=Math.floor(n/(a+e));f=s*(a+e),v=Math.ceil(t.length/s)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,n=v,s=m;v=Math.floor((m+i)/f)+1,m+=a+i,n!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=s+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(u){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=Mc.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=s.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(u?g:f,u?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:n=16,gradientStops:s}=e;if(!i||!s)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=s.map((t=>({offset:n*t.offset/o,color:t.color}))),h=s.map((t=>({offset:(o-n*t.offset)/o,color:t.color}))),c=Mc.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];at(ct(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),at(ct(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(rw.selected)?this._setLegendItemState(t,rw.selectedHover,e):this._setLegendItemState(t,rw.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===ow.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(aw.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(rw.unSelectedHover)||t.hasState(rw.selectedHover))&&(i=!0),t.removeState(rw.unSelectedHover),t.removeState(rw.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(rw.unSelectedHover)&&!t.hasState(rw.selectedHover)||(i=!0),t.removeState(rw.unSelectedHover),t.removeState(rw.selectedHover)}));const n=t.getChildren()[0].find((t=>t.name===ow.focus),!1);n&&n.setAttribute("visible",!1),i&&this._dispatchLegendEvent(aw.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(aw.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let n=!1;t.hasState(e)||(n=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==ow.focus&&(n||t.hasState(e)||(n=!0),t.addState(e,!0))})),n&&this._dispatchLegendEvent(aw.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let n=!1;e.forEach((e=>{!n&&t.hasState(e)&&(n=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==ow.focus&&e.forEach((e=>{!n&&t.hasState(e)&&(n=!0),t.removeState(e)}))})),n&&this._dispatchLegendEvent(aw.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(rw.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n,s={}){t.name=e,t.data=i,t.delegate=n,t.states=j({},cw,s)}_dispatchLegendEvent(t,e,i){const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(rw.selected),currentSelectedItems:n,currentSelected:s,event:i})}_handleStyle(t,e,i,n,s){const r={};return t.style&&(u(t.style)?r.style=t.style(e,i,n,s):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(u(t.state[a])?r.state[a]=t.state[a](e,i,n,s):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};uw.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:iw,spaceRow:nw,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:sw,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};const dw=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],n=[t.key,...e.map((t=>null==t?void 0:t.key))],s=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(d)?void 0:j({},...i),key:n.every(d)?void 0:j({},...n),value:s.every(d)?void 0:j({},...s)})},pw=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:G(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},gw={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:R_,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:R_,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:R_,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new he).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},fw=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];d_(),b_(),T_(),M_(),S_();let mw=class t extends Jg{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:n,panel:s,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const u=Ce(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},s),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:u[3],y:u[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",j({symbolType:"circle"},d.shape,{visible:U_(d)&&U_(d.shape)}),"symbol"),"object"!=typeof d.value.text||null===d.value.text||"rich"!==d.value.text.type&&"html"!==d.value.text.type?d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:U_(d)&&U_(d.value)},pw(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=d.value.text)&&void 0!==e?e:"",visible:U_(d)&&U_(d.value)},d.value),"text"):"rich"===d.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:U_(d)&&U_(d.value)},pw(d.value)),"richtext"):"html"===d.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:d.value.text.text},L_),d.value),visible:U_(d)&&U_(d.value),width:d.value.width,height:d.value.height,wordBreak:d.value.wordBreak,textAlign:d.value.textAlign,textBaseline:d.value.textBaseline,singleLine:!1,textConfig:[]},d.value),"richtext"));const g=U_(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:f,textBaseline:m}=d.value,v=s.width-u[3]-u[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",d.height):"middle"===m?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const y=U_(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),n&&n.length){this._tooltipContent.setAttribute("x",u[3]),this._tooltipContent.setAttribute("y",u[0]+y);let e=0;n.forEach(((i,n)=>{const s=t.getContentAttr(this.attribute,n);if(!U_(s))return;const l=`tooltip-content-${n}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),u=s.shape.size+s.shape.spacing;let d="right"===c?(o?u:0)+(U_(s.key)?r+s.key.spacing:0)+(U_(s.value)?a:0):0;this._createShape("right"===c?d-s.shape.size/2:d+s.shape.size/2,s,h,l),o&&("right"===c?d-=u:d+=u);const g=this._createKey(s,h,l);g&&(tb(c,g,s.key.textAlign,d,r),g.setAttribute("y",0),"right"===c?d-=r+s.key.spacing:d+=r+s.key.spacing);const f=this._createValue(s,h,l);if(f){let t="right";p(s.value.textAlign)?t=s.value.textAlign:U_(s.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),tb(c,f,t,d,a),f.setAttribute("y",0)}e+=s.height+s.spaceRow}))}}_createShape(t,e,i,n){var s;if(U_(e.shape))return i.createOrUpdateChild(`${n}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(s=Ba(e.key.lineHeight,e.key.fontSize))&&void 0!==s?s:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var n;if(U_(t.key)){let s;return s=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},pw(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(n=t.key.text)&&void 0!==n?n:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},pw(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},L_),t.key)},"richtext"),s}}_createValue(t,e,i){var n;if(U_(t.value)){let s;return s=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},pw(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(n=t.value.text)&&void 0!==n?n:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},pw(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),s}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>fw.includes(t)))?(this._mergeAttributes(e,n),d(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,u=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?u-=i+s:"middle"===l?u-=i/2:u+=s,c+e>h.x2&&(c-=e+n),u+i>h.y2&&(u-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&U_(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach((([e,i],a)=>{var c;const{key:u,value:d,shape:p,spaceRow:g}=i,f=U_(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=K_(u),y=K_(d);let _=0;if(U_(u)){const{width:t,height:e}=v.quickMeasure(u.text);l.push(t),_=Math.max(_,e)}if(U_(d)){const{width:t,height:e}=y.quickMeasure(d.text);h.push(t),_=Math.max(_,e)}f&&Io[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=u,e.valueWidth=d}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return dw({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return dw({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};function vw(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return A(n)&&(t+=n),t}),0)}function yw(t,e){const i=_w(t),n=_w(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 _w(t,e={x:0,y:0}){return Ft.distancePP(t,e)}function bw(t,e,i){let n=!1;if(e&&u(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}mw.defaultAttributes=gw;function xw(t){return function(e){let i;return i=_(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function Sw(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&Sw(t[i],e)}}var Aw,ww,kw;function Tw(t){var e,i;const{type:n}=t;return n===ww.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(Aw||(Aw={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(ww||(ww={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(kw||(kw={}));const Cw={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},Mw={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function Bw(t,e){var i;if(!t)return[];const n=Dw(t,e);if(!n||_(n))return null!==(i=n)&&void 0!==i?i:[];if(g(n)){const{dataScheme:i}=n;return i?Iw(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>Pw(i)?Ow(t,i,e):i)).filter(p)}))):i.map((i=>Pw(i)?Ow(t,i,e):i)).filter(p):[]}return[]}function Ew(t,e){var i,n;return Iw(t)?null!==(n=null===(i=t.find((t=>p(t.isAvailable)?u(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==n?n:t[t.length-1].scheme:t}function Ow(t,e,i){var n;const s=Dw(t,i);if(!s)return;let r;const{palette:a}=s;if(g(a)&&(r=null!==(n=function(t,e){const i=Cw[e];if(i&&t[i])return t[i];if(t[e])return t[e];const n=Mw[e];return n?t[n]:void 0}(a,e.key))&&void 0!==n?n:e.default),!r)return;if(d(e.a)&&d(e.l)||!y(r))return r;let o=new Ae(r);if(p(e.l)){const{r:t,g:i,b:n}=o.color,{h:s,s:r}=ge(t,i,n),a=pe(s,r,e.l),l=new Ae(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const Rw=(t,e)=>{if(e&&Pw(t)){const i=Ow(e,t);if(i)return i}return t};function Pw(t){return t&&"palette"===t.type&&!!t.key}function Iw(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function Lw(t){return _(t)?{dataScheme:t}:t}function Dw(t,e){var i,n;const{type:s}=null!=e?e:{};let r;if(!e||d(s))r=null==t?void 0:t.default;else{const a=Tw(e);r=null!==(n=null!==(i=null==t?void 0:t[`${s}_${a}`])&&void 0!==i?i:null==t?void 0:t[s])&&void 0!==n?n:null==t?void 0:t.default}return r}class Fw extends wS{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(!Iw(this._range))return void super.range(this._range);const t=Ew(this._range,this._domain);super.range(t)}}const jw={linear:$S,band:CS,point:class extends CS{constructor(t){super(!1),this.type=iS.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:wS,threshold:tA,colorOrdinal:Fw};function Nw(t){const e=jw[t];return e?new e:null}function Uw(t,e,i){if(!e)return t;const n=e.range(),s=i&&e._calculateWholeRange?e._calculateWholeRange(n):e.range(),r=Math.min(s[0],s[s.length-1]),a=Math.max(s[0],s[s.length-1]);return Math.min(Math.max(r,t),a)}function Hw(t,e,i){if(!e)return!0;const n=e.range(),s=(i&&e._calculateWholeRange?e._calculateWholeRange(n):e.range()).map((t=>e.invert(t))),r=Math.min(s[0],s[s.length-1]),a=Math.max(s[0],s[s.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function zw(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function Vw(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Ww(t){return!!y(t)&&(!!t.endsWith("%")&&Kg(t.substring(0,t.length-1)))}function Gw(t){return!!g(t)&&("percent"in t||"offset"in t)}function Yw(t,e,i,n=0){var s,r;return S(t)?t:Ww(t)?Number(t.substring(0,t.length-1))*e/100:u(t)?t(i):g(t)?e*(null!==(s=t.percent)&&void 0!==s?s:0)+(null!==(r=t.offset)&&void 0!==r?r:0):n}function Xw(t,e,i){var n,s,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(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]=Yw(t[n],e.size,i)}))})),o}function $w(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function Kw(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):S(t)||Ww(t)||u(t)||Gw(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function qw(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const Zw=(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},Jw=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function Qw(t,e){return t&&e.key in t?t[e.key]:e.default}function tk(t){return t&&"token"===t.type&&!!t.key}const ek={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},ik={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:Jw,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:ek,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},nk={name:"dark",colorScheme:{default:{dataScheme:Jw,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},sk=(t,e,i)=>{if(d(e))return t;const n=e[0];return d(n)?t:1===e.length?(t[n]=i,t):(d(t[n])&&("number"==typeof e[1]?t[n]=[]:t[n]={}),sk(t[n],e.slice(1),i))};function rk(t,...e){let i=-1;const n=e.length;for(;++i{const n=t[i];return e[i]=Lw(n),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}ak._charts={},ak._series={},ak._components={},ak._graphicComponents={},ak._marks={},ak._regions={},ak._animations={},ak._implements={},ak._chartPlugin={},ak._vChartPlugin={},ak._componentPlugin={},ak.transforms={fields:Ve,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}},ak.dataParser={csv:(t,e={},i)=>(i.type=ze.DSV,Ze(t)),dsv:(t,e={},i)=>{i.type=ze.DSV;const n=Ne(Qe,e),{delimiter:s}=n;if(!y(s))throw new TypeError("Invalid delimiter: must be a string!");return qe(s).parse(t)},tsv:(t,e={},i)=>(i.type=ze.DSV,Je(t))},ak._layout={},ak._grammarTransforms={},ak._stageEventPlugins={},ak.registerStageEventPlugin=(t,e)=>{ak._stageEventPlugins[t]=e},ak.getStageEventPlugin=t=>ak._stageEventPlugins[t],ak._interactionTriggers={},ak.registerInteractionTrigger=(t,e)=>{ak._interactionTriggers[t]=e},ak._composedEventMap={},ak.registerComposedEvent=(t,e)=>{ak._composedEventMap[t]=e},ak._tooltipProcessors={},ak.registerTooltipProcessor=(t,e)=>{ak._tooltipProcessors[t]=e},ak.createTooltipProcessor=(t,e)=>{const i=ak._tooltipProcessors[t];return i?new i(e):null};const hk=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e};hk();const ck={[ik.name]:ik},uk=ik.name,dk=new Map(Object.keys(ck).map((t=>[t,ck[t]]))),pk=new Map,gk=new Map(Object.keys(ck).map((t=>[t,t===uk]))),fk=(t,e)=>{if(!t)return;const i=_k(e);dk.set(t,i),gk.set(t,!0)},mk=(t=uk)=>(gk.has(t)&&!gk.get(t)&&fk(t,dk.get(t)),dk.get(t)),vk=t=>dk.delete(t)&&pk.delete(t)&&gk.delete(t),yk=t=>!!y(t)&&dk.has(t),_k=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:uk;return ok({},mk(i),t)};class bk{static registerInstance(t){bk.instances.set(t.id,t)}static unregisterInstance(t){bk.instances.delete(t.id)}static getInstance(t){return bk.instances.get(t)}static instanceExist(t){return bk.instances.has(t)}static forEach(t,e=[],i){const n=G(e);return bk.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}bk.instances=new Map;class xk{static registerTheme(t,e){fk(t,e)}static getTheme(t,e=!1){return mk(t)}static removeTheme(t){return vk(t)}static themeExist(t){return yk(t)}static getDefaultTheme(){return xk.themes.get(uk)}static setCurrentTheme(t){xk.themeExist(t)&&(xk._currentThemeName=t,bk.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return xk.getTheme(xk._currentThemeName,t)}static getCurrentThemeName(){return xk._currentThemeName}}function Sk(t){return y(t)?xk.themeExist(t)?xk.getTheme(t):{}:g(t)?t:{}}xk.themes=dk,xk._currentThemeName=uk;const Ak=["animationThreshold","colorScheme","name","padding"];function wk(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((s=>{const r=t[s];Ak.includes(s)?n[s]=r:m(r)?Pw(r)?n[s]=Rw(r,e):tk(r)?n[s]=Qw(i,r):n[s]=wk(r,e,i):n[s]=r})),n}function kk(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]=kk(t[n],e)}return i}return _(t)?t.map((t=>kk(t,e))):t}function Tk(t,e){if(!t)return t;if(m(t)){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(y(t[n])&&e.getFunction(t[n])){i[n]=e.getFunction(t[n]);continue}i[n]=Tk(t[n],e)}return i}return _(t)?t.map((t=>Tk(t,e))):t}function Ck(t,...e){return u(t)?t(...e):t}const Mk=(t,e,i,n)=>((t,e,i)=>K_(t,e,i,{fontFamily:ek.fontFamily,fontSize:ek.fontSize}))(e,i,n).measure(t),Bk="__VCHART",Ek=500,Ok=500,Rk=`${Bk}_MEASURE_CANVAS_ID`,Pk=`${Bk}_DEFAULT_DATA_INDEX`,Ik=`${Bk}_DEFAULT_DATA_KEY`,Lk=`${Bk}_DEFAULT_DATA_SERIES_FIELD`,Dk=`${Bk}_DEFAULT_SERIES_STYLE_NAME`,Fk=`${Bk}_STACK_KEY`,jk=`${Bk}_STACK_START`,Nk=`${Bk}_STACK_END`,Uk=`${Bk}_STACK_START_PERCENT`,Hk=`${Bk}_STACK_END_PERCENT`,zk=`${Bk}_STACK_START_OffsetSilhouette`,Vk=`${Bk}_STACK_END_OffsetSilhouette`,Wk=`${Bk}_STACK_TOTAL`,Gk=`${Bk}_STACK_TOTAL_PERCENT`,Yk=`${Bk}_STACK_TOTAL_TOP`,Xk=`${Bk}_STACK_TOTAL_BOTTOM`,$k=`${Bk}_MOSAIC_VALUE_START_PERCENT`,Kk=`${Bk}_MOSAIC_VALUE_END_PERCENT`,qk=`${Bk}_MOSAIC_CAT_START_PERCENT`,Zk=`${Bk}_MOSAIC_CAT_END_PERCENT`,Jk=`${Bk}_SEGMENT_START`,Qk=`${Bk}_SEGMENT_END`,tT=`${Bk}_KEY`,eT=`${Bk}_MAP_LOOK_UP_KEY`;function iT(t,e){for(let i=0;it.key===e))}function sT(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}function rT(t,e,i){const n=t.getStackSort(),s={};let r=null;return n&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var n;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(s[o]=null!==(n=s[o])&&void 0!==n?n:{groupField:a.groupField,nodes:{}},cT(t,a,s[o],l,e,r))})),n?aT(s):s}function aT(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):aT(t[e].nodes);return t}function oT(t,e){if("values"in t&&t.values.length){const i=vw(t.values,e),n=function(t,e){const i=[];return t.forEach((t=>{const n=+t[e];A(n)&&i.push(n)})),0===i.length?null:X(i)}(t.values,Hk);t.values.forEach((t=>{t[Wk]=i,t[Gk]=n}))}else for(const i in t.nodes)oT(t.nodes[i],e)}function lT(t){if(!t.values.length)return;const e=t.values[t.values.length-1][Nk]/2;for(let i=0;i0){let n=0,o=0,l=1,h=0,c=null,u=null;const d=t.values.length;for(let i=0;i=0?(l[s.start]=n,n+=l[s.end],l[s.end]=n):(l[s.start]=o,o+=l[s.end],l[s.end]=o),l[s.key]=t.key,a&&(delete l[s.max],(!u||l[s.end]>u[s.end])&&(u=l)),r&&(delete l[s.min],(!c||l[s.start]=0?n:o;l=h>=0?1:-1,r[s.startPercent]=0===a?0:Math.min(1,r[s.start]/a)*l,r[s.endPercent]=0===a?0:Math.min(1,r[s.end]/a)*l}}for(const r in t.nodes)hT(t.nodes[r],e,i,n,s)}function cT(t,e,i,n,s,r,a){var o;if("values"in e)if(s&&e.values.forEach((t=>t[Nk]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[n]))),i.series.push({s:t,values:e.values}),r){const n=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:n?r[n].sort[e[n]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),cT(t,e.nodes[l],i.nodes[l],n,s,r,h)}}function uT(t={}){const e=Object.assign({},t);if(u(t.style)?e.style=(e,i,n,s)=>pT(t.style(e,i,n,s)):E(t.style)||(e.style=pT(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{u(t.state[e])?i[e]=(i,n,s,r)=>pT(t.state[e](i,n,s,r)):E(t.state[e])||(i[e]=pT(t.state[e]))})),e.state=i}return e}function dT(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,n,s,r)=>pT(t[i](e,n,s,r)):E(t[i])||(e[i]=pT(t[i]))})),e}function pT(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:jt(t.angle)}):t}const gT=t=>"line"===t||"area"===t,fT=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return gT(i)?e:null==e?void 0:e[0]},mT=(t,e)=>{const i=t.getAttributes(!0),n={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(n[t]=e[t])})),n};let vT=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},s=ak.getComposedEvent(t);if(s){const e=new s(this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(n.callback,{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(ak.getComposedEvent(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}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var yT;!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"}(yT||(yT={}));const _T=["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 bT,xT,ST;t.ChartEvent=void 0,(bT=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",bT.rendered="rendered",bT.renderFinished="renderFinished",bT.animationFinished="animationFinished",bT.regionSeriesDataFilterOver="regionSeriesDataFilterOver",bT.afterInitData="afterInitData",bT.afterInitEvent="afterInitEvent",bT.afterInitMark="afterInitMark",bT.rawDataUpdate="rawDataUpdate",bT.viewDataFilterOver="viewDataFilterOver",bT.viewDataUpdate="viewDataUpdate",bT.viewDataStatisticsUpdate="viewDataStatisticsUpdate",bT.markDeltaYUpdate="markDeltaYUpdate",bT.viewDataLabelUpdate="viewDataLabelUpdate",bT.scaleDomainUpdate="scaleDomainUpdate",bT.scaleRawDomainUpdate="scaleRawDomainUpdate",bT.scaleUpdate="scaleUpdate",bT.dataZoomChange="dataZoomChange",bT.drill="drill",bT.layoutStart="layoutStart",bT.layoutEnd="layoutEnd",bT.layoutRectUpdate="layoutRectUpdate",bT.playerPlay="playerPlay",bT.playerPause="playerPause",bT.playerEnd="playerEnd",bT.playerChange="playerChange",bT.playerForward="playerForward",bT.playerBackward="playerBackward",bT.scrollBarChange="scrollBarChange",bT.brushStart="brushStart",bT.brushChange="brushChange",bT.brushEnd="brushEnd",bT.brushClear="brushClear",bT.brushActive="brushActive",bT.legendSelectedDataChange="legendSelectedDataChange",bT.legendFilter="legendFilter",bT.legendItemClick="legendItemClick",bT.legendItemHover="legendItemHover",bT.legendItemUnHover="legendItemUnHover",bT.tooltipShow="tooltipShow",bT.tooltipHide="tooltipHide",bT.tooltipRelease="tooltipRelease",bT.afterResize="afterResize",bT.afterRender="afterRender",bT.afterLayout="afterLayout",bT.afterMarkLayoutEnd="afterMarkLayoutEnd",bT.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(xT||(xT={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(ST||(ST={}));const AT=[ST.mark,ST.model,ST.chart,ST.vchart];class wT{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(ST.vchart,[]),this._levelNodes.set(ST.chart,[]),this._levelNodes.set(ST.model,[]),this._levelNodes.set(ST.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}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const kT={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class TT{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),n=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,s=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=O(t.event,"target");let a=t.datum;n&&"component"===n.modelType&&(a=null!==(e=n.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:n,mark:null!=s?s:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let n=null;i.graphics&&(n=i.graphics);const s={event:t.event,chart:e,graphics:n,datums:n&&n.map((t=>fT(t)))};this.dispatch(t.type,s)},this.globalInstance=t,this._compiler=e}register(t,e){var i,n,s,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||xT.chart),l=this.getEventListeners((null===(n=e.filter)||void 0===n?void 0:n.source)||xT.chart);o.get(t)||o.set(t,new wT);if(o.get(t).addHandler(e,null===(s=e.filter)||void 0===s?void 0:s.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,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)||xT.chart),l=this.getEventListeners((null===(n=null==e?void 0:e.filter)||void 0===n?void 0:n.source)||xT.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)||xT.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||xT.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{let i=0;for(;!s&&i{const n=this.getEventBubble(i).get(t);n&&n.getAllHandlers().forEach((t=>{e?AT.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[xT.chart,xT.window,xT.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var n,s,r;if(u(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&O(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 kT[a]&&(a=kT[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const n=t.map((t=>{var n,s,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(n=t.query)||void 0===n?void 0:n.consume;return a&&(null===(s=i.event)||void 0===s||s.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?ST.model:ST.vchart:ST.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=ft(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=gt(t.callback,i.debounce));let n=this._getQueryLevel(i),s=null,r=xT.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!==ST.model&&n!==ST.mark||(s=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,n=ST.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 xT.chart:return this._viewBubbles;case xT.window:return this._windowBubbles;case xT.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case xT.chart:return this._viewListeners;case xT.window:return this._windowListeners;case xT.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return _T.includes(t)||Object.values(yT).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&ak.hasInteractionTrigger(e)}}function CT(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function MT(t,e,i){t.getParser(e)||t.registerParser(e,i)}const BT=new Map;function ET(t,e=!1){let i=e;return t.latestData instanceof si&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const OT=(t,e)=>0===t.length?[]:1===t.length?ET(t[0],null==e?void 0:e.deep):t.map((t=>ET(t,null==e?void 0:e.deep)));function RT(e,i,n){CT(i=i instanceof ni?i:e.dataSet,"copyDataView",OT);const s=new si(i,n);return s.parse([e],{type:"dataview"}),s.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),s}function PT(t,e,i=[]){var n;if(t instanceof si)return t;const{id:s,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let u;h.clone=!(!1===h.clone);const d=i.find((t=>t.name===s));if(d)u=d;else{const t={name:s};if(c&&(t.fields=c),u=new si(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Ng(`no data matches fromDataId ${o}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Ng(`no data matches fromDataIndex ${a}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else Array.isArray(r)?u.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(u.parse([]),Ng("values should be array")):u.parse(r,null!==(n=h)&&void 0!==n?n:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&u.transform(t)}))}return u}function IT(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var LT,DT,FT,jT;t.TransformLevel=void 0,(LT=t.TransformLevel||(t.TransformLevel={}))[LT.copyDataView=-10]="copyDataView",LT[LT.treemapFilter=-8]="treemapFilter",LT[LT.treemapFlatten=-7]="treemapFlatten",LT[LT.dotObjFlat=-7]="dotObjFlat",LT[LT.linkDotInfo=-7]="linkDotInfo",LT[LT.sankeyLayout=-7]="sankeyLayout",LT[LT.dataZoomFilter=-6]="dataZoomFilter",LT[LT.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(DT||(DT={})),function(t){t.data="data",t.mark="mark"}(FT||(FT={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(jT||(jT={}));const NT=["line","area","trail"];function UT(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(tT,i?t.slice().sort(i):t.slice()),{keys:[tT],data:n};if(1===t.length){const i=e(t[0],0);return n.set(i,[t[0]]),{keys:[i],data:n}}const s=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=n.get(a))&&void 0!==r?r:[];o.push(t),n.set(a,o),s.add(a)})),i&&s.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(s),data:n}}const HT=(t,e,i={})=>(t&&Object.keys(t).forEach((n=>{i[n]=t[n](e)})),i);function zT(t,e,i,n,s){const r=t=>{if(!n&&t&&(!i||i(t))){const i=e.call(null,t);if(s&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{zT(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function WT(t,e,i,n){const s=UT(t,(t=>i(t))),r=UT(e,(t=>n(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){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}}const GT=`${Bk}_BuiltIn_CallBack_Disappear`;var YT;!function(t){t.render="render",t.disappear="disappear"}(YT||(YT={}));class XT{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,n,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterVRenderDraw)||void 0===s||s.call(n,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,n,s;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:u,autoPreventDefault:d,background:f}=this._option;Op.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new Gp(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(n=this._container.canvas)&&void 0!==n?n:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,n;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(n=(i=this._option).beforeRender)||void 0===n||n.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:u,autoPreventDefault:d},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(s=this._option.renderHooks)&&void 0!==s?s:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=nh({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:Gg(o))&&!1!==c&&ak.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=jT.before}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(Op.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=Op.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>zT(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>zT(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,n,s,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{zT(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.beforeVRenderDraw)||void 0===s||s.call(n,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(jg(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===jT.before&&(this._layoutState=jT.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=jT.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),jg(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:n=!1,animation:s={},enableExitAnimation:r=!1}=t,a=VT(this._rootMarks),{update:o,exit:l}=function(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):n.enter.push({next:[t]})}));const a=WT(s,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=WT(s,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=UT(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=UT(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}(this._cachedMarks,a,{morph:i,morphAll:n,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const n=t[i];_(n)?e[i]="disappear"===i?n.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:GT,customParameters:{callBack:t.callBack}});var e})):n.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{zT(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===DT.appear))?DT.appear:e.every((t=>t===DT.disappear))?DT.disappear:DT.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const n=this._width!==t||this._height!==e;this._width=t,this._height=e,n&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var n,s;if(!1!==this._option.interactive)if(t===xT.chart){const s=this.getRootGroup(),r=function(n){var r;const a=n.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(s,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,u=p(l.modelUserId)?l.modelUserId:null,d=p(l.markUserId)?l.markUserId:null,g={event:n,type:e,source:t,item:o,datum:fT(o),markId:h,modelId:c,markUserId:d,modelUserId:u};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(n=this._stage)||void 0===n||n.addEventListener(e,r)}else if(t===xT.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)}else if(t===xT.canvas){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._canvasListeners.set(i,{type:e,callback:n});const r=null===(s=this.getStage())||void 0===s?void 0:s.window;null==r||r.addEventListener(e,n)}}removeEventListener(t,e,i){var n,s,r,a,o;if(!1!==this._option.interactive)if(t===xT.chart){const t=null===(n=this._viewListeners.get(i))||void 0===n?void 0:n.callback;t&&(null===(s=this._stage)||void 0===s||s.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===xT.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)}else if(t===xT.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,n=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&n&&(null==t||t.removeEventListener(e,n)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{zT(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=VT(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Wg(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return Yo(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Gi.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{zT(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=Op.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){Op.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function $T(t,e){var n;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(n=null==e?void 0:e.onError)&&void 0!==n?n:Ug)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function KT(t){t.crosshair=G(t.crosshair||{}).map((e=>rk({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function qT(t,e,i){var n;const{width:s,height:r}=t;if(p(s)&&p(r))return{width:s,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=Me(l,i.width,i.height);a=t,o=e}else if(h&&Wg(e.mode)){let t;t=y(h)?Op.getElementById(h):h;const{width:e,height:n}=Me(t,i.width,i.height);a=e,o=n}else if(Yg(e.mode)&&(null===(n=e.modeParams)||void 0===n?void 0:n.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=s?s:a,o=null!=r?r:o,{width:a,height:o}}function ZT(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function JT(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var QT,tC,eC,iC,nC,sC;t.LayoutZIndex=void 0,(QT=t.LayoutZIndex||(t.LayoutZIndex={}))[QT.SeriesGroup=0]="SeriesGroup",QT[QT.Axis_Grid=50]="Axis_Grid",QT[QT.CrossHair_Grid=100]="CrossHair_Grid",QT[QT.Region=450]="Region",QT[QT.Mark=300]="Mark",QT[QT.Node=400]="Node",QT[QT.Axis=100]="Axis",QT[QT.MarkLine=500]="MarkLine",QT[QT.MarkArea=100]="MarkArea",QT[QT.MarkPoint=500]="MarkPoint",QT[QT.DataZoom=500]="DataZoom",QT[QT.ScrollBar=500]="ScrollBar",QT[QT.Player=500]="Player",QT[QT.Legend=500]="Legend",QT[QT.CrossHair=500]="CrossHair",QT[QT.Indicator=500]="Indicator",QT[QT.Title=500]="Title",QT[QT.Label=500]="Label",QT[QT.Brush=500]="Brush",QT[QT.CustomMark=500]="CustomMark",QT[QT.Interaction=700]="Interaction",t.LayoutLevel=void 0,(tC=t.LayoutLevel||(t.LayoutLevel={}))[tC.Indicator=10]="Indicator",tC[tC.Region=20]="Region",tC[tC.Axis=30]="Axis",tC[tC.DataZoom=40]="DataZoom",tC[tC.Player=40]="Player",tC[tC.ScrollBar=40]="ScrollBar",tC[tC.Legend=50]="Legend",tC[tC.Title=70]="Title",tC[tC.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(eC=t.AttributeLevel||(t.AttributeLevel={}))[eC.Default=0]="Default",eC[eC.Theme=1]="Theme",eC[eC.Chart=2]="Chart",eC[eC.Base_Series=3]="Base_Series",eC[eC.Series=4]="Series",eC[eC.Mark=5]="Mark",eC[eC.User_Chart=6]="User_Chart",eC[eC.User_Series=7]="User_Series",eC[eC.User_Mark=8]="User_Mark",eC[eC.User_SeriesStyle=9]="User_SeriesStyle",eC[eC.Built_In=99]="Built_In";class rC{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,j({},rC.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=G(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}rC.defaultMarkInfo={};class aC{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class oC{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const n=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(n.spec,e,i),n}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const n=this._getDefaultSpecFromChart(e),s=t=>rk({},i,n,t);return _(t)?{spec:t.map((t=>s(t))),theme:i}:{spec:s(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class lC extends aC{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=oC,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new rC,this._lastLayoutRect=null,this.id=$g(),this.userId=t.id,this._spec=t,this.effect={},this.event=new vT(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,n){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:n}=e,s=Object.assign({},e);i&&(s.style=this._convertMarkStyle(i)),n&&(s.state={},Object.keys(n).forEach((t=>{s.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(s)}stateKeyToSignalName(t,e){let i=`${Bk}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},n){const{type:s,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=ak.createMark(s,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),n&&l.setMarkConfig(n)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!d(e))return O(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class hC{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var n;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(n=null==e?void 0:e.getSpec)||void 0===n?void 0:n.call(e)}_setLayoutAttributeFromSpec(t,e){var i,n,s,r;if(this._spec&&!1!==this._spec.visible){let a=Xw(Kw(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:Yw(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(n=this._maxHeight)&&void 0!==n?n:null:Yw(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(s=this._minWidth)&&void 0!==s?s:null:Yw(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:Yw(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:Yw(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:Yw(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=Yw(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=Yw(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,n,s,r;this._spec=t,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}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=Yw(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};d(n)||(r.width-=n),d(s)||(r.width-=s),d(e)||(r.height-=e),d(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(d(n)?d(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,d(e)?d(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var n,s,r,a;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),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec($w(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class cC extends lC{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new hC(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=j(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=j(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,n,s;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(n=this._spec.orient)&&void 0!==n?n:this._orient,this.layoutLevel=null!==(s=this._spec.layoutLevel)&&void 0!==s?s:this.layoutLevel}}class uC extends oC{_initTheme(t,e){return{spec:t,theme:this._theme}}}class dC extends cC{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var n;super(e,i),this.transformerConstructor=uC,this.modelType="region",this.specKey="region",this.type=dC.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(n=e.coordinate)&&void 0!==n?n:"cartesian"}_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"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),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"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const n=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),n&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,n){var s,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:n});const o=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return z(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,n;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||G(t.userId).includes(e.userId))&&(!p(t.specIndex)||G(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(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})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function pC(t){const e=[],i=[],n=[];return t.forEach((t=>{d(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&n.push(t)})),{startItems:e,endItems:n,middleItems:i}}function gC(t,e,i){e?t.forEach((t=>{const e=Y(t),n=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,s=(i-n)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+s})}))})):t.forEach((t=>{const e=Y(t),n=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,s=(i-n)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+s,y:t.getLayoutStartPoint().y})}))}))}function fC(t,e,i,n){let s;t.forEach(((t,r)=>{t.length>1&&(s=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?s-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):s-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+n*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+n*a*r})})))}))}function mC(t,e,i,n,s,r){if(t.length){let a=0;const o="right"===s,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const u=[];let d=[];const p=[];t.forEach((t=>{const{rect:n}=bC(t,e,r),s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=s,c>i&&d.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+s,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),u.push(d),d=[t]):(a=Math.max(a,g),d.push(t))})),p.push(a),u.push(d),fC(u,!0,p,l),n&&gC(u,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function vC(t,e,i,n,s){if(t.length){let i=0;const r="right"===n,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{rect:n}=bC(t,e,s),d=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:n}=bC(t,e,r),s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&d.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=s,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),u.push(d),d=[t]):(l=Math.max(l,s),d.push(t))})),p.push(l),u.push(d),fC(u,!1,p,o),n&&gC(u,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function _C(t,e,i,n,s){if(t.length){const i="top"===n,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{layoutTag:n,layoutRect:u,rect:d}=bC(t,e,s),p=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-d.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),n=t.filter((t=>"region-relative-overlap"===t.layoutType)),s=i.concat(n),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return n.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:n,allRelatives:s,overlapItems:r}}layoutItems(t,e,i,n){var s,r,a;this._layoutInit(t,e,i,n);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(s=null==t?void 0:t.getSpec())||void 0===s?void 0:s.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:u,relativeOverlapItems:d,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,u,d,g,o,l),this._processAutoIndent(c,u,d,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},s,r,a,o=!1){if(s.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:u}=this._checkAutoIndent(s,r);(l||h||c||u)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-u,this.layoutRegionItems(t,e,i,n,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=bC(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),n=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=pC(t);s.length&&mC(s,e,i,!1,"left",n),r.length&&mC(r,e,i,!0,"left",n),a.length&&vC(a,e,0,"left",n)}(i,this,o,e),s.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=pC(t);s.length&&yC(s,e,i,!1,"top",n),r.length&&yC(r,e,i,!0,"top",n),a.length&&_C(a,e,0,"top",n)}(s,this,a,e),n.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=pC(t);s.length&&mC(s,e,i,!1,"right",n),r.length&&mC(r,e,i,!0,"right",n),a.length&&vC(a,e,0,"right",n)}(n,this,o,e),r.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=pC(t);s.length&&yC(s,e,i,!1,"bottom",n),r.length&&yC(r,e,i,!0,"bottom",n),a.length&&_C(a,e,0,"bottom",n)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:n}=bC(t,this,i);e.rect.width=Math.max(n.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(n.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{z(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=bC(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const n=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),s=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=n-t.layoutPaddingLeft-t.layoutPaddingRight,i=s-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:s,regionWidth:n}}layoutRegionItems(t,e,i,n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},s,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,s)})),this._layoutRelativeOverlap("left",n.left,s),this._layoutRelativeOverlap("right",n.right,s),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,s)})),this._layoutRelativeOverlap("top",n.top,s),this._layoutRelativeOverlap("bottom",n.bottom,s),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,s)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:u}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+u-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const n=t.find((t=>t.getModelId()===e));return n||(null!==(i=this._onError)&&void 0!==i?i:Ug)("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,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const n="left"===t.layoutOrient||"right"===t.layoutOrient,s=t.getLastComputeOutBounds(),r=this._getOutInLayout(s,t,e);n?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:n,y:s}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(n-t.x1),right:n+r+t.x2-i.right,top:i.top-(s-t.y1),bottom:s+a+t.y2-i.bottom}}}xC.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(iC||(iC={})),t.STATE_VALUE_ENUM=void 0,(nC=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",nC.STATE_HOVER="hover",nC.STATE_HOVER_REVERSE="hover_reverse",nC.STATE_DIMENSION_HOVER="dimension_hover",nC.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",nC.STATE_SELECTED="selected",nC.STATE_SELECTED_REVERSE="selected_reverse",nC.STATE_SANKEY_EMPHASIS="selected",nC.STATE_SANKEY_EMPHASIS_REVERSE="blur",nC.STATE_HIGHLIGHT="highlight",nC.STATE_BLUR="blur",nC.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(sC||(sC={}));const SC=["linear","radial","conical"],AC={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const wC={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{wC[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class kC extends aC{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class TC extends kC{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];p(n.domain)&&(s.domain=n.domain),p(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:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,NT.includes(t));var t}checkOneState(t,e,i){var n;let s=!1,r=!1;if(p(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e),r=!0;else if(i.items)s=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:this._mark.type};s=i.filter(null==e?void 0:e[0],n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){var i;const n=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!wC[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const n=e[0];if(_(t.datums)){const e=this._isMultiMark(),s=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Bk)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?s.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):s.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(Bk))),s=this._isMultiMark();i=e.every((e=>{var i,r;return s?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var n;let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(n=e[0])||void 0===n?void 0:n[r];if(sS(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n){var s;const r=this._isMultiMark()?null===(s=i[0])||void 0===s?void 0:s[e]:i[e];return rt[t.length-1]}release(){}}class CC extends aC{constructor(){super(...arguments),this.id=$g(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=ak.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class MC extends CC{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const BC=(t,e,i,n)=>"function"==typeof t?t(e,i,n):t,EC=(t,e,i,n,s)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=BC(l.delay,s,a,o),u=BC(l.duration,s,a,o),d=BC(l.oneByOne,s,a,o),p=BC(l.splitPath,s,a,o),g=A(d)&&d>0?t=>S(d)?t*d:!0===d?t*u:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var 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)?gx:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:fx)(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);cx(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:u,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)?gx:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:fx)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>ax(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>lx(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:_n.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const u=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),d=e.animate(Object.assign({},i,{onEnd:r}));d.wait(u),d.play(new hx({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:ex,null!==(l=i.easing)&&void 0!==l?l:ix))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:_n.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new ux({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:ex,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:ix))}})(t,e[0],{delay:c,duration:u,easing:h,onEnd:n,individualDelay:g,splitPath:p}):cx(t[0],e[0],{delay:c,duration:u,easing:h,onEnd:n})},OC=(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))))},RC=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,n;const s=null===(n=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===n?void 0:n[0];s&&(t.context.morphKey=s[e.morphElementKey])}))}};class PC extends CC{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const n=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var s,r;const a="function"==typeof n?n(t,e,i):n;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(s=e.context.compiler.getChart())||void 0===s?void 0:s.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},n={};Object.keys(t).forEach((e=>{const s=t[e];_(s)?n[e]=s.map(i):p(s)&&(n[e]=i(s))})),this._animationConfig=n}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new MC(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=nh("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var n;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new ps)),i&&(u(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==iC.enter&&t.context.diffState!==iC.update||(t.stateProxy=(e,i)=>{var n;return this._runEncoderOfGraphic(null===(n=this._encoderOfState)||void 0===n?void 0:n[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=e,this.model=i.model,this.key=i.key,this.state=new TC(i,this),this._attributeContext=i.attributeContext,null===(n=i.map)||void 0===n||n.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,n=i.range();return i.range(n.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,jt)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((s=>{let r=t[s];d(r)||(r=this._filterAttribute(s,r,e,i,n),this.setAttribute(s,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,n,s){let r=this._styleConvert(e);if(s)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var n;if(t)if(e&&i){const s=null!==(n=this.stateStyle[i])&&void 0!==n?n:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},s[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const n={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(n[i]=this._computeAttribute(i,e)(t))})),n}}setAttribute(t,e,i="normal",n=0){var s;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:n,style:e,referer:void 0});const r=null===(s=this.stateStyle[i][t])||void 0===s?void 0:s.level;p(r)&&r<=n&&rk(this.stateStyle[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(rS(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return y(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=Nw(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let n=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];n||(n=this.stateStyle.normal[t]);const s=this._computeStateAttribute(n,t,e),r=u(null==n?void 0:n.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=s(r);return a=n.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>n.postProcess(s(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return n=>i(t,n,e,s(n))}return s}_computeStateAttribute(t,e,i){var n;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):SC.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):rS(null===(n=t.style.scale)||void 0===n?void 0:n.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const n=i[e];if("style"in n){const i=n.style;let s={stateValue:e};"level"in n&&(s.level=n.level),"filter"in n&&(s=u(n.filter)?Object.assign({filter:n.filter},s):Object.assign(Object.assign({},n.filter),s)),this.state.addStateInfo(s),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(n,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,n,s,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let d=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(d=t),g||(g=e)}const f=Ew(Bw(this.model.getColorScheme(),"series"===this.model.modelType?null===(n=(i=this.model).getSpec)||void 0===n?void 0:n.call(i):void 0),null!==(a=null===(r=null===(s=this.model)||void 0===s?void 0:s.getDefaultColorDomain)||void 0===r?void 0:r.call(s))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},AC[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((n=>{const s=m[n];"stops"===n?e.stops=s.map((e=>{const{opacity:n,color:s,offset:r}=e;let a=null!=s?s:null==d?void 0:d.scale(t[g]);return u(s)&&(a=s(t,this._attributeContext,i)),p(n)&&(a=Ae.SetOpacity(a,n)),{offset:u(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):u(s)?e[n]=s(t,this._attributeContext,i):e[n]=s})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:n}=t,s=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(s).forEach((e=>{const i=s[e];u(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)SC.includes(null===(a=s.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(s.stroke)(t));else{const s=Ew(Bw(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=n;if(!(i&&n||"series"!==this.model.modelType)){const{scale:e,field:n}=this.model.getColorAttribute();i||(a=e),l||(l=n),o.stroke=(null==a?void 0:a.scale(t[l]))||s[0]}}return o}}_getDataByKey(t){return UT(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return ak.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=u(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[Ik],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=UT(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===DT.appear))?DT.appear:t.every((t=>t===DT.disappear))?DT.disappear:t[0];return null!=e?e:DT.none}createAnimationStateList(t,e){var i;let n=e[t];return n&&Array.isArray(n)&&(n=1===n.length?n[0]:n),Array.isArray(n)?n.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):n?Object.assign(Object.assign({},n),{priority:"normal"===t?null!==(i=n.priority)&&void 0!==i?i:1/0:n.priority}):n}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const n=[],s=[];t.forEach((t=>{RC(t),n.push(...t.getGraphics())})),e.forEach((t=>{RC(t),s.push(...t.getGraphics())}));const r=t=>{var e,i,n;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(n=t.context)||void 0===n?void 0:n.key},a=new Map,o=new Map;if(n.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),s.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const u=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);EC([],e,i,u,{}),c+=1})),l.forEach((t=>{const e=a.get(t),n=o.get(t),s=Math.min(e.length,n.length);if(s>0){const t=OC(e,s),r=OC(n,s);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",n);if(s&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(n.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",n)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=n[e];if(i&&i.length>0){const n=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));n.forEach((e=>{e.animation.customParameters=t.context}));const s=[e];t.applyAnimationState(s,[1===n.length?n[0]:n])}"enter"===e&&n.normal&&(a=!0)})),a&&this._product&&(null===(i=n.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",n)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,n;const s=("component"===this.type?this.model.getAnimationStateCallback():null===(n=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===DT.exit?DT.exit:i===DT.update?DT.update:DT.appear}),r=s(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===iC.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,n=[],s=new Set(this._graphics.filter((t=>t.context.diffState===iC.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=iC.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=iC.enter,f.isExiting=!1,this._graphicMap.set(t,f),n.push(f)):(f=this._graphicMap.get(t),f&&(m=iC.update,n.push(f))),f&&(s.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=DT.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=DT.disappear}));s.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=n.length;n.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=n,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return HT(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=HT(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((n=>{this._unCompileChannel[n]||(this._option.noSeparateStyle||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||(!!u(s)||!(!(null==s?void 0:s.scale)||s.field===i))}(n,t,this._groupKey)?e[n]=t[n]:i[n]=t[n])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const n=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,s;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(s=t.currentStates)||void 0===s||s.forEach((e=>{var i;const n=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),n)})),d(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==n?void 0:n[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,n)=>{var s,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=mT(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(s=i.setFinalAttributes)||void 0===s||s.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?n:n+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:n}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,n)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:n,overflow:s}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(n)){const e=_(n)?n:n(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(s)||(t.overflow=s),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=ak.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const n=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=ak.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(n,t)}renderInner(){var t,e,i;this._updateEncoderByState();const n=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],s=this._runBeforeTransform(n);let r;if(null==s?void 0:s.progressive){this.renderContext={beforeTransformProgressive:s.progressive};const t=s.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(s),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===jT.before||(this._product||this._initProduct(),jg(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===iC.exit&&!e.isExiting)if(e.context.animationState===iC.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const n=this.getAnimationConfig();if(n.exit&&n.exit.length){const s=n.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===s.length?s[0]:s],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((n=>{const s=this.renderContext.progressive.groupedData.get(n),r=this.renderContext.progressive.step,a=s.slice(t*r,(t+1)*r),o=[];a.forEach(((i,s)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:iC.enter,data:[i],uniqueKey:`${n}_${null!=a?a:t*r+s}`,key:a,groupKey:n})};o.push(l),e.push(l)})),i[n]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=nh({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,n;if(this._attrsByGroup&&t){const s=t.parent;s&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&s.setTheme({common:this._attrsByGroup[null===(n=t.context)||void 0===n?void 0:n.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{t.clearStates()}))}}var IC;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(IC||(IC={}));class LC extends PC{constructor(){super(...arguments),this.type=LC.type,this._marks=[],this._diffState=iC.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Ng("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?(Ng("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return zT(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===iC.update){const t=this.hasAnimation(),e=mT(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=iC.update}render(){this._isCommited&&(jg(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}LC.type="group";const DC={measureText:Mk};class FC{static instance(){return FC.instance_||(FC.instance_=new FC),FC.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class jC{constructor(){this.id=$g(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Ng("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class NC extends jC{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((n=>{n.onAfterModelSpecTransform&&n.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const UC={type:"fadeIn"};function HC(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return UC;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const zC={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},VC={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},WC=()=>{ak.registerAnimation("scaleInOut",(()=>VC))},GC=(t,e)=>({appear:HC(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:mx,duration:zC.update.duration,easing:zC.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),YC=()=>{ak.registerAnimation("line",GC)},XC=()=>{Kb.registerBuiltInAnimate("growPointsIn",Px),Kb.registerBuiltInAnimate("growPointsOut",Ix),Kb.registerBuiltInAnimate("growPointsXIn",Dx),Kb.registerBuiltInAnimate("growPointsXOut",Fx),Kb.registerBuiltInAnimate("growPointsYIn",Nx),Kb.registerBuiltInAnimate("growPointsYOut",Ux),Kb.registerBuiltInAnimate("clipIn",_x),Kb.registerBuiltInAnimate("clipOut",bx)},$C=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class KC{constructor(t){this._markSet=new rC,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const n=t.stateStyle;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const n=this.getMarkIdByState();return n&&n[e]&&n[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const qC={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class ZC extends KC{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:n}=this.options;this._lastGraphic&&(n.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,n.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const n=t.item,s=n&&this._markSet.getMarkInId(n.context.markId);(this._resetType.includes("view")&&!s||this._resetType.includes("self")&&s)&&this.resetAll(t)},this.options=Object.assign({},qC,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:n,interaction:s}=this.options;if(this._lastGraphic===t)return;const r=s.updateStates(this,[t],s.getStatedGraphics(this),i,n);s.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}ZC.type="element-highlight",ZC.defaultOptions=qC;const JC=()=>{ak.registerInteractionTrigger(ZC.type,ZC)},QC={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class tM extends KC{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:n}=this.options,s=n.getStatedGraphics(this);s&&s.length&&(n.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:s,options:this.options},t)),n.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const n=t.item,s=n&&this._markSet.getMarkInId(n.context.markId);(this._resetType.includes("view")&&!s||this._resetType.includes("self")&&s)&&this.resetAll(t)},this.options=Object.assign({},QC,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:n,resetType:s}=(t=>{const e=G(t),i=[],n=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(n.push(t.replace("view:","")),i.push("view")):(n.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:n,resetType:i}})(t);return n.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=s,i}start(t,e){const{state:i,reverseState:n,isMultiple:s,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const s=a&&a.filter((e=>e!==t));s&&s.length?r.setStatedGraphics(this,r.updateStates(this,s,a,i,n)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,s&&a?[...a,t]:[t],a,i,n);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}tM.type="element-select",tM.defaultOptions=QC;const eM=()=>{ak.registerInteractionTrigger(tM.type,tM)};class iM extends jC{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class nM{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>ak.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>ak.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>ak.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return ak.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>ak.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){ak.registerTransform(t,e)}static registerFunction(t,e){t&&e&&FC.instance().registerFunction(t,e)}static unregisterFunction(t){t&&FC.instance().unregisterFunction(t)}static getFunction(t){return t?FC.instance().getFunction(t):null}static getFunctionList(){return FC.instance().getFunctionNameList()}static registerMap(t,e,i){const n=ak.getImplementInKey("registerMap");n&&n(t,e,i)}static unregisterMap(t){const e=ak.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,BT.get(e);var e}static registerSVG(t,e,i){const n=ak.getImplementInKey("registerSVG");n&&n(t,e,i)}static unregisterSVG(t){const e=ak.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){bk.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return it.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,n){var s,r,a,o,l,h,c,u,d;this.id=$g(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=YT.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var n;this._reSetRenderState();const s=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;z(s.theme,this._spec.theme)?z(this._spec.background,s.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(s);if(r.reSize=a,this._spec.type!==s.type)return null===(n=this._compiler)||void 0===n||n.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=ZT(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,n)=>{if(1!==n||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const n="series"===t[0]?ak.getSeriesBuiltInTheme(e):ak.getComponentBuiltInTheme(e);i=i?rk({},n,i[e]):n}n===t.length-1&&p(i)&&(i=wk({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},Sw(n),this._option=Object.assign(Object.assign({},this._option),n),(null==n?void 0:n.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),n.optimize)),this._onError=null===(s=this._option)||void 0===s?void 0:s.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Wg(v);if(S?im(Vi):"node"===v&&Nv(Vi),S&&f&&(this._container=y(f)?Op.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=xk.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const w=new it(null!==(a=this._option.logLevel)&&void 0!==a?a:et.Error);it.setInstance(w),(null===(o=this._option)||void 0===o?void 0:o.onError)&&w.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new XT({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new TT(this,this._compiler),this._event=new vT(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),bk.registerInstance(this),null===(d=null===(u=this._option.performanceHook)||void 0===u?void 0:u.afterCreateVChart)||void 0===d||d.call(u,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=rk({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=kk(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,n;nM.getFunctionList()&&nM.getFunctionList().length&&(t=Tk(t,nM)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=ak.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(n=this._chartSpecTransformer)||void 0===n?void 0:n.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=ak.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,n,s;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(n=this._option)||void 0===n||n.onError("chart is already initialized"));const r=ak.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=ft(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,n;return qT(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:Ek,height:null!==(n=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==n?n:Ok})}_initDataSet(t){this._dataSet=t instanceof ni?t:new ni,MT(this._dataSet,"dataview",ti),MT(this._dataSet,"array",n),CT(this._dataSet,"copyDataView",OT);for(const t in ak.transforms)CT(this._dataSet,t,ak.transforms[t]);for(const t in ak.dataParser)MT(this._dataSet,t,ak.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return u(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,n,s,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),t.reMake?(null===(s=this._compiler)||void 0===s||s.releaseGrammar(!0),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))):t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,n,s,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const n=e=>{var i;const n=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===n?DT.none:DT.appear:n};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(n)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(n)}))}}release(){var t,e,i,n;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(n=this._compiler)||void 0===n||n.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,bk.unregisterInstance(this)}updateData(t,e,n,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,n,s)}))}_updateDataById(t,e,i){const n=this._spec.data.find((e=>e.name===t||e.id===t));n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,n){return this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==n?void 0:n.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const n=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:s,fields:r}=t,a=n.find((t=>t.name===e));if(a)a instanceof si?(a.setFields(I(r)),a.parse(i,I(s))):(a.values=i,p(s)&&(a.parser=s),p(r)&&(a.fields=r));else{const e=PT(t,this._dataSet,n);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,n,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,s);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:n,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,n){const s=this._updateSpec(t,e,n);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const n=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(n,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,n=!1,s){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,n,s)}))}updateModelSpecSync(t,e,i=!1,n){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),u(t)||function(t,e,i,n){Object.keys(t).forEach((s=>{if(g(e))e.type===s&&(_(t[s])?t[s].length>=e.index&&(t[s][e.index]=n?rk({},t[s][e.index],i):i):t[s]=n?rk({},t[s],i):i);else if(_(t[s])){const r=t[s].findIndex((t=>t.id===e));r>=0&&(t[s][r]=n?rk({},t[s][r],i):i)}else t.id===e&&(t[s]=n?rk({},t[s],i):i)}))}(this._spec,t,e,i),this._chart){const s=this._chart.getModelInFilter(t);if(s)return this._updateModelSpec(s,e,!0,i,n)}return this}_updateModelSpec(t,e,i=!1,n=!1,s){n&&(e=rk({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:s,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,n;return this._beforeResize(t,e)?(null===(n=(i=this._compiler).resize)||void 0===n||n.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,n,s,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===n||n.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterResizeWithUpdate)||void 0===r||r.call(s,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var n;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(n=this._event)||void 0===n||n.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const n=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));n>=0&&(this._userEvents.splice(n,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,n;const s=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=ok({},e,e.chart[t])),e};let l;if(E(s)&&E(r))l=Sk(this._currentThemeName),this._currentTheme=o(a,l);else{const t=ok({},Sk(g(r)&&r.type?r.type:g(s)&&s.type?s.type:this._currentThemeName),Sk(s),Sk(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(rb.poptip,sb,h),null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let n=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(n=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(n=!0);const s=this._autoSize;return this._autoSize=!!Wg(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==s&&(n=!0),n}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return Sk(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!xk.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const 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=p(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.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const 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.getComponentsByType(r.discreteLegend);n&&n[t]&&n[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield $T(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,n;return i(this,void 0,void 0,(function*(){if(!Wg(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(n=this._option)||void 0===n||n.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t,e,i;null===(t=this._chart)||void 0===t||t.resetLayoutItemTag(),null===(e=this._chart)||void 0===e||e.setLayoutTag(!0,null,!1),null===(i=this._compiler)||void 0===i||i.render()}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=y(this._canvas)?Op.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,n){var s;if(!this._chart)return null;if(E(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o){const e=Object.keys(t),s=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=s?o.dataToPosition(s,n):o.dataToPosition(t,n),a?qw(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var n,s;if(!this._chart||d(t)||E(e))return null;if(!_(t)){const{axisId:s,axisIndex:r}=e;let a;if(p(s)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===s)):p(r)&&(a=null===(n=this._chart.getComponentsByKey("axes"))||void 0===n?void 0:n[r]),!a)return Ng("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o?qw(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Ng("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return FC.instance().getFunction(t)}registerFunction(t,e){t&&e&&FC.instance().registerFunction(t,e)}unregisterFunction(t){t&&FC.instance().unregisterFunction(t)}getFunctionList(){return FC.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);n&&n[t]&&n[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var n,s;const a=null===(n=this._chart)||void 0===n?void 0:n.getRegionsInQuerier(t)[0],o=null===(s=this._chart)||void 0===s?void 0:s.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=ak.getChartPlugins();t.length>0&&(this._chartPlugin=new NC(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=ak.getVChartPlugins();e.length>0&&(this._vChartPlugin=new iM(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=YT.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;this._renderState=YT.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent()}}nM.InstanceManager=bk,nM.ThemeManager=xk,nM.globalConfig={uniqueTooltip:!0},nM.Utils=DC,nM.vglobal=Op;ak.registerRegion("region",dC),ak.registerLayout("base",xC),w_(),d_(),ak.registerMark(LC.type,LC),ak.registerStageEventPlugin("gesture",kf),JC(),eM(),fk(nk.name,nk);const sM="monotone",rM="linear",aM="bevel";function oM(t,e){return e("component",t)}function lM(t,e,i,n){if(t)return{formatFunc:t,args:[i,n]};const s=ak.getFormatter();return e&&s?{formatFunc:s,args:[i,n,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const hM=(t,e,i,n)=>{if(d(t[e]))return;const s=_(t[e]),r=s?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||n&&!n(t)||a.push({spec:t,specPath:s?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},cM=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},uM=(t,e,i,n)=>{let s;if(s=u(t)?t(e,i):m(t)&&p(t.field)?O(e,t.field):t,n){const{formatFunc:i,args:r}=lM(void 0,n,t,e);i&&r&&(s=i(...r))}return s},dM=(t,e,i)=>d(t)?t:u(t)?t(e,i):t;const pM=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function gM(t,i,n,s,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},s),n),i):Object.assign(Object.assign({},s),i),{key:h,keyFormatter:c,keyTimeFormat:u,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=mM(uM(h,r,a,c),u,g),o.value=mM(uM(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=uM(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function fM(t,e,i,n,s,r,a){if(u(e)){gM(t,e(s,a),i,n,r,a)}else e&&gM(t,e,i,n,r,a)}const mM=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const n=Be.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?n.timeFormat:n.timeUTCFormat)(e,t)};class vM{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:n}=this,s=n.getSeriesField();return{seriesFields:p(s)?G(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._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const n=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[n]},this._getSeriesStyle=(t,e,i)=>{var n;for(const i of G(e)){const e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let n=this._seriesCacheInfo.dimensionFields;return i[0]&&(n=n.filter((t=>t!==i[0]))),n.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var n,s,r,a,o,l,h,c,u,d,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(n=null==i?void 0:i.style)||void 0===n?void 0:n.shape),null==i?void 0:i[t]),null===(s=null==i?void 0:i[t])||void 0===s?void 0:s[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(u=m.shapeStroke)&&void 0!==u?u:this.shapeStrokeCallback,shapeHollow:null!==(d=m.shapeHollow)&&void 0!==d&&d,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,n,s,r){var a;return function(t,e,i,n,s,r){if(s&&s.length){const a=[];return s.forEach((s=>{_(t)?t.forEach((t=>{fM(a,t,e,i,n,s,r)})):u(t)?fM(a,t,e,i,n,s,r):t&&gM(a,t,e,i,s,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,n,s,r)}getTitleResult(t,e,i,n,s){let r=u(e)?e(n,s):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(n),e={visible:uM(r.visible,t,s),value:mM(uM(r.value,t,s,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:uM(r.valueStyle,t,s),hasShape:r.hasShape};return Object.keys(i).forEach((n=>{e[n]=uM(i[n],t,s)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,n,s){var r,a;if(!(this.enableByType(t)&&pM(t,this.spec)&&("dimension"!==t||n&&n.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,n,s).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,n,s);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,s),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const yM={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const n of t)e[n]||(i.push(n),e[n]=1);return i}},_M=(t,e)=>{var i,n;let s=e.fields;if(u(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return{};s=iT([],s);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(n=(i=t[0]).getFields)||void 0===n?void 0:n.call(i);return bM(a,s,o)},bM=(t,e,i)=>{const n={};let s=[],r=[];return e.forEach((e=>{const a=e.key;n[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;s.length=0,t&&t.forEach((t=>{t&&s.push(t[a])}));const u=s.length;if(h){r.length=0,s.forEach(((t,e)=>{Kg(t)&&r.push(t)}));const t=s;s=r,r=t,c=s.length===u}else s=l.some((t=>"array-min"===t||"array-max"===t))?s.reduce(((t,e)=>(e&&e.forEach((e=>{Kg(e)&&t.push(e)})),t)),[]):s.filter((t=>void 0!==t));e.filter&&(s=s.filter(e.filter)),l.forEach((t=>{if(e.customize)n[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(n[a][t]=o.domain.slice())}else if("allValid"===t)return;n[a][t]=yM[t](s),"array-max"===t&&(n[a].max=n[a][t]),"array-min"===t&&(n[a].min=n[a][t])}})),h&&(n[a].allValid=c)})),n},xM=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();return"zero"!==n||s&&s.length&&t.forEach((t=>{s.forEach((e=>{Kg(t[e])||(t[e]=0)}))})),t};function SM(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function AM(t,e,i){t&&(i.needDefaultSeriesField&&(t[Lk]=i.defaultSeriesField),t[Pk]=e,t[Ik]=i.getKey(t,e,i))}const wM={label:{name:"label",type:"text"}},kM=`${Bk}_rect_x`,TM=`${Bk}_rect_x1`,CM=`${Bk}_rect_y`,MM=`${Bk}_rect_y1`,BM={data:!0},EM={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},OM=[...Object.keys(zC),"normal"];function RM(t={},e,i){const n={};for(let s=0;s{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var n;let s=t;return FM(s)&&delete s.type,s.oneByOne&&(s=IM(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:LM,null==i?void 0:i.dataCount)),s})):o.map(((t,e)=>{var n;let s=rk({},o[e],a);return FM(s)&&delete s.type,s.oneByOne&&(s=IM(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:LM,null==i?void 0:i.dataCount)),s})),n[r]=l):n[r]=o}return n}function PM(t,e,i){var n,s,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(n=e.animationAppear[t])&&void 0!==n?n:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(s=e.animationDisappear[t])&&void 0!==s?s:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),jM(t,(t=>{var i;if(u(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function IM(t,e,i){const{oneByOne:n,duration:s,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=u(s)?s(t,i,a):A(s)?s:0,h=u(r)?r(t,i,a):A(r)?r:0;let c=u(n)?n(t,i,a):n;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=u(s)?s(t,r,o):A(s)?s:0,c=u(a)?a(t,r,o):A(a)?a:0;let d=u(n)?n(t,r,o):n;if(!1===d)return c;return d=!0===d?0:d,c+((i?i():r.parent.count-1)-l)*(h+d)},delete t.oneByOne,t}function LM(t,e){var i;return null!==(i=null==t?void 0:t[Pk])&&void 0!==i?i:e.context.graphicIndex}function DM(t,e){var i,n,s,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(s=null===(n=t.animationAppear)||void 0===n?void 0:n[e])&&void 0!==s?s:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function FM(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function jM(t,e,i=[]){if(_(t))t.forEach(((n,s)=>{t[s]=e(t[s],s),jM(t[s],e,i)}));else if(g(t)&&"function"!=typeof t)for(const n in t)i.includes(n)||(t[n]=e(t[n],n),jM(t[n],e,i))}function NM(t){var e,i,n,s,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(n=o.animationThreshold)&&void 0!==n?n:Number.MAX_SAFE_INTEGER;return null===(s=t.getMarks())||void 0===s||s.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class UM extends oC{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,n,s;const r=Tw(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=ak.getSeriesMarkMap(o)?function(t,e,i){const n=ak.getSeriesMarkMap(e);if(!n)return t;const s={};return Object.values(n).forEach((({type:e,name:n})=>{s[n]=rk({},i("mark",G(e)[0]),i("markByName",n),null==t?void 0:t[n])})),Object.assign(Object.assign({},t),s)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return rk({},l,h,(null!==(s=null!==(n=this.stack)&&void 0!==n?n:null==h?void 0:h.stack)&&void 0!==s?s:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const n=super.transformSpec(t,e,i);return this._transformLabelSpec(n.spec),Object.assign(Object.assign({},n),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",n="initLabelMarkStyle",s=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!s;this.addLabelSpec(u(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&d)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[n])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:n,innerRadius:s,direction:r}=t;return p(n)&&(i.outerRadius=n),p(s)&&(i.innerRadius=s),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const n=this._getDefaultSpecFromChart(e),s=t=>{const e=rk({},i,n,t),s=i.label;return s&&g(s)&&_(e.label)&&(e.label=e.label.map((t=>rk({},s,t)))),e};return _(t)?{spec:t.map((t=>s(t))),theme:i}:{spec:s(t),theme:i}}return{spec:t,theme:i}}}class HM extends lC{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${Bk}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var n;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=UM,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(n=this._spec)||void 0===n?void 0:n.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=NM(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return d(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(CT(this._rawData.dataSet,"invalidTravel",xM),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const n=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(n&&(this._rawData=PT(n,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=RT(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=RT(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new MC(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,n,s;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(n=this._rawData.getFields())||void 0===n?void 0:n[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=bM(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(s=this._rawStatisticsCache[t])&&void 0!==s?s:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){CT(this._dataSet,"dimensionStatistics",_M);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new si(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&iT(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){CT(this._dataSet,"dimensionStatistics",_M);const n=new si(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const n=iT(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&iT(n,[{key:this._seriesField,operations:["values"]}]),n},target:"latest"}},!1),n}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new si(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return d(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:n}=i,s=this._getSeriesDataKey(t);return void 0===n.get(s)?(n.set(s,0),s):(n.set(s,n.get(s)+1),`${s}_${n.get(s)}`)}:y(t)?e=>e[t]:_(t)&&t.every((t=>y(t)))?e=>t.map((t=>e[t])).join("-"):u(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(CT(this._rawData.dataSet,"addVChartProperty",cM),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:SM.bind(this),call:AM}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:y(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,n,s){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${n}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),s.hasAnimation&&!1!==t.animation){const e=RM({},PM(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${n}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,s)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(n=this._option.mode)===t.RenderModeEnum["desktop-browser"]||n===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:Gg(n)||Yg(n)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var n;let s=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?s.enable=a:g(a)&&(s.enable=!0,s=rk(s,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=rk(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(s.enable){const t=$C(s,e);t.length&&l.push({trigger:this._defaultHoverConfig(s),marks:t})}if(r.enable){const t=$C(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,n=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:n,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=$C(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const n=null!==(e=this._seriesField)&&void 0!==e?e:Lk;this.getMarksWithoutRoot().forEach((e=>{const s={},r={},a={};i.forEach((t=>{var i;const n=null===(i=t[e.name])||void 0===i?void 0:i.style;n&&(s[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(n).forEach((e=>{r[e]=!0,a[t.name][e]=n[e]})))})),e.state.addStateInfo({stateValue:Dk,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][n]]:!0===s[t[n]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var s,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(s=a[i[0][n]])||void 0===s?void 0:s[t]}return o=null===(r=a[i[n]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,Dk,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,n;(null===(n=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===n?void 0:n.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new vM(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!z(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const n=super._compareSpec(t,e),s=Object.keys(e||{}).sort();if(!z(s,Object.keys(t||{}).sort()))return n.reMake=!0,n;const r=Object.assign(Object.assign(Object.assign(Object.assign({},BM),EM),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),n),!n.reMake&&this._compareLabelSpec(G(t.label),G(e.label),n),!n.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),n),n.reMake?n:(!n.reCompile&&this._marks.getMarks().some((i=>{var n,s;return r[i.name]=!0,(null===(n=e[i.name])||void 0===n?void 0:n.visible)!==(null===(s=t[i.name])||void 0===s?void 0:s.visible)}))&&(n.reCompile=!0),!n.reCompile&&s.some((i=>EM[i]&&!z(t[i],e[i])))&&(n.reCompile=!0),s.some((i=>!r[i]&&!z(t[i],e[i])))?(n.reMake=!0,n):n)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof si||IT(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();NM(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,n;return null!==(n=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==n?n:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:Lk,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),n=this._getDataScheme();return null===(e=(t=(new Fw).domain(i)).range)||void 0===e?void 0:e.call(t,n)}_getDataScheme(){return Bw(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:Lk}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var n,s,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:u={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),d(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),d(h)||_.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(n=i.morph)&&void 0!==n&&n,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(s=i.support3d)&&void 0!==s?s:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(l),this.initMarkStyleWithSpec(_,rk({},u,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:Ik}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const n=this.getSeriesField();return n&&!i.includes(n)&&(e+=`_${t[n]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==Nk&&t!==Hk&&t!==jk&&t!==Uk||(t=this.getStackValueField()),null!==(e=sT(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Kg(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),n=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=n?n:[]}_forEachStackGroup(t,e){var i,n;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(n=e.values)||void 0===n?void 0:n.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:Lk]}}function zM(t,e,i){const n=t.getScale(0),s="isInverse"in t&&t.isInverse();sS(n.type)?i.sort(((t,i)=>(t[e]-i[e])*(s?-1:1))):i.sort(((t,i)=>(n.index(t[e])-n.index(i[e]))*(s?-1:1)))}function VM(t){return{dataIndex:e=>{var i,n;const s="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[s],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(n=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==n?n:[]).indexOf(r)||0},dataCount:()=>{var e,i,n;const s="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(n=(null!==(i=null===(e=null==s?void 0:s.domain)||void 0===e?void 0:e.call(s))&&void 0!==i?i:[]).length)&&void 0!==n?n:0}}}HM.mark=wM,HM.transformerConstructor=UM;class WM extends HM{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const n={key:i,operations:[]},s=e.axisHelper.getScale(0);sS(s.type)?(n.operations=["max","min"],"log"===s.type&&(n.filter=t=>t>0)):n.operations=["values"],t.push(n)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${Bk}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(Nk),this.setFieldX2(jk)):(this.setFieldY(Nk),this.setFieldY2(jk))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(Hk),this.setFieldX2(Uk)):(this.setFieldY(Hk),this.setFieldY2(Uk))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(Vk),this.setFieldX2(zk)):(this.setFieldY(Vk),this.setFieldY2(zk))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=G(this._spec.xField),this._specYField=G(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,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(G(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,n,s,r){const a=s();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,n);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(G(this.getDatumPositionValues(t,o)),this._scaleConfig)))),s()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(zM("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function GM(t){return"bottom"===t||"top"===t}function YM(t){return"left"===t||"right"===t}function XM(t){return"z"===t}function $M(t,e){return Vw(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function KM(t,e){var i;const n=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?GM(t)?"linear":"band":GM(t)?"band":"linear"}(t.orient,e);return{axisType:n,componentName:`${r.cartesianAxis}-${n}`}}const qM=(t,e,i)=>{var n;const s=null!==(n="band"===e?oM("axisBand",i):["linear","log","symlog"].includes(e)?oM("axisLinear",i):{})&&void 0!==n?n:{},r=GM(t)?oM("axisX",i):YM(t)?oM("axisY",i):oM("axisZ",i);return rk({},oM("axis",i),s,r)};class ZM{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,n;(null!==(n=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==n?n:Ug)("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:Ug)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,n,s;const r=null!==(s=null===(n=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===n?void 0:n.call(i,this.chart,{x:t,y:e}))&&void 0!==s?s:[];return 0===r.length?null:r}dispatch(t,e){var i,n;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=s.filter((t=>aS(t.getScale().type))),a=r.length?r:s.filter((t=>{const e=t.getOrient();return GM(e)||"angle"===e})),o=[],l=null===(n=this.chart)||void 0===n?void 0:n.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class JM extends ZM{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.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:xT.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const QM=(t,e)=>{var i,n;return t===e||!d(t)&&!d(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))},tB=(t,e)=>{const i=t.tooltipFilterRange,n="function"==typeof i?i({scale:e}):i;return A(n)?[-n,n]:n},eB=(t,e,i,n)=>{var s;const r=e.getScale(),a=aS(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(n(h)),l=null===(s=h.getViewData())||void 0===s?void 0:s.latestData;if(i&&l)if(a){const e=[],n=[];l.forEach(((s,r)=>{var a;(null===(a=s[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(s),n.push(r))})),o.push({series:h,datum:e,key:iB(h,n)})}else if(p(i[1])){const e=[],n=[];l.forEach(((s,r)=>{var a;((null===(a=s[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(s[i[0]])&&p(s[i[1]])&&t>=s[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=s[0]&&r<=s[1]&&(a.push(e),c.push(n))}}));else{let e=1/0,n=0;l.forEach(((s,r)=>{if(p(s[i[0]])){const o=Math.abs(s[i[0]]-t),l=Math.sign(s[i[0]]-t);o`${t.id}_${e.join("_")}`,nB=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&e(n)&&((t,e,i)=>{const n=t.getRegionsInIds(G(e.layout.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})}))})(t,n,i)));return n.length?n:null};class sB extends ZM{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,n,s;if(!t||(null===(s=null===(n=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===n?void 0:n.disableDimensionHoverEvent)||void 0===s?void 0:s.call(n)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!QM(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,n,s;t&&!(null===(s=null===(n=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===n?void 0:n.disableDimensionHoverEvent)||void 0===s?void 0:s.call(n))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:xT.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:xT.canvas}),callback:this.onMouseOut}),Gg(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:xT.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Gg(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var rB;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(rB||(rB={}));const aB={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class oB{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,n=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(aB.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var n,s;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:aM,curveType:rM,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,o=a===sM?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(aB.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:DM(this._spec,aB.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new si(this._option.dataSet,{name:`${Bk}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(rB.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const n in this._symbolMark.stateStyle[i])"visible"!==n&&(this._symbolActiveMark.stateStyle[i][n]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const n=this._symbolActiveMark;n&&(this._initSymbolMark(n),n&&(null===(i=null===(e=this._spec[aB.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(n.setVisible(!0),this.event.on(rB.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(n,rk({},this._spec[aB.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var n,s,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(s=null===(n=e.stateStyle.normal)||void 0===n?void 0:n[i])||void 0===s?void 0:s.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const lB=Object.assign(Object.assign({},wM),aB),hB=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>hB(t,e[i])));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]))},cB=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class uB extends PC{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return cB}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const n=this._getIgnoreAttributes(),s=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||n.includes(a))return;r&&s.includes(a)&&(rS(null==o?void 0:o.type)||(null==o?void 0:o.scale)||u(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let n=null;return t.forEach(((t,e)=>{n&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?hB(t,e):t===e))(n[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),n=t,i.push({attrs:n,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var n,s,r;const a=e.context.data,o=[],l=[],h={},c=null===(n=this.renderContext)||void 0===n?void 0:n.progressive,u=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var n;l[i]={},o[i]={},Object.keys(t).forEach((n=>{this._isValidPointChannel(n)?l[i][n]=t[n](e):this._segmentStyleKeys.includes(n)&&!c?o[i][n]=t[n](e):0!==i||c&&!u||(h[n]=t[n](e))})),l[i].context=null!==(n=this._keyGetter(e))&&void 0!==n?n:i})),c){const t=null!==(r=null===(s=e.attribute)||void 0===s?void 0:s.segments)&&void 0!==r?r:[];return t.push({points:l}),u?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const n=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&n&&n.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,n)=>{const s=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=s.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:iC.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[n].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[Ik]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class dB extends uB{constructor(){super(...arguments),this.type=dB.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)===ww.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}dB.type="line";const pB=()=>{ak.registerMark(dB.type,dB),w_(),g_(),VA(),jA(),XC(),ak.registerGraphicComponent("line",Zh)};class gB extends PC{constructor(){super(...arguments),this.type=gB.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var n,s,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(s=null!==(n=a.shape)&&void 0!==n?n:a.symbolType)&&void 0!==s?s:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}gB.type="symbol";const fB=()=>{ak.registerMark(gB.type,gB),w_(),T_(),jA(),ak.registerGraphicComponent("symbol",$h)};class mB extends UM{_transformLabelSpec(t){var e,i,n;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(n=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===n?void 0:n.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function vB(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function yB(t,e){var i;const n=Y(e)-e[0],s=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===n?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=n,a/=n);const o=t.getDomainSpec(),l={total:n,negative:r,positive:a,includeZero:s,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let n,s;0===i?(n=t._break.scope[i],s=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,s=[e[e.length-2],e[e.length-1]]):(n=t._break.scope[i-1],s=[e[i-1],e[i]],l.negative=n[0]+(0-s[0])/(s[1]-s[0])*(n[1]-n[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=s}return l}function _B(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:u}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),u[0]=-u[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),u[1]=-u[0]*t}return!0}function bB(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 xB(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 SB(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)}const AB=(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;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const u=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==u?void 0:u.length))return t;const d=o.getScale();if(!d)return t;const p=d.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=u.map((t=>function(t,e,i,n,s){const r=Lt(t,e),a=Math.max(It(i),It(r));return s*(Math.round(r*10**a)/Math.round(i*10**a))+n}(t.value,p[0],g,f[0],m)));return Qx(v)};class wB{constructor(t){this.id=$g(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class kB extends wB{constructor(){super(kB.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!sS(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const n=this._checkEnableSync(i);if(!n)return;if(!n.zeroAlign)return;const s=this._getTargetAxis(i,n);s&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===s.id},(()=>{((t,e)=>{var i,n,s,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(s=null===(n=(i=t).getDomainAfterSpec)||void 0===n?void 0:n.call(i))&&void 0!==s?s:[0,1],u=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&u&&vB(c)&&vB(u)))return;const d=yB(t,c),p=yB(e,u);if(!0===d.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=d,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!bB(d,p))return}else if(0===_&&0===b){if(!bB(p,d))return}else if(y||A)if(y&&!A){if(!_B(d,p))return}else if(A&&!y){if(!_B(p,d))return}else{if(f===b)return;if(f>b){if(!xB(d,p))return}else if(!xB(p,d))return}else{if(0===f&&0===_){if(!SB(d,p))return}else if(0===b&&0===g&&!SB(p,d))return;if(0===f&&0===b)if(0===c[0]&&u[0]>0){if(!x)return;u[0]=0}else{if(!(0===u[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&u[1]>0){if(!S)return;u[1]=0}else{if(!(0===u[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(u)})(s,i)}))}onDidCompile(t,e){var i;const n=this._checkEnableSync(e);if(!n)return;const s=this._getTargetAxis(e,n);if(s&&n.tickAlign){CT(e.getOption().dataSet,"tickAlign",AB);const t={targetAxis:()=>s,currentAxis:()=>e},n=null===(i=s.getTickData())||void 0===i?void 0:i.getDataView();n&&n.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}kB.pluginType="component",kB.type="AxisSyncPlugin";const TB={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function CB(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 MB(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const BB=t=>"band"===t||"ordinal"===t||"point"===t;function EB(t,e){return{id:t,label:t,value:e,rawValue:t}}function OB(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class RB extends jC{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const PB=`${Bk}_ARC_TRANSFORM_VALUE`,IB=`${Bk}_ARC_RATIO`,LB=`${Bk}_ARC_START_ANGLE`,DB=`${Bk}_ARC_END_ANGLE`,FB=`${Bk}_ARC_K`,jB=`${Bk}_ARC_MIDDLE_ANGLE`,NB=`${Bk}_ARC_QUADRANT`,UB=`${Bk}_ARC_RADIAN`,HB=-Math.PI/2,zB=3*Math.PI/2,VB=(t,e,i)=>{var n;const s=null!==(n="band"===e?oM("axisBand",i):"linear"===e?oM("axisLinear",i):{})&&void 0!==n?n:{},r=oM("angle"===t?"axisAngle":"axisRadius",i);return rk({},oM("axis",i),s,r)};function WB(t,e,i,n){switch(t){case r.cartesianBandAxis:return qM($M(i,["z"]),"band",e);case r.cartesianLinearAxis:return qM($M(i,["z"]),"linear",e);case r.cartesianLogAxis:return qM($M(i,["z"]),"log",e);case r.cartesianSymlogAxis:return qM($M(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return qM($M(i),void 0,e);case r.polarBandAxis:return VB(i.orient,"band",e);case r.polarLinearAxis:return VB(i.orient,"linear",e);case r.polarAxis:return VB(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,n;const s=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:u}=null!==(n=oM(r.crosshair,t))&&void 0!==n?n:{},d=s.find((t=>GM(t.orient)));let g;g=p(d)?rk({},BB(d.type)?a:o,l):l;const f=s.find((t=>YM(t.orient)));let m;return m=p(f)?rk({},aS(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:u}})(e,n);case r.polarCrosshair:return((t,e)=>{var i,n;const s=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:u}=null!==(n=oM(r.crosshair,t))&&void 0!==n?n:{},d=s.find((t=>"angle"===t.orient));let g;g=p(d)?rk({},BB(d.type)?a:o,l):l;const f=s.find((t=>"radius"===t.orient));let m;return m=p(f)?rk({},aS(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:u}})(e,n);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return GB(i,oM(t,e));default:return oM(t,e)}}const GB=(t,e)=>{var i;const n=e[function(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}(null!==(i=t.orient)&&void 0!==i?i:e.orient)],s=rk({},e,n);return delete s.horizontal,delete s.vertical,s};class YB extends oC{getTheme(t,e){return WB(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:n}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:n}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:n}=t;i&&e&&n&&(t.padding=Object.assign(Object.assign({},Kw(e)),{[n]:0}))}}class XB extends cC{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=YB,this._delegateEvent=(t,e,i,n=null,s=null)=>{var r,a;e instanceof la||this.event.emit(i,{model:this,node:t,event:e,item:n,datum:s,source:xT.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:n}=t,s=e(t,["spec"]);return new this(n,Object.assign(Object.assign({},i),s))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new RB(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!z(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(t.release(!0),null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var $B,KB;XB.transformerConstructor=YB,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}($B||($B={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(KB||(KB={}));class qB extends PC{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=ak.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(yT.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}qB.type="component";const ZB=()=>{ak.registerMark(qB.type,qB)},JB=t=>t;class QB extends XB{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,n;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(n=t.hideWhenEmpty)&&void 0!==n&&n,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,n,s,r,a,o,l,h,c,u,d,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?$B.circleAxis:$B.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?KB.circleAxisGrid:KB.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(s=null===(n=this._spec.grid)||void 0===n?void 0:n.style)||void 0===s?void 0:s.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==O(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=RM(null===(h=ak.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(u=null!==(c=this._spec.animationAppear)&&void 0!==c?c:O(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==u?u:O(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:O(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:O(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:O(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:O(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:O(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:O(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:O(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:O(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this._specVisible&&(this.getVisible()||this._spec.forceInitTick||this._hideWhenEmpty)}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new MC(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&bw(this._regions,(n=>{var s;let a=this.collectSeriesField(t,n);if(a=_(a)?sS(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=n.getFieldAlias(a[0])),a){const t=n.getViewData();if(e)a.forEach((t=>{i.push(n.getRawDataStatisticsByField(t,!!sS(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(s=n.getViewDataStatistics)||void 0===s?void 0:s.call(n),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((n=>{var s;(null===(s=null==e?void 0:e.latestData)||void 0===s?void 0:s[n])&&(o?i.push(Object.assign(Object.assign({},e.latestData[n]),{values:t.latestData.map((t=>t[n]))})):i.push(e.latestData[n]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return bw(this._regions,(e=>{var i;_(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;p(t)&&(this._seriesUserId=G(t)),p(i)&&(this._regionUserId=G(i)),p(e)&&(this._seriesIndex=G(e)),p(n)&&(this._regionIndex=G(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=function(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),bw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,n,s,r,a,o,l,h,c,u;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(s=null===(n=this._axisMark)||void 0===n?void 0:n.getComponent)||void 0===s?void 0:s.call(n))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(u=this._spec.grid)||void 0===u?void 0:u.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&z(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):bw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(bw(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var n,s;return(null===(n=null==e?void 0:e[i])||void 0===n?void 0:n.visible)!==(null===(s=null==t?void 0:t[i])||void 0===s?void 0:s.visible)})),i))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var n;if(t.domainLine&&t.domainLine.visible?i.line=((n=uT(n=t.domainLine)).startSymbol=uT(n.startSymbol),n.endSymbol=uT(n.endSymbol),n):i.line={visible:!1},t.label&&t.label.visible){const e=N(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=u(t.label.style)?(e,i,n,s)=>{var r;const a=t.label.style(e.rawValue,i,e,n,s);return pT(rk({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:pT(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,n,s,r)=>pT(t[i](e.rawValue,n,e,s,r)):E(t[i])||(e[i]=pT(t[i]))})),e}(t.label.state)),u(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:u(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=u(t.tick.style)?(e,i,n,s)=>{var r;const a=t.tick.style(e,i,n,s);return pT(rk({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:pT(t.tick.style)),t.tick.state&&(i.tick.state=dT(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=u(t.subTick.style)?(e,i,n,s)=>{var r;const a=t.subTick.style(e,i,n,s);return pT(rk({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:pT(t.subTick.style)),t.subTick.state&&(i.subTick.state=dT(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const n=t.title,{autoRotate:s,angle:r,style:a={},background:o,state:l,shape:h}=n,c=e(n,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==t.orient&&"right"!==t.orient||s&&d(p)&&(p="left"===t.orient?-90:90,u=TB[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?jt(p):null,textStyle:rk({},u,pT(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:pT(h.style)}),h.state&&(i.title.state.shape=dT(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:pT(o.style)}),o.state&&(i.title.state.background=dT(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=dT(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=pT(t.background.style)),t.background.state&&(i.panel.state=dT(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:Ck(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:u(t.grid.style)?(e,i)=>{var n,s;const r=t.grid.style(null===(n=e.datum)||void 0===n?void 0:n.rawValue,i,e.datum);return pT(rk({},null===(s=this._theme.grid)||void 0===s?void 0:s.style,r))}:pT(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:Ck(t.subGrid.alternateColor),style:pT(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=lM(t,e);return i?(t,n,s)=>i(n.rawValue,n,e):null}_initTickDataSet(t,e=0){MT(this._option.dataSet,"scale",JB);const i=this.registerTicksTransform();return new si(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:n,tickStep:s,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:n,tickStep:s,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var n;null===(n=null==i?void 0:i.getDataView())||void 0===n||n.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===cb.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}QB.specKey="axes";const tE=()=>{ZB(),ak.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},eE=[kB];class iE extends QB{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,n){super(i,n),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),bw(this._regions,(t=>{const e=this.getOrient();GM(e)?OB(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):YM(e)?OB(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):XM(e)&&OB(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:n}=i,s=e(i,["grid"]),r=rk({x:t.x,y:t.y},this._axisStyle,s);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(rk({x:t.x,y:t.y},this._getGridAttributes(),n)),this._syncComponentVisibility()},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=GM(this.getOrient()),s=t=>{var e;return(n?!GM(t.getOrient()):GM(t.getOrient()))&&sS(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&Y(t.getScale().domain())>=0)},r=i.filter((t=>s(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);n?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=$M(i,["z"]),XM(this._orient)&&(this.layoutType="absolute"),this._dataSet=n.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!MB(e))return null;const{axisType:t,componentName:n}=KM(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:n}]}const n=e.filter((t=>"z"===t.orient))[0];let s=!0;if(n){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>YM(t.orient)))[0];s=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));s||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!MB(t))return;const{axisType:n,componentName:s}=KM(t,i);t.type=n,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:s})})),a}static createComponent(t,i){const{spec:n}=t,s=e(t,["spec"]),r=ak.getComponentInKey(s.type);return r?new r(n,Object.assign(Object.assign({},i),s)):(i.onError(`Component ${s.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:n,top:s,bottom:r}=this._innerOffset;let a=[];return GM(this.getOrient())?A(t)&&(a=this._inverse?[t-n,i]:[i,t-n]):XM(this.getOrient())?A(t)&&(a=this._inverse?[t-n,i]:[i,t-n],this._scale.range(a)):A(e)&&(a=this._inverse?[s,e-r]:[e-r,s]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(eE.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){GM(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!GM(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!XM(this.getOrient())&&this._spec.innerOffset){const t=this._spec;YM(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=Yw(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=Yw(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=GM(this.getOrient())?t.fieldX:XM(this.getOrient())?t.fieldZ:t.fieldY,sS(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,n;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(n=this._spec.label)||void 0===n?void 0:n.flush})}axisHelper(){return{isContinuous:sS(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(yT.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(GM(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=GM(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return bw(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,n;let s;return s=t>0?null===(n=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===n?void 0:n[t]:GM(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:XM(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,s}updateSeriesScale(){const t=this.getOrient();bw(this._regions,(e=>{GM(t)?OB(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):YM(t)?OB(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):XM(t)&&OB(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=GM(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&_(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const n={skipLayout:!1},s=GM(this.getOrient());this.pluginService&&(s?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),n=rk(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(n);a&&!a.empty()||(a=(new le).set(n.x,n.y,n.x,n.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,s)}return i}positionToData(t,e){const i=GM(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?ct(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):ct(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const n=this._scale.range();return(t-n[0])*(t-Y(n))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,n,s,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(n=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==n?n:null===(s=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),n=e+t[0].getLayoutRect().width,s=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return EB(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,n=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:sS(this._scale.type)?i>=n[0]&&i<=Y(n):n.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let n=0,s=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;n=Math.max(n,e)}else if(e===a){const e=t.getLayoutRect().width;s=Math.max(s,e)}})),{left:n,right:s}}}}iE.type=r.cartesianAxis,iE.specKey="axes";const nE=(t,e,i)=>i.reduce(((t,n,s)=>(t.push([n,i.length===s+1?e:i[s+1]]),t)),[[t,i[0]]]);function sE(t,e){const i=t[0],n=t[t.length-1],s=e.filter((t=>t>i&&tt-e,aE=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let n=0,s=0;for(;n{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(s);return i[n]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function oE(t,e,i="count"){const n=aE(t,e),s="count"===i?t.length:n.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return n.forEach(((t,e)=>{if(0===s)r.push([0,e/n.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===n.length-1?1:Math.min((a+l)/s,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const lE=Math.sqrt(50),hE=Math.sqrt(10),cE=Math.sqrt(2);class uE{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=CB(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(u(i.tickCount)){const t=this._scale.range();let n=Math.abs(Y(t)-t[0]);if(1===n&&this._option){n=GM(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:n,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:n,max:s}=null!==(t=this._domain)&&void 0!==t?t:{};return d(n)&&d(s)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(p(n)||p(this._softMinValue))&&d(s)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(n)||!d(this._softMinValue)||!p(s)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let n,s,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;n=void 0===n?e:Math.min(n,e),s=void 0===s?a:Math.max(s,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?s:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:n,scope:s}=function(t,e,i){return t.sort(rE),e.sort(rE),{domain:sE(t,e),scope:oE(t,e,i)}}(r,Fg(t),this._spec.breaks[0].scopeType);e=Fg(n),this._break={domain:n,scope:s,breakDomains:t,breaks:i}}else e=[n,s]}else e=[n,s]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=CB(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=lE?10:s>=hE?5:s>=cE?2:1)*Math.pow(10,n),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const n=this._scale.domain();if(this.extendDomain(n),this.includeZero(n),this.setDomainMinMax(n),this.niceDomain(n),this._scale.domain(n,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,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=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,n=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*n)/n:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const dE={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},pE={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},gE={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},fE={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}};class mE extends iE{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new $S}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const n=super._getUpdateAttribute(t);if(!XM(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=GM(this._orient),s=i?t:e;n.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:n,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/s;let o;o=Ww(r)?Number(r.substring(0,r.length-1))/100:r/s;const l=A(null==n?void 0:n.angle)?n.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},n),{angle:l*Math.PI/180}),rawRange:e}}))}return n}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=Fg(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return CT(this._option.dataSet,t,nA),t}}mE.type=r.cartesianLinearAxis,mE.specKey="axes",mE.builtInTheme={axis:fE,axisLinear:dE,axisX:pE,axisY:gE},W(mE,uE);const vE=()=>{ak.registerGraphicComponent($B.lineAxis,((t,e)=>new Jx(t,e))),ak.registerGraphicComponent(KB.lineAxisGrid,((t,e)=>new JA(t,e))),tE(),ak.registerComponent(mE.type,mE)};class yE extends iE{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new CS}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return CT(this._option.dataSet,t,lA),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=yS(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:n,bandSizeLevel:s=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};s=Math.min(s,this._scales.length-1);for(let t=s;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),u=e=>{const i=t===s?a:0;if(d(r)||t1)for(let e=0;e{this._onTickDataChange(n)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=n}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new MC(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const n=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},s=this._tickDataMap[t],r=null==s?void 0:s.getDataView().transformsArr.find((t=>t.type===n));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===n));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,n;if(0===t.length||0===this._scales.length)return 0;const{position:s,bandScale:r}=this.getPosition(t);return s+r.bandwidth()*(null!==(n=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==n?n:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((n,s)=>{var r;const a=this._tickDataMap[s],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):n.domain();if(l&&l.length)if(i&&i.length){const n=[],s=[];i.forEach((e=>{l.forEach((i=>{const r=G(e).concat(i);if(s.push(r),o){const e=EB(i,this._getNormalizedValue(r,t));n.push(e)}}))})),o&&e.push(n.filter((t=>t.value>=0&&t.value<=1))),i=s}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>EB(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}});const _E=()=>{ak.registerGraphicComponent($B.lineAxis,((t,e)=>new Jx(t,e))),ak.registerGraphicComponent(KB.lineAxisGrid,((t,e)=>new JA(t,e))),tE(),ak.registerComponent(yE.type,yE,!1)};class bE extends mE{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),bw(this._regions,(t=>{GM(this.getOrient())?OB(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):OB(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=rk({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new si(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new MC(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,n,s,r,a,o;const l=Be.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(n=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===n?void 0:n.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,u=(null===(r=null===(s=this._spec.layers)||void 0===s?void 0:s[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",d="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,n,s)=>{var r;let a;return a=0===s?d(u,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const n=[],s=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();s&&s.length&&n.push(s.map((e=>EB(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&n.push(r.map((e=>EB(e.value,this._getNormalizedValue([e.value],t))))),n}registerTicksTransform(){const t=`${this.type}-ticks`;return CT(this._option.dataSet,t,nA),t}transformScaleDomain(){}}bE.type=r.cartesianTimeAxis,bE.specKey="axes",bE.builtInTheme={axis:fE,axisX:pE,axisY:gE};class xE extends mE{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new JS}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return CT(this._option.dataSet,t,nA),t}transformScaleDomain(){}}xE.type=r.cartesianLogAxis,xE.specKey="axes",xE.builtInTheme={axis:fE,axisLinear:dE,axisX:pE,axisY:gE},W(xE,uE);class SE extends mE{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new QS}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return CT(this._option.dataSet,t,nA),t}transformScaleDomain(){}}SE.type=r.cartesianSymlogAxis,SE.specKey="axes",SE.builtInTheme={axis:fE,axisLinear:dE,axisX:pE,axisY:gE},W(SE,uE);const AE=`${Bk}_hide_`;function wE(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const kE=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:n,deltaMul:s=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[AE]&&(wE(t,!0),t[AE]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let n=-1/0,s=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+s)*i),r=(-1/0-l)**2+(n-h)**2,r<(o+s+e)**2?t.context.finalAttrs.forceShow||(t[AE]=!0,wE(t,!1)):n=h,s=e}))}(r,n,s):1===i?function(t,e,i){let n=-1/0,s=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+s)*i),Math.abs(o-n){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+s)*i),Math.abs(o-n){var i,n;const s=null===(n=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===n?void 0:n[r];return t[s]?t[s].push(e):t[s]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},TE=()=>{ak.registerGrammarTransform("symbolOverlap",{transform:kE,runType:"afterEncode"})},CE={min:$,max:X,average:function(t,e){let i=0,n=0;return t.forEach((t=>{const s=e?+t[e]:+t;A(s)&&(i+=s,n++)})),i/n},sum:vw};function ME(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,u=0;r[u++]=c;for(let t=1;to&&(o=l,h=t))}r[u++]=h,c=h}r[u-1]!==a-1&&(r[u++]=a-1);return r.map((t=>i?e[t].i:t))}function BE(t,e,i,n,s){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][s]=e[l][s];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function EE(t,e,i,n){return BE(t,e,i,"min",n)}function OE(t,e,i,n){return BE(t,e,i,"max",n)}function RE(t,e,i,n){return BE(t,e,i,"average",n)}function PE(t,e,i,n){return BE(t,e,i,"sum",n)}const IE=(t,e)=>{let i=u(t.size)?t.size():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{mode:s,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=ME;if("min"===s?l=EE:"max"===s?l=OE:"average"===s?l=RE:"sum"===s&&(l=PE),e.length){const t={};if(a){for(let i=0,n=e.length;i{const r=t[s];if(r.length<=i){const t=r.map((t=>t.i));n=n.concat(t)}else{const t=l(i,r,!0,o);n=n.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},LE=()=>{ak.registerGrammarTransform("dataSampling",{transform:IE})};class DE extends WM{constructor(){super(...arguments),this.type=ww.line,this.transformerConstructor=mB,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,n;const s={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(RM(null===(i=ak.getAnimationInKey("line"))||void 0===i?void 0:i(s,r),PM("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=VM(this);this._symbolMark.setAnimationConfig(RM(null===(n=ak.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),PM("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var 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:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}DE.type=ww.line,DE.mark=lB,DE.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},DE.transformerConstructor=mB,W(DE,oB);class FE{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(n,((t,e)=>{IT(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof si)return;const n=this.getSeriesData(t.id,i);n&&e(t,n,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Ng(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Ng(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class jE{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)=>{qg(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{iT(e,[{key:t,operations:sS(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&iT(e,[{key:i.field,operations:sS(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?Nw("colorOrdinal"):Nw(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(qg(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const 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;if(!z(r.specified,n.specified))return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),qg(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)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!qg(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,n.domain().slice());let s;s=sS(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const n=sS(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,n);e&&(n?(d(s[0])?s[0]=e.min:s[0]=Math.min(e.min,s[0]),d(s[1])?s[1]=e.max:s[1]=Math.max(e.max,s[1])):e.values.forEach((t=>{s.add(t)})))}))}));const r=s;sS(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)return;if(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(sS(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const n=this._getSeriesBySeriesId(t.seriesId),s=sS(e.type),r=n.getRawDataStatisticsByField(t.field,s);if(!E(r))return"expand"===t.changeDomain?(s?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(s?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));sS(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(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(s=i.clone()),n.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:s})),s}}class NE{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,n,s){return this._disableTriggerEvent?[]:e&&e.length?(n&&s?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,s),this.toggleStateOfGraphics(t,e,i,n)):this.addBothStateOfGraphics(t,e,n,s):n&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,n):this.addStateOfGraphics(t,e,n)),e):[]}toggleReverseStateOfGraphics(t,e,i,n){const s=t.getMarkIdByState();i.forEach((t=>{var e;if(n&&s[n]&&s[n].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,s=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(n,!0,s)}})),e.forEach((t=>{var e;if(n&&s[n]&&s[n].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,s=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(n,s)}}))}toggleStateOfGraphics(t,e,i,n){const s=t.getMarkIdByState();i.forEach((t=>{var e;if(n&&s[n]&&s[n].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,s=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(n,s)}})),e.forEach((t=>{var e;if(n&&s[n]&&s[n].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,s=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(n,!0,s)}}))}addBothStateOfGraphics(t,e,i,n){const s=t.getMarks(),r=t.getMarkIdByState();s.forEach((t=>{var s;const a=n&&r[n]&&r[n].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(n,!0,l)}))}))}addStateOfGraphics(t,e,i){const n=t.getMarks(),s=t.getMarkIdByState();n.forEach((t=>{var n;const r=i&&s[i]&&s[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const n=this.getStatedGraphics(t);if(!n||!n.length)return;const s=t.getMarks(),r=t.getMarkIdByState();s.forEach((t=>{if(t){const s=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");s&&s.length&&(i&&r[i]&&r[i].includes(t.id)&&s.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&s.forEach((t=>{n.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class UE extends aC{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const n=this.getCompiler();return n&&(n.updateLayoutTag(),t&&i&&n.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,n,s,r;super(e),this.type="chart",this.id=$g(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:Ek,height:Ok},this._viewRect={width:Ek,height:Ok},this._viewBox={x1:0,y1:0,x2:Ek,y2:Ok},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>G(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=Kw(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new vT(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new FE(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(n=this._option)||void 0===n?void 0:n.onError,disableTriggerEvent:!0===(null===(s=this._option)||void 0===s?void 0:s.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new NE;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const n=t.getInteractionTriggers();if(n&&n.length){const s=t.getRegion().id;n.forEach((({trigger:t,marks:n})=>{const r=`${s}-${t.type}`;i[r]?n.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:n}),e.push(i[r]))}))}})),e.forEach((t=>{const e=ak.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(RM({},PM("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const n={width:t,height:e};this._canvasRect=n,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=N(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=ak.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:n}=i,s=e(i,["spec"]),r=new t(n,Object.assign(Object.assign({},this._modelOption),s));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:n}=i,s=e(i,["spec"]);let r;if(p(n.regionId)?r=this.getRegionsInUserId(n.regionId):p(n.regionIndex)&&(r=this.getRegionsInIndex([n.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(n,Object.assign(Object.assign(Object.assign({},this._modelOption),s),{type:n.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(u(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var n;if((null!==(n=i.specKey)&&void 0!==n?n:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const n=ak.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){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._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===s||s.call(n,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof lC)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const n=this.getComponentByUserId(t);return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof PC))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof PC)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&(s.markRunning(),s.parseNewData(e,n)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&IT(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=qT(this._spec,this._option,{width:Ek,height:Ok})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const n=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=Bw(n),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new jE(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){ZT(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=Bw(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!z(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let n=0;n{ZT(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0};this._components.forEach((n=>{var s,a;if(n.type===r.label||n.type===r.totalLabel)return;i[n.type]&&(i[n.type]=!1);const o=n.specKey||n.type,l=null!==(s=this._spec[o])&&void 0!==s?s:{};_(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,ZT(t,n.updateSpec(null!==(a=l[n.getSpecIndex()])&&void 0!==a?a:{},l))):ZT(t,n.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}const n=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(_(i)?i.some(n):n(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];ZT(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:n=0,x2:s,y2:r}=e;i={width:s-t,height:r-n}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=Xw(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===n||n.call(i,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(E(t[n]))continue;const s=t[n];let r={stateValue:n};r=u(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(e,i,n){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,n)}setHovered(e,i,n){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,n)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(yT.AFTER_MARK_RENDER_END,e)};this._event.on(yT.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const n=(t=t?G(t):null)?Object.keys(t[0]):null,s=[],r=null!==(i=e.getDatum)&&void 0!==i?i:fT;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||u(e.filter)&&e.filter(o,l))){if(gT(l.type))h.filter((h=>{const c=r(h,l,o,i),u=c&&t.every(((t,e)=>n.every((i=>t[i]==c[e][i]))));u&&(a.push(h),s.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),u=h&&c.findIndex((t=>n.every((e=>t[e]==h[e]))));u>=0&&(c.splice(u,1),a.push(t),s.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const s=r(e,l,o,i);return s&&n.every((e=>t[0][e]==s[e]))}));c&&(a.push(c),s.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),s}_setStateInDatum(t,e,i,n){if(!e)return void this._interaction.clearByState(t);const s=this.filterGraphicsByDatum(e,{filter:i,region:n});this._interaction.updateStateOfGraphics(t,s)}setDimensionIndex(t,e){var i,n;let s=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:n,event:r}=i;if(n===rB.dimensionHover||n===rB.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(s=i)}}));const a=d(t)||!s||s.every((t=>aS(t.axis.getScale().type)&&d(t.index))),o=a||s.every((t=>aS(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(n=(i=t).hideTooltip)||void 0===n||n.call(i);else{const i={};s.forEach((t=>{const{axis:e,value:n,data:s}=t,r="left"===e.getOrient()||"right"===e.getOrient();s.forEach((t=>{var e,s,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(s=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===s?void 0:s[o])&&void 0!==a?a:n}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(s))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const n=this.getComponentsByKey("axes"),s=[];n.forEach((e=>{const i=t(e);!1!==i&&s.push({axis:e,value:i})})),i.showCrosshair(s)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const HE=(t,e)=>{var i;const n=t.spec,{regionId:s,regionIndex:r}=n;if(p(s)){const t=G(s);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class zE{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,n,s)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=n,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,s),u=Object.assign(Object.assign({},n),c);e?u.theme=h.getTheme(r,t):sk(t,a,c.spec),sk(s,null!=o?o:a,u)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,n;e||(e=this.generateTransform(t,!0));const s={};return this.forEachRegionInSpec(t,e,s),this.forEachSeriesInSpec(t,e,s),null===(i=s.series)||void 0===i||i.forEach(((t,e)=>{var i,n;const r=(null!==(n=null!==(i=HE(t,s))&&void 0!==i?i:s.region)&&void 0!==n?n:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,s),Object.values(null!==(n=s.component)&&void 0!==n?n:{}).forEach((t=>t.forEach(((t,e)=>{var i,n,r;if(t){if(!t.regionIndexes){const e=null!==(n=null!==(i=HE(t,s))&&void 0!==i?i:s.region)&&void 0!==n?n:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const n=t.spec,{seriesId:s,seriesIndex:r}=n;if(p(s)){const t=G(s);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,s);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,n;const r=null===(i=s.region)||void 0===i?void 0:i[t];null===(n=null==r?void 0:r.seriesIndexes)||void 0===n||n.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),s}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t,e,i){var n,s,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(n=t.animation)&&void 0!==n?n:null===(s=this._option.globalInstance)||void 0===s?void 0:s.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var n;return(null!==(n=t.region)&&void 0!==n?n:[]).map(((t,n)=>e(ak.getRegionInType("region"),{spec:t,specPath:["region",n],type:"region",regionIndexes:[n]},i)))}forEachSeriesInSpec(t,e,i){var n;return(null!==(n=t.series)&&void 0!==n?n:[]).map(((t,n)=>e(ak.getSeriesInType(t.type),{spec:t,specPath:["series",n],type:t.type,seriesIndexes:[n]},i)))}forEachComponentInSpec(t,e,i){var n,s,a;const o=[],l=ak.getComponents();let h,c,u,d;const p=[];for(let e=0;e0&&(g=!0,n.forEach((t=>{const n=ak.getComponentInKey(t.type);o.push(e(n,t,i))})))}if(c&&!g){const n=c.getSpecInfo(t,i);(null==n?void 0:n.length)>0&&(g=!0,n.forEach((t=>{const n=ak.getComponentInKey(t.type);o.push(e(n,t,i))})))}return u&&!g&&(null===(s=u.getSpecInfo(t,i))||void 0===s||s.forEach((t=>{o.push(e(u,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:n})=>{var s;null===(s=n.getSpecInfo?n.getSpecInfo(t,i):hM(t,n.specKey,n.type))||void 0===s||s.forEach((t=>{o.push(e(n,t,i))}))})),d&&(null===(a=hM(t,d.specKey,d.type))||void 0===a||a.forEach((t=>{o.push(e(d,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const n="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!n.includes(i.orient))return!1;if(p(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:n,barMinWidth:s,barWidth:r,barGapInGroup:a}=i;let o=!1;S(s)?(t.minBandSize=s,o=!0):S(r)?(t.minBandSize=r,o=!0):S(n)&&(t.minBandSize=n,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class VE extends zE{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:n}=i;let s=null;"top"!==n&&"bottom"!==n||(e.x=!0,s=this._setDefaultXAxisSpec(t)),"left"!==n&&"right"!==n||(e.y=!0,s=this._setDefaultYAxisSpec(t)),"z"===n&&(e.z=!0,s=this._setDefaultZAxisSpec(t)),s&&Object.keys(s).forEach((t=>{d(i[t])&&(i[t]=s[t])})),O(i,"trimPadding")&&rk(i,JT(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class WE extends VE{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),KT(t)}}const GE=(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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),n=i.some((t=>t.getStack()));if(!n)return;const s=i.some((t=>{var e,i,n,s;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(s=null===(n=t.getSpec())||void 0===n?void 0:n.totalLabel)||void 0===s?void 0:s.visible)})),r=s||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=rT(t,!0);for(const e in o)for(const i in o[e].nodes)hT(o[e].nodes[i],t.getStackInverse(),r,s);if(a)for(const t in o)for(const e in o[t].nodes)lT(o[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),n=t.getStackValueField();e&&n&&oT(o[i],n)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class XE{_beforeInit(){this._dataSet&&CT(this._dataSet,"stackSplit",GE)}_initStack(){this._stack=new YE(this),this._stack.init()}}const $E={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:rB.dimensionHover};class KE extends KC{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,n=i.getStatedGraphics(this);n&&n.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:n,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},$E,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),n=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=i.filter((e=>e.model===t.series&&e.getVisible()));s.forEach((i=>{const s=i.getGraphics();if(!s||!s.length)return;const r=s.filter((i=>{const n=fT(i);let s;return s=_(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s}));n.push(...r)}))}))})),n}}KE.type="dimension-hover",KE.defaultOptions=$E;const qE=()=>{ak.registerInteractionTrigger(KE.type,KE)},ZE=()=>{ak.registerComposedEvent(rB.dimensionHover,sB),ak.registerComposedEvent(rB.dimensionClick,JM)},JE=t=>t.fieldX[0],QE=t=>t.fieldY[0],tO=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},eO=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},iO=(t,e)=>t?e?JE:tO:e?QE:eO,nO=(t,e,i)=>{var n,s;if(!t)return null;const{x:r,y:a}=e,o=null!==(n=nB(t,(t=>GM(t.getOrient())),e))&&void 0!==n?n:[],l=null!==(s=nB(t,(t=>YM(t.getOrient())),e))&&void 0!==s?s:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,u=new Set;[o,l].forEach((t=>t.forEach((t=>{aS(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&u.add(t)}))));const d=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(u.size>0){if(u.has(t)){const n=sO(t,i,iO(e,aS(t.getScale().type)));n&&d.push(n)}}else{const n=h.size>0;if((n?h:c).has(t)){const s=sO(t,i,iO(e,n));s&&d.push(s)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===d.length&&p("x")):(p("x"),0===d.length&&p("y")),d.length?d:null},sO=(t,e,i)=>{const n=t.positionToData(e,!0);return d(n)?null:rO(t,n,i)},rO=(t,e,i)=>{const n=t.getScale();if(d(e))return null;let s=n.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));s<0&&(s=void 0);const r=eB(e,t,"cartesian",null!=i?i:GM(t.getOrient())?JE:QE);return{index:s,value:e,position:n.scale(e),axis:t,data:r}},aO=(t,e,i,n=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((s=>{var r,a,o,l,h,c;const{currentValue:u,cacheInfo:d,labelsComp:g,attributes:f,coordKey:m}=t[s];let v=null,y=0,_=null;if(u.size){const t=Array.from(u.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!u.size&&Number.isFinite(y)&&!Number.isNaN(y),x=n&&!b&&p(d),S=x?d:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let w=0;if(f&&u.forEach((({axis:t,datum:i=""})=>{var n,r,a,o,l,h,c,u,d,p;let g=null;const m=t.getScale();if(aS(m.type))A=m.bandwidth(),0===A&&m.step&&(w=m.step());else if(sS(m.type)){const n="xField"===s?e.fieldX[0]:e.fieldY[0],r="xField"===s?e.fieldX2:e.fieldY2,a=function(t,e,i,n){for(let s=0,r=t.length;s=e)return r}}return null}(e.getViewData().latestData,+i,n,r);if(a){const t="xField"===s?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===s?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[n]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(n=f.label)||void 0===n?void 0:n.visible)&&!x){const e=function(t){let e=0;return O(t,"tick.visible")&&(e+=O(t,"tick.tickSize")),O(t,"label.visible")&&(e+=O(t,"label.space")),e}(t.getSpec()),n=t.getOrient(),s=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[n]&&(S.labels[n].visible=!0,S.labels[n].text=i,"left"===n?(S.labels[n].dx=-e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:s&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===n?(S.labels[n].dx=e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:s&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===n?(S.labels[n].y=0,S.labels[n].dy=-e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:s&&_&&null!==(u=_.attribute.textBaseline)&&void 0!==u?u:"bottom"}):"bottom"===n&&(S.labels[n].dy=e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(d=_.attribute.textAlign)&&void 0!==d?d:"center",textBaseline:s&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[n].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};lO(t,u),"xField"===s?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&oO(S.labels[t],t,f.label)}))}t[s].bandSize=null!=A?A:0,t[s].offsetSize=w,t[s].cacheInfo=S})),t),oO=(t,e,i)=>{const{formatMethod:n,formatter:s}=i,{formatFunc:r,args:a}=lM(n,s,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},lO=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:n}=e.getLayoutStartPoint(),{width:s,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,n),t.x2=Math.max(t.x2,i+s),t.y2=Math.max(t.y2,n+r)}))}))},hO=t=>{const{cacheInfo:e,attributes:i,bandSize:n,offsetSize:s,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+n/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=cO(i,n,s,e.axis),{coordRange:u}=e;c={visible:!0,start:{[r]:Math.max(o+t,u[0]),[a]:l[0]},end:{[r]:Math.min(o+h,u[1]),[a]:l[1]}}}return c},cO=(t,e,i,n)=>{var s,r,a;const o=0===e?i:e;let l=o;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=n.getLayoutRect();l=t.style.size(e,n)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},uO=(t,e)=>{var i;const n=new Map,s=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?s:n).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:n,attributes:{visible:!!n.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:s,attributes:{visible:!!s.size,type:"rect"}}};return aO(c,r,e),c.xField.cacheInfo?hO(c.xField):c.yField.cacheInfo?hO(c.yField):void 0},dO=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],pO=(t,e,i,n,s)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&dO.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,n,n[0].datum,s)))}break;case"dimension":if(null==n?void 0:n.length){if(gO(n).every((t=>{var e;return!pM("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return n.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,n,r.datum,s);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},gO=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},fO={dom:`${Bk}_TOOLTIP_HANDLER_DOM`,canvas:`${Bk}_TOOLTIP_HANDLER_CANVAS`},mO={key:"其他",value:"..."};var vO;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(vO||(vO={}));class yO{constructor(e){this._showTooltipByHandler=(e,i)=>{var n,s,r;if(d(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(d(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=d(null==o?void 0:o.key)&&d(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(n=a.handler)||void 0===n?void 0:n.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,n,s,r,a,o,l,h,c;const{changePositionOnly:u,model:g}=e;if(!u||!this._cacheActiveSpec){const u=this.component.getSpec();if(this._cacheActiveSpec=pO(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&p(u.handler)&&(this._cacheActiveSpec.handler=u.handler);const g=null!==(i=u[this.activeType])&&void 0!==i?i:{},f=null!==(n=this._cacheActiveSpec.updateTitle)&&void 0!==n?n:g.updateTitle,m=null!==(s=this._cacheActiveSpec.updateContent)&&void 0!==s?s:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},mO),t):mO;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,n;return!!this.component.enable&&(!d(e)&&pM(this.activeType,null===(n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===n?void 0:n.spec))}clearCache(){this._cacheActiveSpec=void 0}}class _O extends yO{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const n=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,n)}_getDimensionInfo(t){var e,i,n;let s;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),s=null!==(n=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==n?n:[],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!aS(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(p(n))break}return p(n)&&n.getDimensionField()[0]===n.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const bO=()=>{ak.registerTooltipProcessor("dimension",_O)};class xO extends yO{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var n,s,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,u=null===(n=o.getSpec())||void 0===n?void 0:n.tooltip,d=null===(s=null==u?void 0:u.mark)||void 0===s?void 0:s.checkOverlap;let p=!1;if(!0===d||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==d){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),n={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},n),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(n.x,n.y,yn.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(fT(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,n;const s=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===s){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.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(n=!0)}else if("component"===s){const e=t.model,s=t.node;if("label"===e.name&&s){const t=e.getLabelInfoByTextGraphic(s),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:s.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(n=!0)}}return{tooltipInfo:i,ignore:n}}}const SO=()=>{ak.registerTooltipProcessor("mark",xO)};class AO extends yO{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:G(n),series:s}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let 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.group;if(null==r?void 0:r.has(t.mark)){const s=this.component.getSpec()[this.activeType];((null==s?void 0:s.triggerMark)?G(s.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(n={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:n,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:n}=t,s=e;if(["line","area"].includes(i.type))return G(n);const r=s.getViewData().latestData,a=s.getSeriesField();if(!a)return r;const o=G(n)[0][a];return r.filter((t=>t[a]===o))}}const wO=()=>{ak.registerTooltipProcessor("group",AO)};class kO extends UE{constructor(){super(...arguments),this.transformerConstructor=WE,this.type="line",this.seriesType=ww.line}_setModelOption(){this._modelOption.getDimensionInfo=nO,this._modelOption.getDimensionInfoByValue=rO,this._modelOption.getRectByDimensionData=uO}}kO.type="line",kO.seriesType=ww.line,kO.transformerConstructor=WE,W(kO,XE);function TO(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 CO=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:TO(t,e)}),MO=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:TO(t,e)}),BO={type:"fadeIn"},EO={type:"growCenterIn"};function OO(t,e){if(!1===e)return{};switch(e){case"fadeIn":return BO;case"scaleIn":return EO;default:return CO(t)}}class RO extends PC{constructor(){super(...arguments),this.type=RO.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}RO.type="rect";const PO=()=>{w_(),b_(),LA("rect",UA),ak.registerMark(RO.type,RO),Kb.registerBuiltInAnimate("growHeightIn",Bx),Kb.registerBuiltInAnimate("growHeightOut",Ex),Kb.registerBuiltInAnimate("growWidthIn",Yx),Kb.registerBuiltInAnimate("growWidthOut",Xx),Kb.registerBuiltInAnimate("growCenterIn",Tx),Kb.registerBuiltInAnimate("growCenterOut",Cx),ak.registerGraphicComponent("rect",ec)},IO=Object.assign(Object.assign({},wM),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function LO(t,e,i){var n,s;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,n]=[t,e].sort(((t,e)=>t-e));const s=n-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,n=n-t}const r=n-i,a=Zw(this._spec.barMinWidth||2,s);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[kM]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):Uw(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[TM]):Uw(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const n=Uw(this._dataToPosX(t),e,i),s=Uw(this._dataToPosX1(t),e,i);return this._getLinearBarRange(n,s)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[CM]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):Uw(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[MM]):Uw(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const n=Uw(this._dataToPosY(t),e,i),s=Uw(this._dataToPosY1(t),e,i);return this._getLinearBarRange(n,s)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},jO.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:DM(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(jO.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const n=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let s;if(CT(this._option.dataSet,"addVChartProperty",cM),n){const t=([t],{scaleDepth:e})=>{var i,n;let s=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[n,s]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[n]}-${t[s]}`;r[e]||(r[e]={[n]:t[n],[s]:t[s]},i.push(r[e]))})),i};CT(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();s=new si(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:SM.bind(this),call:AM}},!1),null==e||e.target.addListener("change",s.reRunAllTransform)}this._barBackgroundViewData=new MC(this._option,s)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,n,s,r,a;e._bar_series_position_calculated=!0,t?(i=MM,n=CM,s="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=TM,n=kM,s="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=rT(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)LO(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:n,startMethod:s,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var n,s;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(s=(n=this[o]).getScale)||void 0===s?void 0:s.call(n,0),h=this[o].isInverse(),c=this._spec.barMinHeight,u=Uw(this[r](t),l,i),d=Uw(this[a](t),l,i);let p=Math.abs(u-d);p<=0&&!Hw(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,n;if(!this._spec.stackCornerRadius)return;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),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let n=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,d=1/0,g=-1/0;i.values.forEach((e=>{const i=e[jk],s=e[Nk],r=e[Uk],u=e[Hk];if(n=Math.min(n,i,s),o=Math.max(o,i,s),t){const t=e[a?CM:kM],i=e[a?MM:TM];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(u)&&(c=!0,d=Math.min(d,r,u),g=Math.max(g,r,u))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[jk]:n,[Nk]:o}),c?{[Uk]:d,[Hk]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,s),x1:t?h:this._getBarXEnd(f,s),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(ec(Object.assign(Object.assign({},m),{cornerRadius:u(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,n,s;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(s=null===(n=this._yAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>Uw(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>Uw(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,n,s,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(s=null===(n=this._yAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=d(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),n=X(t);return n<0?e.scale(n):i>0?e.scale(i):e.scale(0)}}},n=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,s=VM(this);this._barMark.setAnimationConfig(RM(null===(e=ak.getAnimationInKey("bar"))||void 0===e?void 0:e(i,n),PM(this._barMarkName,this._spec,this._markAttributeContext),s))}_getBarWidth(t,e){var i,n;const s=this._groups?this._groups.fields.length:1,r=d(e)?s:Math.min(s,e),a=null!==(n=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==n?n:6,o=p(this._spec.barWidth)&&r===s,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=Zw(this._spec.barWidth,a)),l&&(c=Math.max(c,Zw(this._spec.barMinWidth,a))),h&&(c=Math.min(c,Zw(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,n){var s,r,a,o,l;let h,c,u;"horizontal"===t?(h=this.getYAxisHelper(),c="height",u="barBackground"===n?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",u="barBackground"===n?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(i)?f:Math.min(f,i),v=null!==(r=null===(s=h.getBandwidth)||void 0===s?void 0:s.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(this._spec.barGapInGroup);let n=0,s=0;for(let r=t.length-1;r>=1;r--){const c=t[r],u=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],d=u.length,p=Zw(null!==(l=i[r-1])&&void 0!==l?l:Y(i),v),g=u.indexOf(e[c]);r===t.length-1?(n+=d*y+(d-1)*p,s+=g*(y+p)):(s+=g*(n+p),n+=n+(d-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-n/2+s}const _=sS(g.type||"band");return u(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,n=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,n;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(n=this._barBackgroundViewData)||void 0===n||n.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}jO.type=ww.bar,jO.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},jO.mark=IO,jO.transformerConstructor=FO;const NO=()=>{LE(),PO(),ak.registerAnimation("bar",((t,e)=>({appear:OO(t,e),enter:CO(t,!1),exit:MO(t,!1),disappear:{duration:zC.disappear.duration}}))),_E(),vE(),ak.registerSeries(jO.type,jO)};class UO extends VE{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),KT(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const n=t.series.some((t=>"horizontal"===t.direction)),s=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(n?["left","right"]:["top","bottom"]).includes(t.orient)));if(s&&!s.bandSize&&!s.maxBandSize&&!s.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:n,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(s,e,{barMaxWidth:n,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class HO extends UE{constructor(){super(...arguments),this.transformerConstructor=UO,this.type="bar",this.seriesType=ww.bar}_setModelOption(){this._modelOption.getDimensionInfo=nO,this._modelOption.getDimensionInfoByValue=rO,this._modelOption.getRectByDimensionData=uO}}HO.type="bar",HO.seriesType=ww.bar,HO.transformerConstructor=UO,W(HO,XE);const zO=[...cB,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class VO extends uB{constructor(){super(...arguments),this.type=VO.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return zO}_getIgnoreAttributes(){return[]}}VO.type="area";class WO extends vM{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var n,s,r,a;for(const i of G(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")),p(e))return e}return i}}}const GO=Object.assign(Object.assign(Object.assign({},wM),aB),{area:{name:"area",type:"area"}}),YO=()=>{ak.registerAnimation("area",GC),YC(),WC()};class XO extends mB{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,n;const s=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(n=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===n?void 0:n.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!s||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var n,s,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,u=!1!==l.visible&&!1!==(null===(n=l.style)||void 0===n?void 0:n.visible),d=!1!==h.visible&&!1!==(null===(s=h.style)||void 0===s?void 0:s.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||d&&!u)&&(g=h,f=l),l.style=rk({},f.style,g.style),l.state=rk({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class $O extends WM{constructor(){super(...arguments),this.type=ww.area,this.transformerConstructor=XO,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark($O.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,n,s,r;const a=null!==(n=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==n?n:null===(r=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===r?void 0:r.curveType,o=a===sM?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return Uw(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return Uw(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[Nk]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,n;const s={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(RM(null===(e=ak.getAnimationInKey("line"))||void 0===e?void 0:e(s,r),PM("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(RM(null===(i=ak.getAnimationInKey("area"))||void 0===i?void 0:i(s,r),PM("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=VM(this);this._symbolMark.setAnimationConfig(RM(null===(n=ak.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),PM("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new WO(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,n,s,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}$O.type=ww.area,$O.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},$O.mark=GO,$O.transformerConstructor=XO,W($O,oB);const KO=()=>{LE(),TE(),pB(),ak.registerMark(VO.type,VO),w_(),c_(),VA(),jA(),XC(),ak.registerGraphicComponent("area",_c),fB(),YO(),_E(),vE(),ak.registerSeries($O.type,$O)};class qO extends VE{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),KT(t)}}class ZO extends UE{constructor(){super(...arguments),this.transformerConstructor=qO,this.type="area",this.seriesType=ww.area}_setModelOption(){this._modelOption.getDimensionInfo=nO,this._modelOption.getDimensionInfoByValue=rO,this._modelOption.getRectByDimensionData=uO}}ZO.type="area",ZO.seriesType=ww.area,ZO.transformerConstructor=qO,W(ZO,XE);class JO extends HM{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=.6,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const n=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:n,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};sS(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:[]};sS(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&zM(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function QO(t){return Kg(t)?Number.parseFloat(t):0}const tR=(t,e)=>{const{asStartAngle:i,asEndAngle:n,asMiddleAngle:s,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:u}=e,d=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&u&&eR(m,d,c))return[];const v=(t,e,a)=>{t[i]=e,t[n]=e+a,t[s]=e+a/2,t[r]=a,t[o]=Vt(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[d]))),S=g-p;let A=p,w=S,k=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const n=Math.pow(10,e),s=t.map((t=>(isNaN(t)?0:t)/i*n*100)),r=100*n,a=s.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=s.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/n))}(x);if(m.forEach(((t,e)=>{const i=t[PB],n=y?i/y:0;let s=n*S;s{v(e,p+i*t,t)}))}else{const t=w/k;A=p,m.forEach((e=>{const i=e[r]===f?f:e[PB]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][n]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},eR=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===QO(t[e])))||!i&&0===t.reduce(((t,i)=>t+QO(i[e])),0)));function iR(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const nR=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:iR(t,!0,DT.appear)}),sR={type:"fadeIn"},rR=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:iR(t,!0,DT.enter)}),aR=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:iR(t,!0,DT.exit)});function oR(t,e){if(!1===e)return{};switch(e){case"fadeIn":return sR;case"growRadius":return nR(Object.assign(Object.assign({},t),{growField:"radius"}));default:return nR(Object.assign(Object.assign({},t),{growField:"angle"}))}}class lR extends PC{constructor(t,e){super(t,e),this.type=hR.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",n)=>{var s;return n+(null!==(s=this.getAttribute("radiusOffset",e,i))&&void 0!==s?s:0)},this.computeCenter=(t,e,i="normal",n)=>Ut({x:0,y:0},this.getAttribute("centerOffset",e,i),e[jB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class hR extends lR{constructor(){super(...arguments),this.type=hR.type}}hR.type="arc";const cR=()=>{w_(),l_(),LA("arc",YA),Kb.registerBuiltInAnimate("growRadiusIn",Vx),Kb.registerBuiltInAnimate("growRadiusOut",Wx),Kb.registerBuiltInAnimate("growAngleIn",Ax),Kb.registerBuiltInAnimate("growAngleOut",kx),ak.registerGraphicComponent("arc",Sc),ak.registerMark(hR.type,hR)},uR=Object.assign(Object.assign({},wM),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class dR extends UM{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let n=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);n=rk({},this._theme,i,t);const s=(t,e)=>rk({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(n.label)?n.label=n.label.map((t=>s(t.position,t))):n.label=s(n.label.position,n.label)}return{spec:n,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:n,centerY:s}=t;return p(n)&&(i.centerX=n),p(s)&&(i.centerY=s),Object.keys(i).length>0?i:void 0}}const pR=`${Bk}_LABEL_VISIBLE`;class gR extends JO{constructor(){super(...arguments),this.transformerConstructor=dR,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:Yw(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:Yw(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=HB,this._endAngle=zB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[jB];if(d(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t);return Ut(this.computeCenter(t),(i+n)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,n,s,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,n=2*Math.PI;const s=p(t),r=p(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}}(p(this._spec.startAngle)?jt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?jt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?jt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(n=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==n&&n,this._showAllZero=null!==(s=this._spec.showAllZero)&&void 0!==s&&s,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;CT(this._dataSet,"pie",tR),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?jt(this._spec.minAngle):0,asStartAngle:LB,asEndAngle:DB,asRatio:IB,asMiddleAngle:jB,asRadian:UB,asQuadrant:NB,asK:FB,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new si(this._dataSet,{name:`${Bk}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new MC(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},gR.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:Ik,groupKey:this._seriesField,isSeriesMark:!0},{morph:DM(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return xw(LB)(t)}endAngleScale(t){return xw(DB)(t)}_computeLayoutRadius(){return((t,e,i,n)=>{const s=t();if(S(s))return s;if(u(s))return s(e(),i());const r=e();if("auto"===s&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=n();return zt(r,i(),t,e)}return Math.min(r.width/2,r.height/2)})((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:zw(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:zw(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const n=this._emptyArcMark;n&&this.setMarkStyle(n,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const n in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[n]),n,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:xw(pR).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,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}computeRadius(t,e){return this._computeLayoutRadius()*t*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const n=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];n.forEach((t=>{i[t]=!0}));const s=super._compareSpec(t,e,i);return t=null!=t?t:{},n.some((i=>t[i]!==e[i]))&&(s.reRender=!0,s.change=!0),s}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[jB];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const n=this.computeDatumRadius(t);return Ut(this.computeCenter(t),n,i)}initAnimation(){var t,e,i;const n={growFrom:(t,e,i)=>{var n,s;if(i===DT.appear)return this._startAngle;if(i===DT.disappear)return this._endAngle;const r=[DT.disappear,DT.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[Pk];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Pk]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Pk])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Pk])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Ut({x:0,y:0},a,e[jB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Ut({x:0,y:0},a,e[jB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Ut({x:0,y:0},a,e[jB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Ut({x:0,y:0},a,e[jB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=RM(null===(i=ak.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(n,null!=s?s:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}gR.transformerConstructor=dR,gR.mark=uR,gR.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class fR extends gR{constructor(){super(...arguments),this.type=ww.pie}}fR.type=ww.pie;const mR=()=>{cR(),ak.registerAnimation("pie",((t,e)=>({appear:oR(t,e),enter:rR(t),exit:aR(t),disappear:{duration:zC.disappear.duration}}))),ak.registerAnimation("emptyCircle",((t,e)=>({appear:oR(t,e)}))),ak.registerSeries(fR.type,fR)};class vR extends zE{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,n;const s=G(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 p(r)&&s.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),s}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class yR extends vR{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class _R extends UE{constructor(){super(...arguments),this.transformerConstructor=yR}}_R.transformerConstructor=yR;class bR extends _R{constructor(){super(...arguments),this.transformerConstructor=yR,this.type="pie",this.seriesType=ww.pie}}bR.type="pie",bR.seriesType=ww.pie,bR.transformerConstructor=yR;class xR extends zE{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var n;if("bar"===e.type){const s=this._findBandAxisBySeries(e,i,t.axes);if(s&&!s.bandSize&&!s.maxBandSize&&!s.minBandSize){const t=g(e.autoBandSize)&&null!==(n=e.autoBandSize.extend)&&void 0!==n?n:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(s,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{O(e,"trimPadding")&&rk(e,JT(this.type,t))})),this._transformAxisSpec(t)}}const SR=(t,e)=>{if(!t)return null;const i=nB(t,(t=>"angle"===t.getOrient()),e),n=nB(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||n&&n.length))return null;const s=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&aS(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=yw({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,n=$(e),s=X(e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(p,h);const g=_w(u),f=null===(e=n[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=eB(v,t,"polar",r);s.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),n&&n.forEach((t=>{var e;const n=t.getScale(),l=null==n?void 0:n.range();if(n&&aS(n.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=yw({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=_w(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=n.invert(p);if(d(m))return;let v=n.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=eB(m,t,"polar",r);s.push({index:v,value:m,position:n.scale(m),axis:t,data:y})}})),s.length?s:null};class AR extends UE{constructor(){super(...arguments),this.transformerConstructor=xR,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var n,s;return[...null!==(n=nO(t,e,i))&&void 0!==n?n:[],...null!==(s=SR(t,e))&&void 0!==s?s:[]]},this._modelOption.getDimensionInfoByValue=rO,this._modelOption.getRectByDimensionData=uO}}AR.type="common",AR.transformerConstructor=xR,W(AR,XE);const wR={rect:ER,symbol:MR,arc:RR,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=MR(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:function(t,e,i){const n=t.series,s=t.labelSpec||{},r=n.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=s.position||"withChange",o=s.offset||0,l=e?e(r.data):r.data,h=TR(t,l,s.formatMethod);return h.x=function(t,e,i,n){if("horizontal"===e.direction)return"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+n:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-n:e.totalPositionX(t,"end")+(t.end>=t.start?n:-n);return e.totalPositionX(t,"index",.5)}(l,n,a,o),h.y=function(t,e,i,n){if("horizontal"===e.direction)return e.totalPositionY(t,"index",.5);if("middle"===i)return.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start"));if("max"===i)return e.totalPositionY(t,t.end>=t.start?"end":"start")-n;if("min"===i)return e.totalPositionY(t,t.end>=t.start?"start":"end")+n;return e.totalPositionY(t,"end")+(t.end>=t.start?-n:n)}(l,n,a,o),"horizontal"===n.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Gh(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const s=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[n.getDimensionField()[0]])}));s&&(s.data=i,e.push(s))})),e},overlap:{strategy:[]}}},line:PR,area:PR,rect3d:ER,arc3d:RR,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,n)=>{for(let s=0;s"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function kR(t,e){var i;const{labelSpec:n}=e;n.overlap&&!g(n.overlap)&&(n.overlap={});const s=null!==(i=wR[t])&&void 0!==i?i:wR.point;return e.series.type===ww.sankey?function(t){var e,i,n;const{series:s,labelSpec:r={}}=t,a=null!==(e=CR(r.position))&&void 0!==e?e:"outside",o=s.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(n=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==n?n:IR(s)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):s(e)}function TR(t,e,i,n){var s,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(s=h.text)&&void 0!==s?s:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==ww.sankey){const{formatFunc:t,args:s}=lM(i,n,h.text,e);t&&(h._originText=h.text,h.text=t(...s,{series:o}))}return h}function CR(t){return u(t)?e=>t(e.data):t}function MR(t){var e,i,n;const{series:s,labelSpec:r}=t,a="horizontal"===s.direction?"right":"top",o=null!==(e=CR(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(n=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==n?n:BR(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function BR(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function ER(t){var e,i,n,s,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=CR(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",u="horizontal"===o.direction?null===(n=o.getXAxisHelper())||void 0===n?void 0:n.isInverse():null===(s=o.getYAxisHelper())||void 0===s?void 0:s.isInverse();let d,p=h;p=t=>{var e;const{data:i}=t,n=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===n){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},n=(null==i?void 0:i[t])>=0&&u||(null==i?void 0:i[t])<0&&!u?1:0;return e[c][n]}return n},d=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:OR(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:d,smartInvert:g}}function OR(t){return[{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"]}}]}function RR(t){var e;const{labelSpec:i}=t,n=null!==(e=CR(i.position))&&void 0!==e?e:"outside",s=n;let r;return r=i.smartInvert?i.smartInvert:y(n)&&n.includes("inside"),{position:s,smartInvert:r}}function PR(t){var e,i,n,s;const{labelSpec:r,series:a}=t,o=null===(n=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===n?void 0:n.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[Lk]:a.getSeriesKeys()[0]}];return{position:null!==(s=r.position)&&void 0!==s?s:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function IR(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class LR extends XB{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover: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}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,z(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:n})=>{const s=i(),r=Rw({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=n(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:s}=t.context;s!==iC.exit&&e.forEach(((t,{})=>{const e=n(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},s)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:s}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}LR.type=r.label;class DR extends PC{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=DR.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const n=super._transformGraphicAttributes(t,e,i),{text:s}=n;return g(s)&&p(s.text)&&("rich"===this._textType||"rich"===s.type)&&(n.textConfig=s.text),n}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?pc(t):Gh(t)}}DR.type="text";class FR extends DR{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}FR.type="text",FR.constructorType="label";const jR=()=>{ak.registerMark(DR.type,DR),w_(),M_(),S_(),ak.registerGraphicComponent("text",Gh),ak.registerGraphicComponent("richtext",pc),ak.registerMark(FR.constructorType,FR)};class NR extends YB{_initTheme(t,e){return{spec:t,theme:this._theme}}}class UR extends LR{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=NR,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],n=(null==e?void 0:e.region)||[];return n.forEach(((n,s)=>{(n.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:n={}}=i;return Object.values(n).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,s],regionIndexes:[s]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(yT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(yT.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),bw(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),n=t.getRegion();this._labelInfoMap.get(n)||this._labelInfoMap.set(n,[]);for(let s=0;s{var s,o,l;if(e.visible){const h=this._labelInfoMap.get(n),c=this._createMark({type:"label",name:`${null!==(s=t.userId)&&void 0!==s?s:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let n=!1;const s=`${i.getGroupMark().name}-label-component`;let r=t[s];r||(n=!0,r=this._createMark({type:"component",name:s},{componentType:"label"},{support3d:this._spec.support3d})),r&&(n&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[s]=null)}else e.forEach(((e,n)=>{var s;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(s=e.baseMark.getData())||void 0===s||s.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[n])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,n;const{labelMark:s,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(s,r),u(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,s,r)}(null===(n=null===(i=s.stateStyle)||void 0===i?void 0:i.normal)||void 0===n?void 0:n.lineWidth)&&s.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const n=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,s;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),u=null!==(s=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==s?s:0;let d=rk({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:n.map((t=>t.getMarks()[0].getProductId()))}},kR(h,r),Object.assign(Object.assign(Object.assign({},N(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:u}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[Xk])):t=>t.filter((t=>t.data[Yk]))}:{});return l&&l.parseLabelStyle&&(d=l.parseLabelStyle(d,a,o)),"line"!==h&&"area"!==h||(d.type=h),d},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?TR(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,n=null==i?void 0:i.parent;if(n){const t=n.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,s)=>{s.getComponent()===n&&(e=G(i())[t])}))}return e}}UR.type=r.label,UR.specKey="label",UR.transformerConstructor=NR;var HR;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(HR||(HR={}));const zR={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class VR extends XB{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=ft((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:n}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,n,e,t.activeType);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let n=!1;if(t.forEach((t=>{aS(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!this.enable)return!1;const{currentValue:s}=this._stateByField[i];return t.forEach(((t,i)=>{const n=t.axis;s.set(i,{datum:this._getDatumAtPoint(n,e),axis:n})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:n}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:n}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:n=0,datum:s}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===n));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(n,{axis:r,datum:s}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||z(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var n;if(!1===(null===(n=this._option.componentShowContent)||void 0===n?void 0:n.crosshair))return;const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:ST.chart}:{source:xT.chart};_(t)?t.forEach((t=>{this.event.on(t,r,s)})):this.event.on(t,r,s)}_eventOff(t,e,i){const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,n)})):this.event.off(t,n)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),n={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},n),{x:n.x-this.getLayoutStartPoint().x,y:n.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Gg(e)||Yg(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=G(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const n=[];return t.forEach((t=>{n.push({click:"click"===t,in:i[t],out:e(t)})})),n}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:xT.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:xT.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:xT.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const n=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==n?void 0:n.length))return null;let s=O(this._spec,`${t}Field.bindingAxesIndex`);if(s||(s=[],n.forEach(((e,i)=>{zR[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:u}=this.getLayoutStartPoint();return s.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const s=n.find((e=>e.getSpecIndex()===t));if(!s)return;const d=(null===(i=(e=s).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};s.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+d.left),o=Math.min(o,i-u+d.top),l=Math.max(l,e+t.getLayoutRect().width-c-d.right),h=Math.max(h,i+t.getLayoutRect().height-u-d.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:s})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:n}=this._stateByField[t].attributes,s="rect"===n?"rectStyle":"lineStyle";i.setAttributes({[s]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:n}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==n&&(this.gridZIndex=n)}_parseField(t,i){var n,s,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:u,fillOpacity:d,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?u:d;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=O(o,"width",h||2);else{a.style.fill=l||r,(null===(s=null===(n=null==t?void 0:t.line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.stroke)&&(a.style.stroke=t.line.style.stroke);const e=O(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,n=l.style||{},s=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:u}=s,d=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},n),{fill:n.fill||"#fff",stroke:O(n,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},u)},d):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((n=>{const s=n.axis;var r,a,o;if(a=e,o=i,((r=n).x1>a||r.x2o||r.y2a||os&&(d=s-l),h>r&&(p=r-h),d&&t.setAttribute("dx",d+c),p&&t.setAttribute("dy",p+u)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:n}=this._stateByField[e];return i&&t.push(i),n&&Object.keys(n).forEach((e=>{n[e]&&t.push(n[e])})),t}),[])}}VR.specKey="crosshair";const WR={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class GR extends VR{static getSpecInfo(t){return hM(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}_getDatumAtPoint(t,e){const i=GM(t.getOrient())?"x":"y",n=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(n)}setAxisValue(t,e){GM(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,n){var s;let r=t,a=e;if(i&&i.length)if("dimension"===n){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let n;if(e>-1){const i=t.data[e];n=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:YM(null===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.getOrient()))?a=null==n?void 0:n.y:r=null==n?void 0:n.x}else if("mark"===n){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=((t,e)=>{for(let i=0;i{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:n,bandSize:s,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=hO(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,u,d;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+s/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(u=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==u?u:0,textStyle:Object.assign(Object.assign({},null===(d=i.label)||void 0===d?void 0:d.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(n[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,n[l]=e}))}else n[l]&&n[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:n}=this._stateByField[t];let{crosshairComp:s}=this._stateByField[t];if(s)s.setAttributes(e);else{const r=n.style;"line"===n.type?s=new ob(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===n.type&&(s=new lb(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(s),this._stateByField[t].crosshairComp=s}}}GR.specKey="crosshair",GR.builtInTheme={crosshair:WR},GR.type=r.cartesianCrosshair;const YR=(t,e)=>p(e)?t.map((t=>e[t])):void 0,XR=(t,e)=>i=>t.every(((t,n)=>i[t]===(null==e?void 0:e[n]))),$R=t=>!d(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function KR(t,e,i){var n,s,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),u=i.getOption(),g=u.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=qR(t,g),m=null!==(n=c.activeType)&&void 0!==n?n:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=u.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:n,measureFields:s,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>XR(i,n)(t)&&XR(s,r)(t)&&(d(a)||XR([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const n=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),s=null!==(e=c.x)&&void 0!==e?e:v.x+n.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+n.y,a={x:0,y:0};S.transformPoint({x:s,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const n=new Map;f.forEach((t=>{var e;n.has(t.series)||n.set(t.series,[]),null===(e=n.get(t.series))||void 0===e||e.push(t)}));const l=[{value:t[e.data.dimensionFields[0]],data:[...n.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=n.get(t))||void 0===e?void 0:e.map((t=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(s=u.globalInstance.getChart())&&void 0!==s?s:void 0,datum:void 0,model:void 0,source:xT.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=u.globalInstance;return nM.globalConfig.uniqueTooltip&&nM.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const n=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),s=[{datum:[n],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:n[e.data.dimensionFields[0]],data:s}],chart:null!==(h=u.globalInstance.getChart())&&void 0!==h?h:void 0,datum:n,model:e.series,source:xT.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:n,mark:null,series:e.series},r,!1);const a=u.globalInstance;return nM.globalConfig.uniqueTooltip&&nM.hideTooltip(a.id),m}return"none"}const qR=(t,e)=>{const i=e.getSeries(),n=[];return i.forEach((e=>{var i,s,r,a,o,l,h;const c=e.getDimensionField(),u=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(s=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=YR(c,t);let y=YR(u,t);const _=$R(y),b=!_&&p(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(XR(c,v));if(!_&&(y=YR(u,i),!$R(y)))return;const s=e.type===ww.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(s)||isNaN(s.x)||isNaN(s.y)||n.push({pos:s,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=aS(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",s=c.map(((t,e)=>[t,e])).filter((([,t])=>d(null==v?void 0:v[t])));let r=[null!=v?v:[]];s.length>0&&s.forEach((([t,i])=>{var n,s,a,o;const l=null!==(o=null===(a=null===(s=null===(n=e.getViewDataStatistics)||void 0===n?void 0:n.call(e))||void 0===s?void 0:s.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var n;const s=null!==(n=null==t?void 0:t.slice())&&void 0!==n?n:[];s[i]=e,h.push(s)}))})),r=h})),r.forEach((s=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(XR(c,s));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=YR(u,o),!$R(y))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||n.push({pos:l,data:{dimensionFields:c,dimensionData:s,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(XR(c,s));if(!_&&(y=YR(u,r),!$R(y)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;n.push({pos:o,data:{dimensionFields:c,dimensionData:s,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===ww.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(XR(c,v))).find((t=>t[g]===f));m.forEach((s=>{if(y=YR(u,i),!$R(y))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||n.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:s},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,s,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(XR(c,v));const o=e.getNameMap(),l=null===(r=null===(s=e.getMapViewData)||void 0===s?void 0:s.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=YR(u,a),h=y,!$R(y)&&!a)return;$R(y)||(y=[null])}const p=e.dataToPosition(a);d(p)||isNaN(p.x)||isNaN(p.y)||n.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),n},ZR=t=>p(t)&&!_(t),JR=t=>p(t)&&_(t),QR=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class tP extends YB{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:n}=super._initTheme(t,e),s=rk({},...QR.map((t=>void 0!==(null==n?void 0:n[t])?{[t]:n[t]}:void 0)),null==n?void 0:n.style),r=rk({},n);QR.forEach((t=>{delete r[t]})),delete r.style;const a=rk({},r,i);return a.style=rk({},s,a.style),{spec:a,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var n,s,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(n=t.visible)||void 0===n||n,t.activeType=(t=>{var e,i,n;if(!1===(null==t?void 0:t.visible))return[];const s={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(n=null==t?void 0:t.group)||void 0===n?void 0:n.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(s).forEach((e=>{var i;s[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(s).filter((t=>s[t]))})(t),t.renderMode=null!==(s=t.renderMode)&&void 0!==s?s:Yg(this._option.mode)||!Wg(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=Op.getElementById(t.parentElement)):Wg(this._option.mode)&&(t.parentElement=null==Vg?void 0:Vg.body)}}const eP={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class iP extends XB{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=tP,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,n,s,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i)))return;const o=Wg(null===(s=this._option)||void 0===s?void 0:s.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,n,s,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(s=this._spec)||void 0===s?void 0:s.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:n},ignore:{mark:s}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let n=0,s=a.length;n!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(s&&ZR(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(n)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(n)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,n,s)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),s)o=!a.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],s=this._isSameAsCache(n,i,t);o=!a.showTooltip(n,i,s),o&&(this._cacheInfo=n,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,n&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&nM.globalConfig.uniqueTooltip&&l&&nM.hideTooltip(l.id),o},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=e=>{var i,n,s;if(!this._isTooltipShown&&!(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:xT.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:xT.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const n=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",s=this._option.globalInstance.getTooltipHandlerByUser();if(s)this.tooltipHandler=s,this._enterable=!1;else{const t="canvas"===n?fO.canvas:fO.dom,s=ak.getComponentPluginInType(t);s||Ug("Can not find tooltip handler: "+t);const r=new s;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===n&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,n;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const s=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);s&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===s[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(n=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==n?n:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=ak.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),n=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(Gg(n)||Yg(n))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,ft(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,n;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",s=this._spec.enterable&&"html"===t;s&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=s,null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===n||n.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const n=KR(t,e,this);return"none"!==n&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=n),n}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(JR(t)){if(ZR(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>QM(t,e[i])))}if(JR(this._cacheInfo))return!1;const n=this._cacheInfo;if(!((null==t?void 0:t.datum)===n.datum&&(null==t?void 0:t.mark)===n.mark&&(null==t?void 0:t.series)===n.series))return!1;const s=this._cacheParams;return!d(s)&&!d(e)&&(s.mark===e.mark&&s.model===e.model&&s.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:n,y:s}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return n>=a&&n<=a+l&&s>=o&&s<=o+h}getVisible(){return!1!==this._spec.visible}}iP.type=r.tooltip,iP.transformerConstructor=tP,iP.builtInTheme={tooltip:eP},iP.specKey="tooltip";function nP(t,i){const n=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:s={},item:r={},pager:a={},background:o={}}=t;s=I(s),r=I(r),a=I(a),o=I(o);const l=n;return s.visible?l.title=function(t){var e,i;const n=Object.assign({},t);return E(t.style)||(n.textStyle=pT(t.style)),E(t.textStyle)||rk(n.textStyle,pT(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&pT(n.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&pT(n.background.style),n}(s):l.title={visible:!1},E(r.focusIconStyle)||pT(r.focusIconStyle),r.shape&&(r.shape=uT(r.shape)),r.label&&(r.label=uT(r.label)),r.value&&(r.value=uT(r.value)),r.background&&(r.background=uT(r.background)),Ww(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),Ww(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),Ww(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(E(a.railStyle)||pT(a.railStyle),E(a.sliderStyle)||pT(a.sliderStyle)):(E(a.textStyle)||pT(a.textStyle),a.handler&&uT(a.handler)),l.pager=a,o.visible&&!E(o.style)&&(rk(l,o.style),p(o.padding)&&(l.padding=o.padding)),l}const sP=(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},rP=(t,e)=>{var i,n,s;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),u=l();if(0===c.length&&u.length)return[];if(c.length===u.length)return t;const d={};c.forEach((t=>{d[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:Lk;return h?h(t,c,g):(_(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])))):p(g)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,g)]))),t)};class aP extends XB{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{bw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),bw(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=Vw(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;p(n)&&(this._seriesUserId=G(n)),p(e)&&(this._regionUserId=G(e)),p(s)&&(this._seriesIndex=G(s)),p(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(z(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new MC(this._option,e),this._initSelectedData(),bw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,n,s;const r=this._selectedData;d(e)||JSON.stringify(r)===JSON.stringify(e)||(bw(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(n=(i=this.effect).onSelectedDataChange)||void 0===n||n.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(n.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(rk({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(rk({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:n,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(n-s)/2:"end"===i&&(o=n-s):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+s,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());z(t,this._cacheAttrs)||this._legendComponent.setAttributes(rk({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}aP.specKey="legends";class oP extends aP{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return hM(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),bw(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){CT(this._option.dataSet,"discreteLegendFilter",rP),CT(this._option.dataSet,"discreteLegendDataMake",sP);const t=new si(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return bw(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,n;const s=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return s;if(!t.getRawData())return s;const a=this._option.globalScale.getScaleSpec(r);if(!a)return s;if(this._spec.field)return this._spec.field;if(!qg(a.domain))return s;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(n=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==n?n:s}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return u(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(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=sT(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},nP(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return uw}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(aw.legendItemClick,(i=>{const n=O(i,"detail.currentSelected");e&&this.setSelectedData(n),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:n,event:i})})),this._legendComponent.addEventListener(aw.legendItemHover,(e=>{const i=O(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(aw.legendItemUnHover,(e=>{const i=O(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const n=t.style("fillOpacity"),s=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(n)?n:1,strokeOpacity:A(s)?s:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return u(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,n,s;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(s=null===(n=this._spec.item)||void 0===n?void 0:n.value)&&void 0!==s?s:{},{formatFunc:h}=lM(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=lM(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}oP.specKey="legends",oP.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},oP.type=r.discreteLegend;const lP="vchart-tooltip",hP=`${lP}-container`,cP=`${lP}-title`,uP=`${lP}-content-box`,dP={offsetX:10,offsetY:10},pP="99999999999999";function gP(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const fP=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,mP=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?gP(t):"",vP=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(u(t)){const n=t(e);S(n)&&(i=n)}return i},yP={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},_P=(t,e,i=2)=>{var n,s;return null!==(s=null===(n=yP[t])||void 0===n?void 0:n["x"===e?0:1])&&void 0!==s?s:i};class bP extends wB{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:n}=i;return n?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,n,s,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const u=h.activeType;if(h.handler)return null!==(s=null===(n=(i=h.handler).showTooltip)||void 0===n?void 0:n.call(i,u,e,t))&&void 0!==s?s:0;const d=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[u])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==d?void 0:d.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var n,s,r,a,o,l,h,c,d;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(s=null===(n=b[0])||void 0===n?void 0:n.data)||void 0===s?void 0:s[0]:null==b?void 0:b[0],{offsetX:w,offsetY:k}=this._option,T=m[_],C=dM(null==T?void 0:T.position,b,e),M=null!==(r=dM(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},O="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),P=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:Ek,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:Ok;let L=!1;const D={width:0,height:0};let F,j={x:0,y:0},N={x:0,y:0},U=1,H=1;const z=Wg(this._env);if(z&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=P,D.height=I),z&&!O){const t=this._getParentElement(m);N=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(d=this._compiler.getCanvas())&&void 0!==d?d:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),j={x:F.x-N.x,y:F.y-N.y},U=fP(e,F),H=fP(t,N)}const V=H/U,W={},G={x:C,y:C},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:n},s)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=n?n:"x"===s?w:k;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===s?i.x1:i.y1)+h[s],o=("x"===s?i.x2:i.y2)+h[s])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[s],o=t.end[s])}else G[s]=t;if(L){const e=Y[s][0],i="x"===s?B:E;switch(_P(t,s)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},$=["x","y"];if(g(C))if(g(K=C)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:n}=C;W.left=vP(t,y),W.top=vP(i,y),W.right=vP(e,y),W.bottom=vP(n,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(C)&&$.forEach((t=>{const e=C[t];S(e)||u(e)?W[Y[t][0]]=vP(e,y):X(e,t)}));else p(C)&&(X({orient:C,mode:M},"x"),X({orient:C,mode:M},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?B:E,n="x"===t?P:I,s="x"===t?w:k,r=_P(G[t],t);if(A(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(A(W[Y[t][1]]))q[t]=n-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;q[t]=r>0?e+s:0===r?e-i*V/2:e-i*V-s}q[t]*=U,z&&(q[t]+=j[t]),q[t]/=H;const a="x"===t?D.width:D.height,o=m.confine?-(N[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/U)/H:-N[t]/H,l=a/H+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?s+i/2:2*s+i,q[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",SP=(t={},e={})=>{var i,n;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const s=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(s)&&(e.color=s),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=xP(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=xP(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(n=t.wordBreak)&&void 0!==n?n:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},AP=(t={})=>{const{lineHeight:e}=t;return t.fontSize?Yw(e,t.fontSize):0},wP=t=>{var e;const{backgroundColor:i,border:n,shadow:s,padding:r}=t,a={borderWidth:`${null!==(e=null==n?void 0:n.width)&&void 0!==e?e:0}px`};let o=null;(null==n?void 0:n.color)&&(a.borderColor=n.color),i&&(a.backgroundColor=i),a.boxShadow=s?`${s.x}px ${s.y}px ${s.blur}px ${s.spread}px ${s.color}`:"initial";const{radius:l}=null!=n?n:{};return p(l)&&(a.borderRadius=A(l)?`${l}px`:`${l}`),p(r)&&(o=Ce(r),a.padding=xP(o)),{panelStyle:a,panelPadding:o}};function kP(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class TP extends bP{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(TP.type),this.type=fO.dom,this._tooltipContainer=null==Vg?void 0:Vg.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Vg&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,n,s;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=wP(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),A(g)&&(y.marginBottom=`${g}px`);const _={width:xP(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=SP(h),x=SP(u),S=SP(p),w="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[w]=xP(null!==(i=c.spacing)&&void 0!==i?i:8),x[w]=xP(null!==(n=u.spacing)&&void 0!==n?n:26),S[w]=xP(null!==(s=p.spacing)&&void 0!==s?s:0);const k=Math.max(AP(p),AP(u));return y.lineHeight=k>0?`${k}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:n}=t,s=n&&n.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(cP))),l=a.find((t=>t.className.includes(uP)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(cP),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(kP(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),s?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&s&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${lP}-column`),e.classList.add(`${lP}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(uP),this._rootDom.appendChild(l)),l&&s){const t=[...l.children];kP(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&n.every((t=>!t.hasShape||!t.shapeType));kP(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const s=[...t.children];s.slice(n.length).forEach((t=>{t.parentNode.removeChild(t)})),n.forEach(((e,a)=>{let o=s[a];o||(o=document.createElement("div"),o.classList.add(`${lP}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===n.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=mP(e.key),e.keyStyle&&SP(e.keyStyle,l)):"value"===i?(o.innerHTML=mP(e.value),e.valueStyle&&SP(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,n,s,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:u=!1,shapeFill:d}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?gP(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?gP(c):m,_=p,b=t=>new Xh({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,w;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;w=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(w=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new le));let k=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,n]=k.split(" ").map((t=>Number(t))),s=Number(f.slice(0,-2));k=`${t-s/2} ${e-s/2} ${i+s} ${n+s}`}const T=Us.IsGradientStr(d);if(!d||y(d)&&!T||u)return m=u?"none":d?gP(d):"currentColor",`\n \n \n \n `;const C=T?Us.Parse(d):g(d)?d:null;if(C){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(n=C.stops)&&void 0!==n?n:[]).map((t=>``)).join("");return"radial"===C.gradient?t=`\n ${i}\n `:"linear"===C.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),kP(o,l)}))}}))}else l&&!s&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,n,s,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(uP))),h=[...o.children].find((t=>t.className.includes(cP)));if(l){const o=this._component.getSpec(),c={},u=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(u&&u.autoWidth&&!1!==u.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(n=null==o?void 0:o.style)||void 0===n?void 0:n.maxContentHeight)){const t=h&&h.className.includes(cP)?h.getBoundingClientRect().height+(null!==(s=o.style.spaceRow)&&void 0!==s?s:0):0,e=this._chartOption.getChartViewRect(),i=Yw(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,kP(l,c))}const d=l.children,g=[];if(d){for(let i=0;i{var i;let n,s;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(n=t.split("\n"),n=n.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(s=t.text,n=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:s},Ec||(Ec=Mc.CreateGraphic("richtext",{})),Ec.setAttributes(a),Ec.AABBBounds);var a;return{width:r.width(),height:r.height(),text:n}};function BP(t={},e,i){var n,s;return Object.assign(Object.assign({},null!=i?i:CP),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const EP=t=>{var e;const{backgroundColor:i,border:n,shadow:s}=t,r={lineWidth:null!==(e=null==n?void 0:n.width)&&void 0!==e?e:0,shadow:!!s};(null==n?void 0:n.color)&&(r.stroke=n.color),i&&(r.fill=i),s&&(r.shadowColor=s.color,r.shadowBlur=s.blur,r.shadowOffsetX=s.x,r.shadowOffsetY=s.y,r.shadowSpread=s.spread);const{radius:a}=null!=n?n:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class OP extends bP{constructor(){super(OP.type),this.type=fO.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new mw({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,n;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var n,s,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:u={},titleLabel:d,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=Ce(u.padding),b=Kw(u.padding),x=BP(Object.assign({textAlign:"right"===y?"right":"left"},d),i),S=BP(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=BP(m,i),w={fill:!0,size:null!==(n=null==g?void 0:g.size)&&void 0!==n?n:8,spacing:null!==(s=null==g?void 0:g.spacing)&&void 0!==s?s:6},k={panel:EP(u),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:w,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:C=[]}=t;let M=b.left+b.right,B=b.top+b.bottom,E=0;const O=!!C.length;let R=0,P=0,I=0,L=0;if(O){const t=[],e=[],i=[],n=[];let s=0;k.content=C.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:u,shapeStroke:d,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:k}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=rk({},S,BP(b,void 0,{})),{width:n,height:s,text:r}=MP(h,i);T.key=Object.assign(Object.assign({width:n,height:s},i),{text:r}),y?e.push(n):t.push(n),o=Math.max(o,s)}if(p(m)){const t=rk({},A,BP(x,void 0,{})),{width:e,height:n,text:s}=MP(m,t);T.value=Object.assign(Object.assign({width:e,height:n},t),{text:s}),i.push(e),o=Math.max(o,n)}if(l){const t={visible:!0,symbolType:c};k?t.stroke=u:t.fill=u,t.stroke=null!=d?d:u,t.lineWidth=g,T.shape=t;const e=null!=f?f:w.size;o=Math.max(e,o),n.push(e)}else T.shape={visible:!1};return T.height=o,s+=o,aV.autoWidth&&!1!==V.multiLine;if(N){V=rk({},x,BP(H,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:O?Math.ceil(E):void 0);const{text:t,width:e,height:i}=MP(U,V);k.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=k.title.value.width,F=k.title.value.height,j=F+(O?k.title.spaceRow:0)}return B+=j,k.title.width=D,k.title.height=F,W()?M+=E||D:M+=Math.max(D,E),O&&k.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=M-b.left-b.right-L-R-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),k.valueWidth=Math.max(k.valueWidth,i.width))})),k.panel.width=M,k.panel.height=B,k})(t,this._component.getSpec(),e)}const{panel:s}=null!==(n=this._attributes)&&void 0!==n?n:{};return{width:s.width+s.lineWidth,height:s.height+s.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:n}=e,s=n.position;e.changePositionOnly?p(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),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()}}OP.type=fO.canvas;const RP=/\{([^}]+)\}/,PP=/\{([^}]+)\}/g,IP=/:/;class LP extends wB{constructor(){super(LP.type),this.type="formatterPlugin",this._timeModeFormat={utc:Be.getInstance().timeUTCFormat,local:Be.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Fe.getInstance().format,this._numericSpecifier=Fe.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:n}=t;if(!n)return;this._spec=null!==(i=null==e?void 0:e[LP.specKey])&&void 0!==i?i:{};const{timeMode:s,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;u(r)?this._formatter=r:(this._formatter=this._format.bind(this),u(o)?this._timeFormatter=o:s&&this._timeModeFormat[s]&&(this._timeFormatter=this._timeModeFormat[s]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),ak.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,n)=>{const s=_(i)?i[n]:i;return s?this._formatSingleLine(t,e,s):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let n;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?n=this._isNumericFormatterCache.get(i):(n=RP.test(i),this._isNumericFormatterCache.set(i,n))),n){const t=i.replace(PP,((t,i)=>{if(!IP.test(i)){const n=e[i.trim()];return void 0!==n?n:t}const n=i.split(":"),s=e[n.shift()],r=n.join(":");return this._formatSingleText(s,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ie.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}LP.pluginType="chart",LP.specKey="formatter",LP.type="formatterPlugin";nM.useRegisters([()=>{bO(),SO(),wO(),ZE(),qE(),LE(),TE(),pB(),fB(),YC(),WC(),_E(),vE(),ak.registerSeries(DE.type,DE),ak.registerChart(kO.type,kO)},()=>{bO(),SO(),wO(),qE(),KO(),ZE(),ak.registerChart(ZO.type,ZO)},()=>{bO(),SO(),wO(),qE(),NO(),ZE(),ak.registerChart(HO.type,HO)},()=>{SO(),mR(),ak.registerChart(bR.type,bR)},()=>{bO(),SO(),wO(),ZE(),ak.registerChart(AR.type,AR),qE()},vE,_E,()=>{ak.registerComponent(oP.type,oP)},()=>{ak.registerComponent(iP.type,iP)},()=>{ak.registerComponent(GR.type,GR)},()=>{ak.registerGraphicComponent(UR.type,(t=>new $A(t))),jR(),ZB(),ak.registerComponent(UR.type,UR,!0,1/0)},()=>{var t;t=OP,ak.registerComponentPlugin(t.type,t)},()=>{var t;t=LP,ak.registerChartPlugin(t.type,t)},JC,eM]),nM.useRegisters([()=>{ny(Vi)}]),t.DEFAULT_CHART_HEIGHT=Ok,t.DEFAULT_CHART_WIDTH=Ek,t.DEFAULT_CLOSE_STROKE_JOIN=aM,t.DEFAULT_DATA_INDEX=Pk,t.DEFAULT_DATA_KEY=Ik,t.DEFAULT_DATA_SERIES_FIELD=Lk,t.DEFAULT_KEY=tT,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=rM,t.DEFAULT_MAP_LOOK_UP_KEY=eT,t.DEFAULT_MEASURE_CANVAS_ID=Rk,t.DEFAULT_SERIES_STYLE_NAME=Dk,t.DEFAULT_SMOOTH_INTERPOLATE=sM,t.Factory=ak,t.MOSAIC_CAT_END_PERCENT=Zk,t.MOSAIC_CAT_START_PERCENT=qk,t.MOSAIC_VALUE_END_PERCENT=Kk,t.MOSAIC_VALUE_START_PERCENT=$k,t.ManualTicker=class extends Yb{constructor(t){super(t),this.lastFrameTime=0,this.status=en.RUNNING}setupTickHandler(){const t=new Xb;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===en.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===en.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=en.RUNNING,!0}},t.PREFIX=Bk,t.SEGMENT_FIELD_END=Qk,t.SEGMENT_FIELD_START=Jk,t.STACK_FIELD_END=Nk,t.STACK_FIELD_END_OffsetSilhouette=Vk,t.STACK_FIELD_END_PERCENT=Hk,t.STACK_FIELD_KEY=Fk,t.STACK_FIELD_START=jk,t.STACK_FIELD_START_OffsetSilhouette=zk,t.STACK_FIELD_START_PERCENT=Uk,t.STACK_FIELD_TOTAL=Wk,t.STACK_FIELD_TOTAL_BOTTOM=Xk,t.STACK_FIELD_TOTAL_PERCENT=Gk,t.STACK_FIELD_TOTAL_TOP=Yk,t.StreamLight=class extends qb{constructor(t,e,i,n,s){super(t,e,i,n,s)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),n=Gi.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=n,n.pathProxy=new ps,i.add(n)}onStartRect(){var t,e,i;const n=this.target.attachShadow(),s=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=s?"height":"width",a=s?"width":"height",o=this.target.AABBBounds[r](),l=s?0:this.target.AABBBounds.y1,h=Gi.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,n.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var n,s,r,a,o,l,h,c,u,d,p,g,f,m,v,y;const _=null===(s=null===(n=this.params)||void 0===n?void 0:n.isHorizontal)||void 0===s||s,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,n=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,s=null!==(u=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==u?u:60,d=-s,p=d+(n-d)*e,g=Math.max(p,0),f=Math.min(Math.min(p+s,s),n-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:_n.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(d=b.height)&&void 0!==d?d:Math.abs(b.y1-b.y))&&void 0!==p?p:250,n=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,s=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(n+s)*e;let a=Math.min(r,i);const o=Math.min(i-r,s);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:_n.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const n=this.line||this.area;if(!n)return;const s=n.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(s,r,t,e,i):this._onUpdateLineWithoutCache(s,r,t,e,i);const a=r.attribute;n.setAttributes(Object.assign({stroke:a.stroke},n.attribute)),n.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,n,s){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const s=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,s,n)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,s=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,s,n)}}_updateCurves(t,e,i,n){var s,r;const a=i*n,o=Math.min(a+(null!==(r=null===(s=this.params)||void 0===s?void 0:s.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,n.p2&&n.p3){const[e,i]=Pn(n,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=n.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(n.p2&&n.p3){c&&(u=(o-a)/c.getLength());const[e]=Pn(c||n,u);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=n.getPointAt(u);t.lineTo(e.x,e.y)}break}if(h)if(n.p2&&n.p3){const e=c||n;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(n.p1.x,n.p1.y);l+=s}}_onUpdateLineWithoutCache(t,e,i,n,s){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&d.push(Ft.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pu){d.push(Ft.pointAtPP(o[t-1],o[t],1-(p+e-u)/e));break}d.length&&d.push(o[t]),p+=e}if(d.length&&!(d.length<2)){t.clear(),t.moveTo(d[0].x,d[0].y);for(let e=1;e{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(u(e.set))l=function(t){const i=o.get(t[n]);e.set(t,i)};else if(s){const t=s.length;l=function(e){const i=o.get(e[n]);if(d(i))for(let i=0;i(l(t),t)))},t.measureText=Mk,t.normalizeLayoutPaddingSpec=Kw,t.queryColorFromColorScheme=Ow,t.queryToken=Qw,t.registerDataSetInstanceParser=MT,t.registerDataSetInstanceTransform=CT,t.registerTheme=fk,t.removeTheme=vk,t.themeExist=yk,t.themes=dk,t.token=ek,t.transformColorSchemeToStandardStruct=Lw,t.transformToGraphic=pT,t.version="2.0.22",t.vglobal=Op,t.warn=Ng,Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function e(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 s,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(s=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",s["mobile-browser"]="mobile-browser",s.node="node",s.worker="worker",s.miniApp="miniApp",s.wx="wx",s.tt="tt",s.harmony="harmony",s["desktop-miniApp"]="desktop-miniApp",s.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new s(n,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},o.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,r=n.length,a=new Array(r);sObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var u=t=>"function"==typeof t;var d=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>S(t)&&Number.isFinite(t);var C=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var w=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const k=Object.prototype;var M=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||k)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(M(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var P=(t,e,i)=>{const n=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function I(t,e,i){let n;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const s=_(t),r=t.length;n=s?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=s?void 0:Object.keys(Object(t));let o=-1;if(n)for(;++o<(a||t).length;){const s=a?a[o]:o,r=t[s];i&&i.includes(s.toString())?n[s]=r:n[s]=I(r,e,i)}return n}function D(t,e,i=!1,n=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),r=[];for(const t in s)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(s[a])||"object"!=typeof s[a]||n&&_(t[a])?F(t,a,s[a]):L(t,e,a,i,n)}}}}function L(t,e,i,n=!1,s=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(n)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const s=t[n];let r=!1;e.forEach((t=>{(y(t)&&t===n||t instanceof RegExp&&n.match(t))&&(r=!0)})),r||(i[n]=s)})),i}function j(t){return Object.prototype.toString.call(t)}function z(t){return Object.keys(t)}function W(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(j(t)!==j(e))return!1;if(u(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let n=t.length-1;n>=0;n--)if(!W(t[n],e[n],i))return!1;return!0}if(!m(t))return!1;const n=z(t),s=z(e);if(n.length!==s.length)return!1;n.sort(),s.sort();for(let t=n.length-1;t>=0;t--)if(n[t]!=s[t])return!1;for(let s=n.length-1;s>=0;s--){const r=n[s];if(!W(t[r],e[r],i))return!1}return!0}function H(t,e,i){const n=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let s=0;s{var i;if(0===t.length)return;let n=t[0];for(let s=1;s0&&(n=r)}return n},K=(t,e)=>{var i;if(0===t.length)return;let n=t[0];for(let s=1;se?1:t>=e?0:NaN}function J(t){return Number(t)}const Q="undefined"!=typeof console;function et(t,e,i){const n=[e].concat([].slice.call(i));Q&&console[t].apply(console,n)}var it;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(it||(it={}));class nt{static getInstance(t,e){return nt._instance&&S(t)?nt._instance.level(t):nt._instance||(nt._instance=new nt(t,e)),nt._instance}static setInstance(t){return nt._instance=t}static setInstanceLevel(t){nt._instance?nt._instance.level(t):nt._instance=new nt(t)}static clearInstance(){nt._instance=null}constructor(t=it.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=it.Info}canLogDebug(){return this._level>=it.Debug}canLogError(){return this._level>=it.Error}canLogWarn(){return this._level>=it.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=it.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):et(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=it.Warn&&et(this._method||"warn","WARN",t),this}info(...t){return this._level>=it.Info&&et(this._method||"log","INFO",t),this}debug(...t){return this._level>=it.Debug&&et(this._method||"log","DEBUG",t),this}}function st(t,e,i=0,n){for(d(n)&&(n=t.length);i>>1;Z(t[s],e)>0?n=s:i=s+1}return i}nt._instance=null;const rt=1e-10,at=1e-10;function ot(t,e,i=at,n=rt){const s=n,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(s,r)}function lt(t,e,i,n){return t>e&&!ot(t,e,i,n)}function ht(t,e,i,n){return t{let e=null,i=null;return(...n)=>(e&&n.every(((t,i)=>t===e[i]))||(e=n,i=t(...n)),i)};var ut=function(t,e,i){return ti?i:t};var dt=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function pt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let gt=!1;try{gt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){gt=!1}function ft(t,e,i){let n,s,r,a,o,l,h=0,c=!1,u=!1,d=!0;const p=!e&&0!==e&>if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||u&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,n=e-(t-l);return u?Math.min(n,r-i):n}(t))}function _(t){return o=void 0,d&&n?f(t):(n=s=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(n=t,s=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(u)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,u="maxWait"in i,u&&(r=Math.max(A(i.maxWait)?i.maxWait:0,e)),d="trailing"in i?!!i.trailing:d),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,n=l=s=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function mt(t,e,i){let n=!0,s=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(n="leading"in i?!!i.leading:n,s="trailing"in i?!!i.trailing:s),ft(t,e,{leading:n,trailing:s,maxWait:e})}function vt(t,e){return i=>t*(1-i)+e*i}function yt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}gt=!1;const _t=1e-12,bt=Math.PI,xt=bt/2,St=2*bt,At=2*Math.PI,Ct=Math.abs,wt=Math.atan2,Tt=Math.cos,kt=Math.max,Mt=Math.min,Bt=Math.sin,Et=Math.sqrt,Pt=Math.pow;function Ot(t){return t>=1?xt:t<=-1?-xt:Math.asin(t)}function Rt(t,e,i,n,s){let r=i,a=n;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function It(t,e){return t[0]*e[1]-t[1]*e[0]}function Dt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Lt(t,e){return function(t,e=10){return Math.round(t*e)/e}(t-e,10**Math.max(Dt(t),Dt(e)))}class Ft{constructor(t=0,e=0,i,n){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Ft(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class Ut{static distancePP(t,e){return Et(Pt(t.x-e.x,2)+Pt(t.y-e.y,2))}static distanceNN(t,e,i,n){return Et(Pt(t-i,2)+Pt(e-n,2))}static distancePN(t,e,i){return Et(Pt(e-t.x,2)+Pt(i-t.y,2))}static pointAtPP(t,e,i){return new Ft((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Nt(t){return t*(Math.PI/180)}const jt=(t=0)=>{if(t<0)for(;t<-St;)t+=St;else if(t>0)for(;t>St;)t-=St;return t};function zt(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function Wt(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Ht(t,e,i,n){const{x:s,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const n=Wt(Math.min(t,e)),s=n+i,r=[n,s];let a=Math.floor(n/Math.PI)*Math.PI/2;for(;an&&r.push(a),a+=Math.PI/2;return r}(i,n),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-s):-1===i?h.push(s):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-s)/i)):h.push(Math.abs(s/i)))})),Math.min.apply(null,h)}function Vt(t){return(t=Wt(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 Gt(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function Yt(t,e,i,n){if(!function(t,e,i,n){let s=t[0],r=e[0],a=i[0],o=n[0];return r=0&&h<=1&&[t[0]+s[0]*h,t[1]+s[1]*h]}var Xt;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(Xt||(Xt={}));const Kt=(t,e,i)=>{let n=t.x1,s=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(n>s&&([n,s]=[s,n]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function $t(t,e,i){if(t&&e){if(!i)return!(t.x1>e.x2||t.x2e.y2||t.y2l||sc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let n=e.x1,s=e.x2,r=e.y1,a=e.y2;return n>s&&([n,s]=[s,n]),r>a&&([r,a]=[a,r]),t.x>=n&&t.x<=s&&t.y>=r&&t.y<=a}function Zt(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Jt({x:t,y:e},i,n={x:0,y:0}){return{x:(t-n.x)*Math.cos(i)-(e-n.y)*Math.sin(i)+n.x,y:(t-n.x)*Math.sin(i)+(e-n.y)*Math.cos(i)+n.y}}function Qt(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function te(t,e){const i=e?Nt(t.angle):t.angle,n=Qt(t);return[Jt({x:t.x1,y:t.y1},i,n),Jt({x:t.x2,y:t.y1},i,n),Jt({x:t.x2,y:t.y2},i,n),Jt({x:t.x1,y:t.y2},i,n)]}function ee(t,e,i=!1){const n=te(t,i),s=te(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Qt(t),Qt(e)),o=r(n[0],n[1]),l=r(n[1],n[2]),h=r(s[0],s[1]),c=r(s[1],s[2]),u=i?Nt(t.angle):t.angle;let d=i?Nt(90-t.angle):t.angle+xt;const p=i?Nt(e.angle):e.angle;let g=i?Nt(90-e.angle):e.angle+xt;d>At&&(d-=At),g>At&&(g-=At);const f=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(Zt(s,i)+Zt(s,n))/2>Zt(s,a)};return f((t.x2-t.x1)/2,u,h,c)&&f((t.y2-t.y1)/2,d,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}function ie(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}const ne=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};function se(t,e={},i){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")}class re{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=se(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:u,textBaseline:d=(null!=u?u:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:d,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(d(t))return{width:0,height:0};if(d(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:n,lineHeight:s}=this.textSpec;return{width:i.width,height:null!==(e=s)&&void 0!==e?e:n,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=s)&&void 0!==i?i:n)+1)+1}}return e(t.toString())}_measureNumberChar(){if(d(this._numberCharSize)){const t=this._standardMethod(re.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/re.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(re.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(re.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/re.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}re.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",re.NUMBERS_CHAR_SET="0123456789",re.FULL_SIZE_CHAR="字";const ae=(t,e)=>{const{x1:i,x2:n,y1:s,y2:r}=t,a=Math.abs(n-i),o=Math.abs(r-s);let l=(i+n)/2,h=(s+r)/2,c=0,u=0;switch(e){case"top":case"inside-top":u=-.5;break;case"bottom":case"inside-bottom":u=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,u=-.5;break;case"top-left":c=-.5,u=-.5;break;case"bottom-right":c=.5,u=.5;break;case"bottom-left":c=-.5,u=.5}return l+=c*a,h+=u*o,{x:l,y:h}},oe=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),le=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function n(t,e,i){const n=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...n),max:Math.max(...n)}}let s=0;for(const r of i){const i=n(t,r.x,r.y),a=n(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(t=0,e=0,i=0,n=0){const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return he(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*n-l*s+h,l*n+o*s+c,o*n-l*a+h,l*n+o*a+c,o*r-l*s+h,l*r+o*s+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,n){const{x1:s,y1:r,x2:a,y2:o}=this;return[t*s+(1-t)*i,e*r+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class ue extends ce{}class de extends ce{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return ee(this,t)}setValue(t=0,e=0,i=0,n=0,s=0){return super.setValue(t,e,i,n),this.angle=s,this}clone(){return new de(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Jt({x:this.x1,y:this.y1},this.angle,t),Jt({x:this.x2,y:this.y1},this.angle,t),Jt({x:this.x1,y:this.y2},this.angle,t),Jt({x:this.x2,y:this.y2},this.angle,t)]}}class pe{constructor(t=1,e=0,i=0,n=1,s=0,r=0){this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new pe,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,u=n*this.e-s*this.f+r,d=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=u,this.f=d,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,u=o*t+h*e,d=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=u,this.c=d,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new pe;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,u=-s/l,d=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*u+p,e.y=f*c+m*d+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new pe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,s=t*n-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=s/a,r.skewX=(t*i+e*n)/s,r.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=s/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*n)/s}return r.rotateDeg=180*r.rotateDeg/Math.PI,r}}class ge{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:n=this.L_TIME,R_COUNT:s=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=s)););if(in;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:n=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>n&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();t.forEach((t=>{for(;n-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();for(;n-t.timestamp[0]>i;)t.timestamp.shift()}}function fe(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function me(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const ve=/^#([0-9a-f]{3,8})$/,ye={transparent:4294967040},_e={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function be(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function xe(t){return S(t)?new Te(t>>16,t>>8&255,255&t,1):_(t)?new Te(t[0],t[1],t[2]):new Te(255,255,255)}function Se(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ae(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Ce=(t,e)=>{const i=ve.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new Te((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?xe(t):8===e?new Te(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class we{static Brighter(t,e=1){return 1===e?t:new we(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new we(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof we?t:new we(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(ye[t]))return function(t){return S(t)?new Te(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new Te(t[0],t[1],t[2],t[3]):new Te(255,255,255,1)}(ye[t]);if(p(_e[t]))return xe(_e[t]);const e=`${t}`.trim().toLowerCase(),i=Ce(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Te(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=fe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Te(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=we.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new Te(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}add(t){const{r:e,g:i,b:n}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,n+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=me(this.color.r,this.color.g,this.color.b),r=fe(d(t)?s.h:ut(t,0,360),d(e)?s.s:e>=0&&e<=1?100*e:e,d(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new Te(r.r,r.g,r.b,n),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Ce(e,!0);return null!=i?i:this}setColorName(t){const e=_e[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let n,s,r;return n=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),s=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*n+.7152*s+.0722*r}clone(){return new we(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Se(t.color.r),this.color.g=Se(t.color.g),this.color.b=Se(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Ae(t.color.r),this.color.g=Ae(t.color.g),this.color.b=Ae(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class Te{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${be(this.r)+be(this.g)+be(this.b)+(1===this.opacity?"":be(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=me(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ke(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),u=Math.round(a*(1-t)+o*t);return new Te(e,c,u,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:me});function Be(t){if(A(t))return[t,t,t,t];if(_(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,n]=t;return[e,i,n,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:n=0,left:s=0}=t;return[e,i,n,s]}return[0,0,0,0]}function Ee(t,e=0,i=0){if(!t)return{width:e,height:i};let n;try{n=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){n=()=>({})}const s=n(t);if(/^(\d*\.?\d+)(px)$/.exec(s.width)){const n=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,r=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:n<=0?e:n,height:r<=0?i:r}}return{width:e,height:i}}const Pe=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();class Oe{static getInstance(){return Oe.instance||(Oe.instance=new Oe),Oe.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));++r1?s[0]+s.slice(2):s,+i.slice(n+1)]}let Ie;function De(t,e){const i=Re(t,e);if(!i)return t+"";const n=i[0],s=i[1];return s<0?"0."+new Array(-s).join("0")+n:n.length>s+1?n.slice(0,s+1)+"."+n.slice(s+1):n+new Array(s-n.length+2).join("0")}class Le{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Fe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ue(t){let e;if(e=Fe.exec(t))return new Le({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});nt.getInstance().error("invalid format: "+t)}const Ne=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class je{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,n){let s=t.length;const r=[];let a=0,o=e[0],l=0;for(;s>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),r.push(t.substring(s-=o,s+o)),!((l+=o+1)>n));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return je.instance||(je.instance=new je),je.instance}newFormat(t){const e=Ue(t);let i=e.fill,n=e.align;const s=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,u=e.type;"n"===u?(l=!0,u="g"):ze[u]||(void 0===h&&(h=12),c=!0,u="g"),(a||"0"===i&&"="===n)&&(a=!0,i="0",n="=");const d="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(u)?"0"+u.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(u)?this.percent:"",g=ze[u],f=/[defgprstz%]/.test(u);h=void 0===h?6:/[gprs]/.test(u)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:y,group:_,numerals:b}=this;function x(t){let e,r,x,S=d,A=p,C=t;if("c"===u)A=g(C)+A,C="";else{C=+C;let t=C<0||1/C<0;if(C=isNaN(C)?m:g(Math.abs(C),h),c&&(C=function(t){const e=t.length;let i,n=-1;t:for(let s=1;s0&&(n=0)}return n>0?t.slice(0,n)+t.slice(i+1):t}(C)),t&&0==+C&&"+"!==s&&(t=!1),S=(t?"("===s?s:v:"-"===s||"("===s?"":s)+S,A=("s"===u?Ne[8+Ie/3]:"")+A+(t&&"("===s?")":""),f)for(e=-1,r=C.length;++ex||x>57){A=(46===x?y+C.slice(e+1):C.slice(e))+A,C=C.slice(0,e);break}}l&&!a&&(C=_(C,1/0));let w=S.length+C.length+A.length,T=w>1)+S+C+A+T.slice(w);break;default:C=T+S+C+A}return b(C)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Ue(t);i.type="f";const n=this.newFormat(i.toString()),s=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=Re(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-s),a=Ne[8+s/3];return function(t){return n(r*t)+a}}}const ze={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>De(100*t,e),r:De,s:function(t,e){const i=Re(t,e);if(!i)return t+"";const n=i[0],s=i[1],r=s-(Ie=3*Math.max(-8,Math.min(8,Math.floor(s/3))))+1,a=n.length;return r===a?n:r>a?n+new Array(r-a+1).join("0"):r>0?n.slice(0,r)+"."+n.slice(r):"0."+new Array(1-r).join("0")+Re(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};const We=function(t,...e){return function(t,...e){t||(t={});let i=-1;const n=e.length;for(;++i{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.sort&&(A(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+Ze(e,6):Ze(e,4))+"-"+Ze(t.getUTCMonth()+1,2)+"-"+Ze(t.getUTCDate(),2)+(r?"T"+Ze(i,2)+":"+Ze(n,2)+":"+Ze(s,2)+"."+Ze(r,3)+"Z":s?"T"+Ze(i,2)+":"+Ze(n,2)+":"+Ze(s,2)+"Z":n||i?"T"+Ze(i,2)+":"+Ze(n,2)+"Z":"")}function Qe(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 Ke;if(h)return h=!1,Xe;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(;a{const n=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!_(t))throw new TypeError("Invalid data: must be DataView array!");return _(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let si=0;function ri(t="dataset"){return si>1e8&&(si=0),t+"_"+si++}class ai{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:ri("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:nt.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let 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){if(this._callMap){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()}}class oi{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&W(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:ri("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var 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){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,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:n,skipEqual:s}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===n||s&&W(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof oi||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?U({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Ye),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class li{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 hi extends li{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}class ci{static GenAutoIncrementId(){return ci.auto_increment_id++}}ci.auto_increment_id=0;class ui{}const di=new ui;let pi=0;class gi{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=di.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++pi,t),this.tryRunAnimationFrameNextFrame(),pi}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class fi{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const n=this._resolveCapture(i),s=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(n))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),s&&this._deleteListenerRecord(t,e,n)};a.set(n,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var n,s;if(!e)return;const r=this._resolveCapture(i),a=null===(s=null===(n=this._listenerMap.get(t))||void 0===n?void 0:n.get(e))||void 0===s?void 0:s.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const n=this._listenerMap.get(t);if(!n)return;const s=n.get(e);s&&(s.delete(i),0===s.size&&n.delete(e),0===n.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var mi=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 vi extends fi{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=ci.GenAutoIncrementId(),this.hooks={onSetEnv:new hi(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const 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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gi);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gi),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return mi(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}var 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())}))};class _i extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=ci.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return yi(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,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&nt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const 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(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Si))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Ti(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 Si))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=Ti(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");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let n=o;for(;n&&n!==this.rootTarget;)i.add(n),n=n.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursorTarget=s.target,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 Si))return void nt.getInstance().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=Ti(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,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 Si))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Ti(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.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Si))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=wi.now(),s=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(s,"pointerup"),"touch"===s.pointerType)this.dispatchEvent(s,"touchend");else if(Ti(s.pointerType)){const t=2===s.button;this.dispatchEvent(s,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!s.composedPath().includes(a)){let e=a;for(;e&&!s.composedPath().includes(e);){if(s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType)this.notifyTarget(s,"touchendoutside");else if(Ti(s.pointerType)){const t=2===s.button;this.notifyTarget(s,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(s,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:n});const a=r.clicksByButton[t.button];a.target===e.target&&n-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=n,e.detail=a.clickCount,Ti(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(s)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Si))return void nt.getInstance().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"):Ti(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 Ai))return void nt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,n,s,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===n?void 0:n.stage)&&(null===(r=null===(s=this._prePointTargetCache)||void 0===s?void 0:s[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;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){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=wi.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let n=0,s=i.length;n{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,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,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=s.supportsTouchEvents,supportsPointerEvents:l=s.supportsPointerEvents}=t;this.manager=new ki(n,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=s,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Si,this.rootWheelEvent=new Ai,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:n}=this;if(this.currentCursor===t)return;this.currentCursor=t;const s=this.cursorStyles[t];s?"string"==typeof s&&i?n.style.cursor=s:"function"==typeof s?s(t):"object"==typeof s&&i&&Object.assign(n.style,s):i&&y(t)&&!R(this.cursorStyles,t)&&(n.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const n=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(n)return n;let s=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};s=e.clientX||0,r=e.clientY||0}else s=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:s-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const Pi=St-1e-8;class Oi{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>Pi)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,u=-1/0,d=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),lu&&(u=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=St)<0&&(n+=St),(s%=St)<0&&(s+=St),ss;++o,a-=xt)g(a);else for(a=n-n%xt+xt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Ii=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Di={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},Li={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Fi,Ui,Ni,ji,zi,Wi;function Hi(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;tWi){let t,e=Ni;for(let n=1,r=i.length;n1&&(g=Math.sqrt(g),i*=g,n*=g);const f=u/i,m=c/i,v=-c/n,y=u/n,_=f*o+m*l,b=v*o+y*l,x=f*t+m*e,S=v*t+y*e;let A=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;A<0&&(A=0);let C=Math.sqrt(A);r===s&&(C=-C);const w=.5*(_+x)-C*(S-b),T=.5*(b+S)+C*(x-_),k=Math.atan2(b-T,_-w);let M=Math.atan2(S-T,x-w)-k;M<0&&1===r?M+=St:M>0&&0===r&&(M-=St);const B=Math.ceil(Math.abs(M/(xt+.001))),E=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,u=(i%l+l)%l;o?(u>=h&&(u-=l),c=u-h):(u<=h&&(u+=l),c=u-h);const d=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/d;for(let e=0;ee.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 en(t,e,i=0,n=0,s=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*n+e,this.p1.y*s+i,this.p2.x*n+e,this.p2.y*s+i,this.p3.x*n+e,this.p3.y*s+i);else if(r>0){const[a]=un(this,r);t.bezierCurveTo(a.p1.x*n+e,a.p1.y*s+i,a.p2.x*n+e,a.p2.y*s+i,a.p3.x*n+e,a.p3.y*s+i)}}includeX(t){const e=Mt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=kt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Mt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(kt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function pn(t,e){const{p0:i,p1:n}=t,s=Ut.pointAtPP(i,n,e);return[new gn(i,s),new gn(s,n)]}class gn extends nn{constructor(t,e){super(),this.type=Ki.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return Ut.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?Ut.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Xi.ROW?Ct(this.p0.x-this.p1.x):t===Xi.COLUMN?Ct(this.p0.y-this.p1.y):0}draw(t,e,i,n,s,r){if(t.moveTo(this.p0.x*n+e,this.p0.y*s+i),r>=1)t.lineTo(this.p1.x*n+e,this.p1.y*s+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*n+e,a.y*s+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const n=(t-e.x)/(i.x-e.x);return e.y+n*(i.y-e.y)}return 1/0}}class fn{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,n,s,r,a,o){const l=new dn(new Ft(this._lastX,this._lastY),new Ft(t,e),new Ft(i,n),new Ft(s,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=s,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,n){const s=this.addLinearCurve(t,e,i,this._lastOriginP,n);this.curves.push(s),this._lastX=t,this._lastY=e,this._lastOriginP=n}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,n){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,n,s){const r=new gn(new Ft(this._lastX,this._lastY),new Ft(t,e));return r.originP1=n,r.originP2=s,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Xi.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],n=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ct(t.p0.y-n.y)}if(t===Xi.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],n=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ct(t.p0.x-n.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class mn extends fn{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 vn(t,e,i=1){let n=!1;for(let i=0,s=e.length;i<=s;i++)i>=s===n&&((n=!n)?t.lineStart():t.lineEnd()),n&&t.point(e[i])}function yn(t,e,i){const n=null!=e?e:Ct(i[i.length-1].x-i[0].x)>Ct(i[i.length-1].y-i[0].y)?Xi.ROW:Xi.COLUMN;return"monotoneY"===t?new mn(t,n):new fn(t,n)}class _n{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 bn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=yn("linear",i,t);return xn(new _n(s,n),t),s}function xn(t,e){return vn(t,e,1)}function Sn(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 An{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&&Sn(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:Sn(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 Cn(t,e){return vn(t,e,2)}function wn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return bn(t,e);const s=yn("basis",i,t);return Cn(new An(s,n),t),s}function Tn(t){return t<0?-1:1}function kn(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(Tn(r)+Tn(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Mn(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Bn(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 En{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Bn(this,this._t0,Mn(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,n=t.y;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,Bn(this,Mn(this,e=kn(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Bn(this,this._t0,e=kn(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 Pn extends En{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function On(t,e){return vn(t,e,2)}function Rn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return bn(t,e);const s=yn("monotoneX",i,t);return On(new En(s,n),t),s}function In(t,e){return vn(t,e,2)}function Dn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return bn(t,e);const s=yn("monotoneY",i,t);return In(new Pn(s,n),t),s}let Ln=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const n=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(n,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class Fn extends Ln{lineEnd(){this.context.closePath()}}function Un(t,e,i={}){const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new fn("step",null!=n?n:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?Xi.ROW:Xi.COLUMN);return Nn(new Ln(r,e,s),t),r}function Nn(t,e){return vn(t,e,1)}function jn(t,e,i={}){const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new fn("step",null!=n?n:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?Xi.ROW:Xi.COLUMN);return Nn(new Fn(r,e,s),t),r}class zn extends _n{lineEnd(){this.context.closePath()}}function Wn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=yn("linear",i,t);return Hn(new zn(s,n),t),s}function Hn(t,e){return vn(t,e,1)}function Vn(t,e,i,n,s){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>_t){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>_t){const n=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,s=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*n+t._x1*t._l23_2a-e*t._l12_2a)/s,l=(l*n+t._y1*t._l23_2a-i*t._l12_2a)/s}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,n,t.lastPoint1)}function Gn(t,e){return function(i,n,s={}){const{direction:r,startPoint:a}=s;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return bn(i,s);const o=yn(t,r,i);return vn(new e(o,n,a),i,2),o}}const Yn=Gn("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Vn(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Xn=Gn("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Vn(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Kn extends nn{constructor(t,e,i){super(),this.type=Ki.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return hn(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?cn(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===Xi.ROW?Ct(this.p0.x-this.p2.x):t===Xi.COLUMN?Ct(this.p0.y-this.p2.y):0}getAngleAt(t){const e=kt(t-.01,0),i=Mt(t+.01,1),n=this.getPointAt(e),s=this.getPointAt(i);return wt(s.y-n.y,s.x-n.x)}draw(t,e,i,n,s,r){if(t.moveTo(this.p0.x*n+e,this.p0.y*s+i),r>=1)t.quadraticCurveTo(this.p1.x*n+e,this.p1.y*s+i,this.p2.x*n+e,this.p2.y*s+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:n,p2:s}=t,r=hn(i,n,s,e),a=Ut.pointAtPP(i,n,e),o=Ut.pointAtPP(n,s,e);return[new Kn(i,a,r),new Kn(r,o,s)]}(this,r);t.quadraticCurveTo(a.p1.x*n+e,a.p1.y*s+i,a.p2.x*n+e,a.p2.y*s+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class $n{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new gn(new Ft(this._lastX,this._lastY),new Ft(t,e))}quadraticCurveTo(t,e,i,n){const s=new Kn(new Ft(this._lastX,this._lastY),new Ft(t,e),new Ft(i,n));this.path.addCurve(s),this._lastX=i,this._lastY=n}bezierCurveTo(t,e,i,n,s,r){const a=new dn(new Ft(this._lastX,this._lastY),new Ft(t,e),new Ft(i,n),new Ft(s,r));this.path.addCurve(a),this._lastX=s,this._lastY=r}arcTo(t,e,i,n,s){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,n,s,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,n){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,n,s,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function qn(t,e,i){var n,s;switch(e){case"linear":default:return bn(t,i);case"basis":return wn(t,i);case"monotoneX":return Rn(t,i);case"monotoneY":return Dn(t,i);case"step":return Un(t,.5,i);case"stepClosed":return jn(t,.5,i);case"stepBefore":return Un(t,0,i);case"stepAfter":return Un(t,1,i);case"catmullRom":return Yn(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"catmullRomClosed":return Xn(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"linearClosed":return Wn(t,i)}}class Zn extends Ri{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Oi(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Li.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Li.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([Li.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([Li.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([Li.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([Li.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([Li.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([Li.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([Li.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new $n(this);en(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Li.M]=t=>`M${t[1]} ${t[2]}`,t[Li.L]=t=>`L${t[1]} ${t[2]}`,t[Li.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Li.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Li.A]=t=>{const e=[],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6];Qi(e,r,a,i,n,s,s,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Li.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=Hi(t);return this._runCommandStrList(r,e,i,n,s),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:n}=t.attribute;if(!e)return;const s=qn(e,i);"x"===n?this.direction=Xi.ROW:"y"===n?this.direction=Xi.COLUMN:"auto"===n&&(this.direction=s.direction),this._curves=s.curves}fromCustomPath2D(t,e,i,n,s){return this.clear(),this._runCommandList(t.commandList,e,i,n,s),this._updateBounds(),this}transform(t,e,i,n){const s=this.commandList;if(!this.transformCbList){const t=[];t[Li.M]=this.moveToTransform,t[Li.L]=this.lineToTransform,t[Li.Q]=this.quadraticCurveToTransform,t[Li.C]=this.bezierCurveToTransform,t[Li.AT]=this.arcToTransform,t[Li.E]=this.ellipseTransform,t[Li.R]=this.rectTransform,t[Li.A]=this.arcTransform,t[Li.Z]=this.closePathTransform,this.transformCbList=t}s.forEach((s=>{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,e=0,i=0,n=1,s=1){let r,a,o,l,h,c=null,u=0,d=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),en(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Xi.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ct(t.p0.y-e.p1.y)}if(this.direction===Xi.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ct(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}drawWithClipRange(t,e,i,n,s){this.tryBuildCurves();const r=this.getLength()*s;let a=0;for(let s=0;s{nt.getInstance().warn("空函数")}}),As=Object.assign(Object.assign({},fs),{points:[],cornerRadius:0,closePath:!0}),Cs=Object.assign(Object.assign({},fs),{width:100,height:100,spikes:5,thickness:.5}),ws=Object.assign(Object.assign({},fs),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Ts=Object.assign(Object.assign({},fs),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),ks=Object.assign(Object.assign({},fs),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),Ms=Object.assign(Object.assign(Object.assign({},fs),cs),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Bs=Object.assign(Object.assign(Object.assign({},fs),cs),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Es=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},fs),{fill:!0,cornerRadius:0,cornerType:"round"}),Ps=Object.assign(Object.assign({},Es),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});class Os{static GetImage(t,e){var i;const n=Os.cache.get(t);n?"fail"===n.loadState?di.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):Os.loadImage(t,e)}static GetSvg(t,e){var i;let n=Os.cache.get(t);n?"fail"===n.loadState?di.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):(n={type:"image",loadState:"init"},Os.cache.set(t,n),n.dataPromise=di.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.waitingMark&&(n.waitingMark=[])})).catch((()=>{var e;n.loadState="fail",null===(e=n.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),n.waitingMark&&(n.waitingMark=[])}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Os.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Os.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=di.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=di.global.loadBlob(t):"json"===e&&(i.dataPromise=di.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Os.isLoading&&Os.toLoadAueue.length){Os.isLoading=!0;const t=Os.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:n}=t,s={type:"image",loadState:"init"};if(Os.cache.set(i,s),s.dataPromise=di.global.loadImage(i),s.dataPromise){s.waitingMark=n;const t=s.dataPromise.then((t=>{var e;s.loadState=(null==t?void 0:t.data)?"success":"fail",s.data=null==t?void 0:t.data,null===(e=s.waitingMark)||void 0===e||e.map(((e,n)=>{(null==t?void 0:t.data)?(s.loadState="success",s.data=t.data,e.imageLoadSuccess(i,t.data)):(s.loadState="fail",e.imageLoadFail(i))})),s.waitingMark&&(s.waitingMark=[])}));e.push(t)}else s.loadState="fail",n.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Os.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Os.loading()})).catch((t=>{console.error(t),Os.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Os.loading()}))}}),0)}static loadImage(t,e){const i=Rs(t,Os.toLoadAueue);if(-1!==i)return Os.toLoadAueue[i].marks.push(e),void Os.loading();Os.toLoadAueue.push({url:t,marks:[e]}),Os.loading()}static improveImageLoading(t){const e=Rs(t,Os.toLoadAueue);if(-1!==e){const t=Os.toLoadAueue.splice(e,1);Os.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Rs(t,e){for(let i=0;i{var e;let i=!0;if(c(t,!0)){for(let n=0;n<4;n++)Ds[n]=t,i&&(i=!(null!==(e=Ds[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Ds[e]=!!t[e],i&&(i=!!Ds[e]);else Ds[0]=!1,Ds[1]=!1,Ds[2]=!1,Ds[3]=!1;return{isFullStroke:i,stroke:Ds}},Fs=[0,0,0,0],Us=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Fs[0]=t[0],Fs[2]=t[0],Fs[1]=t[1],Fs[3]=t[1],Fs):t:t:0,Ns=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],js=[1,2,3,0,1,2,3,0];function zs(t,e,i,n){for(;t>=At;)t-=At;for(;t<0;)t+=At;for(;t>e;)e+=At;Ns[0].x=i,Ns[1].y=i,Ns[2].x=-i,Ns[3].y=-i;const s=Math.ceil(t/xt)%4,r=Math.ceil(e/xt)%4;if(n.add(Tt(t)*i,Bt(t)*i),n.add(Tt(e)*i,Bt(e)*i),s!==r||e-t>bt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Ft(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Ft(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)}}Ys.TimeOut=1e3/60;const Xs=new Ys,Ks=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,$s=(t,e)=>{const i=Ks(t,e);return isNaN(i)?i:Math.max(e,i)};class qs{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Zs(t,e,i,n,s){return s?t.arc(i,n,e,0,St,!1,s):t.arc(i,n,e,0,St),!1}var Js=new class extends qs{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,n,s){return Zs(t,this.parseSize(e)/2,i,n,s)}drawOffset(t,e,i,n,s,r){return Zs(t,this.parseSize(e)/2+s,i,n,r)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i} a ${s},${s} 0 1,0 ${2*s},0 a ${s},${s} 0 1,0 -${2*s},0`}};var Qs=new class extends qs{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,n,s){return function(t,e,i,n,s){return t.moveTo(-3*e+i,-e+n,s),t.lineTo(-e+i,-e+n,s),t.lineTo(-e+i,-3*e+n,s),t.lineTo(e+i,-3*e+n,s),t.lineTo(e+i,-e+n,s),t.lineTo(3*e+i,-e+n,s),t.lineTo(3*e+i,e+n,s),t.lineTo(e+i,e+n,s),t.lineTo(e+i,3*e+n,s),t.lineTo(-e+i,3*e+n,s),t.lineTo(-e+i,e+n,s),t.lineTo(-3*e+i,e+n,s),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,s)}drawOffset(t,e,i,n,s,r){return function(t,e,i,n,s,r){return t.moveTo(-3*e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-3*e+n-s,r),t.lineTo(e+i+s,-3*e+n-s,r),t.lineTo(e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,e+n+s,r),t.lineTo(e+i+s,e+n+s,r),t.lineTo(e+i+s,3*e+n+s,r),t.lineTo(-e+i-s,3*e+n+s,r),t.lineTo(-e+i-s,e+n+s,r),t.lineTo(-3*e+i-s,e+n+s,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,s,r)}};function tr(t,e,i,n,s){return t.moveTo(i,n-e,s),t.lineTo(e+i,n,s),t.lineTo(i,n+e,s),t.lineTo(i-e,n,s),t.closePath(),!0}var er=new class extends qs{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,n,s){return tr(t,this.parseSize(e)/2,i,n,s)}drawFitDir(t,e,i,n,s){return tr(t,this.parseSize(e)/2,i,n,s)}drawOffset(t,e,i,n,s,r){return tr(t,this.parseSize(e)/2+s,i,n,r)}};function ir(t,e,i,n){const s=2*e;return t.rect(i-e,n-e,s,s),!1}var nr=new class extends qs{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return ir(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return ir(t,this.parseSize(e)/2+s,i,n)}};function sr(t,e,i,n,s=0){return t.moveTo(i+e+2*s,e+n+s),t.lineTo(i-e-2*s,e+n+s),t.lineTo(i,n-e-2*s),t.closePath(),!0}class rr extends qs{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,n){return sr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return sr(t,this.parseSize(e)/2,i,n,s)}}var ar=new rr;var or=new class extends rr{constructor(){super(...arguments),this.type="triangle"}};const lr=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),hr=Math.sin(St/10)*lr,cr=-Math.cos(St/10)*lr;function ur(t,e,i,n){const s=hr*e,r=cr*e;t.moveTo(i,-e+n),t.lineTo(s+i,r+n);for(let a=1;a<5;++a){const o=St*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+n),t.lineTo(l*s-h*r+i,h*s+l*r+n)}return t.closePath(),!0}var dr=new class extends qs{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,n){return ur(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return ur(t,this.parseSize(e)/2+s,i,n)}};const pr=Et(3);function gr(t,e,i,n){const s=e,r=s/pr,a=r/5,o=e;return t.moveTo(0+i,-s+n),t.lineTo(r/2+i,n),t.lineTo(a/2+i,n),t.lineTo(a/2+i,o+n),t.lineTo(-a/2+i,o+n),t.lineTo(-a/2+i,n),t.lineTo(-r/2+i,n),t.closePath(),!0}var fr=new class extends qs{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,n){return gr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return gr(t,this.parseSize(e)/2+s,i,n)}};function mr(t,e,i,n){const s=2*e;return t.moveTo(i,-e+n),t.lineTo(s/3/2+i,e+n),t.lineTo(-s/3/2+i,e+n),t.closePath(),!0}var vr=new class extends qs{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,n){return mr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return mr(t,this.parseSize(e)/2+s,i,n)}};function yr(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(i,e+n),!1}var _r=new class extends qs{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,n){return yr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return yr(t,this.parseSize(e)/2+s,i,n)}};const br=-.5,xr=Et(3)/2,Sr=1/Et(12);function Ar(t,e,i,n){const s=e/2,r=e*Sr,a=s,o=e*Sr+e,l=-a,h=o;return t.moveTo(s+i,r+n),t.lineTo(a+i,o+n),t.lineTo(l+i,h+n),t.lineTo(br*s-xr*r+i,xr*s+br*r+n),t.lineTo(br*a-xr*o+i,xr*a+br*o+n),t.lineTo(br*l-xr*h+i,xr*l+br*h+n),t.lineTo(br*s+xr*r+i,br*r-xr*s+n),t.lineTo(br*a+xr*o+i,br*o-xr*a+n),t.lineTo(br*l+xr*h+i,br*h-xr*l+n),t.closePath(),!1}var Cr=new class extends qs{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,n){return Ar(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return Ar(t,this.parseSize(e)/2+s,i,n)}};function wr(t,e,i,n,s){return t.moveTo(-e+i-2*s,n),t.lineTo(e+i+s,e+n+2*s),t.lineTo(e+i+s,n-e-2*s),t.closePath(),!0}var Tr=new class extends qs{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,n){return wr(t,this.parseSize(e)/2,i,n,0)}drawOffset(t,e,i,n,s){return wr(t,this.parseSize(e)/2,i,n,s)}};function kr(t,e,i,n,s=0){return t.moveTo(i-e-s,e+n+2*s),t.lineTo(e+i+2*s,n),t.lineTo(i-e-s,n-e-2*s),t.closePath(),!0}var Mr=new class extends qs{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,n){return kr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return kr(t,this.parseSize(e)/2,i,n,s)}};function Br(t,e,i,n,s=0){return t.moveTo(i-e-2*s,n-e-s),t.lineTo(i+e+2*s,n-e-s),t.lineTo(i,n+e+2*s),t.closePath(),!0}var Er=new class extends qs{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,n){return Br(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return Br(t,this.parseSize(e)/2,i,n,s)}};const Pr=Et(3);function Or(t,e,i,n){const s=e*Pr;return t.moveTo(i,n+-s/3*2),t.lineTo(e+i,n+s),t.lineTo(i-e,n+s),t.closePath(),!0}var Rr=new class extends qs{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,n){return Or(t,this.parseSize(e)/2/Pr,i,n)}drawOffset(t,e,i,n,s){return Or(t,this.parseSize(e)/2/Pr+s,i,n)}};function Ir(t,e,i,n){const s=2*e;return t.moveTo(e+i,n-s),t.lineTo(i-e,n),t.lineTo(e+i,s+n),!0}var Dr=new class extends qs{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,n){return Ir(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return Ir(t,this.parseSize(e)/4+s,i,n)}};function Lr(t,e,i,n){const s=2*e;return t.moveTo(i-e,n-s),t.lineTo(i+e,n),t.lineTo(i-e,s+n),!0}var Fr=new class extends qs{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,n){return Lr(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return Lr(t,this.parseSize(e)/4+s,i,n)}};function Ur(t,e,i,n){const s=2*e;return t.moveTo(i-s,n+e),t.lineTo(i,n-e),t.lineTo(i+s,n+e),!0}var Nr=new class extends qs{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,n){return Ur(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return Ur(t,this.parseSize(e)/4+s,i,n)}};function jr(t,e,i,n){const s=2*e;return t.moveTo(i-s,n-e),t.lineTo(i,n+e),t.lineTo(i+s,n-e),!0}var zr=new class extends qs{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,n){return jr(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return jr(t,this.parseSize(e)/4+s,i,n)}};function Wr(t,e,i,n,s){return t.moveTo(i,n-e),t.lineTo(i,n+e),!0}var Hr=new class extends qs{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,n,s){return Wr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Wr(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e}, ${i-s} L ${e},${i+s}`}};function Vr(t,e,i,n,s){return t.moveTo(i-e,n),t.lineTo(i+e,n),!0}var Gr=new class extends qs{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,n,s){return Vr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Vr(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i} L ${e+s},${i}`}};function Yr(t,e,i,n,s){return t.moveTo(i-e,n-e),t.lineTo(i+e,n+e),t.moveTo(i+e,n-e),t.lineTo(i-e,n+e),!0}var Xr=new class extends qs{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,n,s){return Yr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Yr(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i-s} L ${e+s},${i+s} M ${e+s}, ${i-s} L ${e-s},${i+s}`}};function Kr(t,e,i,n){return t.rect(i-e[0]/2,n-e[1]/2,e[0],e[1]),!1}function $r(t,e,i,n){const s=e,r=e/2;return t.rect(i-s/2,n-r/2,s,r),!1}var qr=new class extends qs{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,n){return S(e)?$r(t,e,i,n):Kr(t,e,i,n)}drawWithClipRange(t,e,i,n,s,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*s,l=[{x:i+e[0]/2,y:n-e[1]/2},{x:i+e[0]/2,y:n+e[1]/2},{x:i-e[0]/2,y:n+e[1]/2},{x:i-e[0]/2,y:n-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/n,s=(i.y-c.y)*(o-h)/n;t.lineTo(c.x+e,c.y+s);break}t.lineTo(i.x,i.y),c=i,h+=n}return!1}drawOffset(t,e,i,n,s){return S(e)?$r(t,e+2*s,i,n):Kr(t,[e[0]+2*s,e[1]+2*s],i,n)}};const Zr=new ue;class Jr{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,n,s,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((s=>{t.beginPath(),en(s.path.commandList,t,i,n,e,e),a&&a(s.path,s.attribute)})),!1):(en(this.path.commandList,t,i,n,e+s,e+s),!1)}draw(t,e,i,n,s,r){return e=this.parseSize(e),this.drawOffset(t,e,i,n,0,s,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,n,s,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,n,s),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,n,s),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Zr.x1=i.bounds.x1*t,Zr.y1=i.bounds.y1*t,Zr.x2=i.bounds.x2*t,Zr.y2=i.bounds.y2*t,e.union(Zr)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const Qr=[Js,Qs,er,nr,Rr,or,dr,fr,vr,_r,Cr,Tr,Mr,ar,Er,Dr,Fr,Nr,zr,qr,Hr,Gr,Xr],ta={};Qr.forEach((t=>{ta[t.type]=t}));const ea={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class ia{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function na(t,e,i,n){const s=t.indexOf(e,i);if(-1===s)throw new Error(n);return s+e.length-1}function sa(t,e,i,n=">"){const s=function(t,e,i=">"){let n,s="";for(let r=e;r",r,"Closing Tag is not closed."),a=s.lastIndexOf(".");s=s.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&n&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=n),n="",r=e}else if("?"===t[r+1])r=sa(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=na(t,"--\x3e",r+4,"Comment is not closed.");else{const a=sa(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(s+=s?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),s=s.substr(0,s.length-1),l=o):l=l.substr(0,l.length-1);const t=new ia(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),s=s.substr(0,s.lastIndexOf("."))}else{const t=new ia(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),i=t}n="",r=c}else n+=t[r];return e.child}}function oa(t,e){return la(t)}function la(t,e){const i={};for(let e=0;e{di.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)}))}function ma(t,e,i,n=0){return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let va=0;function ya(){return va++}var _a;function ba(t){const e=[];let i=0,n="";for(let s=0;sxa.set(t,!0)));const Sa=new Map;function Aa(t){if(xa.has(t))return!0;if(Sa.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Ca(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Sa.set(t,!0)));const wa=ya(),Ta=ya(),ka=ya(),Ma=ya(),Ba=ya(),Ea=ya(),Pa=ya(),Oa=ya(),Ra=ya(),Ia=ya(),Da=ya(),La=ya(),Fa=ya(),Ua=ya(),Na=ya(),ja=ya(),za=ya(),Wa=Symbol.for("GraphicService"),Ha=Symbol.for("GraphicCreator"),Va={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},Ga=Object.keys(Va),Ya={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Xa=Object.keys(Ya),Ka={duration:200,easing:"cubicOut"},$a=Symbol.for("CanvasFactory"),qa=Symbol.for("Context2dFactory");function Za(t){return function(){var t,e;const i=null===(t=di.global)||void 0===t?void 0:t.env,n=i?null===(e=di.canvasFactory)||void 0===e?void 0:e.call(di,i):void 0;if(!n)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return n}()(t)}const Ja=1e-4,Qa=Math.sqrt(3),to=1/3;function eo(t){return t>-mo&&tmo||t<-mo}function no(t){return"number"==typeof t&&Number.isFinite(t)}const so=[0,0],ro=[0,0],ao=[0,0];function oo(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function lo(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function ho(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 co(t){return(t%=At)<0&&(t+=At),t}function uo(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+u&&c>n+u&&c>r+u&&c>o+u||ct+u&&h>i+u&&h>s+u&&h>a+u||h=0&&pi||c+hs&&(s+=At);let u=Math.atan2(l,o);return u<0&&(u+=At),u>=n&&u<=s||u+At>=n&&u+At<=s}function fo(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(eo(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 yo=[-1,-1,-1],_o=[-1,-1];function bo(){const t=_o[0];_o[0]=_o[1],_o[1]=t}function xo(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=u*u-4*c*d;if(eo(t)){const t=u/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-u+e),n=c*o+1.5*a*(-u-e);i=i<0?-Math.pow(-i,to):Math.pow(i,to),n=n<0?-Math.pow(-n,to):Math.pow(n,to);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*u)/(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+Qa*Math.sin(e)))/(3*a),h=(-o+i*(n-Qa*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,yo);if(0===c)return 0;let u=0,d=-1,p=0,g=0;for(let h=0;h1&&bo(),p=ho(e,n,r,o,_o[0]),d>1&&(g=ho(e,n,r,o,_o[1]))),2===d?c<_o[0]?u+=pe&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(eo(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,yo);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=lo(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);yo[0]=-l,yo[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=At-1e-4){n=0,s=At;const e=r?1:-1;return a>=yo[0]+t&&a<=yo[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=At,s+=At);let c=0;for(let e=0;e<2;e++){const i=yo[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=At+t),(t>=n&&t<=s||t+At>=n&&t+At<=s)&&(t>bt/2&&t<1.5*bt&&(e=-e),c+=e)}}return c}function Co(t){return Math.round(t/bt*1e8)/1e8%2*bt}function wo(t,e){let i=Co(t[0]);i<0&&(i+=At);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=At?s=i+At:e&&i-s>=At?s=i-At:!e&&i>s?s=i+(At-Co(i-s)):e&&i1&&(i||(h+=ie(c,u,d,p,n,s))),g&&(c=a[1],u=a[2],d=c,p=u);const f=a[0],m=a[1],v=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,A=b;To[0]=S,To[1]=A,wo(To,Boolean(a[6])),S=To[0],A=To[1];const C=S,w=A-S,T=!!(1-(a[6]?0:1)),k=(n-m)*y/y+m;switch(f){case Li.M:d=m,p=v,c=d,u=p;break;case Li.L:if(i){if(fo(c,u,m,v,e,n,s))return!0}else h+=ie(c,u,m,v,n,s)||0;c=m,u=v;break;case Li.C:if(i){if(po(c,u,m,v,y,_,b,x,e,n,s))return!0}else h+=xo(c,u,m,v,y,_,b,x,n,s)||0;c=b,u=x;break;case Li.Q:if(i){if(uo(c,u,m,v,y,_,e,n,s))return!0}else h+=So(c,u,m,v,y,_,n,s)||0;c=y,u=_;break;case Li.A:if(o=Math.cos(C)*y+m,l=Math.sin(C)*y+v,g?(d=o,p=l):h+=ie(c,u,o,l,n,s),i){if(go(m,v,y,C,C+w,T,e,k,s))return!0}else h+=Ao(m,v,y,C,C+w,T,k,s);c=Math.cos(C+w)*y+m,u=Math.sin(C+w)*y+v;break;case Li.R:if(d=c=m,p=u=v,o=d+y,l=p+_,i){if(fo(d,p,o,p,e,n,s)||fo(o,p,o,l,e,n,s)||fo(o,l,d,l,e,n,s)||fo(d,l,d,p,e,n,s))return!0}else h+=ie(o,p,o,l,n,s),h+=ie(d,l,d,p,n,s);break;case Li.Z:if(i){if(fo(c,u,d,p,e,n,s))return!0}else h+=ie(c,u,d,p,n,s);c=d,u=p}}return i||(g=u,f=p,Math.abs(g-f)0&&i("Invalid input not EOF"),t}()}}();class Bo{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Bo.IsGradientStr(t))try{const e=Mo(t)[0];if(e){if("linear"===e.type)return Bo.ParseLinear(e);if("radial"===e.type)return Bo.ParseRadial(e);if("conic"===e.type)return Bo.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const n=t.length>1?i/(t.length-1):0;return{color:e.value,offset:n}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,n=bt/2,s=parseFloat(e.value)/180*bt-n;return{gradient:"conical",x:.5,y:.5,startAngle:s,endAngle:s+At,stops:Bo.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:Bo.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,n=bt/2;let s="angular"===e.type?parseFloat(e.value)/180*bt:0;for(;s<0;)s+=At;for(;s>=At;)s-=At;let r=0,a=0,o=0,l=0;return s{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,u,d):"conical"===c.gradient?h=function(t,e,i,n,s,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*s,n+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(s+i,r+n,void 0):l}(t,c,p,g,u,d):"radial"===c.gradient&&(h=function(t,e,i,n,s,r){var a,o,l,h,c,u;const d=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*s,n+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(s,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*s,n+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(s,r)*(null!==(u=e.r1)&&void 0!==u?u:.5));return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d}(t,c,p,g,u,d))}return h||"orange"}function Oo(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Ro(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],u=e[10],d=e[11];return 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+u*n,t[7]=l*s+d*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=u*s-o*n,t[11]=d*s-l*n,t}function Io(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],u=e[10],d=e[11];return 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-u*n,t[3]=l*s-d*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+u*s,t[11]=l*n+d*s,t}function Do(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],u=e[6],d=e[7];return 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+u*n,t[3]=l*s+d*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=u*s-o*n,t[7]=d*s-l*n,t}function Lo(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,u,d,p,g,f,m,v;return e===t?(t[12]=e[0]*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],u=e[5],d=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=u,t[6]=d,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+u*s+f*r+e[13],t[14]=l*n+d*s+m*r+e[14],t[15]=h*n+p*s+v*r+e[15]),t}function Fo(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 Uo(t,e,i){const n=i[0],s=i[1],r=i[2];return 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}function No(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],u=e[8],d=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*u+S*f,t[1]=_*s+b*l+x*d+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*u+S*f,t[5]=_*s+b*l+x*d+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*u+S*f,t[9]=_*s+b*l+x*d+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*u+S*f,t[13]=_*s+b*l+x*d+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function jo(t,e,i,n){let s,r,a,o,l,h,c,u,d,p;const g=e[0],f=e[1],m=e[2],v=n[0],y=n[1],_=n[2],b=i[0],x=i[1],S=i[2];return Math.abs(g-b)<_t&&Math.abs(f-x)<_t&&Math.abs(m-S)<_t?Oo(t):(c=g-b,u=f-x,d=m-S,p=1/Math.hypot(c,u,d),c*=p,u*=p,d*=p,s=y*d-_*u,r=_*c-v*d,a=v*u-y*c,p=Math.hypot(s,r,a),p?(p=1/p,s*=p,r*=p,a*=p):(s=0,r=0,a=0),o=u*a-d*r,l=d*s-c*a,h=c*r-u*s,p=Math.hypot(o,l,h),p?(p=1/p,o*=p,l*=p,h*=p):(o=0,l=0,h=0),t[0]=s,t[1]=o,t[2]=c,t[3]=0,t[4]=r,t[5]=l,t[6]=u,t[7]=0,t[8]=a,t[9]=h,t[10]=d,t[11]=0,t[12]=-(s*g+r*f+a*m),t[13]=-(o*g+l*f+h*m),t[14]=-(c*g+u*f+d*m),t[15]=1,t)}function zo(t,e,i,n,s,r,a){const o=1/(e-i),l=1/(n-s),h=1/(r-a);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+i)*o,t[13]=(s+n)*l,t[14]=(a+r)*h,t[15]=1,t}function Wo(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}const Ho=Symbol.for("MatrixAllocate"),Vo=Symbol.for("Mat4Allocate");function Go(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}class Yo{constructor(){this.pools=[]}allocate(t,e,i,n,s,r){if(!this.pools.length)return new pe(t,e,i,n,s,r);const a=this.pools.pop();return a.a=t,a.b=e,a.c=i,a.d=n,a.e=s,a.f=r,a}allocateByObj(t){if(!this.pools.length)return new pe(t.a,t.b,t.c,t.d,t.e,t.f);const e=this.pools.pop();return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}class Xo{constructor(){this.pools=[]}static identity(t){return Oo(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 Xo.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;i0&&(Ko.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Ko.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n,s=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,n=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,n=!0){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},Zo),function(t,e,i){return ko(t,0,!1,e,i)}(this.path.commandList,Zo.x,Zo.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Zo);const i=Eo(this,this.lineWidth,this.dpr);return function(t,e,i,n){return ko(t,e,!0,i,n)}(this.path.commandList,i,Zo.x,Zo.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(t=!0,e=this.dpr){this.setTransformFromMatrix(qo,t,e)}setClearMatrix(t,e,i,n,s,r){this._clearMatrix.setValue(t,e,i,n,s,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Ko.free(t))),this.stack.length=0}}const Qo={WIDTH:500,HEIGHT:500,DPR:1};class tl{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:n=Qo.WIDTH,height:s=Qo.HEIGHT,dpr:r=Qo.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=n*r,this._pixelHeight=s*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=n,this._displayHeight=s,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var el;tl.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(el||(el={}));class il{static Get(t,e=el.Color1,i=[0,0,0,1]){if(e===el.Color1){const e=il.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const n=we.parseColorString(t);if(n){const e=[n.r/255,n.g/255,n.b/255,n.opacity];il.store1[t]=e,il.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const n=il.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;const s=we.parseColorString(t);return s&&(il.store1[t]=[s.r/255,s.g/255,s.b/255,s.opacity],il.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=s.r,i[1]=s.g,i[2]=s.b,i[3]=s.opacity),i}static Set(t,e,i){if(e===el.Color1){if(il.store1[t])return;il.store1[t]=i,il.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(il.store255[t])return;il.store255[t]=i,il.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function nl(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function sl(t,e,i,n,s){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((s,r)=>{var a,o;return rl(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,n)})):rl(t,e,i,n,s)}function rl(t,e,i,n,s){if(!t||!e)return t&&nl(t)||e&&nl(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=il.Get(t,el.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=il.Get(e,el.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:nl(a)})))});return o?sl(r,l,i,n,s):sl(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 al(n,s,i);if("radial"===n.gradient)return ol(n,s,i);if("conical"===n.gradient)return ll(n,s,i)}return!1}return s&&s(r,a),nl(hl(r,a,i),n)}function al(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:pl(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}function ol(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:pl(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}function ll(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:pl(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}function hl(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]}function cl(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}il.store255={},il.store1={};const ul=[0,0,0,0],dl=[0,0,0,0];function pl(t,e,i){return il.Get(t,el.Color255,ul),il.Get(e,el.Color255,dl),`rgba(${Math.round(ul[0]+(dl[0]-ul[0])*i)},${Math.round(ul[1]+(dl[1]-ul[1])*i)},${Math.round(ul[2]+(dl[2]-ul[2])*i)},${ul[3]+(dl[3]-ul[3])*i})`}class gl{static GetCanvas(){try{return gl.canvas||(gl.canvas=di.global.createCanvas({})),gl.canvas}catch(t){return null}}static GetCtx(){if(!gl.ctx){const t=gl.GetCanvas();gl.ctx=t.getContext("2d")}return gl.ctx}}class fl extends ge{static getInstance(){return fl._instance||(fl._instance=new fl),fl._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=gl.GetCanvas(),n=gl.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})`}GetOrCreate(t,e,i,n,s=[],r=100){let a=`${t}${e}${i}${n}`;s.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new fl(s,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class ml{static GetSize(t){for(let e=0;e=t)return ml.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=ml.GenKey(t,e,i,n,s),l=ml.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=ml.GenKey(t,e,i,n,s);ml.cache[l]?ml.cache[l].push({width:a,height:o,pattern:r}):ml.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}function vl(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=At;for(;i>At;)i-=At;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),sl(o.color,l.color,h,!1)}function yl(t,e,i,n,s,r,a,o,l){const h=Math.floor(180*s/Math.PI),c=gl.GetCanvas(),u=gl.GetCtx();if(!u)return null;const d=ml.GetSize(o),p=ml.GetSize(l);let g=ml.Get(e,i,n,r,a,d,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(n,2),Math.pow(d-i,2)+Math.pow(n,2)),Math.max(Math.pow(d-i,2)+Math.pow(p-n,2),Math.pow(i,2)+Math.pow(p-n,2)))),m=h+1,v=s/Math.max(1,m-1),y=fl.getInstance().GetOrCreate(i,n,d,p,e,m),_=2*Math.PI*f/360;c.width=d,c.height=p,u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,d,p),u.translate(i,n),u.rotate(r);for(let t=0,e=m-1;ta);t++){const e=y.getColor(t);u.beginPath(),u.rotate(v),u.moveTo(0,0),u.lineTo(f,-2*_),u.lineTo(f,0),u.fillStyle=e,u.closePath(),u.fill()}const b=u.getImageData(0,0,d,p);return c.width=b.width,c.height=b.height,u.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&ml.Set(e,i,n,r,a,g,d,p),g}ml.cache={},ml.ImageSize=[20,40,80,160,320,640,1280,2560];const _l=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function bl(t){return null==t?void 0:t}class xl{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,n;const s=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(n=e.priority)&&void 0!==n?n:0;return s!==r?s-r:t.name.localeCompare(e.name)})),n=new Map;i.forEach(((t,e)=>{n.set(t.name,e)}));const s=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),s.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=n.get(t.name))&&void 0!==i?i:0,patch:bl(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(s,"exclude"),this.expandRelationClosure(s,"suppress"),s}normalizeDefinition(t,e){var i,n;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>_l.has(t)))){const s=e;return{name:null!==(i=s.name)&&void 0!==i?i:t,priority:null!==(n=s.priority)&&void 0!==n?n:0,patch:bl(s.patch),resolver:s.resolver,declaredAffectedKeys:s.declaredAffectedKeys,exclude:s.exclude,suppress:s.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,n)=>{i.set(n,new Set(t[e]))})),t.forEach(((t,n)=>{const s=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===n||e.has(t)||s.has(t)||(s.add(t),e.add(t),r(t,e),e.delete(t))}))};r(n,new Set([n])),t[e]=s}))}}function Sl(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Al(t){if(!Sl(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Al(t[i])})),e}function Cl(t,e){var i;const n=null!==(i=Al(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],s=n[t];Sl(s)&&Sl(i)?n[t]=Cl(s,i):n[t]=Al(i)})),n}class wl{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),n=this.adjudicate(i),s=n.active,r=s.filter((t=>!n.suppressedSet.has(t))),a=s.filter((t=>n.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,s)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=s,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),n=this.compiledDefinitions.get(e);return i&&n?i.priority!==n.priority?i.priority-n.priority:i.rank-n.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const n=e[t],s=this.compiledDefinitions.get(n);s&&(s.exclude.forEach((i=>{const n=e.indexOf(i);-1!==n&&(e.splice(n,1),n{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},n=this.resolverCacheValid&&this.resolverCacheKey===e;n||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const s=this.compiledDefinitions.get(t);if(s&&(s.patch&&this.mergeInto(i,s.patch),s.hasResolver)){const r=n?this.resolverPatchCache.get(t):null===(e=s.resolver)||void 0===e?void 0:e.call(s,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(n||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),n||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Al(e[i])})):Object.keys(e).forEach((i=>{var n;const s=e[i],r=t[i],a=null===(n=this.baseAttributes)||void 0===n?void 0:n[i];Sl(r)&&Sl(s)?t[i]=Cl(r,s):!Sl(r)&&Sl(a)&&Sl(s)?t[i]=Cl(a,s):t[i]=Al(s)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?Tl.PAINT|Tl.BOUNDS|Tl.PICK:Tl.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),n=Number(null!=e?e:0);return i!==n&&(i>0||n>0)?Tl.PAINT|Tl.BOUNDS:Tl.PAINT}};class Bl{analyzeTransition(t,e,i={}){var n,s;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(n=i.noWorkAnimateAttr)&&void 0!==n?n:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(s=i.animateConfig)||void 0===s?void 0:s.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const u=i.extraAnimateAttrs;if(u)for(const e in u){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(u,e)||i&&void 0!==t[e]||c(e,u[e])}return r}applyTransition(t,e,i,n={}){var s,r,a;if(i){const i=null!==(s=n.animateConfig)&&void 0!==s?s:Ka;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:Yi.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:Yi.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:Yi.STATE}),e}applyClearTransition(t,e,i,n={}){var s;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(s=n.shouldSkipDefaultAttribute)&&void 0!==s?s:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:n.animateConfig,extraAnimateAttrs:n.extraAnimateAttrs});return this.applyTransition(t,r,i,n)}}const El=new xl;function Pl(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,Ol(t),!0)}function Ol(t,e=t.revision+1){var i;const n=(s=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},s?s.effectiveSourceDefinitions:a,r));var s,r,a;return t.effectiveSourceDefinitions=n,t.effectiveCompiledDefinitions=El.compile(n),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function Rl(t){if(t)return t.parentScope&&Rl(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&Ol(t),t}function Il(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function Dl(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function Ll(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var n;i.sharedStateDirty=!0,Dl(null!==(n=null!=e?e:i.stage)&&void 0!==n?n:t.ownerStage,i)})),Il(null!=e?e:t.ownerStage))}const Fl=new ue,Ul=new pe,Nl=["lineWidth","scaleX","scaleY","angle","anchor","visible"],jl=["x","y"],zl=["scaleX","scaleY"],Wl=["angle"],Hl=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),Vl=new Ft,Gl=[],Yl=Tl.PAINT|Tl.SHAPE|Tl.BOUNDS|Tl.TRANSFORM|Tl.LAYOUT;function Xl(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Kl(t){if(!Xl(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const n=e[t];i[t]=Xl(n)?Kl(n):n})),i}function $l(t,e){return t===e||!!(Xl(t)||Xl(e)||Array.isArray(t)||Array.isArray(e))&&W(t,e)}function ql(t,e){var i;const n=null!==(i=Kl(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],s=n[t];Xl(s)&&Xl(i)?n[t]=ql(s,i):n[t]=Kl(i)})),n}const Zl={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Jl extends _i{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,Dl(this.stage,this),Il(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&Rl(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Yi.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(Rl(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new xl).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),n=this.resolveUseStatesTransition(this.currentStates,i),s=null!==(e=n.effectiveStates)&&void 0!==e?e:n.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=n.states,this.effectiveStates=[...s],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Kl(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const n=i[t],s=e[t];"deep"===this.stateMergeMode&&Xl(s)&&Xl(n)?e[t]=ql(s,n):e[t]=Kl(n)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const n=this.buildStaticAttributeSnapshot(),s=n;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,s)||(i[e]=void 0===t?t:Kl(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,s));else if(Object.prototype.hasOwnProperty.call(n,e)){const t=n[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,s):t)}else a(this.getStateTransitionDefaultAttribute(e,s))})),i}syncObjectToSnapshot(t,e){const i=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((n=>{const s=Object.prototype.hasOwnProperty.call(e,n),r=t[n];if(!s)return void(Object.prototype.hasOwnProperty.call(t,n)&&(i.set(n,{prev:r,next:void 0}),delete t[n]));const a=e[n];$l(r,a)||(i.set(n,{prev:r,next:a}),t[n]=Kl(a))})),i}_syncAttribute(){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const t=this.buildStaticAttributeSnapshot(),e=this.syncObjectToSnapshot(this.attribute,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,e}_syncFinalAttributeFromStaticTruth(){const t=this.finalAttribute;if(!t)return;const e=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(t,e)}mergeAttributeDeltaCategory(t,e,i,n){var s;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var n;const s=Ml[t];return s?s(e,i):null!==(n=kl[t])&&void 0!==n?n:Tl.PAINT}(e,i,n):null!==(s=kl[e])&&void 0!==s?s:Tl.PAINT;return r&Tl.PICK&&(r|=Tl.BOUNDS),r===Tl.PAINT&&this.needUpdateTag(e)&&(r=Tl.SHAPE|Tl.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&Yl)!==Yl?(t&Tl.SHAPE?this.addUpdateShapeAndBoundsTag():t&Tl.BOUNDS&&this.addUpdateBoundTag(),t&Tl.PAINT&&this.addUpdatePaintTag(),t&Tl.TRANSFORM&&this.addUpdatePositionTag(),t&Tl.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=Tl.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,n,s;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(n=this.resolverEpoch)&&void 0!==n?n:0)+1,null===(s=this.stateEngine)||void 0===s||s.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!Xl(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const n=e[t];i[t]=Xl(n)?Object.assign({},n):n})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const n=t,s=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r=!0,s[t]=n[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=s,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,n){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(n)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&Vi.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const n=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&n.clear(),n}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new de),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=ta[t];if(e)return e;if(e=Jl.userSymbolMap[t],e)return e;if(!0===ua(t=ea[t]||t)){const e=new pa,{svg:i}=e.parse(t);if(!i)return null;const n=_(i.path)?i.path:[i.path];Fl.clear();const s=[];n.forEach((t=>{const e=(new Zn).fromString(t.d),i={};Xa.forEach((e=>{t[e]&&(i[Ya[e]]=t[e])})),s.push({path:e,attribute:i}),Fl.union(e.bounds)}));const r=Fl.width(),a=Fl.height(),o=1/kt(r,a);s.forEach((t=>t.path.transform(0,0,o,o)));const l=new Jr(t,s,!0);return Jl.userSymbolMap[t]=l,l}const i=(new Zn).fromString(t),n=i.bounds.width(),s=i.bounds.height(),r=1/kt(n,s);i.transform(0,0,r,r);const a=new Jr(t,i);return Jl.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const n=this.attribute,s=this.updateAABBBounds(n,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=n,a=Us(r);return a&&s.expand(a),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Oi(t);return en(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new pe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Vi.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Vi.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Vi.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Vi.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Vi.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&Vi.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Vi.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===Gi.GLOBAL){const i=new Ft(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,n){if(!t)return;const s=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,s,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||n)&&t.preventAttrs(s)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===Yi.STATE||null!=i&&i>=Yi.ANIMATE_BIND&&i<=Yi.ANIMATE_END)return;const n=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,s=this.setFinalAttributes;n&&"function"==typeof s&&s.call(this,n)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var n,s;const r=this.context,a=null!==(n=null==r?void 0:r.diffAttrs)&&void 0!==n?n:t,o=null==i?void 0:i.type;if(!e.length||!a||o===Yi.STATE||null!=o&&o>=Yi.ANIMATE_BIND&&o<=Yi.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(s=this.transientFromAttrsBeforePreventAnimate)&&void 0!==s?s:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),s=this.sortLocalStates(t);return{changed:n,states:n?s:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const n=this.ensureStateEngine();if(n)return this.toGraphicStateTransition(n.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const s=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(s)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,n=this.currentStates.filter(i);return n.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(n)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const n=this.getStateResolveBaseAttrs(),s=this.ensureStateEngine(n);e&&(null==s||s.invalidateResolverCache());const r=s?this.toGraphicStateTransition(s.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},n=null!=e?e:{},s=new Set([...Object.keys(i),...Object.keys(n)]);for(const t of s){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(n,t))return!1;if(!$l(i[t],n[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var n;const s=null!==(n=this.currentStates)&&void 0!==n?n:Gl,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,s,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Yi.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:Yi.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,n;return null!==(n=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==n?n:Ka}applyStateAttrs(t,e,i,n,s,r){const a=i?this.resolveStateAnimateConfig(s):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(n)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,n;const s=null!==(e=this.currentStates)&&void 0!==e?e:Gl,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===s.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Kl(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(n=this.baseAttributes)&&void 0!==n?n:{};a.changed&&!this.beforeStateUpdate(o,s,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Yi.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:Yi.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const n=this.resolveAddStateTransition(t,e);n.changed&&this.useStates(n.states,i)}setStates(t,e){var i,n,s;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:Gl,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(n=this.effectiveStates)||void 0===n?void 0:n.length)||this.resolvedStatePatch||(null===(s=this.registeredActiveScopes)||void 0===s?void 0:s.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const n=null!==(i=this.currentStates)&&void 0!==i?i:Gl,s=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(n,r.states)||this.beforeStateUpdate(o,n,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,s))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Yi.STATE}):this.restoreAttributeFromStatePatchDelta(s,this.resolvedStatePatch,{type:Yi.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),n=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=n,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Yi.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],n=null!=e?e:[];if(i.length!==n.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=s();n[0]=i.x1+(i.x2-i.x1)*e}else n[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=s();n[1]=i.y1+(i.y2-i.y1)*e}else n[1]=t[1];return n}doUpdateLocalMatrix(){const{x:t=as.x,y:e=as.y,scaleX:i=as.scaleX,scaleY:n=as.scaleY,angle:s=as.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&s&&(l=this.getAnchor(a,h)),!r||1===i&&1===n)!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,u=e.d,d=e.e,p=e.f,g=Tt(a),f=Bt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=n);const y=m-i,_=v-n,b=l*g+c*f,x=h*g+u*f,S=c*g-l*f,A=u*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*A,t.e=d+l*m+c*v-b*y-S*_,t.f=p+h*m+u*v-x*y-A*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,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),l=this.getAnchor(r,h,!0),di.transformUtil.fromMatrix(a,a).scale(i,n,{x:l[0],y:l[1]})}const c=this.getOffsetXY(as);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ul.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){var i,n,s,r,a,o,l,h,c,u;const d=null!==(s=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(n=this.stage)||void 0===n?void 0:n.graphicService)&&void 0!==s?s:di.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),n=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),n.push(t)))})),n.length&&(n.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:Yi.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==d?void 0:d.onSetStage)||void 0===h||h.call(d,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(u=this.registeredActiveScopes)||void 0===u?void 0:u.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:Yi.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,n;return t&&(t.shadowHost=this),this.shadowRoot=null!==(n=null!=t?t:null===(i=(e=di.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==n?n:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Zn).fromString(t):this.pathProxy=new Zn,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,n;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const s=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:di.graphicService;null===(n=null==s?void 0:s.onRelease)||void 0===n||n.call(s,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,n;if(this.hasCustomEvent(t)){const s=new Ci(t,e);s.bubbles=!1;const r=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager;return r?(s.manager=r,this.dispatchEvent(s)):_i.prototype.dispatchEvent.call(this,s)}return!0}beforeStateUpdate(t,e,i,n,s){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:Yi.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!n,isClear:!!s})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:Yi.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const n=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||di.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(n){const t=new Jo(null,1);return n.drawShape(this,t,0,0,{},{}),t.path}return null}}function Ql(t){return!!t&&("string"==typeof t?!Hl.has(t)&&(t.startsWith("{t[i]=e[i]}))}const sh=ih();class rh{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},eh.forEach((t=>{this._defaultTheme[t]=Object.create(sh[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0)}this.userTheme?this.doCombine(n&&n.theme.combinedTheme):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,nt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;eh.forEach((n=>{const s=Object.create(sh[n]);t&&t[n]&&nh(s,t[n]),i[n]&&nh(s,i[n]),e[n]&&nh(s,e[n]),this.combinedTheme[n]=s})),e.common&&eh.forEach((t=>{nh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const ah=new rh;function oh(t,e){return t.glyphHost?oh(t.glyphHost):e?(t.isContainer,e):lh(t)||t.attachedThemeGraphic&&oh(t.attachedThemeGraphic)||ah.getTheme()}function lh(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)):ah.getTheme()}return null}const hh=(t,e,i)=>{const{outerBorder:n,shadowBlur:s=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(r+(s+a)/2)}return i},ch=["radius","startAngle","endAngle",...Nl];class uh extends Jl{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Ma}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return oh(this).circle}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:s,tb2:r}=di.graphicService.updateTempAABBBounds(i);return hh(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,di.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:n=e.startAngle,endAngle:s=e.endAngle,radius:r=e.radius}=t;return s-n>At-_t?i.set(-r,-r,r,r):zs(n,s,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,ch)}needUpdateTag(t){return super.needUpdateTag(t,ch)}toCustomPath(){var t,e,i;let n=super.toCustomPath();if(n)return n;const s=this.attribute,r=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return n=new Zn,n.arc(0,0,r,a,o),n}clone(){return new uh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return uh.NOWORK_ANIMATE_ATTR}}function dh(t){return new uh(t)}function ph(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function gh(t,e,i,n=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?n-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function fh(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[Pe(i)]=t[i])})),["fontSize","lineHeight"].forEach((n=>{const s=Pe(n);d(t[n])||(e[s]=i(t[n]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}uh.NOWORK_ANIMATE_ATTR=Zl;class mh{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,n){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===n.length){const t=n[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,n,s="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=ts.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const u=[],d=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,n=t.length;io){const n=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,s,r,l);a=n.str,e=n.width}else e=n.width;u.push({str:a,width:e,ascent:n.ascent,descent:n.descent,keepCenterInLine:c})}d[0]=o}else{let e,i,n=0;for(let s=0,r=t.length;sMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:d[0],height:d[1]};return this.LayoutBBox(p,e,i,u),this.layoutWithBBox(p,u,e,i,n)}layoutWithBBox(t,e,i,n,s){const r=[0,0],a=e.length*s;"top"===n||("middle"===n?r[1]=(t.height-a)/2:"bottom"===n&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===s.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=za}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return oh(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new yh({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const n=this.obbText.AABBBounds,{x:s,y:r}=e,a={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},o=Jt(a,i,{x:s,y:r});return this._OBBBounds.copy(n),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:n=e.text}=this.attribute;Array.isArray(n)?this.updateMultilineAABBBounds(n):this.updateSingallineAABBBounds(n);const{tb1:s}=di.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){ma(s,o/Math.abs(r+a),!0,l),i.union(s)}return di.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||di.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,he(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:n=e.underlineOffset}=this.attribute,s="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&n&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+n),s}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const n=this.getGraphicTheme(),s=this.attribute,{fontFamily:r=n.fontFamily,textAlign:a=n.textAlign,textBaseline:o=n.textBaseline,fontSize:l=n.fontSize,fontWeight:h=n.fontWeight,ellipsis:c=n.ellipsis,maxLineWidth:u,stroke:d=n.stroke,wrap:p=n.wrap,measureMode:g=n.measureMode,lineWidth:f=n.lineWidth,whiteSpace:m=n.whiteSpace,suffixPosition:v=n.suffixPosition,ignoreBuf:y=n.ignoreBuf,keepCenterInLine:_=n.keepCenterInLine}=s,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(s,n,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=di.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new mh(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?n.ellipsis:c||void 0,!1,{lineWidth:u,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:C}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(C.xOffset,C.yOffset,C.xOffset+C.width,C.yOffset+C.height),d&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,n,s;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:u,stroke:d=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),C=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}const w=di.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:C},k=new mh(a,T,w),M=_(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/C),1)),x&&(P=Math.min(P,x)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let n=0,s=M.length;n{const e=t.reduce(((t,e)=>t+e.width),0);a=kt(e,a)}));const t=ph(y,a),e=this.cache.verticalList.length*v,i=gh(_,e,u);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>ba(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?s.ellipsis:h,n=r.clipTextWithSuffixVertical(t,{fontSize:u,fontWeight:d,fontFamily:c},l,i,!1,m);b[e]=n.verticalList,a=n.width}else{const i=r.clipTextVertical(t,{fontSize:u,fontWeight:d,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===_a.HORIZONTAL?u:r.measureTextWidth(t.text,{fontSize:u,fontWeight:d,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=kt(e,a)}));const S=ph(y,a),A=x.verticalList.length*v,C=gh(_,A,u);return this._AABBBounds.set(C,S,C+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const n=this.attribute;return null!==(i=null!==(e=n.maxLineWidth)&&void 0!==e?e:n.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var n;return null!==(n=$s(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==n?n:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=vh){return super.needUpdateTags(t,e)}needUpdateTag(t,e=vh){return super.needUpdateTag(t,e)}_interpolate(t,e,i,n,s){"text"===t&&(s.text=n)}clone(){return new yh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yh.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return yh.baselineMapAlign}getAlignMapBaseline(){return yh.alignMapBaseline}}function _h(t){return new yh(t)}yh.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Zl),yh.baselineMapAlign={top:"left",bottom:"right",middle:"center"},yh.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const bh=["heightLimit","lineClamp"];class xh extends yh{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,n,s,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:u=a.ellipsis,maxLineWidth:d,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=$s(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=di.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(n=this.stage)||void 0===n?void 0:n.textMeasureId)),C=new mh(o,{fontSize:c,fontWeight:m,fontFamily:o},A),w=t.map((t=>t.toString())),T=[],k=[0,0];let M=1/0;if(y>0&&(M=Math.max(Math.floor(y/x),1)),b&&(M=Math.min(M,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),k[0]=t}else{let t,e,i=0;for(let n=0,s=w.length;n{const{outerBorder:n,shadowBlur:s=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=n;ma(i,a+(s+o)/2,!0,r)}})(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return di.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:n=e.size}=t;if(_(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:n=e.size}=t,s=this.getParsedPath();return s?(s.bounds(n,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Ah)}needUpdateTag(t){return super.needUpdateTag(t,Ah)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Zn).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Zn).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function wh(t){return new Ch(t)}Ch.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Zl);const Th=["segments","points","curveType","curveTension",...Nl];let kh=class t extends Jl{constructor(t={}){super(t),this.type="line",this.numberType=Oa}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Vs(i,n,e))}getGraphicTheme(){return oh(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),di.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:n=e.lineJoin}=t;return di.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points,connectedType:r}=t,a=i;return s.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments,connectedType:r}=t,a=i;return s.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Th)}needUpdateTag(t){return super.needUpdateTag(t,Th)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Zn;const i=e.segments,n=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):e.points&&n(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Mh(t){return new kh(t)}kh.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Zl);const Bh=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(t.height)?t.y1-t.y:t.height,n=0,s=0;return e<0?(n=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(s=i,i=-i):Number.isNaN(i)&&(i=0),{x:n,y:s,width:e,height:i}},Eh=["width","x1","y1","height","cornerRadius",...Nl];class Ph extends Jl{constructor(t){super(t),this.type="rect",this.numberType=La}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return oh(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:n}=t;const{x1:s,y1:r,x:a,y:o}=t;e=null!=e?e:s-a,n=null!=n?n:r-o,(isFinite(e)||isFinite(n)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,n||0)}const{tb1:n,tb2:s}=di.graphicService.updateTempAABBBounds(i);return hh(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,di.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Eh)}needUpdateTag(t){return super.needUpdateTag(t,Eh)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const n=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,s=t=>null!=n[t],r=t=>null==n[t];switch(t){case"width":return r("width")&&s("x")&&s("x1");case"height":return r("height")&&s("y")&&s("y1");case"x1":return r("x1")&&s("x")&&s("width");case"y1":return r("y1")&&s("y")&&s("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const n=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,s=t=>{const e=n[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=s("x"),a=s("y"),o=s("x1"),l=s("y1"),h=s("width"),c=s("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:n,width:s,height:r}=Bh(e);return t=new Zn,t.moveTo(i,n),t.rect(i,n,s,r),t}clone(){return new Ph(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ph.NOWORK_ANIMATE_ATTR}}function Oh(t){return new Ph(t)}Ph.NOWORK_ANIMATE_ATTR=Zl;const Rh=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class Ih extends Ph{constructor(t){super(t),this.type="rect3d",this.numberType=Fa}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:n,x:s,y:r,length:a=Mt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-s,l=null!=l?l:n-r;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,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return oh(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const n=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const s={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(s,i.attributes)})),this.beforeStateUpdate(s,n,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(s,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new Lh(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Lh.NOWORK_ANIMATE_ATTR}}function Fh(t){return new Lh(t)}Lh.NOWORK_ANIMATE_ATTR=Zl;const Uh=Symbol.for("EnvContribution"),Nh=Symbol.for("VGlobal"),jh="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",zh={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"}},Wh=!0,Hh=!1,Vh=/\w|\(|\)|-/,Gh=/[.?!,;:/,。?!、;:]/,Yh=/\S/,Xh=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Kh(t,e,i,n,s){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=di.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=$h(t,a)),a}function $h(t,e,i=!1){let n=e;for(;Vh.test(t[n-1])&&Vh.test(t[n])||Gh.test(t[n]);)if(n--,n<=0)return i?qh(t,e):e;return n}function qh(t,e){let i=e;for(;Vh.test(t[i+1])&&Vh.test(t[i])||Gh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Zh(t,e,i="actual"){var n;if(""===t)return{ascent:0,height:0,descent:0,width:0};const s=di.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?s.actualBoundingBoxAscent:s.fontBoundingBoxAscent,o="actual"===i?s.actualBoundingBoxDescent:s.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(s.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(s.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(n=e.space)&&void 0!==n?n:0;return r.width+=l,r}class Jh{constructor(t,e,i,n,s,r,a,o,l,h,c,u,d,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=zh[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=u,this.singleLine=d,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height: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;"right"===this.globalAlign||"end"===this.globalAlign?o=-s:"center"===this.globalAlign&&(o=-s/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let 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,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=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=!0===this.ellipsis?"...":this.ellipsis||"",s=this.lines[i].getWidthWithEllips(n);s>t&&(t=s),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=s),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=!0===this.ellipsis?"...":this.ellipsis||"",s=this.lines[i].getWidthWithEllips(n);s>t&&(t=s),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Qh(t,e,i,n){const s=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(n);return{left:t>s?s:s-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>n?o:o+.5}}class tc{constructor(t,e,i,n){var s,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=n;const a=$s(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Zh(t,i,this.ascentDescentMode);let u=0,d=0,p=0;this.height>l&&(u=(this.height-l)/2,d=Math.ceil(u),p=Math.floor(u)),"top"===this.textBaseline?(this.ascent=u,this.descent=l-u):"bottom"===this.textBaseline?(this.ascent=l-u,this.descent=u):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+d,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(s=i.dx)&&void 0!==s?s:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Zh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,n,s,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+n;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Kh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Zh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const u=Qh(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},u),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,n,s,r,a){var o;let l=e+i,h=this.text,c=this.left+n+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let u=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,u="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Kh(h,("vertical"===u?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===u);else{const{width:e}=Zh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===u&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:d=1}=this.character;if(this.character.stroke&&d&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Qh(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Qh(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Qh(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Qh(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===u&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Kh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:n}=Zh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-n}return i}}const ec=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...Nl];class ic extends Jl{constructor(t){super(t),this.type="image",this.numberType=Pa,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,n){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,n)}getGraphicTheme(){return oh(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:n=e.maxWidth,maxHeight:s=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>n/s?(r=n,a=n/t):(a=s,r=s*t)}}else r=n,a=s}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:n,tb2:s}=di.graphicService.updateTempAABBBounds(i);return hh(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,di.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return Es[t]}needUpdateTags(t){return super.needUpdateTags(t,ec)}needUpdateTag(t){return super.needUpdateTag(t,ec)}clone(){return new ic(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ic.NOWORK_ANIMATE_ATTR}}function nc(t){return new ic(t)}ic.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Zl);class sc extends ic{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Us(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Us(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=Es.width,height:e=Es.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 rc{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 sc?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=zh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof tc){const e=Yh.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,n=this.height;let s=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const n=this.paragraphs[e];if(n.overflow)t=t&&""===n.text;else if(t){i=!0;break}}let n=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof sc)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===s?"...":s||"";i.ellipsisStr=r;const{width:a}=Zh(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+n){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+n+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+n;break}i.ellipsis="hide",n+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,s)=>{if(e instanceof sc)return;const r=e.drawBackground(t,n,this.ascent,i,0===s,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],n=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,n.right-i.left,n.bottom-i.top)})),this.paragraphs.forEach(((e,s)=>{if(e instanceof sc)return e.setAttributes({x:i+e._x,y:n+e._y}),void r(e,t,i+e._x,n+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Hh;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:n=1,opacity:s=1}=e;t.globalAlpha=n*s,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Xh(t,e)})(t,e.character),function(t,e,i){const n=e&&e.fill||Wh;if(!n)return void(t.globalAlpha=0);const{fillOpacity:s=1,opacity:r=1}=e;t.globalAlpha=s*r,t.fillStyle=i?Po(t,n,{AABBBounds:i}):n,Xh(t,e)}(t,e.character,a),e.draw(t,n,this.ascent,i,0===s,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const n=this.paragraphs[i];if(n instanceof sc)break;const{width:s}=Zh(t,n.character,n.ascentDescentMode),r=s||0;if(r<=this.blankWidth+e){n.ellipsis="add",n.ellipsisWidth=r;break}if(r<=this.blankWidth+e+n.width){n.ellipsis="replace",n.ellipsisWidth=r,n.ellipsisOtherParagraphWidth=this.blankWidth+e;break}n.ellipsis="hide",e+=n.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof sc?t.width:t.getWidthWithEllips(this.direction)})),i}}class ac{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=zh[this.direction]}store(t){if(t instanceof sc){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new rc(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof sc?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,n=Math.ceil(i/t[this.directionKey.width]*t.length)||0,s=Kh(t.text,i,t.character,n,"break-word"===this.frame.wordBreak);if(0!==s){const[i,n]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new tc(i,t.newLine,t.character,t.ascentDescentMode),new tc(n,!0,t.character,t.ascentDescentMode)]}(t,s);this.store(i),e?this.send():this.deal(n)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let oc=!1;try{oc=Intl&&"function"==typeof Intl.Segmenter}catch(t){oc=!1}const lc=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Nl];class hc extends Jl{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Ua,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const n=this._frameCache.icons.get(t[i]);this.updateHoverIconState(n)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Bs.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:Bs.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:Bs.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:Bs.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:Bs.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:Bs.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:Bs.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:Bs.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return oh(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&hc.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&hc.splitText(t.text).length>1)))}static splitText(t){if(oc){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:n}of e.segment(t))i.push(n);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=hc.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let n=0;n0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:n}=t.getActualSize();let s=o||e||0,r=l||n||0;r="number"==typeof c&&r>c?c:r||0,s="number"==typeof h&&s>h?h:s||0,i.set(0,0,s,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(d){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(u){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),di.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||di.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,di.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,lc)}needUpdateTag(t){return super.needUpdateTag(t,lc)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!hc.AllSingleCharacter(y)&&(y=hc.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let n=0;n0,A="number"==typeof n&&Number.isFinite(n)&&n>0,C="number"==typeof s&&Number.isFinite(s)&&s>0&&(!x||s<=i),w="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=n),T=new Jh(0,0,(C?s:x?i:0)||0,(w?r:A?n:0)||0,a,o,l,h,c,u||"horizontal",!C&&x,!w&&A,d||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),k=new ac(T);if(k.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const n=_[i];e?(n.overflow=!0,n.left=1/0,n.top=1/0,!n.newLine&&T.lines[T.lines.length-1].paragraphs.push(n)):k.deal(n,!0),T.lines.length!==t&&(t=T.lines.length,k.lineBuffer.length=0,n.overflow=!0,n.left=1e3,n.top=1e3,T.lines[T.lines.length-1].paragraphs.push(n),e=!0),n.newLine&&(e=!1,k.lineWidth=0),k.send()}}else for(let t=0;t<_.length;t++)k.deal(_[t]);if(k.send(),!("horizontal"===T.layoutDirection?C:w)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:n)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new hc(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,n,s,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(a=s.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],s.globalY=(null!==(o=s.attribute.y)&&void 0!==o?o:0)+n+e._marginArray[0])})),s}getNoWorkAnimateAttr(){return hc.NOWORK_ANIMATE_ATTR}}function cc(t){return new hc(t)}hc.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Zl);const uc=["path","customPath",...Nl];class dc extends Jl{constructor(t){super(t),this.type="path",this.numberType=Ra}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Zn?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Zn?this.cache:t.path)}getGraphicTheme(){return oh(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:n,tb2:s}=di.graphicService.updateTempAABBBounds(i);hh(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return di.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Zn).fromString(t.path):t.customPath&&(this.cache=new Zn,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,uc)}needUpdateTag(t){return super.needUpdateTag(t,uc)}toCustomPath(){return(new Zn).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new dc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dc.NOWORK_ANIMATE_ATTR}}function pc(t){return new dc(t)}dc.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Zl);const gc=["segments","points","curveType","curveTension",...Nl];class fc extends Jl{constructor(t){super(t),this.type="area",this.numberType=ka}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return oh(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),di.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:n=e.lineJoin}=t;return di.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),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}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Vs(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,gc)}needUpdateTag(t){return super.needUpdateTag(t,gc)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Zn;const e=this.attribute,i=e.segments,n=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 fc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fc.NOWORK_ANIMATE_ATTR}}function mc(t){return new fc(t)}fc.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Zl);const vc=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...Nl];class yc extends Jl{constructor(t){super(t),this.type="arc",this.numberType=wa}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=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:n=t.outerPadding}=this.attribute;let{outerRadius:s=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(s+=n,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(s-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap,clipRange:s=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(s,1)),e=jt(e),i=e+a,n&&Ct(a)>_t&&Ct(a)_t&&o>_t)return{startAngle:e-r*d*s,endAngle:i+r*d*a,sc:r*d*s,ec:r*d*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:n=i.innerPadding,outerPadding:s=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=s,o-=n;const{padRadius:l=Et(a*a+o*o)}=this.attribute,h=Ct(e-t);let c=t,u=e,d=t,p=e;const g=r/2;let f=h,m=h;if(g>_t&&l>_t){const i=e>t?1:-1;let n=Ot(Number(l)/o*Bt(g)),s=Ot(Number(l)/a*Bt(g));return(f-=2*n)>_t?(n*=i,d+=n,p-=n):(f=0,d=p=(t+e)/2),(m-=2*s)>_t?(s*=i,c+=s,u-=s):(m=0,c=u=(t+e)/2),{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return oh(this).arc}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:s,tb2:r}=di.graphicService.updateTempAABBBounds(i);hh(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return di.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:n=e.outerRadius,innerRadius:s=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return n+=r,s-=a,no){const t=l;l=o,o=t}return n<=_t?i.set(0,0,0,0):Math.abs(o-l)>At-_t?i.set(-n,-n,n,n):(zs(l,o,n,i),zs(l,o,s,i)),i}needUpdateTags(t){return super.needUpdateTags(t,vc)}needUpdateTag(t){return super.needUpdateTag(t,vc)}toCustomPath(){var t,e,i,n;let s=super.toCustomPath();if(s)return s;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(n=r.outerPadding)&&void 0!==n?n:0);const c=Ct(o-a),u=o>a;if(h=At-_t)s.moveTo(0+h*Tt(a),0+h*Bt(a)),s.arc(0,0,h,a,o,!u),l>_t&&(s.moveTo(0+l*Tt(o),0+l*Bt(o)),s.arc(0,0,l,o,a,u));else{const t=h*Tt(a),e=h*Bt(a),i=l*Tt(o),n=l*Bt(o);s.moveTo(0+t,0+e),s.arc(0,0,h,a,o,!u),s.lineTo(0+i,0+n),s.arc(0,0,l,o,a,u),s.closePath()}return s}clone(){return new yc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yc.NOWORK_ANIMATE_ATTR}}function _c(t){return new yc(t)}yc.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Zl);const bc=["width","height","spikes","thickness",...Nl];class xc extends Jl{constructor(t){super(t),this.type="star",this._cachedPoints=[],this.numberType=Na}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e,spikes:i}=this.attribute;return(null==t||t>0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return oh(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:n=0}=t;(isFinite(e)||isFinite(n))&&i.set(0,0,e,n)}const{tb1:n,tb2:s}=di.graphicService.updateTempAABBBounds(i);return i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,di.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:n=e.height,spikes:s=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(s)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,n)/2,c=h*(1-o),u=i/2,d=n/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,s=Math.PI/a*t,r=i/(2*h),o=n/(2*h);l.push({x:u+Math.sin(s)*e*r,y:d-Math.cos(s)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,n,s){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(s[t]=i+(n-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,bc)}needUpdateTag(t){return super.needUpdateTag(t,bc)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Zn,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new xc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xc.NOWORK_ANIMATE_ATTR}}function Sc(t){return new xc(t)}xc.NOWORK_ANIMATE_ATTR=Zl;class Ac extends yc{constructor(t){super(t),this.type="arc3d",this.numberType=Ta}updateAABBBounds(t,e,i){const n=this.stage;if(!n||!n.camera)return i;const{outerRadius:s=e.outerRadius,height:r=0}=t,a=s+r;return i.setValue(-a,-a,a,a),di.graphicService.updateTempAABBBounds(i),di.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return Ac.NOWORK_ANIMATE_ATTR}}function Cc(t){return new Ac(t)}var wc;Ac.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Zl),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(wc||(wc={}));class Tc extends Jl{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ea,this._childUpdateTag=Vi.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(Pl(this.sharedStateScope,t),Ll(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new rh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new rh)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Gi.GLOBAL){const i=new Ft(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&Vi.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=as.x,y:e=as.y,dx:i=as.dx,dy:n=as.dy,scaleX:s=as.scaleX,scaleY:r=as.scaleY,angle:a=as.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==n||1!==s||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return oh(this).group}updateAABBBounds(t,e,i){const n=i;i=i.clone();const{width:s,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,Math.max(0,s),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:n=0}=t;i.translate(e,n)}return di.graphicService.updateTempAABBBounds(i),di.graphicService.transformAABBBounds(t,i,e,!1,this),n.copy(i),n}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Vi.CLEAR_BOUNDS,this._childUpdateTag&=Vi.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Vi.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Vi.UPDATE_BOUNDS||(this._childUpdateTag|=Vi.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,n,s,r,a,o;const l=null!==(s=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(n=this.stage)||void 0===n?void 0:n.graphicService)&&void 0!==s?s:di.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&Vi.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=di.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new Tc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Tc.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const n=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,n),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&Pl(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return Ol({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,n,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}}function kc(t){return new Tc(t)}Tc.NOWORK_ANIMATE_ATTR=Zl;const Mc=["points","cornerRadius",...Nl];class Bc extends Jl{constructor(t){super(t),this.type="polygon",this.numberType=Ia}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return oh(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),di.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:n=e.lineJoin}=t;return di.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Vs(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,Mc)}needUpdateTag(t){return super.needUpdateTag(t,Mc)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Zn,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new Bc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Bc.NOWORK_ANIMATE_ATTR}}function Ec(t){return new Bc(t)}Bc.NOWORK_ANIMATE_ATTR=Zl;class Pc extends Bc{constructor(t){super(t),this.type="pyramid3d",this.numberType=Da}updateAABBBounds(t,e,i){const n=this.stage;return n&&n.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)})),di.graphicService.updateTempAABBBounds(i),di.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}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}getNoWorkAnimateAttr(){return Pc.NOWORK_ANIMATE_ATTR}}function Oc(t){return new Pc(t)}Pc.NOWORK_ANIMATE_ATTR=Zl;class Rc extends Tc{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Ic(t){return new Rc(t)}class Dc{constructor(){this.registry=new Map}create(t,e){const i=this.registry.get(t);if(!i)throw new Error(`GraphicFactory has no creator registered for type "${t}"`);return new i(e)}register(t,e){if(!t)throw new Error("GraphicFactory requires a non-empty graphic type");this.registry.set(t,e)}}const Lc=new Dc;const Fc=new class{constructor(){this.store=new Map}registerStore(t,e){this.store.set(t,e),this[t]=e}RegisterGraphicCreator(t,e){Uc(t,e)}CreateGraphic(t,e){return this.store.has(t)?Nc(t,e):null}};function Uc(t,e){if(!t)throw new Error("Graphic registration requires a non-empty graphic type");Fc.registerStore(t,e),Lc.register(t,function(t){return class{constructor(e){try{return new t(e)}catch(i){return t(e)}}}}(e))}function Nc(t,e){return Lc.create(t,e)}function jc(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:u=i.scaleY,scaleZ:d=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=m[1];y[2]=null!==(n=m[2])&&void 0!==n?n:0}if(Oo(t),Lo(t,t,[s+o,r+l,a+h]),Lo(t,t,[y[0],y[1],y[2]]),Ro(t,t,g),Io(t,t,p),Lo(t,t,[-y[0],-y[1],y[2]]),Uo(t,t,[c,u,d]),f){const i=$o.allocate(),n=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=m[1]}Lo(i,i,[n[0],n[1],0]),Do(i,i,f),Lo(i,i,[-n[0],-n[1],0]),No(t,t,i)}}function zc(t){const{alpha:e,beta:i}=t.attribute;return e||i}class Wc{constructor(t=Fc){this.creator=t,this.hooks={onAttributeUpdate:new hi(["graphic"]),onSetStage:new hi(["graphic","stage"]),onRemove:new hi(["graphic"]),onRelease:new hi(["graphic"]),onAddIncremental:new hi(["graphic","group","stage"]),onClearIncremental:new hi(["graphic","group","stage"]),beforeUpdateAABBBounds:new hi(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new hi(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new hi(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new ue,this.tempAABBBounds2=new ue,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updateHTMLTextAABBBounds(t,e,i,n){const{textAlign:s,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),n=gh(r,e,e);i.set(i.x1,n,i.x2,n+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),n=ph(s,e);i.set(n,i.y1,n+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){if(!e.empty()){const{scaleX:s=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,u=this.tempAABBBounds1,d=this.tempAABBBounds2;if(a&&l){ma(u,(l+h)/Math.abs(s+r),n,c),e.union(u),u.setValue(d.x1,d.y1,d.x2,d.y2)}if(o){const{shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;ma(u,o/Math.abs(s+r)*2,!1,c+1),u.translate(n,a),e.union(u)}}if(this.combindShadowAABBBounds(e,s),e.empty())return;let r=!0;const a=s.transMatrix;s&&s.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&he(e,e,a)}validCheck(t,e,i,n){if(!n)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(n.shadowRoot||n.isContainer)return!0;const{visible:s=e.visible}=t;return!(!n.valid||!s)||(i.empty()||(n.parent&&i.transformWithMatrix(n.parent.globalTransMatrix),this.clearAABBBounds(n,n.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}let Hc,Vc;function Gc(t){return Hc||(Hc=Nc("text",{})),Hc.initAttributes(t),Hc.AABBBounds}function Yc(t){return Vc||(Vc=Nc("richtext",{})),Vc.setAttributes(t),Vc.AABBBounds}const Xc=Symbol.for("TransformUtil"),Kc=Symbol.for("GraphicUtil"),$c=Symbol.for("LayerService"),qc=Symbol.for("StaticLayerHandlerContribution"),Zc=Symbol.for("DynamicLayerHandlerContribution"),Jc=Symbol.for("VirtualLayerHandlerContribution"),Qc=Symbol.for("RenderService"),tu=Symbol.for("BeforeRenderConstribution"),eu=Symbol.for("AutoEnablePlugins"),iu=Symbol.for("PluginService"),nu=Symbol.for("GraphicPicker"),su=Symbol.for("PickerService"),ru=Symbol.for("BoundsPicker"),au=Symbol.for("GlobalPickerService"),ou=Symbol.for("PickItemInterceptor"),lu=Symbol.for("PickServiceInterceptor"),hu=Symbol.for("IncrementalDrawContribution"),cu=Symbol.for("ArcRender"),uu=Symbol.for("Arc3dRender"),du=Symbol.for("AreaRender"),pu=Symbol.for("CircleRender"),gu=Symbol.for("GraphicRender"),fu=Symbol.for("GroupRender"),mu=Symbol.for("LineRender"),vu=Symbol.for("PathRender"),yu=Symbol.for("PolygonRender"),_u=Symbol.for("RectRender"),bu=Symbol.for("Rect3DRender"),xu=Symbol.for("SymbolRender"),Su=Symbol.for("TextRender"),Au=Symbol.for("RichTextRender"),Cu=Symbol.for("Pyramid3dRender"),wu=Symbol.for("GlyphRender"),Tu=Symbol.for("ImageRender"),ku=Symbol.for("RenderSelector"),Mu=Symbol.for("DrawContribution"),Bu=Symbol.for("StarRender"),Eu=Symbol.for("VWindow"),Pu=Symbol.for("WindowHandlerContribution");function Ou(t){const e=di.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class Ru extends fi{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=di.global,e=Ou){super(),this.handlerFactory=e,this.hooks={onChange:new hi(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=ci.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const n=this._handler.getWH();this._width=n.width,this._height=n.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,n,s,r){this._handler.setViewBoxTransform(t,e,i,n,s,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),n={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},n),n.x-=i.x1,n.y-=i.y1,n}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&ot(this.width,t.width())&&ot(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class Iu{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Za(Object.assign({nativeCanvas:di.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Za(Object.assign({nativeCanvas:di.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const Du=new Iu;class Lu{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=di.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Du.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var 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:cs.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new re(Object.assign({defaultFontParams:{fontFamily:cs.fontFamily,fontSize:cs.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+re.ALPHABET_CHAR_SET+re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var n,s;if(!e.defaultLayer)return null;const r=null!==(s=null===(n=di.windowFactory)||void 0===n?void 0:n.call(di))&&void 0!==s?s:new Ru(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const u=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=u;const d=r.getNativeHandler();return d.nativeCanvas?d.nativeCanvas:null}}var Fu;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Fu||(Fu={}));const Uu=new pe;class Nu{constructor(){this.matrix=new pe}init(t){return this.mode=Fu.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Fu.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(Uu.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(Uu.a,Uu.b,Uu.c,Uu.d,Uu.e,Uu.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Uu.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:n}=e;this.outTargetMatrix.translate(i,n),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-n)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Uu.a,Uu.b,Uu.c,Uu.d,Uu.e,Uu.f),this}scale(t,e,i){return this.mode===Fu.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Fu.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Uu.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Uu.a,Uu.b,Uu.c,Uu.d,Uu.e,Uu.f),this}translate(t,e){return this.mode===Fu.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Fu.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}class ju{constructor(){this.global=di.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new pe(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 Ft(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,n);a&&(s.graphic=a.graphic,s.params=a.params)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i,n){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var zu=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 Wu(t,e,i){const n={},s=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;n[i]?n[i].push(t):(n[i]=[t],s.push(i))}),i),s.sort(((t,e)=>i?e-t:t-e)),{childMap:n,zIdxArray:s}}function Hu(t,e,i,n=!1,s=!1){let r=!1;if(s)r=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return r=!0,!0;return!1}),n)}if(r){const{childMap:r,zIdxArray:a}=Wu(t,e,n);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;t{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return s=!0,!0;return!1}),n);let r=null,a=!1;if(s){const{childMap:s,zIdxArray:o}=Wu(t,i,n);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),n);return r}const Yu=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new ue)}allocate(t,e,i,n){if(!this.pools.length)return(new ue).setValue(t,e,i,n);const s=this.pools.pop();return s.x1=t,s.y1=e,s.x2=i,s.y2=n,s}allocateByObj(t){if(!this.pools.length)return new ue(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Xu{constructor(){this.time=$i.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:C=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const s=t.resources.get(qu(g));if(!s||"success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=oh(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*m,this.doDrawImage(e,s.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:C}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,n){sd(t,e,i,n)}}const Ku=new Xu,$u=new Set(["top","center","bottom"]);function qu(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Zu({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Ju={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Qu({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const n=Ju[t];return n?{backgroundRepeatMode:"no-repeat",backgroundSizing:n}:{backgroundRepeatMode:t,backgroundSizing:Zu({backgroundFit:e,backgroundKeepAspectRatio:i})}}function td(t,e,i,n,s){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===n)return e/2;if(r===s)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function ed(t,e,i){const[n,s]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const n=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===n.length)return["left","top"];if(1===n.length){const t=n[0];return"center"===t?["center","center"]:$u.has(t)?["center",t]:[t,"center"]}let s,r;const a=[];for(let t=0;t<2;t++){const e=n[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:s=e}return null==s&&a.length&&(s=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=s?s:"left",null!=r?r:"top"]}(t);return{x:td(n,e,"left","center","right"),y:td(s,i,"top","center","bottom")}}function id(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function nd(t){if(!t)return null;const e=id(t.naturalWidth,t.videoWidth,t.width),i=id(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function sd(t,e,i,n){var s,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:u=0,backgroundPosition:d="top-left"}=n,p=i.width(),g=i.height(),f=nd(e),{backgroundRepeatMode:m,backgroundSizing:v}=Qu({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let n=null!==(s=null==f?void 0:f.width)&&void 0!==s?s:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(n=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);n=f.width*t,a=f.height*t}n*=h,a*=h;const{x:o,y:l}=ed(d,p-n,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+u,n,a)}if(o&&"repeat"!==m&&f){const i=f.width,n=f.height;"repeat-x"===m?(y=i*(g/n),_=g):"repeat-y"===m&&(_=n*(p/i),y=p);const s=t.dpr,r=Du.allocate({width:y,height:_,dpr:s}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),Du.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class rd{constructor(t){this.subRenderContribitions=t,this.time=$i.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,u,d)}))}}class ad{constructor(){this.time=$i.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||u),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,n+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const od=new ad;class ld{constructor(){this.time=$i.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||u||e.restore())}}const hd=new ld,cd={getContributions:()=>[]};class ud{constructor(t=[],e=cd,i={}){var n,s,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,n)=>{var s;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,n):this.renderItem(t,i))})):Hu(e,fs.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,n):this.renderItem(t,i))}),!1,!!(null===(s=i.context)||void 0===s?void 0:s.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new ce,this.backupDirtyBounds=new ce,this.global=null!==(n=i.global)&&void 0!==n?n:di.global,this.layerService=null!==(s=i.layerService)&&void 0!==s?s:di.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:cd,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:n,stage:s,viewBox:r,transMatrix:a}=e;if(!n)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=function(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=Kt(t,e,i);return n>=l||s<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(n,o),y1:Math.max(r,h),x2:Math.min(s,l),y2:Math.min(a,c)}}(o,s.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=n.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*n.dpr)/n.dpr,o.y1=Math.floor(o.y1*n.dpr)/n.dpr,o.x2=Math.ceil(o.x2*n.dpr)/n.dpr,o.y2=Math.ceil(o.y2*n.dpr)/n.dpr),this.backupDirtyBounds.copy(o),n.reset(!1),n.save(),n.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),n.clearMatrix(!1),n.translate(r.x1,r.y1,!0),n.beginPath(),n.rect(o.x1,o.y1,o.width(),o.height()),n.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,n,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:fs.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:fs.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Ko.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),n.restore(),n.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Gu(e,i,fs.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,n){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!$t(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let s,r=i;if(this.useDirtyBounds){s=Yu.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Ko.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:n,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(s),Yu.free(s),Ko.free(r))}_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||function(){const t=di.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer: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;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class pd{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class gd{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class fd{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class md{constructor(){this.entries=new Map}register(t,e){var i;const n=null!==(i=this.entries.get(t))&&void 0!==i?i:[];n.push(e),this.entries.set(t,n)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const n=i.filter((t=>t!==e));n.length?this.entries.set(t,n):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const vd={getContributions:()=>[]};class yd{constructor(t=vd,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new fd}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class _d{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ci.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class bd{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=ci.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=di.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=di.global.getRequestAnimationFrame();this.rafId=t((()=>{di.global.devicePixelRatio!==this.dpr&&(this.dpr=di.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=di.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class xd{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ci.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,di.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({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Sd=new ue;class Ad{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ci.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const n=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(n._updateTag&Vi.UPDATE_PAINT)||n._updateTag&Vi.UPDATE_BOUNDS)return;const s=this.ensurePaintDirtyBoundsCache(n);s&&!s.empty()&&i.dirty(s),n.clearUpdatePaintTag();const r=n.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.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&&(Sd.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(Sd,t.parent&&t.parent.globalTransMatrix)))})),t.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))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let Cd;function wd(){if(null==Cd)try{const t=document.createElement("canvas"),e=t.getContext("2d");Cd=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),Cd&&(Cd=!!document.createElement)}catch(t){Cd=!1}}function Td(){wd();const t=di.global&&di.global.env;return t?"browser"===t:Cd}const kd="white";class Md extends Tc{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:kd}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,n,s,r,a,o,l,h,c,u,d,p,g,f,m,v,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new rh,this.hooks={beforeRender:new hi(["stage"]),afterRender:new hi(["stage"]),afterClearScreen:new hi(["stage"]),afterClearRect:new hi(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:di.global,!this.global.env&&Td()&&this.global.setEnv("browser"),this.windowFactory=null!==(s=null!==(n=e.windowFactory)&&void 0!==n?n:di.windowFactory)&&void 0!==s?s:()=>new Ru(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=di.pickerServiceFactory)&&void 0!==a?a:()=>new ju,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(u=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=di.renderServiceFactory)||void 0===h?void 0:h.call(di))&&void 0!==c?c:di.renderService)&&void 0!==u?u:new dd,this.pluginService=null!==(f=null!==(g=null!==(d=e.pluginService)&&void 0!==d?d:null===(p=di.pluginServiceFactory)||void 0===p?void 0:p.call(di))&&void 0!==g?g:di.pluginService)&&void 0!==f?f:new yd,this.layerService=null!==(v=null!==(m=e.layerService)&&void 0!==m?m:di.layerService)&&void 0!==v?v:new Id(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:di.graphicService)&&void 0!==b?b:new Wc,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:kd,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var n,s;i&&(s=e,(n=i).themeStateDefinitions!==s&&(n.themeStateDefinitions=s,Ol(n)),Ll(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Ei(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha: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:u,beta:d,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(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,A=0;c||(x=Math.sin(u)+y,S=Math.sin(d)+_,A=Math.cos(u)*Math.cos(d)*1);const C=Od.getPlugin("DirectionalLight");C&&(this.light=new C(f,m,v));const w={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=w;else{const t=Od.getPlugin("OrthoCamera");t&&(this.camera=new t(w))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Od.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new _d))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new bd))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new xd))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new ce;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Ad,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Od.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Od.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Od.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return Ol({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,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,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Ft(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),n=e?-e.x1:0,s=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:n,y1:s,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class Bd{constructor(t=Md,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class Ed extends Tc{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=n.layerHandler,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 rh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{di.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{di.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}class Pd{constructor(t=Ed){this.LayerCtor=t}create({stage:t,global:e,window:i,params:n}){return new this.LayerCtor(t,e,i,n)}}let Od=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function Rd(t){const e=di.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}Od._pluginClasses={};class Id{static GenerateLayerId(){return`${Id.idprefix}_${Id.prefix_count++}`}constructor(t=di.global,e=new Pd,i=Rd){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let n=this.getRecommendedLayerType(e.layerMode);n=e.main||e.canvasId?"static":n;const s=this.getLayerHandler(n),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:n,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Id.GenerateLayerId(),layerHandler:s})}),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}}Id.idprefix="visactor_layer",Id.prefix_count=0;const Dd=Symbol("ContributionProvider");class Ld{constructor(t,e){this.serviceIdentifier=t,this.container=e,jd.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function Fd(t,e){return new Ld(t,e)}function Ud(t,e){t(Dd).toDynamicValue((({container:t})=>Fd(e,t))).inSingletonScope().whenTargetNamed(e)}function Nd(t,e){t(Dd).toDynamicValue((({container:t})=>Fd(e,t))).whenTargetNamed(e)}class jd{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}jd.store=new Map;class zd{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:n}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=n,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=n}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:n}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=n}return t}estimate(t,{fontSize:e=Ms.fontSize}){let i=0,n=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,"end",!1);if(n&&s.str!==t[o].text){let i="",n=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(n&&a.str!==t){let i=$h(t,a.str.length,s);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,n,s,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,n,s),a&&(o.result=a+o.str);else if("middle"===r){const n=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:n.width,result:n.left+a+n.right}}else o=this._clipTextEnd(t,e,i,n,s),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,n,s){if(n===s){nt.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${n}, ${s}`);const i=t.substring(0,s+1);return{str:i,width:this.measureTextWidth(i,e)}}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._clipTextEnd(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._clipTextEnd(t,e,i,r,s)}return{str:a,width:o}}_clipTextStart(t,e,i,n,s){const r=Math.ceil((n+s)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(r,t.length);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,n,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,n,s,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:n,right:s,width:r+a};const c=t.substring(t.length-o,t.length),u=this.measureTextWidth(c,e);return h+u>i?{left:l,right:s,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,u,o+1)}clipTextWithSuffixVertical(t,e,i,n,s,r){if(""===n)return this.clipTextVertical(t,e,i,s);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,s);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(n,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,s);const a=this.revertVerticalList(l.verticalList);a.unshift({text:n,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,s),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,s);r.verticalList.push({text:n,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,s),l.verticalList.push({text:n,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,n,s,r,a=!1){if(""===n)return this.clipText(t,e,i,s);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(n,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+n,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,n);if(s&&h.str!==t){const i=$h(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+n);return h.str=h.result,h.width+=l,h}}const Wd=Symbol.for("TextMeasureContribution");class Hd extends zd{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function Vd({bind:t}){t(Nh).toDynamicValue((({container:t})=>new vi(Fd(Uh,t)))).inSingletonScope(),t(Eu).to(Ru),t(Kc).toDynamicValue((({container:t})=>new Lu(Fd(Wd,t)))).inSingletonScope(),t(Xc).to(Nu).inSingletonScope(),t($c).to(Id).inSingletonScope()}function Gd({bind:t}){t(Qc).to(dd)}const Yd=(t,e,i,n)=>{let s,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Ta,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];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+=At;for(;o<0;)o+=At;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),n.hack_pieFace="outside",s=i(r,a),s&&s.graphic||(n.hack_pieFace="inside",s=i(r,a)),s&&s.graphic||(n.hack_pieFace="top",s=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const n=e.getChildren(),o=n.map((e=>({ave_z:e.findFace().vertices.map((i=>{var n;return t.view(i[0],i[1],null!==(n=i[2]+e.attribute.z)&&void 0!==n?n:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),s=i(r,a),e.removeAllChild(),n.forEach((t=>{t._next=null,t._prev=null})),e.update(),n.forEach((t=>{e.add(t)}))}else s=i(r,a);return s};class Xd{constructor(){this.order=1}afterPickItem(t,e,i,n,s){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class Kd{constructor(){this.order=1}afterPickItem(t,e,i,n,s){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,n,s):null}beforePickItem(t,e,i,n,s){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,n,s):null}_pickItem(t,e,i,n,s){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=s||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=oh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,u=Ko.allocateByObj(a),d=new Ft(u.a*i.x+u.c*i.y+u.e,u.b*i.x+u.d*i.y+u.f),p=e.pickGroup(c,d,u,n);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class $d{constructor(){this.order=1}beforePickItem(t,e,i,n,s){const r=t.baseGraphic;if(r&&r.parent){const t=new Ft(i.x,i.y),s=e.pickContext;s.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,n):e.pickItem(r,t.clone(),a,n);return s.highPerformanceRestore(),o}return null}}class qd{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){const a=Yd(r,t,(()=>e.pickGroup(t,i,s.parentMatrix,n)),n);return r.camera=null,n.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function Zd({bind:t,isBound:e}){e(su)||(t(au).toSelf(),t(su).toService(au)),t(qd).toSelf().inSingletonScope(),t(ou).toService(qd),t(Kd).toSelf().inSingletonScope(),t(ou).toService(Kd),t($d).toSelf().inSingletonScope(),t(ou).toService($d),Ud(t,ou),t(Xd).toSelf().inSingletonScope(),t(lu).toService(Xd),Ud(t,lu)}function Jd({bind:t}){t(Wa).to(Wc),t(Ha).toConstantValue(Fc)}class Qd{constructor(){this.type="static",this.offscreen=!1,this.global=di.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=Za({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,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()}}function tp(t){(function({bind:t}){Ud(t,Uh)})({bind:t.bind}),function({bind:t}){t(Wd).to(Hd).inSingletonScope(),Ud(t,Wd)}({bind:t.bind}),function({bind:t}){t(Qd).toSelf(),t(qc).toService(Qd)}({bind:t.bind})}const ep=bt/2;function ip(t,e,i,n,s,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),n<0&&(e+=n,n=-n),s<0&&(i+=s,s=-s),S(r,!0))l=[r=Ct(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ct(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ct(t[0]),i=Ct(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ct(l[0]),l[1]=Ct(l[1]),l[2]=Ct(l[2]),l[3]=Ct(l[3])}}else l=[0,0,0,0];if(n<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,n,s);const[h,c,u,d]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],p=Math.min(n/2,s/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[u[0]-g[2],u[1]],b=[u[0],u[1]-g[2]],x=[d[0]+g[3],d[1]],A=[d[0],d[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!$(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-ep,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!$(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,ep,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!$(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],ep,bt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!$(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],bt,bt+ep,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function np(t,e){return!(!t&&!e)}function sp(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function rp(t,e,i){return i&&t*e>0}function ap(t,e,i,n,s){return s&&t*e>0&&0!==i&&0!==n}function op(t,e){return t*e>0}function lp(t,e,i,n,s){return s?t*e>0:t*e>0&&0!==i&&0!==n}function hp(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,u=o-r;let d=u*l-c*h;return d*d<_t?[]:(d=(c*(e-r)-u*(t-s))/d,[t+d*l,e+d*h])}function cp(t,e,i,n,s,r,a){const o=t-i,l=e-n,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,u=-h*o,d=t+c,p=e+u,g=i+c,f=n+u,m=(d+g)/2,v=(p+f)/2,y=g-d,_=f-p,b=y*y+_*_,x=s-r,S=d*f-g*p,A=(_<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let C=(S*_-y*A)/b,w=(-S*y-_*A)/b;const T=(S*_+y*A)/b,k=(-S*y+_*A)/b,M=C-m,B=w-v,E=T-m,P=k-v;return M*M+B*B>E*E+P*P&&(C=T,w=k),{cx:C,cy:w,x01:-c,y01:-u,x11:C*(s/x-1),y11:w*(s/x-1)}}function up(t,e,i,n,s){const r=Ct(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:u,innerEndAngle:d,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=s*Tt(c),C=s*Bt(c),w=n*Tt(d),T=n*Bt(d);let k,M,B,E;if((b>_t||y>_t)&&(k=s*Tt(u),M=s*Bt(u),B=n*Tt(p),E=n*Bt(p),r1?0:P<-1?bt:Math.acos(P))/2),l=Et(t[0]*t[0]+t[1]*t[1]);S=Mt(b,(n-l)/(o-1)),x=Mt(y,(s-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:C,xirs:B,yirs:E,xore:k,yore:M,xire:w,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:u,innerDeltaAngle:h,innerEndAngle:d,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function dp(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let u=!1;if(s=At-_t)e.moveTo(i+s*Tt(o),n+s*Bt(o)),e.arc(i,n,s,o,l,!c),r>_t&&(e.moveTo(i+r*Tt(l),n+r*Bt(l)),e.arc(i,n,r,l,o,c));else{const{outerDeltaAngle:h,xors:d,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:C,outerEndAngle:w,limitedIcr:T,innerDeltaAngle:k,innerEndAngle:M,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:P,maxInnerCornerRadius:O}=up(t,o,l,r,s);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+d,n+p),u=!0;else if(m>_t){const t=Mt(v,m),r=Mt(y,m),o=cp(g,f,d,p,s,t,Number(c)),l=cp(b,x,S,A,s,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),e.arc(i+o.cx,n+o.cy,m,wt(o.y01,o.x01),wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Tt(wt(l.y01,l.x01)),n+o.cy+m*Bt(wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),t>0&&e.arc(i+o.cx,n+o.cy,t,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,n,s,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Tt(wt(l.y01,l.x01)),n+l.cy+r*Bt(wt(l.y01,l.x01))):e.moveTo(i+b,n+s*Bt(w))}else!a||a[0]?(e.moveTo(i+d,n+p),e.arc(i,n,s,C,w,!c)):e.moveTo(i+s*Tt(w),n+s*Bt(w));if(!(r>_t)||k<.001)!a||a[1]?e.lineTo(i+S,n+A):e.moveTo(i+S,n+A),u=!0;else if(T>_t){const t=Mt(E,T),s=Mt(P,T),o=cp(S,A,b,x,r,-s,Number(c)),l=cp(d,p,g,f,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),T0&&e.arc(i+o.cx,n+o.cy,s,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,n,r,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Tt(wt(l.y01,l.x01)),n+l.cy+t*Bt(wt(l.y01,l.x01))):e.moveTo(i+g,n+f)}else!a||a[1]?e.lineTo(i+S,n+A):e.moveTo(i+S,n+A),!a||a[2]?e.arc(i,n,r,M,B,c):e.moveTo(i+r*Tt(B),n+r*Bt(B))}return a?a[3]&&e.lineTo(i+s*Tt(o),n+s*Bt(o)):e.closePath(),u}const pp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class gp{constructor(){this.time=$i.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=n.dpr,o=Du.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),s(r,l);const h=n.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Du.free(o),h}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,At),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,u,d){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,n,l,g,f,m)}drawTexture(t,e,i,n,s,r,a,o,l){var h,c,u,d,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:u}=m,d=e.AABBBounds;n=d.x1,s=d.y1;const p=i;let g;if(u){g=Du.allocate({width:d.width(),height:d.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,d.width(),d.height()),n=0,s=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,n,s,r),p.clip();const v=d.width(),y=d.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,C=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=wh({}));const w=h.columns?v/h.columns:b,T=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[w-A,T-C],symbolType:t});const k=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:pp.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${n}|dpr:${s}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${s}`}createResourcePattern(t,e,i,n,s){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(n>0||s>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*n,a=e+2*n,l=Du.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),s>0){const i=Math.max(0,Math.min(s,Math.min(t,e)/2)),r=n,a=n,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,n,n,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),Du.free(l),c}Du.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const fp=new gp;class mp{constructor(){this.time=$i.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,g=d&&!1!==d.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{innerPadding:m=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:C=l.scaleY,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:k=l.outerRadius}=t.attribute;k+=v,T-=m;const M=(s,r)=>{const a=!(!s||!s.stroke),{distance:o=l[r].distance}=s,h=w?o:Eo(e,o,e.dpr),c=o/k,d="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:k+d*h,innerRadius:T-d*h,startAngle:y-d*c,endAngle:_+d*c}),e.beginPath(),dp(t,e,i,n,k+d*h,T-d*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,s,(x-i)/A,(S-n)/C,l[r]),l[r].opacity=a,e.stroke()}};g&&M(d,"outerBorder"),f&&M(p,"innerBorder"),t.setAttributes({outerRadius:k,innerRadius:T,startAngle:y,endAngle:_})}}const vp=new mp,yp=fp,_p=Ku;class bp{constructor(){this.time=$i.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,g=d&&!1!==d.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:C=l.keepStrokeScale}=t.attribute,w=(s,r)=>{const a=!(!s||!s.stroke),{distance:o=l[r].distance}=s,h=C?o:Eo(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,n,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,s,(b-i)/S,(x-n)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&w(d,"outerBorder"),f&&w(p,"innerBorder")}}const xp=new bp,Sp=fp,Ap=Ku;class Cp extends Xu{constructor(){super(...arguments),this.time=$i.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{background:d,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(d)if(t.backgroundImg&&t.resources){const i=t.resources.get(qu(d));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,n,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=d,e.fill(),e.highPerformanceRestore()}}const wp=new Cp;class Tp{constructor(){this.time=$i.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,g=d&&!1!==d.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:C,y1:w,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:k,height:M}=t.attribute;k=(null!=k?k:C-i)||0,M=(null!=M?M:w-n)||0;const B=(s,r)=>{const a=!(!s||!s.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=s,c=T?h:Eo(e,h,e.dpr),d=i+o*c,p=n+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(d,p,k-o*g,M-o*g)):(e.beginPath(),ip(e,d,p,k-o*g,M-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,s,(b-i)/S,(x-n)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&B(d,"outerBorder"),f&&B(p,"innerBorder")}}class kp{constructor(){this.time=$i.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(d.doStroke=!1)}}class Mp{constructor(){this.time=$i.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{x1:d,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:d-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),!(0===v||_(v)&&v.every((t=>0===t)))){let s,r=0;return ip(e,i,n,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,u)=>{m[o]&&(r===o-1&&m[o]===s||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,n,l),e.beginPath(),e.moveTo(a,h),s=m[o]),r=o,e.lineTo(c,u),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,n),m[0]?e.lineTo(i+b,n):e.moveTo(i+b,n),m[1]?e.lineTo(i+b,n+x):e.moveTo(i+b,n+x),m[2]?e.lineTo(i,n+x):e.moveTo(i,n+x),m[3]){const t=m[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}}const Bp=new Tp,Ep=fp,Pp=Ku;class Op extends Tp{constructor(){super(...arguments),this.time=$i.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){return super.drawShape(t,e,i,n,s,r,a,o,l,h,c,u)}}const Rp=new Op,Ip=Ku;class Dp{constructor(){this.time=$i.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const d=t.getParsedPath();if(!d)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,C=(s,r)=>{const a=!(!s||!s.stroke),{distance:o=l[r].distance}=s,h=A?o:Eo(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===d.drawOffset(e,v,i,n,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,s,(_-i)/x,(b-n)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&C(p,"outerBorder"),m&&C(g,"innerBorder")}}class Lp{constructor(){this.time=$i.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,n,p,m,((s,r)=>{var a,h,c,d;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(d=r.lineWidth)&&void 0!==d?d:t.attribute.lineWidth,r=e}r.stroke&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-n)/_,l),e.stroke()))})),r&&!b.isSvg&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-n)/_,l),e.stroke())))}}const Fp=new Dp,Up=new Lp,Np=fp,jp=Ku,zp=fp,Wp=Ku;class Hp extends gp{constructor(){super(...arguments),this.time=$i.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=d||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:Gs(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Gs(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Gs(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Gs(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,n,l,_,b,x)}}class Vp{constructor(t){this.groupRenderContribitions=t,this.numberType=Ea}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(wp)}drawShape(t,e,i,n,s,r,a,o,l){const{clip:h,fill:c,stroke:u,background:d}=t.attribute;if(!(h||c||u||d))return;l=null!=l?l:oh(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:C=l.cornerType,x:w=l.x,y:T=l.y}=t.attribute,k=ap(p,m,g,f,c),M=lp(p,v,g,f),B=np(c,d),E=sp(u,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(k||M||a||o||d))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===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,n,g,f)):(e.beginPath(),ip(e,i,n,g,f,y,"bevel"!==C));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(wp));const P={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===$i.beforeFillStroke&&r.drawShape(t,e,i,n,B,E,k,M,l,s,a,o,P)})),h&&e.clip();const O=()=>{P.doFill&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,w-i,T-n,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):M&&(e.setStrokeStyle(t,t.attribute,w-i,T-n,l),e.stroke()))};A?(R(),O()):(O(),R()),this._groupRenderContribitions.forEach((r=>{r.time===$i.afterFillStroke&&r.drawShape(t,e,i,n,B,E,k,M,l,s,a,o)}))}draw(t,e,i,n){var s,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,u=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:n,height:s}=t.attribute,r=a.canvas,o=di.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,n,s),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const d=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=oh(t,null==n?void 0:n.theme).group,i=$o.allocate(),s=$o.allocate();jc(s,t,e),No(i,p||i,s),a.modelMatrix=i,$o.free(s),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),n.skipDraw?this.drawShape(t,a,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),n&&n.renderInGroup&&(m=n.renderInGroup(null===(s=n.renderInGroupParams)||void 0===s?void 0:s.skipSort,t,i,null===(r=n.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&$o.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=d,h>0){const{x:e,y:i,width:n,height:s}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,n,s),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=u,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var Gp,Yp=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"}(Gp||(Gp={}));class Xp extends ud{constructor(t,e,i,n){super(t,n),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=n,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=Gp.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new hi([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Yp(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,viewBox:s}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s.x1,s.y1,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:fs.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:fs.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 Yp(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Yp(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Yp(this,void 0,void 0,(function*(){if(2!==t.count)yield Vu(t,fs.zIndex,((i,n)=>{if(this.status===Gp.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Yp(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Yp(this,void 0,void 0,(function*(){this.rendering&&(this.status=Gp.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=Gp.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 Yp(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:()=>Yp(this,void 0,void 0,(function*(){yield Vu(t,fs.zIndex,(t=>Yp(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const Kp=Symbol.for("DrawItemInterceptor"),$p=new ue,qp=new ue;class Zp{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,n,s),!1}beforeDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,n,s),!1}drawItem(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){$p.copy(n.dirtyBounds),qp.copy(n.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e),n.backupDirtyBounds.copy(n.dirtyBounds)}return n.renderGroup(t.shadowRoot,i,Ko.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&(n.dirtyBounds.copy($p),n.backupDirtyBounds.copy(qp)),!0}}class Jp{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return t.attribute._debug_bounds&&this.drawItem(t,e,i,n,s),!1}drawItem(t,e,i,n,s){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}class Qp{constructor(){this.order=1,this.interceptors=[new Zp,new eg,new tg,new Jp]}afterDrawItem(t,e,i,n,s){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rn.renderGroup(t,i,t.parent.globalTransMatrix,!e&&s)),i):n.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&$o.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const ig=Symbol.for("ArcRenderContribution"),ng=Symbol.for("AreaRenderContribution"),sg=Symbol.for("CircleRenderContribution"),rg=Symbol.for("GroupRenderContribution"),ag=Symbol.for("ImageRenderContribution"),og=Symbol.for("PathRenderContribution"),lg=Symbol.for("PolygonRenderContribution"),hg=Symbol.for("RectRenderContribution"),cg=Symbol.for("SymbolRenderContribution"),ug=Symbol.for("TextRenderContribution"),dg=Symbol.for("StarRenderContribution"),pg=Symbol.for("CommonRenderContribution"),gg=Symbol.for("InteractiveSubRenderContribution");function fg(t){!function({bind:t}){t(Xu).toSelf().inSingletonScope(),t(gp).toSelf().inSingletonScope(),t(Mu).to(ud),t(hu).to(Xp),t(fu).toDynamicValue((({container:t})=>new Vp(Fd(rg,t)))).inSingletonScope(),t(gu).toService(fu),Ud(t,rg),Ud(t,gg),t(rd).toDynamicValue((({container:t})=>new rd(Fd(gg,t)))).inSingletonScope(),Ud(t,gu),t(Qp).toSelf().inSingletonScope(),t(Kp).toService(Qp),Ud(t,Kp)}({bind:t.bind})}class mg{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class vg{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new mg(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const n=i.find((t=>t.named===e));return n?this.resolveBinding(n):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function yg(){return new vg}const _g=yg();function bg(){bg.__loaded||(bg.__loaded=!0,Vd({bind:_g.bind}),Jd({bind:_g.bind}),Gd({bind:_g.bind}),Zd({bind:_g.bind,isBound:_g.isBound}),function({bind:t}){t(iu).to(yd),Nd(t,eu)}({bind:_g.bind}),tp(_g),fg(_g))}function xg(){return _g}function Sg(t){bg();const[e]=_g.getAll(t);return e}function Ag(t,e){return bg(),_g.getNamed(t,e)}function Cg(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const n=e()[i];return"function"==typeof n?n.bind(e()):n},set:(t,i,n)=>(e()[i]=n,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const n=Object.getOwnPropertyDescriptor(e(),i);if(n)return Object.assign(Object.assign({},n),{configurable:!0})}})}bg.__loaded=!1;const wg=Cg((()=>Sg(Nh)));di.global=wg;const Tg=xg(),kg=Cg((()=>Sg(Kc))),Mg=Cg((()=>Sg(Xc))),Bg=Cg((()=>Sg(Wa))),Eg=Cg((()=>Sg($c)));function Pg(){di.global=wg,di.graphicUtil=kg,di.transformUtil=Mg,di.graphicService=Bg,di.layerService=Eg,di.canvasFactory=t=>Ag($a,t),di.context2dFactory=t=>Ag(qa,t),di.windowFactory=()=>new Ru(di.global),di.windowHandlerFactory=t=>function(t){const e=Ag(Pu,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),di.renderServiceFactory=()=>Sg(Qc),di.renderService=Cg((()=>Sg(Qc))),di.pluginServiceFactory=()=>Sg(iu),di.pluginService=Cg((()=>Sg(iu))),di.pickerServiceFactory=()=>Sg(su),di.layerHandlerFactory=t=>Sg("static"===t?qc:"dynamic"===t?Zc:Jc),di.incrementalDrawContributionFactory=()=>Sg(hu)}Pg();const Og={x:0,y:0,z:0,lastModelMatrix:null};class Rg{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(od),e(hd),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===$i.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===$i.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,n,s,r,a,o,l,h,c,u,d){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d)}))}afterRenderStep(t,e,i,n,s,r,a,o,l,h,c,u,d){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d)}))}drawPathProxy(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=oh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:u=l.opacity,fillOpacity:d=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,y=rp(u,d,h),_=op(u,g),b=np(h),x=sp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return en(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,b,x,y,_,l,s,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,n-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,n-v,l),e.fill())),this.afterRenderStep(t,e,i,n,b,x,y,_,l,s,a,o),!0}valid(t,e,i,n){const{fill:s=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:u=e.visible}=t.attribute,d=rp(o,l,s),p=op(o,c),g=np(s,r),f=sp(a,h);return!(!t.valid||!u)&&!(!g&&!f)&&!!(d||p||i||n||r)&&{fVisible:d,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,n=!1){const{x:s=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,u=i.modelMatrix,d=i.camera;Og.x=s,Og.y=r,Og.z=a,Og.lastModelMatrix=u;const p=d&&(n||zc(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const n=$o.allocate(),s=$o.allocate();jc(s,t,e),No(n,u||n,s),Og.x=0,Og.y=0,Og.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),$o.free(s)}if(g&&!u){const n=t.getOffsetXY(e);Og.x+=n.x,Og.y+=n.y,Og.z=a,i.setTransformForCurrent()}else if(p)Og.x=0,Og.y=0,Og.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(d&&i.project){const n=t.getOffsetXY(e);Og.x+=n.x,Og.y+=n.y,this.transformWithoutTranslate(i,Og.x,Og.y,Og.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Og.x=0,Og.y=0,Og.z=0;return Og}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},u={x:s,y:r};n.camera=null;const d=1/(h.x*(u.y-c.y)-c.x*u.y+u.x*c.y+(c.x-u.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+u.y*o.x+(c.y-u.y)*a.x)*d,g=(c.y*l.y+h.y*(o.y-l.y)-u.y*o.y+(u.y-c.y)*a.y)*d,f=(h.x*(l.x-o.x)-c.x*l.x+u.x*o.x+(c.x-u.x)*a.x)*d,m=-(c.x*l.y+h.x*(o.y-l.y)-u.x*o.y+(u.x-c.x)*a.y)*d,v=(h.x*(u.y*o.x-c.y*l.x)+h.y*(c.x*l.x-u.x*o.x)+(u.x*c.y-c.x*u.y)*a.x)*d,y=(h.x*(u.y*o.y-c.y*l.y)+h.y*(c.x*l.y-u.x*o.y)+(u.x*c.y-c.x*u.y)*a.y)*d;n.setTransform(p,g,f,m,v,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()}_draw(t,e,i,n,s,r){const{context:a}=n;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.z=u,this.drawPathProxy(t,a,h,c,n,s)||(this.drawShape(t,a,h,c,n,s,null,null,r),this.z=0,a.modelMatrix!==d&&$o.free(a.modelMatrix),a.modelMatrix=d),a.highPerformanceRestore()}}class Ig extends Rg{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=wa,this.builtinContributions=[vp,_p,yp],this.init(t)}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let u=h.endAngle;u=o;const d=u>c;let p=!1;if(s_t){const t=Mt(b,_),r=Mt(x,_),a=cp(v,y,f,m,s,t,Number(d)),o=cp(A,C,w,T,s,r,Number(d));if(_0&&e.arc(i+o.cx,n+o.cy,r,wt(o.y11,o.x11),wt(o.y01,o.x01),!d)}}else e.moveTo(i+f,n+m);if(!(r>_t)||M<.001)e.lineTo(i+w,n+T),p=!0;else if(k>_t){const t=Mt(E,k),s=Mt(P,k),a=cp(w,T,A,C,r,-s,Number(d)),o=cp(f,m,v,y,r,-t,Number(d));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),k0&&e.arc(i+a.cx,n+a.cy,s,wt(a.y01,a.x01),wt(a.y11,a.x11),!d);const t=wt(a.cy+a.y11,a.cx+a.x11),o=u-l-.03;e.arc(i,n,r,t,o,d)}}else e.lineTo(i+r*Tt(B),n+r*Bt(B));return p}drawShape(t,e,i,n,s,r,a,o,l){l=null!=l?l:oh(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:u=l.stroke,x:d=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:C=l.outerRadius,innerRadius:w=l.innerRadius}=t.attribute;C+=b,w-=x;let T=0;const k=(c(S)&&S||S[0])&&"conical"===h.gradient;if(k){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();Ct(n-i)=At-_t){e.beginPath();const r=Math.abs(C-w)/2/C,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,u=h;this.drawArcTailCapPath(t,e,i,n,C,w,u,u+r),M||this.beforeRenderStep(t,e,i,n,y,_,m,v,l,s,a,o);const d=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke()))};(()=>{if(y){const s=c;if("conical"===s.gradient){const r=vl(0,0,h,s);a||rp&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=r,e.fill())}}})(),d()}}this.afterRenderStep(t,e,i,n,y,_,m,v,l,s,a,o),k&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,n,s,r,a,o,l,h){r&&(h?h(e,t.attribute,s):a&&(e.setCommonStyle(t,t.attribute,o-i,l-n,s),e.fill()))}_runStroke(t,e,i,n,s,r,a,o,l){r&&a&&(l?l(e,t.attribute,s):o&&(e.setStrokeStyle(t,t.attribute,i,n,s),e.stroke()))}draw(t,e,i,n){const s=oh(t,null==n?void 0:n.theme).arc;this._draw(t,s,!1,i,n,s)}}class Dg extends Rg{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ma,this.builtinContributions=[xp,Ap,Sp],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=oh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:u=l.endAngle,x:d=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,n,h,c,u),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,y,_,m,v,l,s,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,p-n,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,p-n,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,n,y,_,m,v,l,s,a,o)}draw(t,e,i,n){const s=oh(t,null==n?void 0:n.theme).circle;this._draw(t,s,!1,i,n)}}function Lg(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]=un(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)}}function Fg(t,e,i,n,s,r,a){var o;let l=e.p0,h=n;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)n||(t.lineTo(l.x+s,l.y+r,a),h=!n);else{const{originP1:c,originP2:u}=e;let d;if(c&&!1!==c.defined&&!i?d=l:c&&!1!==u.defined&&(d=null!==(o=e.p3)&&void 0!==o?o:e.p1),n){h=!n;const i=d?d.x:e.p0.x,o=d?d.y:e.p0.y;t.moveTo(i+s,o+r,a)}else d&&(h=!n,t.lineTo(d.x+s,d.y+r,a))}return h}function Ug(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=s||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:u}=e;if(i>=1){if(h){let e,i=!0;u.forEach(((n,s)=>{n.originP1!==n.originP2?(i=Fg(t,n,e,i,r,a,o),e=n):e=n}))}else u.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Lg(t,e,1,s),c=!1):c=!0}));return}if(i<=0)return;let d;"x"===n?d=Xi.ROW:"y"===n?d=Xi.COLUMN:"auto"===n&&(d=e.direction);const p=i*e.tryUpdateLength(d);let g=0,f=!0,m=null;for(let e=0,i=u.length;e{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}function jg(t,e,i,n){const{offsetX:s=0,offsetY:r=0}=n||{},{points:a}=i,o=[];for(let t=0;t{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()}))}class zg extends Rg{constructor(){super(...arguments),this.numberType=Oa}draw(t,e,i,n){const s=oh(t,null==n?void 0:n.theme).line;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g){var f;if(!e)return;t.beginPath();Ug(t,e,l,h,{offsetX:c,offsetY:u,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),d.cache&&!_(d.cache)&&d.cache.curves.every((t=>t.defined))&&d.attribute.curveType&&d.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(d,a,m-c,v-u,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(d,a,m-c,v-u,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,n,s,r,a,o,l,h,c,u,d){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,u,d,i,n,l,s,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,n=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 s=qn(x(t.points,v),y,{startPoint:e,curveTension:m});return n=s,s})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===s[0].points.length&&s.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,u,d,s[g],[l,t.attribute],_,b,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,u,d,s[m],[l,t.attribute],Mt(y,1),b,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,d,t.attribute,l,_,b,i,n,t,a,o)}}function Wg(t,e,i,n){var s;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;ou?Xi.ROW:Xi.COLUMN,Number.isFinite(c)||(o=Xi.COLUMN),Number.isFinite(u)||(o=Xi.ROW);const d=i*(o===Xi.ROW?c:u);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),Lg(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),Lg(t,l,1,n),o=!1):o=!0}t.closePath()}const Vg=new Hp,Gg=Ku;class Yg extends Rg{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ka,this.builtinContributions=[Vg,Gg],this.init(t)}drawLinearAreaHighPerformance(t,e,i,n,s,r,a,o,l,h,c,u,d){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,u,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(u?u(e,t.attribute,l):s&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,u,null,{attribute:t.attribute}),(()=>{var i,s;if(n){const{stroke:n=l&&l.stroke}=t.attribute;if(_(n)&&(n[0]||n[2])&&!1===n[1])if(e.beginPath(),n[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const n=m[t];e.lineTo((null!==(i=n.x1)&&void 0!==i?i:n.x)+a,(null!==(s=n.y1)&&void 0!==s?s:n.y)+o,v)}}d?d(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,n,s,r,a,o){var l,h,c,u,d,p;const g=oh(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,C=S.doStroke&&S.sVisible,{clipRange:w=g.clipRange,closePath:T,points:k,segments:M}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===B&&(B="linearClosed"),1===w&&!M&&!k.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,C,v,_,i,n,g,s,r,a,o);if(t.shouldUpdateShape()){if(M&&M.length){let e,i;const n=M.map(((t,n)=>{if(t.points.length<=1&&0===n)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===n?e={x:i.endX,y:i.endY}:n>1&&(e.x=i.endX,e.y=i.endY);const s=qn(E(t.points,x),B,{startPoint:e,curveTension:b});return i=s,s})).filter((t=>!!t));let s;const r=[];for(let t=M.length-1;t>=0;t--){const e=M[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=M[t-1].points,n=e[e.length-1];n&&i.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(u=n.y1)&&void 0!==u?u:n.y})}i.length>1&&(s=qn(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(s))}t.cacheArea=r.map(((t,e)=>({top:n[e],bottom:t})))}else{if(!k||!k.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(k,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(d=e[t].x1)&&void 0!==d?d:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const n=qn(e,B,{curveTension:b}),s=qn(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:n,bottom:s}}}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===w){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,C,_,r[c],[g,t.attribute],w,i,n,y,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=w*l;let c=0,u=!1;t.cacheArea.forEach(((l,d)=>{if(u)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(u=this.drawSegmentItem(e,l,A,v,C,_,r[d],[g,t.attribute],Mt(f,1),i,n,y,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,C,_,t.attribute,g,w,i,n,y,t,s,a,o)}draw(t,e,i,n){const s=oh(t,null==n?void 0:n.theme).area;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f){return this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f)}_drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=d.attribute;let y,b,x=Xi.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Ct(y.x-b.x),A=Ct(y.y-b.y);x=null==y.x1?Xi.ROW:null==y.y1?Xi.COLUMN:Number.isFinite(S+A)?S>A?Xi.ROW:Xi.COLUMN:Xi.ROW,Wg(t,e,l,{offsetX:h,offsetY:c,offsetZ:u,direction:x}),this.beforeRenderStep(d,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,a,o);const{x:C=0,x:w=0}=a;return!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(d,a,C-h,w-c,o),t.fill())),this.afterRenderStep(d,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==s)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),Ug(t,i[0]?e.top:e.bottom,l,x===Xi.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:u})),t.setStrokeStyle(d,a,C-h,w-c,o),t.stroke()}})(),!1}}const Xg=fp,Kg=Ku;class $g extends Rg{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ra,this.builtinContributions=[Kg,Xg],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,c;const u=null!==(l=this.tempTheme)&&void 0!==l?l:oh(t,null==r?void 0:r.theme).path,{x:d=u.x,y:p=u.y,fillStrokeOrder:g=u.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,u,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)en(t.pathShape.commandList,e,i,n,1,1,f);else{en((null!==(c=t.attribute.path)&&void 0!==c?c:u.path).commandList,e,i,n,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,n,_,b,v,y,u,s,a,o);const x=()=>{b&&(o?o(e,t.attribute,u):y&&(e.setStrokeStyle(t,t.attribute,d-i,p-n,u),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,u):v&&(e.setCommonStyle(t,t.attribute,d-i,p-n,u),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,n,_,b,v,y,u,s,a,o)}draw(t,e,i,n){const s=oh(t,null==n?void 0:n.theme).path;this.tempTheme=s,this._draw(t,s,!1,i,n),this.tempTheme=null}}class qg extends Rg{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=La,this.builtinContributions=[Bp,Pp,Ep],this.init(t)}drawShape(t,e,i,n,s,r,a,o,l){l=null!=l?l:oh(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:u=l.stroke,cornerRadius:d=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:C=l.fillStrokeOrder,drawStrokeWhenZeroWH:w=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:k}=t.attribute;T=(null!=T?T:b-S)||0,k=(null!=k?k:x-A)||0;const M=ap(g,f,T,k,h),B=lp(g,v,T,k,w),E=np(h,c),P=sp(u,m);if(!t.valid||!y)return;if(!E&&!P)return;if(!(M||B||a||o||c))return;0===d||_(d)&&d.every((t=>0===t))?(e.beginPath(),e.rect(i,n,T,k)):(e.beginPath(),ip(e,i,n,T,k,d,"bevel"!==p));const O={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,E,P,M,B,l,s,a,o,O),C?(this._runStroke(t,e,i,n,l,O,B,S,A,o),this._runFill(t,e,i,n,l,O,M,S,A,a)):(this._runFill(t,e,i,n,l,O,M,S,A,a),this._runStroke(t,e,i,n,l,O,B,S,A,o)),this.afterRenderStep(t,e,i,n,E,P,M,B,l,s,a,o)}_runFill(t,e,i,n,s,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,s):a&&(e.setCommonStyle(t,t.attribute,o-i,l-n,s),e.fill()))}_runStroke(t,e,i,n,s,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,s):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-n,s),e.stroke()))}draw(t,e,i,n){const s=oh(t,null==n?void 0:n.theme).rect;this._draw(t,s,!1,i,n,s)}}class Zg extends Rg{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ja,this.builtinContributions=[Fp,jp,Np,Up],this.init(t)}drawShape(t,e,i,n,s,r,a,o,l){var h;l=null!=l?l:oh(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:u=l.x,y:d=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:C=l.keepDirIn3d}=t.attribute,w=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,k=n,M=w;const B=e.camera;if(C&&B&&e.project){const t=e.project(i,n,w);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,k=t.y,M=void 0}!1===A.draw(e,c,T,k,M,((s,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,u-i,d-n,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(u-i)/p,(d-n)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,x,S,y,b,l,s,a,o),f?(this._runStroke(t,e,i,n,l,S,b,u,d,A,m,p,g,o),this._runFill(t,e,i,n,l,x,y,u,d,A,a)):(this._runFill(t,e,i,n,l,x,y,u,d,A,a),this._runStroke(t,e,i,n,l,S,b,u,d,A,m,p,g,o)),this.afterRenderStep(t,e,i,n,x,S,y,b,l,s,a,o)}_runFill(t,e,i,n,s,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,s):a&&(e.setCommonStyle(t,t.attribute,o-i,l-n,s),e.fill()))}_runStroke(t,e,i,n,s,r,a,o,l,h,c,u,d,p){r&&!h.isSvg&&(p?p(e,t.attribute,s):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/u,(l-n)/d,s),e.stroke()))}draw(t,e,i,n){const s=oh(t,null==n?void 0:n.theme).symbol;this._draw(t,s,!1,i,n)}}const Jg=new class extends Xu{constructor(){super(...arguments),this.time=$i.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){var d,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:C=l.opacity,backgroundMode:w=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:k=l.backgroundKeepAspectRatio,backgroundScale:M=l.backgroundScale,backgroundOffsetX:B=l.backgroundOffsetX,backgroundOffsetY:E=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:O=l.backgroundClip,backgroundCornerRadius:R=l.backgroundCornerRadius}=t.attribute;let I,{background:D}=t.attribute;if(!D)return;const L=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const U=g(D)&&D.background?D:null,N=t.transMatrix.onlyTranslate();if(U){const e=t.AABBBounds,i=(null!==(d=U.x)&&void 0!==d?d:e.x1)+(null!==(p=U.dx)&&void 0!==p?p:0),n=(null!==(f=U.y)&&void 0!==f?f:e.y1)+(null!==(m=U.dy)&&void 0!==m?m:0),s=null!==(v=U.width)&&void 0!==v?v:e.width(),r=null!==(y=U.height)&&void 0!==y?y:e.height();if(F=Yu.allocate(i,n,i+s,n+r),D=U.background,!N){const t=F.width(),e=F.height();F.set((null!==(_=U.x)&&void 0!==_?_:0)+(null!==(b=U.dx)&&void 0!==b?b:0),(null!==(x=U.y)&&void 0!==x?x:0)+(null!==(S=U.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,N||(F=Gc(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const i=t.resources.get(D);if(!i||"success"!==i.state||!i.data)return void L();e.highPerformanceSave(),N&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*C,O&&(e.beginPath(),R?ip(e,F.x1,F.y1,F.width(),F.height(),R,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:w,backgroundFit:T,backgroundKeepAspectRatio:k,backgroundScale:M,backgroundOffsetX:B,backgroundOffsetY:E,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=A*C,e.fillStyle=D,R?(ip(e,F.x1,F.y1,F.width(),F.height(),R,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();U&&Yu.free(F),L()}};class Qg extends Rg{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=za,this.builtinContributions=[Jg],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,c;const u=oh(t,null==r?void 0:r.theme).text,{text:d,underline:p=u.underline,lineThrough:g=u.lineThrough,keepDirIn3d:f=u.keepDirIn3d,direction:m=u.direction,fontSize:v=u.fontSize,verticalMode:y=u.verticalMode,x:_=u.x,y:b=u.y}=t.attribute,x=null!==(l=$s(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,u,a,o);if(!S)return;const{fVisible:A,sVisible:C,doFill:w,doStroke:T}=S,k=!f,M=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,n,w,T,A,C,u,s,a,o),k&&this.transformUseContext2d(t,u,M,e);const B=(s,r,l,h)=>{let c=i+r;const d=n+l;if(h){e.highPerformanceSave(),c+=v;const t=Ko.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,d),e.transformFromMatrix(t,!0),Ko.free(t)}T&&(o?o(e,t.attribute,u):C&&(e.setStrokeStyle(t,t.attribute,_-i,b-n,u),e.strokeText(s,c,d,M))),w&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-n,u),e.fillText(s,c,d,M))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,u,M),"horizontal"===m){const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;T&&(o?o(e,t.attribute,u):C&&(e.setStrokeStyle(t,t.attribute,_-i,b-n,u),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,M)})))),w&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-n,u),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,M),this.drawUnderLine(p,g,t,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,s.descent,(s.descent-s.ascent)/2,M,u,e,{width:s.width})}))))}else{let{textAlign:i=u.textAlign,textBaseline:n=u.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[n])&&void 0!==h?h:"left",n=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const s=t.cache,{verticalList:r}=s;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=kt(e,o)}));let l=0,d=0;"bottom"===n?d=-a:"middle"===n&&(d=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const n=t.reduce(((t,e)=>t+(e.width||0)),0),s=o-n;let r=l;"center"===i?r+=s/2:"right"===i&&(r+=s),t.forEach((t=>{const{text:i,width:n,direction:s}=t;B(i,a-(e+1)*x+d,r,s),r+=n}))}))}k&&this.restoreTransformUseContext2d(t,u,M,e),this.afterRenderStep(t,e,i,n,w,T,A,C,u,s,a,o)}draw(t,e,i,n){const s=oh(t,null==n?void 0:n.theme).text,{keepDirIn3d:r=s.keepDirIn3d}=t.attribute,a=!r;this._draw(t,s,a,i,n)}drawUnderLine(t,e,i,n,s,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!d(c),_=y?c.width:i.clipedWidth,b=y?0:ph(u,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,n,s,l),m&&h.setLineDash(m),h.beginPath();const e=s+r+f;h.moveTo(n+b,e,o),h.lineTo(n+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,n,s,l),h.beginPath();const t=s+a;h.moveTo(n+b,t,o),h.lineTo(n+b+_,t,o),h.stroke()}}}function tf(t,e,i,n){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s0===t))?tf(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s,r=!0){var a;if(e.length<3)return void tf(t,e,i,n);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+n));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],u=h.x-o.x,d=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(d,u)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(s)?null!==(a=s[r%e.length])&&void 0!==a?a:0:s,y=v/m;const _=ef(u,d),b=ef(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=nf(h,y,_,u,d),A=nf(h,y,b,p,g),C=2*h.x-S.x-A.x,w=2*h.y-S.y-A.y,T=ef(C,w),k=nf(h,ef(y,v),T,C,w);let M=Math.atan2(S.y-k.y,S.x-k.x);const B=Math.atan2(A.y-k.y,A.x-k.x);let E=B-M;E<0&&(M=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+n):t.lineTo(S.x+i,S.y+n),E&&t.arcTo(h.x+i,h.y+n,A.x+i,A.y+n,v),t.lineTo(A.x+i,A.y+n)}r||t.lineTo(e[l+1].x+i,e[l+1].y+n)}(e.camera?e:e.nativeContext,h,i,n,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,y,b,m,v,l,s,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,d-n,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,d-n,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,n,y,b,m,v,l,s,a,o)}draw(t,e,i,n){const s=oh(t,null==n?void 0:n.theme).polygon;this._draw(t,s,!1,i,n)}}const of=["","repeat-x","repeat-y","repeat"];function lf(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?of[i]:"no-repeat"}function hf({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const n=lf(t,e);return{repeatMode:n,sizingMode:"no-repeat"===n&&null!=i?i:"fill"}}const cf={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function uf(t){return{backgroundMode:cf[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function df({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:n=1,imageOffsetX:s=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=hf({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==n||0!==s||0!==r)}function pf(t,e,i,n,s,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:u=0,imagePosition:d="top-left"}){const{repeatMode:p,sizingMode:g}=hf({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?uf(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};sd(t,e,{x1:i,y1:n,x2:i+s,y2:n+r,width:()=>s,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:u,backgroundPosition:d})}class gf extends Rg{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pa,this.builtinContributions=[Rp,Ip],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=oh(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:u=l.x,y:d=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:C,sVisible:w,doFill:T,doStroke:k}=A;if(!S||!t.resources)return;const M=t.resources.get(S);if("success"!==M.state)return;const B=t.width,E=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,n,B,E):(ip(e,i,n,B,E,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const O=()=>{T&&(a?a(e,t.attribute,l):C&&(e.setCommonStyle(t,t.attribute,i,n,l),pf(e,M.data,i,n,B,E,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},R=()=>{k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,u-i,d-n,l),e.stroke()))},I=df({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),D=P||I;g?(R(),D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,n,T,!1,C,!1,l,s,a),O(),D&&e.restore()):(D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,n,T,!1,C,!1,l,s,a),O(),D&&e.restore(),R()),this.afterRenderStep(t,e,i,n,T,!1,C,!1,l,s,a)}draw(t,e,i){const{image:n}=t.attribute;if(!n||!t.resources)return;const s=t.resources.get(n);if("loading"===s.state&&y(n))return void Os.improveImageLoading(n);if("success"!==s.state)return;const{context:r}=e.drawParams;if(!r)return;const a=oh(t).image;this._draw(t,a,!1,i)}}var ff=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 mf{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new ue}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return ff(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class vf{constructor(){this._uid=ci.GenAutoIncrementId(),this.viewBox=new ue,this.modelMatrix=new pe(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,n,s,r){this.modelMatrix.setValue(t,e,i,n,s,r)}getViewBoxTransform(){return this.modelMatrix}}class yf{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=il.Get(e,el.Color1),this.ambient=i;const n=Et(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=Mt(kt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=y(e)?il.Get(e,el.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*s[0]*n}, ${r[1]*s[1]*n}, ${r[2]*s[2]*n})`}}const _f=()=>{Od.registerPlugin("DirectionalLight",yf)};class bf{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=$o.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=$o.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return jo(this._viewMatrixCached,t,e,i),this._vp||(this._vp=$o.allocate()),this._vp=No(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=$o.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=$o.allocate());const{left:t,top:e,right:i,bottom:n}=this._params;return zo(this._projectionMatrixCached,t,i,n,e,0,-2e6),this._vp||(this._vp=$o.allocate()),this._vp=No(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:n}=this._params;return(null!=e?e:n-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const n=[0,0,0];return Wo(n,[t,e,i],this._viewMatrixCached),n}vp(t,e,i){const n=[0,0,0],{pos:s}=this._params.viewParams;Wo(n,[t,e,i],this._viewMatrixCached),t=n[0],e=n[1],i=n[2];const r=this.getProjectionScale(i);return{x:t*r+s[0],y:e*r+s[1]}}}const xf=()=>{Od.registerPlugin("OrthoCamera",bf)},Sf={getContributions:()=>[]},Af={getContributions:()=>[]};class Cf{constructor(t=Sf,e=Af,i={}){var n,s,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(n=i.global)&&void 0!==n?n:di.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(s=i.pickItemInterceptorContributions)&&void 0!==s?s:this.pickItemInterceptorContributions)&&void 0!==r?r:Sf,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:Af,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;const s=i.bounds.width(),r=i.bounds.height();if(!(new ue).setValue(0,0,s,r).containsPoint(e))return n;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new pe(1,0,0,1,0,0);let o;for(let s=t.length-1;s>=0&&(n=t[s].isContainer?this.pickGroup(t[s],e,a,i):this.pickItem(t[s],e,a,i),!n.graphic);s--)o||(o=n.group);if(n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new Ft(e.x,e.y),a=oh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,s=this.pickGroup(r,i,l,n)}else{const a=new Ft(e.x,e.y);l.transformPoint(a,a);const o=oh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const u=this.pickItem(r,a,i,n);u&&u.graphic&&(s.graphic=u.graphic,s.params=u.params)}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&$o.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),Ko.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class wf{constructor(t={}){var e,i,n,s,r,a,o,l,h,c,u,d,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new pd,picker:null!==(s=null===(n=t.registry)||void 0===n?void 0:n.picker)&&void 0!==s?s:new gd,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new md,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new fd},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new Bd(void 0,(()=>this.createStageDeps())),layer:null!==(d=null===(u=t.factory)||void 0===u?void 0:u.layer)&&void 0!==d?d:new Pd,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new Dc}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),n=i,s=null===(e=n.release)||void 0===e?void 0:e.bind(i);let r=!1;return s&&(n.release=()=>{r||(r=!0,this.stageResources.delete(n),s())}),this.stageResources.add(n),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new dd(new ud([],(t=this.registry.contribution,e=Kp,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class Tf{constructor(t={}){this.context=new wf(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function kf(t={}){return new Tf(t)}class Mf extends Tf{}class Bf extends Tf{}class Ef extends Yg{constructor(){super(...arguments),this.numberType=ka}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=oh(t).area,{fill:c=h.fill,fillOpacity:u=h.fillOpacity,opacity:d=h.opacity,visible:p=h.visible}=t.attribute,g=rp(d,u,c),f=np(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;sl.length)return;const h=oh(t).line,{fill:c=h.fill,stroke:u=h.stroke,opacity:d=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=rp(d,p,c),y=op(d,g),_=np(c),b=sp(u,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||a||o))return;const{context:x}=s;for(let s=e;s{var s,r,a;const o=null!==(a=null!==(s=null==e?void 0:e.type)&&void 0!==s?s:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${n}`,e)}))}function jf(t,e){let i=Df.get(t);i||(i=new Map,Df.set(t,i));let n=i.get(e);return n||(n=new Set,i.set(e,n)),n}function zf(t,e,i){const n=jf(t,e);i&&n.forEach((t=>i(t))),n.clear()}function Wf(){return Ff(),Of}function Hf(){jd.refreshAllContributions()}function Vf(){return Ff(),null!=Rf||(Rf=new vi(Fd(Uh,Of))),Rf}function Gf(t){const e=Wf(),i=Vf();di.global=i,di.canvasFactory=t=>e.getNamed($a,t),di.context2dFactory=t=>e.getNamed(qa,t),di.windowHandlerFactory=t=>Uf(Pu,t),di.windowFactory=()=>new Ru(i,(t=>Uf(Pu,t))),di.pluginServiceFactory=()=>new yd(Fd(eu,e),{pluginRegistry:t.context.registry.plugin}),di.incrementalDrawContributionFactory=()=>new Xp([],new Pf,new Ef(Fd(ng,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,Kp))}function Yf(t){var e;const i=Wf();Hf();const n=i.getAll(gu),s=jf(t.registry.renderer,"vrender:runtime-renderer");zf(t.registry.renderer,"vrender:runtime-renderer",null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),Nf(((e,i)=>{var n;null===(n=null==i?void 0:i.reInit)||void 0===n||n.call(i),t.registry.renderer.register(e,i),s.add(e)}),n,"vrender:runtime-renderer")}function Xf(t){var e;const i=Wf();Hf();const n=i.getAll(Kp),s=null!==(e=Lf.get(t.context.registry.contribution))&&void 0!==e?e:new Set;s.forEach((e=>{var i,n;null===(n=(i=t.context.registry.contribution).unregister)||void 0===n||n.call(i,Kp,e)})),s.clear(),Lf.set(t.context.registry.contribution,s);const r=new Set(t.context.registry.contribution.get(Kp));n.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(Kp,e),r.add(e)),s.add(e)}))}function Kf(t,e){var i;const n=Wf();Hf();const s=n.getAll(e),r=jf(t.registry.picker,"vrender:runtime-picker");zf(t.registry.picker,"vrender:runtime-picker",null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),Nf(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),s,"vrender:runtime-picker")}function $f(t,e,i){const n={};for(const i in e)i in t&&W(t[i],e[i])||(n[i]=e[i]);if(i)for(const s in t)if(!(s in e)){const t=i(s);void 0!==t&&(n[s]=t)}return n}function qf(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,u=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=u,r[4]=u,r[5]=c,r[6]=l,r[7]=n}function Zf(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i0){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;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const u=s.filter((t=>t.length>2));return 1===u.length?[u[0]]:u}function rm(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{width:i,height:n}=Bh(t.attribute),s=om(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{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=om(o*(r+a)/2,l,e),c=[],u=l/h.length,d=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=om(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{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;s{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&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return vm(l,e,h),h},pm=(t,e)=>{const i=t.attribute,n=i.points;if(n)return um(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 um(t,e)}return[]};const gm=t=>t.map((t=>({x:t.x,y:t.y}))),fm=(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,u=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)u.push({x:t[e].x,y:t[e].y});u.push({x:c.x,y:c.y});const d=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];d.push({x:i.x,y:i.y})}return d.push({x:h.x,y:h.y}),[u,d]},mm=t=>{const e=new ce;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 fm(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return fm(t,{x:e.x1,y:s},{x:e.x2,y:s})},vm=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=mm(t);vm(s[0],n,i),vm(s[1],e-n,i)}},ym=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:gm(i)}];const n=[];return vm(i,e,n),n},_m=(t,e)=>{const i=sm(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;rObject.assign({},t))):[]}function xm(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:bm(t.touches),configurable:!0},changedTouches:{value:bm(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function Sm(t,e){try{return t[e]}catch(t){return}}function Am(t,e,i,n){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const s=e();if(1===(r=s).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=xm(t),l=Sm(t,"target"),h=Sm(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)n(t.clientX,t.clientY,s,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];n(t.clientX,t.clientY,s,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];n(t.clientX,t.clientY,s,a,t)}}return o}}var Cm=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=0;a++)"\n"===t[a].text?(s-=Number(r),r=!0):(s--,r=!1);return s>=0?t.length:(a-=1,e>n&&!r&&(a+=1),a)}function km(t,e){var i,n,s,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(n=t[t.length-1])||void 0===n?void 0:n.text)?a+.9:a+.1;const l="\n"===(null===(s=t[e])||void 0===s?void 0:s.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class Mm{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:Tm(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},wm(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},wm(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,n=Cm(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let s=t.data;this.isComposing||"Backspace"===t.type||s||(s="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=Tm(i,this.selectionStartCursorIdx),a=Tm(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=wm(n));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=s,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;s&&s.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=km(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(s,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(s,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),di.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,n=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const s=n.text,r=s?Array.from(s.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=n,this.selectionStartCursorIdx=s}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),di.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class Bm{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,n=Tm(i,Math.ceil(t)),s=Tm(i,Math.floor(e));let r="";for(let t=n;t<=s;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let n=Math.round(e);const s=this.rt.attribute.textConfig;if(!s.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const n=e.getSelection();if(!n)return;const{selectionStartCursorIdx:s,curCursorIdx:r}=n,a=Math.min(s,r),o=Math.max(s,r),l=Tm(i.attribute.textConfig,a),h=Tm(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const n=i.attribute.textConfig;this._formatTextCommand(t,n,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,n)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,n)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const s=this.computedCursorPosByCursorIdx(i,n);this.setCursorAndTextArea(s.x,s.y1,s.y2,n),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(Em,[this.formatTextCommandCb]),this.commandCbs.set(Pm,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):g(t)&&e.forEach((e=>U(e,t))),i.setAttributes(i.attribute);const n=i.getFrameCache();n&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,n),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],n=i.indexOf(e);n>-1&&i.splice(n,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new Mm,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),di.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(di.global.isMacOS()&&t.metaKey&&"c"===t.key||!di.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return di.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const n=i.getFrameCache();if(!n)return;const{lines:s}=n,r=s.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,n)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:n,y1:s,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:n,y:(s+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const n=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,n+.1)}fullSelectionKeyHandler(t){return!!(di.global.isMacOS()&&t.metaKey&&"a"===t.key||!di.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,n=0;"ArrowUp"===t.key?n=-1:"ArrowDown"===t.key?n=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:s,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===s.paragraphs[s.paragraphs.length-2]&&this.curCursorIdx0&&r===s.paragraphs[s.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===s.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===s.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(n){if(n>0&&s===e.lines[e.lines.length-1])return;if(n<0&&s===e.lines[0])return;const t=e.lines.findIndex((t=>t===s))+n;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=n*s.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let u=this.getColumnIndex(e,h)+c;const d=this.computedCursorPosByCursorIdx(u,this.currRt);u<-.1?u=-.1:u>o+.1&&(u=o+.1),this.curCursorIdx=u,this.selectionStartCursorIdx=u,this.setCursorAndTextArea(d.x,d.y1,d.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:n,placeholderColor:s="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},wm(this.currRt.attribute)),{text:n});s&&(l.fill=s),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=cc(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:Yc(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:n}=i;if(!i||!n)return;this.offsetShadowRoot();const s=this.getRichTextAABBBounds(this.currRt),r=s.height(),a=s.width();this.shadowBounds=this.shadowBounds||Oh({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:n,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},wm(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),di.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=kc({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,Om.tryUpdateRichtext(i);const n=this.getShadow(i),s=i.getFrameCache();if(!s)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=Mh({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=kc({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,n),this.addEditLineOrBgOrBounds(this.editBg,n)}if(e=e||this.computedCursorPosByEvent(t,s)){const{x:t,y1:n,y2:s,cursorIndex:r}=e;this.startCursorPos={x:t,y:(n+s)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,n,s,i)}else{const t=0,e=0,n=Yc(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+n)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,n,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,n=0,s=t.attribute;"middle"!==e&&"bottom"!==e||(s.textConfig.length||(s=Object.assign(Object.assign({},s),{textConfig:[{text:"a"}]})),i=Yc(Object.assign(Object.assign({},s),{scaleX:1,scaleY:1}))),"middle"===e?n=-i.height()/2:"bottom"===e&&(n=-i.height()),this.editLine&&this.editLine.setAttributes({dy:n}),this.editBg&&this.editBg.setAttributes({dy:n}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:n})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const n=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,n),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,n),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,n),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const n=e.lineInfo,s=n.paragraphs.findIndex((t=>t===e.columnInfo));if(s<0)return;const r=n.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return n=Math.min(n+1,t.length),{startIdx:i,endIdx:n}}(r,s);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,n={x:t.x,y:(t.y1+t.y2)/2},s=this.getLineByPoint(e,i),r=this.getLineByPoint(e,n);if((i.y>n.y||i.y===n.y&&i.x>n.x)&&([i,n]=[n,i],[r,s]=[s,r]),this.hideSelection(),s===r)this.editBg.setAttributes({x:i.x,y:s.top,width:n.x-i.x,height:s.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:s.top,width:0,height:0});const t=e.lines.findIndex((t=>t===s)),a=e.lines.findIndex((t=>t===r));let o=0;for(let s=t;s<=a;s++){const r=e.lines[s];if(s===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(Oh({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(s===a){const t=r.paragraphs[0];this.editBg.add(Oh({x:t.left,y:o,width:n.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(Oh({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let n=0;n=e.y);n++)i=t.lines[n+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],n=0;if(t.paragraphs.length){const s=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=s.left?(n=-.1,i=s):e.x>=r.left+r.width&&(n=.1,i=r)}if(!n)for(let s=0;s=e.x){n=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:n}}getColumnIndex(t,e){let i=-1;for(let n=0;nMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-n/2:"right"===t.globalAlign&&(this.deltaX=-n),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const n=this.currRt,{textBaseline:s}=n.attribute;let r=0;return"middle"===s?r=Yc(Object.assign(Object.assign({},n.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===s&&(r=Yc(Object.assign(Object.assign({},n.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,n){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const s={x:0,y:0};n.globalTransMatrix.getInverse().transformPoint({x:t,y:e},s);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();s.x+=r,s.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(s.x,s.y,n,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),n=this.getLineByPoint(e,i);if(!n)return;const{columnInfo:s,delta:r}=this.getColumnAndIndexByLinePoint(n,i);if(!s)return;const a=n.top,o=n.top+n.height;let l=this.getColumnIndex(e,s);return l+=r,{x:s.left+(r>0?s.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:n,columnInfo:s}}computedCursorPosByCursorIdx(t,e){var i,n,s;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(s=null===(n=e.attribute.textConfig)||void 0===n?void 0:n[0])||void 0===s?void 0:s.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:Yc(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:u}=l,d=c.top,p=c.top+c.height;return{x:u.left+(a<0?0:u.width),y1:d,y2:p,lineInfo:c,columnInfo:u}}getColumnByIndex(t,e){for(let i=0,n=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Zm=new qm;function Jm(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Qm=new WeakSet;function tv({bind:t}){Jm(Qm,t)||(t(Ig).toDynamicValue((({container:t})=>new Ig(Fd(ig,t)))).inSingletonScope(),t(cu).toService(Ig),t(gu).toService(cu),t(ig).toService(rd),Ud(t,ig))}const ev=tv,iv=new WeakSet;function nv({bind:t}){Jm(iv,t)||(t(qg).toDynamicValue((({container:t})=>new qg(Fd(hg,t)))).inSingletonScope(),t(_u).toService(qg),t(gu).toService(_u),t(Mp).toSelf(),t(kp).toSelf(),t(hg).toService(Mp),t(hg).toService(kp),t(hg).toService(rd),Ud(t,hg))}const sv=nv,rv=new WeakSet;function av({bind:t}){Jm(rv,t)||(t(zg).toDynamicValue((()=>new zg)).inSingletonScope(),t(mu).toService(zg),t(gu).toService(mu))}const ov=av,lv=new WeakSet;function hv({bind:t}){Jm(lv,t)||(t(Yg).toDynamicValue((({container:t})=>new Yg(Fd(ng,t)))).inSingletonScope(),t(du).toService(Yg),t(gu).toService(du),t(ng).toService(rd),Ud(t,ng))}const cv=hv,uv=new WeakSet;function dv({bind:t}){Jm(uv,t)||(t(Zg).toDynamicValue((({container:t})=>new Zg(Fd(cg,t)))).inSingletonScope(),t(xu).toService(Zg),t(gu).toService(xu),t(cg).toService(rd),Ud(t,cg))}const pv=dv,gv=new WeakSet;function fv({bind:t}){Jm(gv,t)||(t(Dg).toDynamicValue((({container:t})=>new Dg(Fd(sg,t)))).inSingletonScope(),t(pu).toService(Dg),t(gu).toService(pu),t(sg).toService(rd),Ud(t,sg))}const mv=fv,vv=new WeakSet;function yv({bind:t}){Jm(vv,t)||(t(Su).toDynamicValue((({container:t})=>new Qg(Fd(ug,t)))).inSingletonScope(),t(gu).toService(Su),t(ug).toService(rd),Ud(t,ug))}const _v=yv,bv=new WeakSet;function xv({bind:t}){Jm(bv,t)||(t($g).toDynamicValue((({container:t})=>new $g(Fd(og,t)))).inSingletonScope(),t(vu).toService($g),t(gu).toService(vu),t(og).toService(rd),Ud(t,og))}const Sv=xv,Av=new WeakSet;function Cv({bind:t}){Jm(Av,t)||(t(yu).toDynamicValue((({container:t})=>new af(Fd(lg,t)))).inSingletonScope(),t(gu).toService(yu),t(lg).toService(rd),Ud(t,lg))}const wv=Cv;class Tv extends Rg{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Na,this.builtinContributions=[Wp,zp],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=oh(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:u=l.fillStrokeOrder}=t.attribute,d=this.valid(t,l,a,o);if(!d)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=d,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,s)=>{0===s?e.moveTo(i+t.x,n+t.y):e.lineTo(i+t.x,n+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,f,m,p,g,l,s,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-n,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-n,l),e.stroke()))};u?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,n,f,m,p,g,l,s,a,o)}draw(t,e,i,n){const s=oh(t,null==n?void 0:n.theme).star;this._draw(t,s,!1,i,n)}}const kv=new WeakSet;function Mv({bind:t}){Jm(kv,t)||(t(Tv).toDynamicValue((({container:t})=>new Tv(Fd(dg,t)))).inSingletonScope(),t(Bu).toService(Tv),t(gu).toService(Bu),Ud(t,dg))}const Bv=Mv;class Ev{constructor(){this.numberType=Ba}reInit(){}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=oh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}}const Pv=new WeakSet;function Ov({bind:t}){Jm(Pv,t)||(t(Ev).toDynamicValue((()=>new Ev)).inSingletonScope(),t(wu).toService(Ev),t(gu).toService(wu))}const Rv=Ov;class Iv extends Rg{constructor(){super(),this.numberType=Ua,this.builtinContributions=[Jg],this.init()}drawShape(t,e,i,n,s){const r=oh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=rp(o,l,!0),u=rp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,n),this.beforeRenderStep(t,e,i,n,c,u,c,u,r,s),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,n,c,u,c,u,r,s))}drawIcon(t,e,i,n,s){var r;const a=oh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:u=a.backgroundFill,backgroundFillOpacity:d=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(v-o)/2,s=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,v,y)):(e.beginPath(),ip(e,i-t,n-s,v,y,f,!0)),u&&(e.globalAlpha=d,e.fillStyle=u,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,n,o,l))}draw(t,e,i){const n=oh(t).richtext;this._draw(t,n,!1,i)}}const Dv=new WeakSet;function Lv({bind:t}){Jm(Dv,t)||(t(Iv).toDynamicValue((()=>new Iv)).inSingletonScope(),t(Au).toService(Iv),t(gu).toService(Au))}const Fv=Lv,Uv=new WeakSet;function Nv({bind:t}){Jm(Uv,t)||(t(Tu).toDynamicValue((({container:t})=>new gf(Fd(ag,t)))).inSingletonScope(),t(gu).toService(Tu),t(ag).toService(rd),Ud(t,ag))}const jv=Nv;class zv extends Rg{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,l,h,c){const u=il.Get(r,el.Color255),d=n.vertices,p=d.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];n.polygons.forEach(((t,e)=>{if(s&&!s[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,n=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=n+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((n=>{const{polygon:s,normal:p}=n.polygon,g=d[s[0]],f=d[s[1]],m=d[s[2]],v=d[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+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,u):r,a.fill())}))}}class Wv extends zv{constructor(){super(...arguments),this.type="rect3d",this.numberType=Fa}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=oh(t,null==r?void 0:r.theme).rect,{fill:u=c.fill,stroke:d=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:C}=t.attribute;A=(null!=A?A:p-f)||0,C=(null!=C?C:g-m)||0;const w=null!==(h=this.z)&&void 0!==h?h:0,T=ap(v,y,A,C,u),k=lp(v,b,A,C,S),M=np(u),B=sp(d,_);if(!t.valid||!x)return;if(!M&&!B)return;if(!(T||k||a||o))return;const{light:E}=s.stage||{},P=t.findFace();if(!1!==u){e.setCommonStyle(t,t.attribute,i,n,c);let s=u;"string"!=typeof s&&(s="black"),this.fill(i,n,w,P,null,s,e,E,null,null,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,c),this.stroke(i,n,w,P,e))}draw(t,e,i){const n=oh(t).rect;this._draw(t,n,!1,i)}}const Hv=new WeakSet;function Vv({bind:t}){Jm(Hv,t)||(t(Wv).toDynamicValue((()=>new Wv)).inSingletonScope(),t(bu).toService(Wv),t(gu).toService(bu))}const Gv=Vv;class Yv extends Rg{constructor(){super(...arguments),this.numberType=Ta}drawShape(t,e,i,n,s,r,a,o){var l;const h=oh(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,u=this.valid(t,h,a,o);if(!u)return;const{fVisible:d,sVisible:p,doFill:g,doStroke:f}=u,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=il.Get(c,el.Color255),{light:A}=s.stage||{},C=s.hack_pieFace,w={top:m,bottom:m+_},T={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===C||"top"===C?(e.beginPath(),function(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let u=!1;if(r=At-_t)e.moveTo(i+r*Tt(o),n+r*Bt(o),s),e.arc(i,n,r,o,l,!c,s),a>_t&&(e.moveTo(i+a*Tt(l),n+a*Bt(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:d,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Tt(p),y=r*Bt(p),_=a*Tt(f),b=a*Bt(f);h<.001?u=!0:(e.moveTo(i+v,n+y,s),e.arc(i,n,r,p,g,!c,s)),!(a>_t)||d<.001?(e.lineTo(i+_,n+b,s),u=!0):(e.lineTo(i+_,n+b,s),e.arc(i,n,a,f,m,c,s))}e.closePath()}(t,e,i,n,w[C],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):d&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=A?A.computeColor(T[C],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==C&&"inside"!==C||("inside"===C&&(e.save(),e.beginPath(),e.arc(i,n,x,0,At,!0,w.top),e.clip()),e.beginPath(),function(t,e,i,n,s,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Ct(h-l),u=h>l;let d=!1;if(a<=_t)e.moveTo(i,n,s);else if(c>=At-_t)e.moveTo(i+a*Tt(l),n+a*Bt(l),s),e.arc(i,n,a,l,h,!u,s),e.lineTo(i+a*Tt(h),n+a*Bt(h),r),e.arc(i,n,a,h,l,u,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Tt(c),f=a*Bt(c),m=a*Tt(p),v=a*Bt(p);t<.001?d=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!u,s),e.lineTo(i+m,n+v,r),e.arc(i,n,a,p,c,u,r))}e.closePath()}(t,e,i,n,w.top,w.bottom,"outside"===C?b:x,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===C?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):d&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=A?A.computeColor(T[C],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===C&&e.restore())}draw(t,e,i,n){const s=oh(t,null==n?void 0:n.theme).arc;this._draw(t,s,!1,i,n)}}const Xv=new WeakSet;function Kv({bind:t}){Jm(Xv,t)||(t(Yv).toDynamicValue((()=>new Yv)).inSingletonScope(),t(uu).toService(Yv),t(gu).toService(uu))}const $v=Kv;class qv extends zv{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=Da}drawShape(t,e,i,n,s,r,a,o){var l;const h=oh(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:u=h.stroke,face:d=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=s.stage||{},f=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,p,f,d,s,e,g,t,h,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,p,f,e))}draw(t,e,i){const n=oh(t).polygon;this._draw(t,n,!1,i)}}const Zv=new WeakSet;function Jv({bind:t}){Jm(Zv,t)||(t(qv).toDynamicValue((()=>new qv)).inSingletonScope(),t(Cu).toService(qv),t(gu).toService(Cu))}const Qv=Jv;function ty(){Uc("arc",_c)}function ey(){Uc("arc3d",Cc)}function iy(){Uc("area",mc)}function ny(){Uc("circle",dh)}function sy(){Uc("glyph",Fh)}function ry(){Uc("group",kc)}function ay(){Uc("image",nc)}function oy(){Uc("line",Mh)}function ly(){Uc("path",pc)}function hy(){Uc("polygon",Ec)}function cy(){Uc("star",Sc)}function uy(){Uc("pyramid3d",Oc)}function dy(){Uc("rect",Oh)}function py(){Uc("rect3d",Dh)}function gy(){Uc("richtext",cc)}function fy(){Uc("symbol",wh)}function my(){Uc("text",_h)}function vy(){Uc("shadowRoot",Ic)}function yy(){Uc("wrapText",Sh)}class _y{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=ci.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let n;return n=e?"string"==typeof e?di.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:di.global.createDom(Object.assign({tagName:"div",parent:n},i)),nativeContainer:n}}parseDefaultStyleFromGraphic(t){return fh("text"===t.type&&t.attribute?t.attribute:oh(t).text)}getTransformOfText(t){const e=oh(t).text,{textAlign:i=e.textAlign,textBaseline:n=e.textBaseline}=t.attribute,s=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=s,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[n]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[n]}`}}updateStyleOfWrapContainer(t,e,i,n,s){const{pointerEvents:r,penetrateEventList:a=[]}=s;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",n.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let p=s.anchorType;if(d(p)&&(p="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===p&&(p="top-left"),"position"===p||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=ae(c,p);l=t.x,h=t.y}const f=di.global.getElementTopLeft(n,!1),m=e.window.getTopLeft(!1),v=e.viewBox,_=l+m.left-f.left+v.x1,b=h+m.top-f.top+v.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===p&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),u(s.style)){const e=s.style({top:b,left:_,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else g(s.style)?o=Object.assign(Object.assign({},o),s.style):y(s.style)&&s.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),n=i[1].trim();t&&n&&(e[t]=n)}}})),e})(s.style)));di.global.updateDom(i,{width:s.width,height:s.height,style:o})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===di.global.env&&(t.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:fs.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:fs.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&di.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const n=t.stage;if(!n)return;const{dom:s,container:r}=i;if(!s)return;const a=d(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof s?this.htmlMap[a].wrapContainer.innerHTML=s:s!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(s));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,r);t&&("string"==typeof s?t.innerHTML=s:t.appendChild(s),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,n,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===di.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const by=()=>{Od.registerPlugin("HtmlAttributePlugin",_y)};class xy extends _y{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=ci.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:n}=this.htmlMap[t];e?di.global.getRequestAnimationFrame()((()=>{e.unmount()})):n&&n(),i&&di.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const n=t.stage;if(!n)return;const s=n.params.ReactDOM,{element:r,container:a}=i;if(!r||!s||!s.createRoot&&!s.render)return;const o=d(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])s.createRoot?this.htmlMap[o].root.render(r):s.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,a);if(t)if(this.htmlMap||(this.htmlMap={}),s.createRoot){const i=s.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else s.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{s.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,n,l,h,i),this.htmlMap[o].renderId=this.renderId}}const Sy=()=>{Od.registerPlugin("ReactAttributePlugin",xy)};class Ay{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=ci.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)}}const Cy=()=>{Od.registerPlugin("ViewTransform3dPlugin",Ay)},wy=new ue;class Ty{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=ci.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new ue}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const n=oh(i).group,{display:s=n.display}=i.attribute;if("flex"!==s)return;const{flexDirection:r=n.flexDirection,flexWrap:a=n.flexWrap,alignItems:o=n.alignItems,clip:l=n.clip}=i.attribute,{alignContent:h=(null!=o?o:n.alignContent)}=i.attribute;let{width:c,height:u,justifyContent:d=n.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==u){let t=0,e=0,i=0;if(p.forEach((n=>{const s=this.getAABBBounds(n);s.empty()||("column"===r||"column-reverse"===r?(e+=s.height(),t=Math.max(t,s.width())):(t+=s.width(),e=Math.max(e,s.height())),i+=s.x1,i+=s.y1,i+=s.x2,i+=s.y2)})),!isFinite(i))return;c=t,u=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=u:u=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:u,field:"y"}},f=g.main,m=g.cross;"column"!==r&&"column-reverse"!==r||(f.len=u,m.len=c,f.field="y",m.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===d?d="flex-end":"flex-end"===d?d="flex-start":p.reverse());let v=0,y=0;const _=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===f.field?e.width():e.height(),n="x"===m.field?e.width():e.height();_.push({mainLen:i,crossLen:n}),v+=i,y=Math.max(y,n)}));const b=[];if(v>f.len&&"wrap"===a){let t=0,e=0;_.forEach((({mainLen:i,crossLen:n},s)=>{t+i>f.len?0===t?(b.push({idx:s,mainLen:t+i,crossLen:n}),t=0,e=0):(b.push({idx:s-1,mainLen:t,crossLen:e}),t=i,e=n):(t+=i,e=Math.max(e,n))})),b.push({idx:_.length-1,mainLen:t,crossLen:e})}else b.push({idx:_.length-1,mainLen:v,crossLen:y});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,d,f,_,x,t),x=t.idx+1})),y=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":m.len,center:m.len/2};this.layoutCross(p,o,m,t,_,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const n={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(m.len-y)/2);b.forEach(((e,i)=>{const n={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",m,n,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(m.len-y)/b.length/2);let e=t;b.forEach(((i,n)=>{const s={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[n],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(m.len-y)/(2*b.length-2));let e=0;b.forEach(((i,n)=>{const s={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[n],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,n,s,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}else if("flex-end"===i){let t=n.len;for(let i=a.idx;i>=r;i--){t-=s[i].mainLen;const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`]))}}else if("space-around"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),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++){const r=o+(e[t],n.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[n.field]=this.updateChildPos(r,e[t].attribute[n.field],a[`${n.field}1`])),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++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),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++){const r=o+(e[t],n.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[n.field]=this.updateChildPos(r,e[t].attribute[n.field],a[`${n.field}1`])),o+=s[t].mainLen+2*i}}else if("center"===i){let t=(n.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}}layoutCross(t,e,i,n,s,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=n[a])&&void 0!==o?o:n["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-s[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-s[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&wy.copy(n)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(wy.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const ky=()=>{Od.registerPlugin("FlexLayoutPlugin",Ty)};var My=Object.freeze({__proto__:null,ARC3D_NUMBER_TYPE:Ta,ARC_NUMBER_TYPE:wa,AREA_NUMBER_TYPE:ka,AbstractGraphicRender:class{},get AnimateMode(){return es},get AnimateStatus(){return ss},get AnimateStepType(){return ns},AppContext:wf,Application:ui,Arc:yc,Arc3d:Ac,Arc3dRender:uu,ArcRender:cu,ArcRenderContribution:ig,Area:fc,AreaRender:du,AreaRenderContribution:ng,get AttributeUpdateType(){return Yi},AutoEnablePlugins:eu,BaseCanvas:tl,BaseEnvContribution:mf,BaseRender:Rg,get BaseRenderContributionTime(){return $i},BaseWindowHandlerContribution:vf,Basis:An,BeforeRenderConstribution:tu,BoundsContext:Oi,BoundsPicker:ru,BrowserEntry:Tf,CIRCLE_NUMBER_TYPE:Ma,Canvas3DDrawItemInterceptor:eg,Canvas3DPickItemInterceptor:qd,CanvasFactory:$a,CanvasTextLayout:mh,Circle:uh,CircleRender:pu,CircleRenderContribution:sg,ColorInterpolate:fl,ColorStore:il,get ColorType(){return el},CommonDrawItemInterceptorContribution:Qp,CommonRenderContribution:pg,Context2dFactory:qa,ContributionProvider:Dd,ContributionRegistry:md,ContributionStore:jd,CubicBezierCurve:dn,CurveContext:$n,get CurveTypeEnum(){return Ki},CustomEvent:Ci,CustomPath2D:Zn,CustomSymbolClass:Jr,DEFAULT_TEXT_FONT_FAMILY:jh,DebugDrawItemInterceptorContribution:Jp,DefaultArcAllocate:Lm,DefaultArcAttribute:ms,DefaultArcRenderContribution:mp,DefaultAreaAllocate:Um,DefaultAreaAttribute:vs,DefaultAreaTextureRenderContribution:Hp,DefaultAttribute:fs,DefaultBaseBackgroundRenderContribution:Xu,DefaultBaseClipRenderAfterContribution:ld,DefaultBaseClipRenderBeforeContribution:ad,DefaultBaseInteractiveRenderContribution:rd,DefaultBaseTextureRenderContribution:gp,DefaultCanvasAllocate:Iu,DefaultCanvasArcRender:Ig,DefaultCanvasAreaRender:Yg,DefaultCanvasCircleRender:Dg,DefaultCanvasGroupRender:Vp,DefaultCanvasImageRender:gf,DefaultCanvasLineRender:zg,DefaultCanvasPathRender:$g,DefaultCanvasPolygonRender:af,DefaultCanvasRectRender:qg,DefaultCanvasSymbolRender:Zg,DefaultCanvasTextRender:Qg,DefaultCircleAllocate:jm,DefaultCircleAttribute:ys,DefaultCircleRenderContribution:bp,DefaultConnectAttribute:ps,DefaultDebugAttribute:gs,DefaultFillStyle:os,DefaultGlobal:vi,DefaultGlobalPickerService:ju,DefaultGlyphAttribute:bs,DefaultGraphicAllocate:Rm,DefaultGraphicMemoryManager:qm,DefaultGraphicService:Wc,DefaultGraphicUtil:Lu,DefaultGroupAttribute:_s,DefaultGroupBackgroundRenderContribution:Cp,DefaultImageAttribute:Es,DefaultImageRenderContribution:Op,DefaultLayerService:Id,DefaultLayout:rs,DefaultLineAllocate:Wm,DefaultLineAttribute:xs,DefaultMat4Allocate:Xo,DefaultMatrixAllocate:Yo,DefaultPathAllocate:Vm,DefaultPathAttribute:Ss,DefaultPickService:Cf,DefaultPickStyle:us,DefaultPolygonAttribute:As,DefaultRect3dAttribute:Ts,DefaultRectAllocate:Im,DefaultRectAttribute:ws,DefaultRectRenderContribution:Tp,DefaultRenderService:dd,DefaultRichTextAttribute:Bs,DefaultRichTextIconAttribute:Ps,DefaultStarAttribute:Cs,DefaultStrokeStyle:hs,DefaultStyle:ds,DefaultSymbolAllocate:Ym,DefaultSymbolAttribute:ks,DefaultSymbolClipRangeStrokeRenderContribution:Lp,DefaultSymbolRenderContribution:Dp,DefaultTextAllocate:Km,DefaultTextAttribute:Ms,DefaultTextMeasureContribution:Hd,DefaultTextStyle:cs,DefaultTransform:as,DefaultTransformUtil:Nu,DefaultWindow:Ru,get Direction(){return Xi},DirectionalLight:yf,DrawContribution:Mu,DrawItemInterceptor:Kp,DynamicLayerHandlerContribution:Zc,get Edge(){return Is},EditModule:Mm,EmptyContext2d:Jo,EnvContribution:Uh,EventManager:ki,EventSystem:Ei,EventTarget:Mi,FORMAT_ALL_TEXT_COMMAND:Pm,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:Em,Factory:Od,FederatedEvent:bi,FederatedMouseEvent:xi,FederatedPointerEvent:Si,FederatedWheelEvent:Ai,FlexLayoutPlugin:Ty,GLYPH_NUMBER_TYPE:Ba,GRAPHIC_UPDATE_TAG_KEY:Nl,GROUP_NUMBER_TYPE:Ea,Generator:ci,GlobalPickerService:au,Glyph:Lh,GlyphRender:wu,GradientParser:Bo,Graphic:Jl,GraphicCreator:Ha,GraphicFactory:Dc,GraphicPicker:nu,GraphicRender:gu,GraphicService:Wa,GraphicUtil:Kc,Group:Tc,GroupRender:fu,GroupRenderContribution:rg,get GroupUpdateAABBBoundsMode(){return wc},HtmlAttributePlugin:_y,get IContainPointMode(){return Gi},IMAGE_NUMBER_TYPE:Pa,Image:ic,ImageRender:Tu,ImageRenderContribution:ag,IncrementalDrawContribution:hu,InteractiveDrawItemInterceptorContribution:tg,InteractivePickItemInterceptorContribution:$d,InteractiveSubRenderContribution:gg,LINE_NUMBER_TYPE:Oa,Layer:Ed,LayerFactory:Pd,LayerService:$c,Line:kh,LineRender:mu,Linear:_n,LinearClosed:zn,Mat4Allocate:Vo,MatrixAllocate:Ho,get MeasureModeEnum(){return ts},MiniappEntry:Bf,MonotoneX:En,MonotoneY:Pn,NOWORK_ANIMATE_ATTR:Zl,Node:_i,NodeEntry:Mf,OrthoCamera:bf,PATH_NUMBER_TYPE:Ra,POLYGON_NUMBER_TYPE:Ia,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:Da,Path:dc,PathRender:vu,PathRenderContribution:og,PerformanceRAF:gi,PickItemInterceptor:ou,PickServiceInterceptor:lu,PickerRegistry:gd,PickerService:su,PluginRegistry:fd,PluginService:iu,Polygon:Bc,PolygonRender:yu,PolygonRenderContribution:lg,Pyramid3d:Pc,Pyramid3dRender:Cu,RECT3D_NUMBER_TYPE:Fa,RECT_NUMBER_TYPE:La,RICHTEXT_NUMBER_TYPE:Ua,RafBasedSTO:Ys,ReactAttributePlugin:xy,Rect:Ph,Rect3DRender:bu,Rect3d:Ih,RectRender:_u,RectRenderContribution:hg,ReflectSegContext:mn,RenderSelector:ku,RenderService:Qc,RendererRegistry:pd,ResourceLoader:Os,RichText:hc,RichTextEditPlugin:Om,RichTextRender:Au,STAR_NUMBER_TYPE:Na,get STATUS(){return is},SVG_ATTRIBUTE_MAP:Va,SVG_ATTRIBUTE_MAP_KEYS:Ga,SVG_PARSE_ATTRIBUTE_MAP:Ya,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Xa,SYMBOL_NUMBER_TYPE:ja,SegContext:fn,ShadowPickServiceInterceptorContribution:Xd,ShadowRoot:Rc,ShadowRootDrawItemInterceptorContribution:Zp,ShadowRootPickItemInterceptorContribution:Kd,SplitRectAfterRenderContribution:Mp,SplitRectBeforeRenderContribution:kp,Stage:Md,StageFactory:Bd,Star:xc,StarRender:Bu,StarRenderContribution:dg,StateDefinitionCompiler:xl,StateEngine:wl,StaticLayerHandlerContribution:qc,Step:Ln,StepClosed:Fn,Symbol:Ch,SymbolRender:xu,SymbolRenderContribution:cg,TEXT_NUMBER_TYPE:za,Text:yh,get TextDirection(){return _a},TextMeasureContribution:Wd,TextRender:Su,TextRenderContribution:ug,Theme:rh,TransformUtil:Xc,get UpdateTag(){return Vi},VGlobal:Nh,VWindow:Eu,ViewTransform3dPlugin:Ay,VirtualLayerHandlerContribution:Jc,WILDCARD:"*",WindowHandlerContribution:Pu,WrapText:xh,XMLParser:pa,_calculateLineHeight:Ks,_interpolateColor:rl,addArcToBezierPath:Qi,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:nm,alignSubpath:Zf,application:di,applyTransformOnBezierCurves:rm,arc3dModule:$v,arcModule:ev,areaModule:cv,bezier:Zi,bezierCurversToPath:am,binarySplitPolygon:mm,bindArc3dRenderModule:Kv,bindArcRenderModule:tv,bindAreaRenderModule:hv,bindCircleRenderModule:fv,bindContributionProvider:Ud,bindContributionProviderNoSingletonScope:Nd,bindGlyphRenderModule:Ov,bindImageRenderModule:Nv,bindLineRenderModule:av,bindPathRenderModule:xv,bindPolygonRenderModule:Cv,bindPyramid3dRenderModule:Jv,bindRect3dRenderModule:Vv,bindRectRenderModule:nv,bindRichtextRenderModule:Lv,bindStarRenderModule:Mv,bindSymbolRenderModule:dv,bindTextRenderModule:yv,boundStroke:ma,builtInSymbolStrMap:ea,builtinSymbols:Qr,builtinSymbolsMap:ta,calcLineCache:qn,calculateArcCornerRadius:up,calculateLineHeight:$s,canvasAllocate:Du,centroidOfSubpath:tm,circleBounds:zs,circleModule:mv,clock:wi,colorEqual:function(t,e){const i=we.parseColorString(t),n=we.parseColorString(e);return!(!i||!n)&&i.r===n.r&&i.g===n.g&&i.b===n.b&&i.opacity===n.opacity},colorStringInterpolationToStr:pl,configureRuntimeApplicationForApp:Gf,container:Tg,cornerTangents:cp,createApp:kf,createArc:_c,createArc3d:Cc,createArea:mc,createBrowserApp:kf,createCanvasEventTransformer:function(t,e,i,n){return Am(t.parentElement,e,i,n)},createCircle:dh,createColor:Po,createConicalGradient:yl,createContributionProvider:Fd,createEventTransformer:Am,createGlyph:Fh,createGraphic:Nc,createGroup:kc,createImage:nc,createLine:Mh,createMat4:Go,createMiniappApp:function(t={}){return new Bf(t)},createNodeApp:function(t={}){return new Mf(t)},createPath:pc,createPolygon:Ec,createPyramid3d:Oc,createRect:Oh,createRect3d:Dh,createRectPath:ip,createRichText:cc,createShadowRoot:Ic,createStage:function(t){return Pg(),(new Bd).create(t)},createStar:Sc,createSymbol:wh,createText:_h,createWrapText:Sh,cubicCalc:an,cubicLength:rn,cubicPointAt:on,cubicSubdivide:qf,defaultArcAllocate:Fm,defaultArcBackgroundRenderContribution:_p,defaultArcRenderContribution:vp,defaultArcTextureRenderContribution:yp,defaultAreaAllocate:Nm,defaultBaseBackgroundRenderContribution:Ku,defaultBaseClipRenderAfterContribution:hd,defaultBaseClipRenderBeforeContribution:od,defaultBaseTextureRenderContribution:fp,defaultCircleAllocate:zm,defaultCircleBackgroundRenderContribution:Ap,defaultCircleRenderContribution:xp,defaultCircleTextureRenderContribution:Sp,defaultGraphicMemoryManager:Zm,defaultGroupBackgroundRenderContribution:wp,defaultImageBackgroundRenderContribution:Ip,defaultImageRenderContribution:Rp,defaultLineAllocate:Hm,defaultPathAllocate:Gm,defaultRectAllocate:Dm,defaultRectBackgroundRenderContribution:Pp,defaultRectRenderContribution:Bp,defaultRectTextureRenderContribution:Ep,defaultStarBackgroundRenderContribution:Wp,defaultStarTextureRenderContribution:zp,defaultSymbolAllocate:Xm,defaultSymbolBackgroundRenderContribution:jp,defaultSymbolClipRangeStrokeRenderContribution:Up,defaultSymbolRenderContribution:Fp,defaultSymbolTextureRenderContribution:Np,defaultTextAllocate:$m,diff:$f,divideCubic:un,drawArc:Ji,drawArcPath:dp,drawAreaSegments:Wg,drawBackgroundImage:sd,drawImageWithLayout:pf,drawIncrementalAreaSegments:jg,drawIncrementalSegments:Ng,drawSegments:Ug,enumCommandMap:Li,fillVisible:rp,findBestMorphingRotation:im,findConfigIndexByCursorIdx:Tm,findCursorIdxByConfigIndex:km,findNextGraphic:Gu,flatten_simplify:function(t,e,i){return t.length<=10||i?t:function(t,e){let i,n,s=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(s=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===s&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)},foreach:Hu,foreachAsync:Vu,genBasisSegments:wn,genBasisTypeSegments:Cn,genLinearClosedSegments:Wn,genLinearClosedTypeSegments:Hn,genLinearSegments:bn,genLinearTypeSegments:xn,genMonotoneXSegments:Rn,genMonotoneXTypeSegments:On,genMonotoneYSegments:Dn,genMonotoneYTypeSegments:In,genNumberType:ya,genStepClosedSegments:jn,genStepSegments:Un,genStepTypeSegments:Nn,getAttributeFromDefaultAttrList:Gs,getBackgroundImage:qu,getConicGradientAt:vl,getCurrentEnv:function(){return Td()?"browser":"node"},getDefaultCharacterConfig:wm,getExtraModelMatrix:function(t,e,i){const{alpha:n,beta:s}=i.attribute;if(!n&&!s)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=ph(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=$o.allocate();return Lo(o,o,[a[0],a[1],0]),s&&Ro(o,o,s),n&&Io(o,o,n),Lo(o,o,[-a[0],-a[1],0]),o},getLegacyBindingContext:xg,getModelMatrix:jc,getRichTextBounds:Yc,getRuntimeInstallerBindingContext:Wf,getRuntimeInstallerGlobal:Vf,getScaledStroke:Eo,getTextBounds:Gc,getTheme:oh,getThemeFromGroup:lh,globalTheme:ah,glyphModule:Rv,graphicCreator:Fc,graphicService:Bg,graphicUtil:kg,identityMat4:Oo,imageModule:jv,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeDrawContributionsToApp:Xf,installRuntimeGraphicRenderersToApp:Yf,installRuntimePickersToApp:Kf,interpolateColor:sl,interpolateGradientConicalColor:ll,interpolateGradientLinearColor:al,interpolateGradientRadialColor:ol,interpolatePureColorArray:hl,interpolatePureColorArrayToStr:cl,intersect:hp,isBrowserEnv:Td,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){wd();const t=di.global&&di.global.env;return t?"node"===t:!Cd},isSvg:ua,isXML:da,layerService:Eg,lineModule:ov,lookAt:jo,mapToCanvasPointForCanvas:function(t){var e;if(no(t._canvasX)&&no(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:Fo,mat4Allocate:$o,matrixAllocate:Ko,multiplyMat4Mat3:function(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],u=e[8],d=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;return t[0]=_*n+b*o+x*u+S*f,t[1]=_*s+b*l+x*d+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i.c,b=i.d,x=0,S=0,t[4]=_*n+b*o+x*u+S*f,t[5]=_*s+b*l+x*d+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=0,b=0,x=1,S=0,t[8]=_*n+b*o+x*u+S*f,t[9]=_*s+b*l+x*d+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i.e,b=i.f,x=0,S=1,t[12]=_*n+b*o+x*u+S*f,t[13]=_*s+b*l+x*d+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t},multiplyMat4Mat4:No,newThemeObj:ih,ortho:zo,parsePadding:Us,parseStroke:Ls,parseSvgPath:Hi,pathModule:Sv,pathToBezierCurves:sm,point:Sn,pointEqual:Ws,pointInterpolation:Hs,pointInterpolationHighPerformance:function(t,e,i,n){const{x:s,y:r}=Rt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Rt(t.x1,t.y1,e.x1,e.y1,i);return n.x=s,n.y=r,n.x1=a,n.y1=o,n.defined=e.defined,n},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>Ws(t,e[i]))):!Number.isNaN(t.x+t.y)&&Ws(t,e))},pointsInterpolation:Vs,polygonModule:wv,preLoadAllModule:bg,pyramid3dModule:Qv,quadCalc:ln,quadLength:cn,quadPointAt:hn,rafBasedSto:Xs,rect3dModule:Gv,rectFillVisible:ap,rectModule:sv,rectStrokeVisible:lp,recursiveCallBinarySplit:vm,refreshRuntimeInstallerContributions:Hf,registerArc3dGraphic:ey,registerArcGraphic:ty,registerAreaGraphic:iy,registerCircleGraphic:ny,registerDirectionalLight:_f,registerFlexLayoutPlugin:ky,registerGlobalEventTransformer:function(t,e,i,n,s){const r=Am(0,i,n,s);t.setEventListenerTransformer(r)},registerGlyphGraphic:sy,registerGraphic:Uc,registerGroupGraphic:ry,registerHtmlAttributePlugin:by,registerImageGraphic:ay,registerLineGraphic:oy,registerOrthoCamera:xf,registerPathGraphic:ly,registerPolygonGraphic:hy,registerPyramid3dGraphic:uy,registerReactAttributePlugin:Sy,registerRect3dGraphic:py,registerRectGraphic:dy,registerRichtextGraphic:gy,registerShadowRootGraphic:vy,registerStarGraphic:cy,registerSymbolGraphic:fy,registerTextGraphic:my,registerViewTransform3dPlugin:Cy,registerWindowEventTransformer:function(t,e,i,n,s){const r=Am(0,i,n,s);t.setEventListenerTransformer(r)},registerWrapTextGraphic:yy,renderCommandList:en,resolveBackgroundDrawMode:Qu,resolveBackgroundParamsByImageSizing:uf,resolveBackgroundPosition:ed,resolveBackgroundSizing:Zu,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:hf,resolveImageRepeatMode:lf,resolveRenderableImageSize:nd,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:Fv,rotateX:Ro,rotateY:Io,rotateZ:Do,runFill:np,runStroke:sp,scaleMat4:Uo,segments:qi,shouldClipImageByLayout:df,shouldUseMat4:zc,snapLength:sn,splitArc:hm,splitArea:dm,splitCircle:cm,splitLine:pm,splitPath:_m,splitPolygon:ym,splitRect:lm,splitToGrids:om,starModule:Bv,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:op,symbolModule:pv,textAttributesToStyle:fh,textDrawOffsetX:ph,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:gh,textModule:_v,transformMat4:Wo,transformPointForCanvas:function(t,e,i,n,s){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(s,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:Mg,translate:Lo,verticalLayout:ba,vglobal:wg,waitForAllSubLayers:fa,wrapCanvas:Za,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=di.global)||void 0===t?void 0:t.env,n=i?null===(e=di.context2dFactory)||void 0===e?void 0:e.call(di,i):void 0;if(!n)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return n}()(t,e)},xul:function(t){const e=_(t)?t[0]:t,i=[];if(!e)return i;if(!0===da(e)){const t=(new pa).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Ca(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Ca(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});function By(t){const e=[];for(let i=0;int.getInstance().info(`[VChart log]: ${t}`,...e),Py=(t,e)=>(u(Ry.warnHandler)&&Ry.warnHandler.call(null,t,e),e?nt.getInstance().warn(`[VChart warn]: ${t}`,e):nt.getInstance().warn(`[VChart warn]: ${t}`)),Oy=(t,e,i)=>{if(!u(Ry.errorHandler))throw new Error(t);Ry.errorHandler.call(null,t,e)},Ry={silent:!1,warnHandler:!1,errorHandler:!1},Iy=Td(),Dy=Iy&&globalThis?globalThis.document:void 0;function Ly(t){return("desktop-browser"===t||"mobile-browser"===t)&&Iy}function Fy(t){return Uy(t)||"mobile-browser"===t}function Uy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Ny=0;function jy(){return Ny>=9999999&&(Ny=0),Ny++}function zy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Wy(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}function Hy(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&Hy(t,e)}))}const Vy=t=>!d(t)&&!1!==t.visible;const Gy=["#ffffff","#000000"];function Yy(t,e,i,n,s,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new we(t).toHex(),o=new we(e).toHex();return Xy(a,o,i,n,r)?a:function(t,e,i,n,s,r){const a=[];s&&(s instanceof Array?a.push(...s):a.push(s)),a.push(...Gy);for(const s of a)if(t!==s&&Xy(s,e,i,n,r))return s}(a,o,i,n,s,r)}function Xy(t,e,i,n,s){if("lightness"===s){const i=we.getColorBrightness(new we(e));return we.getColorBrightness(new we(t))<.5?i>=.5:i<.5}return n?Ky(t,e)>n:"largeText"===i?Ky(t,e)>3:Ky(t,e)>4.5}function Ky(t,e){const i=$y(t),n=$y(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function $y(t){const e=ke(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 qy(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 Zy(t){let e=function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}function Jy(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=It(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const Qy=Nc,t_={arc:t=>Qy("arc",t),circle:t=>Qy("circle",t),group:t=>Qy("group",t),image:t=>Qy("image",t),line:t=>Qy("line",t),path:t=>Qy("path",t),polygon:t=>Qy("polygon",t),rect:t=>Qy("rect",t),richtext:t=>Qy("richtext",t),symbol:t=>Qy("symbol",t),text:t=>Qy("text",t)},e_=-.5*Math.PI,i_=1.5*Math.PI,n_="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var s_;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(s_||(s_={}));const r_={[s_.selectedReverse]:{},[s_.selected]:{},[s_.hover]:{},[s_.hoverReverse]:{}},a_={container:"",width:30,height:30,style:{}},o_=(t,e,i,n)=>new re(Object.assign({defaultFontParams:Object.assign({fontFamily:n_,fontSize:14},n),getTextBounds:i?void 0:Gc,specialCharSet:"-/: .,@%'\"~"+re.ALPHABET_CHAR_SET+re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function l_(t,e,i={}){if(!t)return{width:0,height:0};const n=Gc({text:t,fontFamily:e.fontFamily||i.fontFamily||n_,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:n.width(),height:n.height()}}function h_(t,e="type"){var i,n;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(n=t[e])&&void 0!==n?n:"text"}function c_(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function u_(t,e="type"){const i=h_(t,e);return"rich"===i?t_.richtext(c_(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:n}=e;return t.html=n,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:n}=e;return t.react=n,t.text=i,t.renderable=!1,t}(t)),t_.text(t))}function d_(t,e,i,n,s){"right"===t?"center"===i?e.setAttribute("x",n-s/2):"right"===i||"end"===i?e.setAttribute("x",n):e.setAttribute("x",n-s):"center"===i?e.setAttribute("x",n+s/2):"right"===i||"end"===i?e.setAttribute("x",n+s):e.setAttribute("x",n)}const p_={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},g_={size:8,stroke:"#000",lineWidth:1,zIndex:1};const f_=Math.sin(Math.PI/10);function m_(t,e=f_){const i=!d(t)&&0!==t,n=i?Math.cos(t):1;return i&&Math.abs(n)<=e}function v_(t,e=f_){const i=!d(t)&&0!==t,n=i?Math.sin(t):0;return!i||Math.abs(n)<=e}function y_(t){const e={};return Hy(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function __(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function b_(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 x_(t,e,i){var n;if(v_(null===(n=t.attribute)||void 0===n?void 0:n.angle,Number.EPSILON))return i>oe(t.AABBBounds,e.AABBBounds);const s=t.OBBBounds,r=e.OBBBounds;return!s||!r||s.empty()||r.empty()?i>oe(t.AABBBounds,e.AABBBounds):s.intersects(r)||i>le(s,r)}function S_(t,e){for(let i,n=1,s=t.length,r=t[0];n{const n=e?+i[e]:+i;return A(n)&&(t+=n),t}),0)}function C_(t,e){const i=w_(t),n=w_(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 w_(t,e={x:0,y:0}){return Ut.distancePP(t,e)}function T_(t,e,i){let n=!1;if(e&&u(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 k_(t){return function(e){let i;return i=_(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function M_(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&M_(t[i],e)}}var B_;!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"}(B_||(B_={}));const E_={};function P_(t){switch(t){case B_.Linear:case B_.Log:case B_.Pow:case B_.Sqrt:case B_.Symlog:case B_.Time:return!0;default:return!1}}function O_(t){return!!E_[t]}function R_(t){switch(t){case B_.Ordinal:case B_.Point:case B_.Band:return!0;default:return!1}}function I_(t){return t}Object.values(B_).forEach((t=>{E_[t]=!0}));const D_=t=>-Math.log(-t),L_=t=>-Math.exp(-t),F_=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,U_=t=>10===t?F_:t===Math.E?Math.exp:e=>Math.pow(t,e),N_=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),j_=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),z_=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function W_(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 H_(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function V_(t,e,i){let n;return n=1===t?t+2*i:t-e+2*i,t?n>0?n:1:0}function G_(t,e,i,n){return 1===i&&(i=0),V_(t,i,n)*(e/(1-i))}function Y_(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),n=t[0]-i*e[0];return[n,i+n]}function X_(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=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)};class $_{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=Y_(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:n}=this._fishEyeOptions,s=this.range(),r=s[0],a=s[s.length-1],o=Math.min(r,a),l=Math.max(r,a),h=ut(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(n)?(l-o)*i:n;let u=Math.exp(e);u=u/(u-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const q_=Symbol("implicit");class Z_ extends $_{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=B_.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=q_}clone(){const t=(new Z_).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let n=this._index.get(e);if(!n){if(this._unknown!==q_)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}const s=this._ordinalRange[(n-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(s):s}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return J_(t,e,r,s)}class tb extends Z_{constructor(t){super(),this.type=B_.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),n=super.domain().length,s=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=G_(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),n=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const s=this._rangeFactorStart+n<=1,r=this._rangeFactorEnd-n>=0;if("rangeFactorStart"===e&&s?this._rangeFactorEnd=this._rangeFactorStart+n:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-n:t[0]<=t[1]?s?this._rangeFactorEnd=this._rangeFactorStart+n:r?this._rangeFactorStart=this._rangeFactorEnd-n:(this._rangeFactorStart=0,this._rangeFactorEnd=n):r?this._rangeFactorStart=this._rangeFactorEnd-n:s?this._rangeFactorEnd=this._rangeFactorStart+n:(this._rangeFactorStart=1-n,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,n=e+i;this._wholeRange=[e,n]}else{const e=t[1]+i*(1-this._rangeFactorEnd),n=e-i;this._wholeRange=[n,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=n,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),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=[J(t[0]),J(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[J(t[0]),J(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:Q_(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return Q_(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let n;if(i=pt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),n=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}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new tb(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:eb}=Me;function ib(t,e){const i=typeof e;let n;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return vt(t,e);if("string"===i){if(n=we.parseColorString(e)){const e=eb(we.parseColorString(t),n);return t=>e(t).formatRgb()}return vt(Number(t),Number(e))}return e instanceof Te?eb(t,e):e instanceof we?eb(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):vt(Number(t),Number(e))}class nb extends $_{constructor(t=I_,e=I_){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=I_,this._piecewise=H_,this._interpolate=ib}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),vt)),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,J);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=yt,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 this._autoClamp&&(this._clamp=pt(i[0],i[r-1])),this._piecewise=r>2?X_:H_,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:I_),this.rescale(i)):this._clamp!==I_}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const sb=Math.sqrt(50),rb=Math.sqrt(10),ab=Math.sqrt(2),ob=[1,2,5,10],lb=(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=db(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)),function(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ns+t*n))):t>0?cb(0,-(e-1)/n,n):cb((e-1)/n,0,n)},hb=ct(((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 lb(t,i,null==n?void 0:n.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return lb(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=cb(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=cb(t,e,l);return s&&r.reverse(),r})),db=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let n=ob[0];return i>=sb?n=ob[3]:i>=rb?n=ob[2]:i>=ab&&(n=ob[1]),e>=0?{step:n*10**e,gap:n,power:e}:{step:-(10**-e)/n,gap:n,power:e}};function pb(t,e,i){const n=(e-t)/Math.max(0,i);return db(n)}function gb(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;e0;){if(n=pb(a,o,e).step,n===i)return t[s]=a,t[r]=o,t;if(n>0)a=Math.floor(a/n)*n,o=Math.ceil(o/n)*n;else{if(!(n<0))break;a=Math.ceil(a*n)/n,o=Math.floor(o*n)/n}i=n}}function mb(t,e){const i=S(e.forceMin),n=S(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:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),n?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):s=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:s,niceDomain:a,niceMinMax:r,domainValidator:o}}const vb=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),yb=ct(((t,e,i,n,s,r,a)=>{let o=t,l=e;const h=l0){for(;d<=p;++d)for(c=1;cl)break;g.push(u)}}else for(;d<=p;++d)for(c=n-1;c>=1;--c)if(u=d>0?c/r(-d):c*r(d),!(ul)break;g.push(u)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),_b=ct(((t,e,i,n,s,r)=>{const a=[],o={},l=s(t),h=s(e);let c=[];if(Number.isInteger(n))c=ub(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const s=r(i),l=Number.isInteger(n)?vb(t,e,s):vb(t,e,K_(s)),h=vb(t,e,((t,e)=>{let i,n;return e[0]1&&(o[h]=1,a.push(h))})),a})),bb=ct(((t,e,i,n,s)=>gb(n(t),n(e),i).map((t=>K_(s(t))))));class xb extends nb{constructor(){super(...arguments),this.type=B_.Linear}clone(){var t;const e=new xb;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return hb(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(u(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const n=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,s=this._domain,r=n[0],a=n[n.length-1];let o=ub(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(t=10){const e=this.calculateVisibleDomain(this._range);return gb(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let n,s,r=-1;if(i=+i,(s=(e=+e)<(t=+t))&&(n=t,t=e,e=n),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(s=o[1])&&void 0!==s?s:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function Ab(t){return e=>-t(-e)}function Cb(t=Number.EPSILON){return e=>Math.max(e,t)}class wb extends nb{constructor(){super(N_(10),U_(10)),this.type=B_.Log,this._limit=Cb(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new wb).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=N_(this._base),n=U_(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=Ab(i),this._pows=Ab(n),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=D_,this.untransformer=L_):(this._logs=i,this._pows=n,this._limit=Cb(),this.transformer=this._logs,this.untransformer=n),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return I_}d3Ticks(t=10,e){const i=this.domain(),n=this._limit(i[0]),s=this._limit(i[i.length-1]);return yb(n,s,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return _b(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return bb(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return bb(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}V(wb,Sb);class Tb extends xb{constructor(){super(j_(1),z_(1)),this.type=B_.Symlog,this._const=1}clone(){return(new Tb).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=j_(t),this.untransformer=z_(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),n=i[0],s=i[i.length-1];return yb(n,s,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return _b(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return bb(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return bb(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}V(Tb,Sb);class kb{constructor(){this.type=B_.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!d(t)&&A(+t)?this._range[st(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new kb).domain(this._domain).range(this._range).unknown(this._unknown)}}var Mb,Bb,Eb;function Pb(t){var e,i;const{type:n}=t;return n===Bb.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(Mb||(Mb={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(Bb||(Bb={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(Eb||(Eb={}));const Ob={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},Rb={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function Ib(t,e){var i;if(!t)return[];const n=zb(t,e);if(!n||_(n))return null!==(i=n)&&void 0!==i?i:[];if(g(n)){const{dataScheme:i}=n;return i?Nb(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>Ub(i)?Lb(t,i,e):i)).filter(p)}))):i.map((i=>Ub(i)?Lb(t,i,e):i)).filter(p):[]}return[]}function Db(t,e){var i,n;return Nb(t)?null!==(n=null===(i=t.find((t=>p(t.isAvailable)?u(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==n?n:t[t.length-1].scheme:t}function Lb(t,e,i){var n;const s=zb(t,i);if(!s)return;let r;const{palette:a}=s;if(g(a)&&(r=null!==(n=function(t,e){const i=Ob[e];if(i&&t[i])return t[i];if(t[e])return t[e];const n=Rb[e];return n?t[n]:void 0}(a,e.key))&&void 0!==n?n:e.default),!r)return;if(d(e.a)&&d(e.l)||!y(r))return r;let o=new we(r);if(p(e.l)){const{r:t,g:i,b:n}=o.color,{h:s,s:r}=me(t,i,n),a=fe(s,r,e.l),l=new we(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const Fb=(t,e)=>{if(e&&Ub(t)){const i=Lb(e,t);if(i)return i}return t};function Ub(t){return t&&"palette"===t.type&&!!t.key}function Nb(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function jb(t){return _(t)?{dataScheme:t}:t}function zb(t,e){var i,n;const{type:s}=null!=e?e:{};let r;if(!e||d(s))r=null==t?void 0:t.default;else{const a=Pb(e);r=null!==(n=null!==(i=null==t?void 0:t[`${s}_${a}`])&&void 0!==i?i:null==t?void 0:t[s])&&void 0!==n?n:null==t?void 0:t.default}return r}class Wb extends Z_{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!Nb(this._range))return void super.range(this._range);const t=Db(this._range,this._domain);super.range(t)}}const Hb={linear:xb,band:tb,point:class extends tb{constructor(t){super(!1),this.type=B_.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:Z_,threshold:kb,colorOrdinal:Wb};function Vb(t){const e=Hb[t];return e?new e:null}function Gb(t,e,i){if(!e)return t;const n=e.range(),s=i&&e._calculateWholeRange?e._calculateWholeRange(n):e.range(),r=Math.min(s[0],s[s.length-1]),a=Math.max(s[0],s[s.length-1]);return Math.min(Math.max(r,t),a)}function Yb(t,e,i){if(!e)return!0;const n=e.range(),s=(i&&e._calculateWholeRange?e._calculateWholeRange(n):e.range()).map((t=>e.invert(t))),r=Math.min(s[0],s[s.length-1]),a=Math.max(s[0],s[s.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function Xb(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function Kb(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function $b(t){return!!y(t)&&(!!t.endsWith("%")&&zy(t.substring(0,t.length-1)))}function qb(t){return!!g(t)&&("percent"in t||"offset"in t)}function Zb(t,e,i,n=0){var s,r;return S(t)?t:$b(t)?Number(t.substring(0,t.length-1))*e/100:u(t)?t(i):g(t)?e*(null!==(s=t.percent)&&void 0!==s?s:0)+(null!==(r=t.offset)&&void 0!==r?r:0):n}function Jb(t,e,i){var n,s,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(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]=Zb(t[n],e.size,i)}))})),o}function Qb(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function tx(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):S(t)||$b(t)||u(t)||qb(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function ex(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ix=(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},nx=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function sx(t,e){return t&&e.key in t?t[e.key]:e.default}function rx(t){return t&&"token"===t.type&&!!t.key}const ax={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},ox={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:nx,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:ax,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},lx={name:"dark",colorScheme:{default:{dataScheme:nx,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},hx=(t,e,i)=>{if(d(e))return t;const n=e[0];return d(n)?t:1===e.length?(t[n]=i,t):(d(t[n])&&("number"==typeof e[1]?t[n]=[]:t[n]={}),hx(t[n],e.slice(1),i))};function cx(t,...e){let i=-1;const n=e.length;for(;++i{const n=t[i];return e[i]=jb(n),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}ux._charts={},ux._series={},ux._components={},ux._graphicComponents={},ux._marks={},ux._regions={},ux._animations={},ux._implements={},ux._chartPlugin={},ux._vChartPlugin={},ux._componentPlugin={},ux.transforms={fields:Ye,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}},ux.dataParser={csv:(t,e={},i)=>(i.type=Ge.DSV,ti(t)),dsv:(t,e={},i)=>{i.type=Ge.DSV;const n=We(ii,e),{delimiter:s}=n;if(!y(s))throw new TypeError("Invalid delimiter: must be a string!");return Qe(s).parse(t)},tsv:(t,e={},i)=>(i.type=Ge.DSV,ei(t))},ux._layout={},ux._grammarTransforms={},ux._stageEventPlugins={},ux.registerStageEventPlugin=(t,e)=>{ux._stageEventPlugins[t]=e},ux.getStageEventPlugin=t=>ux._stageEventPlugins[t],ux._interactionTriggers={},ux.registerInteractionTrigger=(t,e)=>{ux._interactionTriggers[t]=e},ux._composedEventMap={},ux.registerComposedEvent=(t,e)=>{ux._composedEventMap[t]=e},ux._tooltipProcessors={},ux.registerTooltipProcessor=(t,e)=>{ux._tooltipProcessors[t]=e},ux.createTooltipProcessor=(t,e)=>{const i=ux._tooltipProcessors[t];return i?new i(e):null};const gx=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e};gx();const fx={[ox.name]:ox},mx=ox.name,vx=new Map(Object.keys(fx).map((t=>[t,fx[t]]))),yx=new Map,_x=new Map(Object.keys(fx).map((t=>[t,t===mx]))),bx=(t,e)=>{if(!t)return;const i=Cx(e);vx.set(t,i),_x.set(t,!0)},xx=(t=mx)=>(_x.has(t)&&!_x.get(t)&&bx(t,vx.get(t)),vx.get(t)),Sx=t=>vx.delete(t)&&yx.delete(t)&&_x.delete(t),Ax=t=>!!y(t)&&vx.has(t),Cx=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:mx;return dx({},xx(i),t)};class Tx{static registerInstance(t){Tx.instances.set(t.id,t)}static unregisterInstance(t){Tx.instances.delete(t.id)}static getInstance(t){return Tx.instances.get(t)}static instanceExist(t){return Tx.instances.has(t)}static forEach(t,e=[],i){const n=G(e);return Tx.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}Tx.instances=new Map;class kx{static registerTheme(t,e){bx(t,e)}static getTheme(t,e=!1){return xx(t)}static removeTheme(t){return Sx(t)}static themeExist(t){return Ax(t)}static getDefaultTheme(){return kx.themes.get(mx)}static setCurrentTheme(t){kx.themeExist(t)&&(kx._currentThemeName=t,Tx.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return kx.getTheme(kx._currentThemeName,t)}static getCurrentThemeName(){return kx._currentThemeName}}function Mx(t){return y(t)?kx.themeExist(t)?kx.getTheme(t):{}:g(t)?t:{}}kx.themes=vx,kx._currentThemeName=mx;const Bx=["animationThreshold","colorScheme","name","padding"];function Ex(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((s=>{const r=t[s];Bx.includes(s)?n[s]=r:m(r)?Ub(r)?n[s]=Fb(r,e):rx(r)?n[s]=sx(i,r):n[s]=Ex(r,e,i):n[s]=r})),n}function Px(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]=Px(t[n],e)}return i}return _(t)?t.map((t=>Px(t,e))):t}function Ox(t,e){if(!t)return t;if(m(t)){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(y(t[n])&&e.getFunction(t[n])){i[n]=e.getFunction(t[n]);continue}i[n]=Ox(t[n],e)}return i}return _(t)?t.map((t=>Ox(t,e))):t}function Rx(t,...e){return u(t)?t(...e):t}const Ix=(t,e,i,n)=>((t,e,i)=>o_(t,e,i,{fontFamily:ax.fontFamily,fontSize:ax.fontSize}))(e,i,n).measure(t),Dx="__VCHART",Lx=500,Fx=500,Ux=`${Dx}_MEASURE_CANVAS_ID`,Nx=`${Dx}_DEFAULT_DATA_INDEX`,jx=`${Dx}_DEFAULT_DATA_KEY`,zx=`${Dx}_DEFAULT_DATA_SERIES_FIELD`,Wx=`${Dx}_DEFAULT_SERIES_STYLE_NAME`,Hx=`${Dx}_STACK_KEY`,Vx=`${Dx}_STACK_START`,Gx=`${Dx}_STACK_END`,Yx=`${Dx}_STACK_START_PERCENT`,Xx=`${Dx}_STACK_END_PERCENT`,Kx=`${Dx}_STACK_START_OffsetSilhouette`,$x=`${Dx}_STACK_END_OffsetSilhouette`,qx=`${Dx}_STACK_TOTAL`,Zx=`${Dx}_STACK_TOTAL_PERCENT`,Jx=`${Dx}_STACK_TOTAL_TOP`,Qx=`${Dx}_STACK_TOTAL_BOTTOM`,tS=`${Dx}_MOSAIC_VALUE_START_PERCENT`,eS=`${Dx}_MOSAIC_VALUE_END_PERCENT`,iS=`${Dx}_MOSAIC_CAT_START_PERCENT`,nS=`${Dx}_MOSAIC_CAT_END_PERCENT`,sS=`${Dx}_SEGMENT_START`,rS=`${Dx}_SEGMENT_END`,aS=`${Dx}_KEY`,oS=`${Dx}_MAP_LOOK_UP_KEY`;function lS(t,e){for(let i=0;it.key===e))}function cS(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}function uS(t,e,i){const n=t.getStackSort(),s={};let r=null;return n&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var n;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(s[o]=null!==(n=s[o])&&void 0!==n?n:{groupField:a.groupField,nodes:{}},mS(t,a,s[o],l,e,r))})),n?dS(s):s}function dS(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):dS(t[e].nodes);return t}function pS(t,e){if("values"in t&&t.values.length){const i=A_(t.values,e),n=function(t,e){const i=[];return t.forEach((t=>{const n=+t[e];A(n)&&i.push(n)})),0===i.length?null:X(i)}(t.values,Xx);t.values.forEach((t=>{t[qx]=i,t[Zx]=n}))}else for(const i in t.nodes)pS(t.nodes[i],e)}function gS(t){if(!t.values.length)return;const e=t.values[t.values.length-1][Gx]/2;for(let i=0;i0){let n=0,o=0,l=1,h=0,c=null,u=null;const d=t.values.length;for(let i=0;i=0?(l[s.start]=n,n+=l[s.end],l[s.end]=n):(l[s.start]=o,o+=l[s.end],l[s.end]=o),l[s.key]=t.key,a&&(delete l[s.max],(!u||l[s.end]>u[s.end])&&(u=l)),r&&(delete l[s.min],(!c||l[s.start]=0?n:o;l=h>=0?1:-1,r[s.startPercent]=0===a?0:Math.min(1,r[s.start]/a)*l,r[s.endPercent]=0===a?0:Math.min(1,r[s.end]/a)*l}}for(const r in t.nodes)fS(t.nodes[r],e,i,n,s)}function mS(t,e,i,n,s,r,a){var o;if("values"in e)if(s&&e.values.forEach((t=>t[Gx]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[n]))),i.series.push({s:t,values:e.values}),r){const n=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:n?r[n].sort[e[n]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),mS(t,e.nodes[l],i.nodes[l],n,s,r,h)}}function vS(t){return!u(t)&&!E(t)&&Object.keys(t).some((e=>u(t[e])))}function yS(t,e,i,n,s){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(u(t))return xS(t(r,i,n,s));if(vS(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{u(e[t])&&(e[t]=e[t](r,i,n,s))})),xS(e)}return xS(t)}function _S(t={}){const e=Object.assign({},t);if(u(t.style)||vS(t.style)?e.style=(e,i,n,s)=>yS(t.style,e,i,n,s):E(t.style)||(e.style=xS(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{u(t.state[e])||vS(t.state[e])?i[e]=(i,n,s,r)=>yS(t.state[e],i,n,s,r):E(t.state[e])||(i[e]=xS(t.state[e]))})),e.state=i}return e}function bS(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,n,s,r)=>xS(t[i](e,n,s,r)):E(t[i])||(e[i]=xS(t[i]))})),e}function xS(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:Nt(t.angle)}):t}const SS=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},AS=t=>"line"===t||"area"===t,CS=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return AS(i)?e:null==e?void 0:e[0]},wS=(t,e)=>{const i=t.getAttributes(!0),n={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(n[t]=e[t])})),n};let TS=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},s=ux.getComposedEvent(t);if(s){const e=new s(this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(n.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,n),this._addEventHandler(t,n);return this}off(t,e,i){var n,s,r;const a=null!=i?i:e;if(ux.getComposedEvent(t))if(a)null===(n=this._composedEventMap.get(a))||void 0===n||n.event.unregister(),this._composedEventMap.delete(a);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(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var kS;!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"}(kS||(kS={}));const MS=["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 BS,ES,PS;t.ChartEvent=void 0,(BS=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",BS.rendered="rendered",BS.renderFinished="renderFinished",BS.animationFinished="animationFinished",BS.regionSeriesDataFilterOver="regionSeriesDataFilterOver",BS.afterInitData="afterInitData",BS.afterInitEvent="afterInitEvent",BS.afterInitMark="afterInitMark",BS.rawDataUpdate="rawDataUpdate",BS.viewDataFilterOver="viewDataFilterOver",BS.viewDataUpdate="viewDataUpdate",BS.viewDataStatisticsUpdate="viewDataStatisticsUpdate",BS.markDeltaYUpdate="markDeltaYUpdate",BS.viewDataLabelUpdate="viewDataLabelUpdate",BS.scaleDomainUpdate="scaleDomainUpdate",BS.scaleRawDomainUpdate="scaleRawDomainUpdate",BS.scaleUpdate="scaleUpdate",BS.dataZoomChange="dataZoomChange",BS.drill="drill",BS.layoutStart="layoutStart",BS.layoutEnd="layoutEnd",BS.layoutRectUpdate="layoutRectUpdate",BS.playerPlay="playerPlay",BS.playerPause="playerPause",BS.playerEnd="playerEnd",BS.playerChange="playerChange",BS.playerForward="playerForward",BS.playerBackward="playerBackward",BS.scrollBarChange="scrollBarChange",BS.brushStart="brushStart",BS.brushChange="brushChange",BS.brushEnd="brushEnd",BS.brushClear="brushClear",BS.brushActive="brushActive",BS.legendSelectedDataChange="legendSelectedDataChange",BS.legendFilter="legendFilter",BS.legendItemClick="legendItemClick",BS.legendItemHover="legendItemHover",BS.legendItemUnHover="legendItemUnHover",BS.tooltipShow="tooltipShow",BS.tooltipHide="tooltipHide",BS.tooltipRelease="tooltipRelease",BS.afterResize="afterResize",BS.afterRender="afterRender",BS.afterLayout="afterLayout",BS.afterMarkLayoutEnd="afterMarkLayoutEnd",BS.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(ES||(ES={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(PS||(PS={}));const OS=[PS.mark,PS.model,PS.chart,PS.vchart];class RS{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(PS.vchart,[]),this._levelNodes.set(PS.chart,[]),this._levelNodes.set(PS.model,[]),this._levelNodes.set(PS.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}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const IS={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class DS{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),n=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,s=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=P(t.event,"target");let a=t.datum;n&&"component"===n.modelType&&(a=null!==(e=n.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:n,mark:null!=s?s:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let n=null;i.graphics&&(n=i.graphics);const s={event:t.event,chart:e,graphics:n,datums:n&&n.map((t=>CS(t)))};this.dispatch(t.type,s)},this.globalInstance=t,this._compiler=e}register(t,e){var i,n,s,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||ES.chart),l=this.getEventListeners((null===(n=e.filter)||void 0===n?void 0:n.source)||ES.chart);o.get(t)||o.set(t,new RS);if(o.get(t).addHandler(e,null===(s=e.filter)||void 0===s?void 0:s.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,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)||ES.chart),l=this.getEventListeners((null===(n=null==e?void 0:e.filter)||void 0===n?void 0:n.source)||ES.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)||ES.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||ES.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{let i=0;for(;!s&&i{const n=this.getEventBubble(i).get(t);n&&n.getAllHandlers().forEach((t=>{e?OS.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[ES.chart,ES.window,ES.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var n,s,r;if(u(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&P(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 IS[a]&&(a=IS[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const n=t.map((t=>{var n,s,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(n=t.query)||void 0===n?void 0:n.consume;return a&&(null===(s=i.event)||void 0===s||s.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?PS.model:PS.vchart:PS.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=ft(t.callback,i.debounce));let n=this._getQueryLevel(i),s=null,r=ES.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!==PS.model&&n!==PS.mark||(s=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,n=PS.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 ES.chart:return this._viewBubbles;case ES.window:return this._windowBubbles;case ES.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case ES.chart:return this._viewListeners;case ES.window:return this._windowListeners;case ES.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return MS.includes(t)||Object.values(kS).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&ux.hasInteractionTrigger(e)}}function LS(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function FS(t,e,i){t.getParser(e)||t.registerParser(e,i)}const US=new Map;function NS(t,e=!1){let i=e;return t.latestData instanceof oi&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const jS=(t,e)=>0===t.length?[]:1===t.length?NS(t[0],null==e?void 0:e.deep):t.map((t=>NS(t,null==e?void 0:e.deep)));function zS(e,i,n){LS(i=i instanceof ai?i:e.dataSet,"copyDataView",jS);const s=new oi(i,n);return s.parse([e],{type:"dataview"}),s.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),s}function WS(t,e,i=[]){var n;if(t instanceof oi)return t;const{id:s,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let u;h.clone=!(!1===h.clone);const d=i.find((t=>t.name===s));if(d)u=d;else{const t={name:s};if(c&&(t.fields=c),u=new oi(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Py(`no data matches fromDataId ${o}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Py(`no data matches fromDataIndex ${a}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else Array.isArray(r)?u.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(u.parse([]),Py("values should be array")):u.parse(r,null!==(n=h)&&void 0!==n?n:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&u.transform(t)}))}return u}function HS(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var VS,GS,YS,XS;t.TransformLevel=void 0,(VS=t.TransformLevel||(t.TransformLevel={}))[VS.copyDataView=-10]="copyDataView",VS[VS.treemapFilter=-8]="treemapFilter",VS[VS.treemapFlatten=-7]="treemapFlatten",VS[VS.dotObjFlat=-7]="dotObjFlat",VS[VS.linkDotInfo=-7]="linkDotInfo",VS[VS.sankeyLayout=-7]="sankeyLayout",VS[VS.dataZoomFilter=-6]="dataZoomFilter",VS[VS.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(GS||(GS={})),function(t){t.data="data",t.mark="mark"}(YS||(YS={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(XS||(XS={}));const KS=["line","area","trail"];function $S(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(aS,i?t.slice().sort(i):t.slice()),{keys:[aS],data:n};if(1===t.length){const i=e(t[0],0);return n.set(i,[t[0]]),{keys:[i],data:n}}const s=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=n.get(a))&&void 0!==r?r:[];o.push(t),n.set(a,o),s.add(a)})),i&&s.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(s),data:n}}const qS=(t,e,i={})=>(t&&Object.keys(t).forEach((n=>{i[n]=t[n](e)})),i);function ZS(t,e,i,n,s){const r=t=>{if(!n&&t&&(!i||i(t))){const i=e.call(null,t);if(s&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{ZS(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function QS(t,e,i,n){const s=$S(t,(t=>i(t))),r=$S(e,(t=>n(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){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}}const tA=`${Dx}_BuiltIn_CallBack_Disappear`;var eA;!function(t){t.render="render",t.disappear="disappear"}(eA||(eA={}));const iA=[0,0,0];class nA{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},os),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},hs),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},cs),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new pe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new pe(1,0,0,1,0,0),this._clearMatrix=new pe(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&nt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new pe(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Ko.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&&(Ko.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Ko.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n,s=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,n=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,n=!0){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-=At;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,u=cthis.canvas.nativeCanvas)));const s=null!==(i=this.fontFamily)&&void 0!==i?i:cs.fontFamily,r=null!==(n=this.fontSize)&&void 0!==n?n:cs.fontSize;return this.mathTextMeasure.textSpec.fontFamily===s&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=s,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(Wo(iA,[e,i,n],this.modelMatrix),e=iA[0],i=iA[1],n=iA[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=Object.create(s[0]);return s.forEach(((t,e)=>{0!==e&&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;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=Po(this,l,t,i,n))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const n=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(n,t)})),this._setShadowBlendStyle(t,e,n)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(s<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;n.shadowBlur=r*this.dpr,n.shadowColor=t,n.shadowOffsetX=s*this.dpr,n.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0);l?(n.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1),h?(n.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(n.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!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=Object.create(s[0]);return s.forEach(((t,e)=>{0!==e&&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(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=s.lineWidth,stroke:o=s.stroke,lineJoin:l=s.lineJoin,lineDash:h=s.lineDash,lineDashOffset:c=s.lineDashOffset,lineCap:u=s.lineCap,miterLimit:d=s.miterLimit,keepStrokeScale:p=s.keepStrokeScale}=e;r.lineWidth=p?a:Eo(this,a,this.dpr),r.strokeStyle=Po(this,o,t,i,n),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=u,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=se(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?this.font=t.font:this.font=se(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,n,s,r){this._clearMatrix.setValue(t,e,i,n,s,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Ko.free(t))),this.stack.length=0}}nA.env="browser";class sA extends tl{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=di.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new nA(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr: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.width=`${n}px`,t.style.height=`${s}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}}function rA(t,e){return i=>{var n,s;const r=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,$a,t.env)),a=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,qa,e.env));r||i.bind($a).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(qa).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}sA.env="browser";const aA=rA(sA,nA);class oA extends nA{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}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;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}oA.env="feishu";class lA extends tl{constructor(t){super(t)}init(){this._context=new oA(this,this._dpr)}release(...t){}}lA.env="feishu";const hA=rA(lA,oA);class cA extends nA{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,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:u=s.lineDash,lineCap:d=s.lineCap,miterLimit:p=s.miterLimit,keepStrokeScale:g=s.keepStrokeScale,lineDashOffset:f=s.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:Eo(this,l,this.dpr),r.strokeStyle=Po(this,h,t,i,n),r.lineJoin=c,0===u[0]&&0===u[1]||(u&&r.setLineDash(u),r.lineDashOffset=f),r.lineCap=d,r.miterLimit=p}}measureText(t,e=di.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,di.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;let r="";r=t.font?t.font:se(t,e,s&&this.camera&&this.camera.getProjectionScale(i)),n.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:se(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}cA.env="harmony";class uA extends tl{constructor(t){super(t)}init(){this._context=new cA(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}uA.env="harmony";const dA=rA(uA,cA);class pA extends nA{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,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:u=s.lineDash,lineCap:d=s.lineCap,miterLimit:p=s.miterLimit,keepStrokeScale:g=s.keepStrokeScale,lineDashOffset:f=s.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:Eo(this,l,this.dpr),r.strokeStyle=Po(this,h,t,i,n),r.lineJoin=c,0===u[0]&&0===u[1]||!u||(r.setLineDash(u),r.lineDashOffset=f),r.lineCap=d,r.miterLimit=p}}measureText(t,e=di.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,di.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}pA.env="lynx";class gA extends tl{constructor(t){super(t)}init(){this._context=new pA(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}gA.env="lynx";const fA=rA(gA,pA);class mA extends nA{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 pe(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}mA.env="node";class vA extends tl{constructor(t){super(t)}init(){this._context=new mA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&u(this._nativeCanvas.release)&&this._nativeCanvas.release()}}vA.env="node";const yA=rA(vA,mA);class _A extends nA{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(Po(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:u=s.lineDash,lineDashOffset:d=s.lineDashOffset,lineCap:p=s.lineCap,miterLimit:g=s.miterLimit,keepStrokeScale:f=s.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:Eo(this,l,this.dpr)),r.setStrokeStyle(Po(this,h,t,i,n)),r.setLineJoin(c),u&&(r.setLineDash(u),r.lineDashOffset=d),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=se(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=se(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}getImageData(t,e,i,n){const s=this.nativeContext,r=s.taro;if(s&&r)return!s.getImageData&&r.canvasGetImageData?new Promise(((s,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:n,success(t){s(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,n,s,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,n,s,r)}}_A.env="taro";class bA extends tl{constructor(t){super(t)}init(){this._context=new _A(this,this._dpr)}release(...t){}}bA.env="taro";const xA=rA(bA,_A);class SA extends oA{}SA.env="tt";class AA extends tl{constructor(t){super(t)}init(){this._context=new SA(this,this._dpr)}release(...t){}}AA.env="tt";const CA=rA(AA,SA);class wA extends nA{draw(){}createPattern(t,e){return null}}wA.env="wx";class TA extends tl{constructor(t){super(t)}init(){this._context=new wA(this,this._dpr)}release(...t){}}TA.env="wx";const kA=rA(TA,wA);function MA(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function BA(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}class EA extends Cf{constructor(t,e,i,n){super(i,n),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=n,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Du.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let s=0;s!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=s||l,o)),((t,i,s,r)=>{if(o||l)return!0;const a=i.lineWidth||s.lineWidth,h=i.pickStrokeBuffer||s.pickStrokeBuffer,c=i.keepStrokeScale||s.keepStrokeScale;return n.lineWidth=c?a+h:Eo(n,a+h,n.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),n.highPerformanceRestore(),o}}class pC extends dC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=wa}}let gC=!1;function fC(t){gC||(gC=!0,t.bind(VA).toDynamicValue((()=>new pC(MA(t,cu)))).inSingletonScope(),t.bind(hC).toService(VA))}class mC extends Rg{contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme();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 u=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u))),this.canvasRenderer.z=0,n.modelMatrix!==h&&$o.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}}class vC extends mC{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=Ta,this.themeType="arc"}}let yC=!1;function _C(t){var e;yC||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,uu))&&(yC=!0,t.bind(GA).toDynamicValue((()=>new vC(MA(t,uu)))).inSingletonScope(),t.bind(hC).toService(GA))}class bC extends dC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=ka}}let xC=!1;function SC(t){xC||(xC=!0,t.bind(YA).toDynamicValue((()=>new bC(MA(t,du)))).inSingletonScope(),t.bind(hC).toService(YA))}class AC extends dC{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ma}}let CC=!1;function wC(t){CC||(CC=!0,t.bind(XA).toDynamicValue((()=>new AC(MA(t,pu)))).inSingletonScope(),t.bind(hC).toService(XA))}class TC{constructor(){this.type="glyph",this.numberType=Ba}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=>{if(n)return;const r=s.pickItem(t,e,null,i);n=!(!r||!r.graphic)})),n}return!1}}class kC extends TC{constructor(t){super(),this.canvasRenderer=t}}let MC=!1;function BC(t){MC||(MC=!0,t.bind(aC).toDynamicValue((()=>new kC(MA(t,wu)))).inSingletonScope(),t.bind(hC).toService(aC))}class EC extends dC{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Pa}}let PC=!1;function OC(t){PC||(PC=!0,t.bind(KA).toDynamicValue((()=>new EC(MA(t,Tu)))).inSingletonScope(),t.bind(hC).toService(KA))}class RC extends Rg{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=t.getGraphicTheme(),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 u=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!u||(u=t.isPointInPath(c.x,c.y),u)),((t,e,i)=>{if(u)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return n.lineWidth=a?s+r:Eo(n,s+r,n.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==h&&$o.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}}class IC extends RC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Oa}}let DC=!1;function LC(t){DC||(DC=!0,t.bind(qA).toDynamicValue((()=>new IC(MA(t,mu)))).inSingletonScope(),t.bind(hC).toService(qA))}const FC=new ue;class UC{constructor(){this.type="rect",this.numberType=La}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=t.getGraphicTheme(),{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||t.shadowRoot||S(r,!0)&&0!==r||_(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,a=i.pickStrokeBuffer||s.pickStrokeBuffer,o=i.keepStrokeScale||s.keepStrokeScale;return n.lineWidth=o?r+a:Eo(n,r+a,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{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;FC.setValue(i.x1,i.y1,i.x2,i.y2),FC.expand(-r/2),h=!FC.containsPoint(e)}}return n.highPerformanceRestore(),h}}class NC extends UC{constructor(t){super(),this.canvasRenderer=t}}let jC=!1;class zC extends RC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ra}}let WC=!1;function HC(t){WC||(WC=!0,t.bind(JA).toDynamicValue((()=>new zC(MA(t,vu)))).inSingletonScope(),t.bind(hC).toService(JA))}class VC extends dC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ia}}let GC=!1;function YC(t){GC||(GC=!0,t.bind(nC).toDynamicValue((()=>new VC(MA(t,yu)))).inSingletonScope(),t.bind(hC).toService(nC))}class XC extends mC{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=Da,this.themeType="polygon"}}let KC=!1;function $C(t){var e;KC||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Cu))&&(KC=!0,t.bind(sC).toDynamicValue((()=>new XC(MA(t,Cu)))).inSingletonScope(),t.bind(hC).toService(sC))}class qC extends UC{constructor(t){super(),this.canvasRenderer=t}}let ZC=!1;function JC(t){ZC||(ZC=!0,t.bind(QA).toDynamicValue((()=>new qC(MA(t,_u)))).inSingletonScope(),t.bind(hC).toService(QA))}class QC extends mC{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=Fa,this.themeType="rect"}}let tw=!1;function ew(t){var e;tw||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,bu))&&(tw=!0,t.bind(tC).toDynamicValue((()=>new QC(MA(t,bu)))).inSingletonScope(),t.bind(hC).toService(tC))}class iw{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Ua}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let nw=!1;function sw(t){nw||(nw=!0,t.bind(rC).toDynamicValue((()=>new iw(MA(t,Au)))).inSingletonScope(),t.bind(hC).toService(rC))}class rw extends dC{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=Na}}let aw=!1;function ow(t){var e;aw||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Bu))&&(aw=!0,t.bind(lC).toDynamicValue((()=>new rw(MA(t,Bu)))).inSingletonScope(),t.bind(hC).toService(lC))}class lw extends mC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=ja}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getParsedPath();if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(s.isSvg||"imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,n),{x:o,y:l,z:h,lastModelMatrix:c}=a;let u=e;if(n.camera){u=e.clone();const i=t.parent.globalTransMatrix;u.x=i.a*e.x+i.c*e.y+i.e,u.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,n,o,l,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return n.lineWidth=a?s+r:Eo(n,s+r,n.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==c&&$o.free(n.modelMatrix),n.modelMatrix=c,n.highPerformanceRestore(),d}}let hw=!1;function cw(t){hw||(hw=!0,t.bind(eC).toDynamicValue((()=>new lw(MA(t,xu)))).inSingletonScope(),t.bind(hC).toService(eC))}class uw extends mC{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=za}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=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.canvasRenderer.z=u;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,d=l.height(),f=l.width(),m=gh(a,d,s),v=ph(o,f);return e.rect(v+h,m+c,f,d,u),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==d&&$o.free(n.modelMatrix),n.modelMatrix=d,n.highPerformanceRestore(),g}}let dw=!1;function pw(t){dw||(dw=!0,t.bind(iC).toDynamicValue((()=>new uw(MA(t,Su)))).inSingletonScope(),t.bind(hC).toService(iC))}const gw=ya();ya();class fw{constructor(){this.type="gif-image",this.numberType=gw}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}}let mw=!1;function vw(t){mw||(mw=!0,t.bind($A).toDynamicValue((()=>new fw)).inSingletonScope(),t.bind(hC).toService($A))}function yw(t){t.isBound(EA)||t.bind(EA).toDynamicValue((()=>new EA(BA(hC,t),MA(t,Mu),BA(ou,t),BA(lu,t)))).inSingletonScope(),t.isBound(su)?t.rebind(su).toService(EA):t.bind(su).toService(EA)}function _w(t){(function(t){uC||(uC=!0,t.bind(oC).toDynamicValue((()=>new cC)).inSingletonScope(),t.bind(hC).toService(oC),Ud(t.bind.bind(t),hC))})(t),fC(t),_C(t),SC(t),wC(t),BC(t),OC(t),LC(t),function(t){jC||(jC=!0,t.bind(ZA).toDynamicValue((()=>new NC(MA(t,_u)))).inSingletonScope(),t.bind(hC).toService(ZA))}(t),HC(t),YC(t),$C(t),JC(t),ew(t),sw(t),ow(t),cw(t),pw(t),vw(t),yw(t)}class bw extends vf{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${bw.idprefix}_${bw.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=di.global,this.viewBox=new ue,this.modelMatrix=new pe(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>n)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:bw.GenerateCanvasId(),canvasControled:!0};this.canvas=new sA(n)}createWindowByCanvas(t){var e,i;let n;if("string"==typeof t.canvas){if(n=this.global.getElementById(t.canvas),n||"undefined"==typeof document||(n=document.getElementById(t.canvas)),!n)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else n=t.canvas;if(!n)throw new Error("发生错误,传入的canvas不正确");let s=t.width,r=t.height;if(null==s||null==r||!t.canvasControled){const t=n.getBoundingClientRect();s=t.width,r=t.height}let a=t.dpr;null==a&&(a=null!==(e=n.getContext("2d").pixelRatio)&&void 0!==e?e:n.width/s),this.canvas=new sA({width:s,height:r,dpr:a,nativeCanvas:n,canvasControled:null!==(i=t.canvasControled)&&void 0!==i&&i})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}}function xw(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,bw))||t.bind(bw).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Pu,bw.env))||t.bind(Pu).toService(bw).whenTargetNamed(bw.env)}bw.env="browser",bw.idprefix="visactor_window",bw.prefix_count=0;var Sw=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 Aw{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function Cw(t,e=!1){const i=document.createElement("img");if(di.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class ww extends mf{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,n;let s=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};s=e.clientX||0,r=e.clientY||0,a=s,o=r}else s=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=s,i=r,a=e.getBoundingClientRect(),o=null===(n=e.getNativeHandler)||void 0===n?void 0:n.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Aw(t)}return new ue}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:n,style:s}=e;return s&&(y(s)?t.setAttribute("style",s):Object.keys(s).forEach((e=>{t.style[e]=s[e]}))),null!=i&&(t.style.width=`${i}px`),null!=n&&(t.style.height=`${n}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,n=document.createElement(e);if(this.updateDom(n,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(n)}return n}loadImage(t){return Cw(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Cw(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:ci.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(...t){}getElementTop(t,e){let i=t.offsetTop,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,n=n.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetLeft,n=n.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,n=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,n+=s.offsetLeft,s=s.offsetParent;return{top:i,left:n}}loadFont(t,e,i){return Sw(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function Tw(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,ww))||(t.bind(ww).toSelf().inSingletonScope(),t.bind(Uh).toService(ww))}function kw(t=xg(),e=!0){kw.__loaded||(kw.__loaded=!0,Tw(t),aA(t),xw(t),e&&_w(t))}kw.__loaded=!1;class Mw extends vf{get container(){return null}constructor(t=di.global){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:ci.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new lA(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 lA({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){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function Bw(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Mw))||t.bind(Mw).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Pu,Mw.env))||t.bind(Pu).toService(Mw).whenTargetNamed(Mw.env)}Mw.env="feishu";class Ew extends Cf{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Jo(null,1)}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;const s=this.pickerMap.get(t.numberType);if(!s)return null;const r=s.contains(t,e,n),a=r?t:null;return a?{graphic:a,params:r}:null}}let Pw=!1;class Ow extends dC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=wa}}let Rw=!1;function Iw(t){Rw||(Rw=!0,t.bind(OA).toDynamicValue((()=>new Ow(MA(t,cu)))).inSingletonScope(),t.bind(PA).toService(OA))}class Dw extends dC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=ka}}let Lw=!1;function Fw(t){Lw||(Lw=!0,t.bind(RA).toDynamicValue((()=>new Dw(MA(t,du)))).inSingletonScope(),t.bind(PA).toService(RA))}class Uw extends dC{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ma}}let Nw=!1;function jw(t){Nw||(Nw=!0,t.bind(IA).toDynamicValue((()=>new Uw(MA(t,pu)))).inSingletonScope(),t.bind(PA).toService(IA))}class zw extends TC{constructor(t){super(),this.canvasRenderer=t}}let Ww=!1;function Hw(t){Ww||(Ww=!0,t.bind(WA).toDynamicValue((()=>new zw(MA(t,wu)))).inSingletonScope(),t.bind(PA).toService(WA))}class Vw{constructor(){this.type="image",this.numberType=Pa}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}}let Gw=!1;function Yw(t){Gw||(Gw=!0,t.bind(DA).toDynamicValue((()=>new Vw)).inSingletonScope(),t.bind(PA).toService(DA))}class Xw extends dC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Oa}}let Kw=!1;function $w(t){Kw||(Kw=!0,t.bind(LA).toDynamicValue((()=>new Xw(MA(t,mu)))).inSingletonScope(),t.bind(PA).toService(LA))}class qw extends dC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ia}}let Zw=!1;function Jw(t){Zw||(Zw=!0,t.bind(zA).toDynamicValue((()=>new qw(MA(t,yu)))).inSingletonScope(),t.bind(PA).toService(zA))}class Qw extends dC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ra}}let tT=!1;function eT(t){tT||(tT=!0,t.bind(FA).toDynamicValue((()=>new Qw(MA(t,vu)))).inSingletonScope(),t.bind(PA).toService(FA))}class iT extends UC{constructor(t){super(),this.canvasRenderer=t}}let nT=!1;function sT(t){nT||(nT=!0,t.bind(UA).toDynamicValue((()=>new iT(MA(t,_u)))).inSingletonScope(),t.bind(PA).toService(UA))}class rT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Ua}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let aT=!1;function oT(t){aT||(aT=!0,t.bind(HA).toDynamicValue((()=>new rT(MA(t,Au)))).inSingletonScope(),t.bind(PA).toService(HA))}class lT extends dC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=ja}}let hT=!1;function cT(t){hT||(hT=!0,t.bind(NA).toDynamicValue((()=>new lT(MA(t,xu)))).inSingletonScope(),t.bind(PA).toService(NA))}class uT{constructor(){this.type="text",this.numberType=za}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let dT=!1;function pT(t){dT||(dT=!0,t.bind(jA).toDynamicValue((()=>new uT)).inSingletonScope(),t.bind(PA).toService(jA))}function gT(t){(function(t){Pw||(Pw=!0,Ud(t.bind.bind(t),PA))})(t),function(t){t.isBound(Ew)||t.bind(Ew).toDynamicValue((()=>new Ew(BA(PA,t),BA(ou,t),BA(lu,t)))).inSingletonScope(),t.isBound(su)?t.rebind(su).toService(Ew):t.bind(su).toService(Ew)}(t),Iw(t),Fw(t),jw(t),Hw(t),Yw(t),$w(t),Jw(t),eT(t),sT(t),oT(t),cT(t),pT(t)}class fT{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,n,s,r){this.nativeCanvas=t,this.ctx=e,this._w=n,this._h=s,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class mT{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,n,s,r){this.nativeCanvas=t,this.ctx=e,this._w=n,this._h=s,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function vT(t,e,i=null==t.id){var n,s,r;return{id:null==t.id?void 0:String(t.id),width:null!==(n=t.width)&&void 0!==n?n:0,height:null!==(s=t.height)&&void 0!==s?s:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function yT(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new fT(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function _T(t,e,i,n){const s=vT(t,e),r=s.id;if(null!=r){const t=i.get(r);if(t)return t}if(!n)return null;const a=function(t,e){var i;const n=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!n)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new mT(t,n,e.dpr,e.width,e.height,e.id)}(n(s),s);return null!=r&&i.set(r,a),a}function bT(t){var e,i,n,s,r;try{return null!==(n=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==n?n:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(s=null==t?void 0:t.feishu)&&void 0!==s?s:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function xT(t,e=bT(t)){var i,n,s,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(s=null===(n=null==e?void 0:e.getSystemInfoSync)||void 0===n?void 0:n.call(e))||void 0===s?void 0:s.pixelRatio)&&void 0!==r?r:1}class ST extends mf{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},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 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,n=bT(i),s=null!==(e=t.dpr)&&void 0!==e?e:xT(i,n),r=_T(t,s,this.canvasMap,i.canvasFactory);if(r)return r;const a=vT(t,s,!1);if(null==a.id||"function"!=typeof(null==n?void 0:n.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=yT(n.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return xT(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Xs.call(t)}}getCancelAnimationFrame(){return t=>{Xs.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function AT(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,ST))||(t.bind(ST).toSelf().inSingletonScope(),t.bind(Uh).toService(ST))}function CT(t=xg(),e=!0){CT.__loaded||(CT.__loaded=!0,AT(t),hA(t),Bw(t),e&&gT(t))}CT.__loaded=!1;function wT(t,e,i){if(t&&i)try{t[e]=i}catch(n){Object.defineProperty(t,e,{configurable:!0,value:i})}}function TT(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ci.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new uA(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 uA({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const n=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return wT(t,"target",n),wT(t,"currentTarget",n),function(t){var e,i,n,s,r,a,o,l,h,c,u,d,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(n=null==t?void 0:t.touches)||void 0===n?void 0:n[0];if(!y)return;const _=TT(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=TT(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&kT(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),kT(t,"x",_),kT(t,"y",b),kT(t,"offsetX",null!==(s=t.offsetX)&&void 0!==s?s:_),kT(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),kT(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),kT(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),kT(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),kT(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(u=y.y)&&void 0!==u?u:b,y.offsetX=null!==(d=y.offsetX)&&void 0!==d?d:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function BT(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,MT))||t.bind(MT).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Pu,MT.env))||t.bind(Pu).toService(MT).whenTargetNamed(MT.env)}MT.env="harmony";const ET="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function PT(t){return"number"==typeof t&&Number.isFinite(t)}function OT(...t){for(let e=0;e({width:i,height:n})),new mT(t,l,s,i,n,e)}function FT(t,e,i,n,s,r,a){const o={id:t,width:e,height:i,dpr:n,offscreen:s};if(r.canvasFactory)return r.canvasFactory(o);if(s&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!s&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(s){const t=DT(e*n,i*n);if(t)return t}throw new Error(ET)}class UT extends mf{constructor(){super(),this.type="harmony",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,this.rafSTO=new Ys(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=RT(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const n=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},s=RT(n),r=null!==(i=t.dpr)&&void 0!==i?i:IT(n),a=function(t,e){if(!PT(t)||!PT(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=LT(FT(e,a.width,a.height,r,!1,n,s),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=LT(FT(l,a.width,a.height,r,!0,n,s),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return IT(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,n;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(n=null==t?void 0:t.touches)||void 0===n?void 0:n[0]}(t),i=OT(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),n=OT(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==n?null:{x:i,y:n}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function NT(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,UT))||(t.bind(UT).toSelf().inSingletonScope(),t.bind(Uh).toService(UT))}function jT(t=xg(),e=!0){jT.__loaded||(jT.__loaded=!0,NT(t),dA(t),BT(t),e&&gT(t))}jT.__loaded=!1;function zT(t,e,i){if(t&&i)try{t[e]=i}catch(n){Object.defineProperty(t,e,{configurable:!0,value:i})}}function WT(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ci.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new gA(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 gA({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const n=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return zT(t,"target",n),zT(t,"currentTarget",n),function(t){var e,i,n,s,r,a,o,l,h,c,u,d,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(n=null==t?void 0:t.touches)||void 0===n?void 0:n[0];if(!y)return;const _=WT(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=WT(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&HT(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),HT(t,"x",_),HT(t,"y",b),HT(t,"offsetX",null!==(s=t.offsetX)&&void 0!==s?s:_),HT(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),HT(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),HT(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),HT(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),HT(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(u=y.y)&&void 0!==u?u:b,y.offsetX=null!==(d=y.offsetX)&&void 0!==d?d:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function GT(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,VT))||t.bind(VT).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Pu,VT.env))||t.bind(Pu).toService(VT).whenTargetNamed(VT.env)}VT.env="lynx";function YT(t){return"number"==typeof t&&Number.isFinite(t)}function XT(...t){for(let e=0;e{n.onload=()=>{t(n)},n.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,n,s;if(null!=t.id){const n=String(t.id),s=this.canvasMap.get(n);if(s)return s;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=$T(r),o=null!==(i=t.dpr)&&void 0!==i?i:qT(r,a),l=JT(t.width,t.height),h=QT(tk(n,l.width,l.height,o,!1,r,a),n,l.width,l.height,o);return this.canvasMap.set(n,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(n=this.lynxEnvParams)&&void 0!==n?n:{},o=$T(a),l=null!==(s=t.dpr)&&void 0!==s?s:qT(a,o),h=JT(t.width,t.height),c=Math.random().toString(),u=QT(tk(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,u),this.freeCanvasList.push(u),u}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return qT(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Xs.call(t)}}getCancelAnimationFrame(){return t=>{Xs.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,n;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(n=null==t?void 0:t.touches)||void 0===n?void 0:n[0]}(t),i=XT(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),n=XT(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==n?null:{x:i,y:n}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function ik(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,ek))||(t.bind(ek).toSelf().inSingletonScope(),t.bind(Uh).toService(ek))}function nk(t=xg(),e=!0){nk.__loaded||(nk.__loaded=!0,ik(t),fA(t),GT(t),e&&gT(t))}nk.__loaded=!1;class sk extends vf{get container(){return null}constructor(t=di.global){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:ci.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new vA(i)}createWindowByCanvas(t){var e;const i=t.canvas,n=null!==(e=t.dpr)&&void 0!==e?e:1;let s=t.width,r=t.height;null!=s&&null!=r&&t.canvasControled||(s=i.width/n,r=i.height/n),this.canvas=new vA({width:s,height:r,dpr:n,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function rk(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,sk))||t.bind(sk).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Pu,sk.env))||t.bind(Pu).toService(sk).whenTargetNamed(sk.env)}sk.env="node";class ak extends mf{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Xs.call(t)}}getCancelAnimationFrame(){return t=>{Xs.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function ok(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,ak))||(t.bind(ak).toSelf().inSingletonScope(),t.bind(Uh).toService(ak))}function lk(t=xg(),e=!0){lk.__loaded||(lk.__loaded=!0,ok(t),yA(t),rk(t))}lk.__loaded=!1;class hk extends vf{get container(){return null}constructor(t=di.global){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:ci.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new bA(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 bA({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){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function ck(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,hk))||t.bind(hk).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Pu,hk.env))||t.bind(Pu).toService(hk).whenTargetNamed(hk.env)}hk.env="taro";class uk extends mf{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},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 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?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){var e,i;const n=this.taroEnvParams,s=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=_T(t,s,this.canvasMap,n.canvasFactory);if(r)return r;const a=vT(t,s,!1);if(null==a.id||"function"!=typeof(null===(i=n.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=yT(n.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}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(...t){}}function dk(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,uk))||(t.bind(uk).toSelf().inSingletonScope(),t.bind(Uh).toService(uk))}function pk(t=xg(),e=!0){pk.__loaded||(pk.__loaded=!0,dk(t),xA(t),ck(t),e&&gT(t))}pk.__loaded=!1;class gk extends vf{get container(){return null}constructor(t=di.global){super(),this.global=t,this.type="tt",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:ci.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new AA(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 AA({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){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function fk(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,gk))||t.bind(gk).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Pu,gk.env))||t.bind(Pu).toService(gk).whenTargetNamed(gk.env)}gk.env="tt";function mk(t){var e,i,n;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(n=null==t?void 0:t.tt)&&void 0!==n?n:null==t?void 0:t.runtime}}function vk(t,e=mk(t)){var i,n,s,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(s=null===(n=null==e?void 0:e.getSystemInfoSync)||void 0===n?void 0:n.call(e))||void 0===s?void 0:s.pixelRatio)&&void 0!==r?r:1}class yk extends mf{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,n=mk(i),s=null!==(e=t.dpr)&&void 0!==e?e:vk(i,n),r=_T(t,s,this.canvasMap,i.canvasFactory);if(r)return r;const a=vT(t,s,!1);if(null==a.id||"function"!=typeof(null==n?void 0:n.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=yT(n.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return vk(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Xs.call(t)}}getCancelAnimationFrame(){return t=>{Xs.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function _k(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,yk))||(t.bind(yk).toSelf().inSingletonScope(),t.bind(Uh).toService(yk))}function bk(t=xg(),e=!0){bk.__loaded||(bk.__loaded=!0,_k(t),CA(t),fk(t),e&&gT(t))}bk.__loaded=!1;class xk{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={}}}function Sk(t,e,i){if(t&&i)try{t[e]=i}catch(n){Object.defineProperty(t,e,{configurable:!0,value:i})}}class Ak extends vf{get container(){return null}constructor(t=di.global){super(),this.global=t,this.type="wx",this.eventManager=new xk}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:ci.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new TA(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 TA({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,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return Sk(t,"target",o),Sk(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(n=t.changedTouches[0].x)&&void 0!==n?n:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function Ck(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Ak))||t.bind(Ak).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Pu,Ak.env))||t.bind(Pu).toService(Ak).whenTargetNamed(Ak.env)}Ak.env="wx";function wk(t){var e,i,n;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(n=null==t?void 0:t.wx)&&void 0!==n?n:null==t?void 0:t.runtime}}function Tk(t,e=wk(t)){var i,n,s,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(s=null===(n=null==e?void 0:e.getSystemInfoSync)||void 0===n?void 0:n.call(e))||void 0===s?void 0:s.pixelRatio)&&void 0!==r?r:1}class kk extends mf{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,n=wk(i),s=null!==(e=t.dpr)&&void 0!==e?e:Tk(i,n),r=_T(t,s,this.canvasMap,i.canvasFactory);if(r)return r;const a=vT(t,s,!1);if(null==a.id||"function"!=typeof(null==n?void 0:n.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=yT(n.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return Tk(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Xs.call(t)}}getCancelAnimationFrame(){return t=>{Xs.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function Mk(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,kk))||(t.bind(kk).toSelf().inSingletonScope(),t.bind(Uh).toService(kk))}function Bk(t=xg(),e=!0){Bk.__loaded||(Bk.__loaded=!0,Mk(t),kA(t),Ck(t),e&&gT(t))}Bk.__loaded=!1;var Ek={},Pk={},Ok={};Object.defineProperty(Ok,"__esModule",{value:!0}),Ok.loop=Ok.conditional=Ok.parse=void 0;Ok.parse=function t(e,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n;if(Array.isArray(i))i.forEach((function(i){return t(e,i,n,s)}));else if("function"==typeof i)i(e,n,s,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(s[r]={},t(e,i[r],n,s[r])):s[r]=i[r](e,n,s,t)}return n};Ok.conditional=function(t,e){return function(i,n,s,r){e(i,n,s)&&r(i,t,n,s)}};Ok.loop=function(t,e){return function(i,n,s,r){for(var a=[],o=i.pos;e(i,n,s);){var l={};if(r(i,t,n,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var Rk={};Object.defineProperty(Rk,"__esModule",{value:!0}),Rk.readBits=Rk.readArray=Rk.readUnsigned=Rk.readString=Rk.peekBytes=Rk.readBytes=Rk.peekByte=Rk.readByte=Rk.buildStream=void 0;Rk.buildStream=function(t){return{data:t,pos:0}};var Ik=function(){return function(t){return t.data[t.pos++]}};Rk.readByte=Ik;Rk.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var Dk=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};Rk.readBytes=Dk;Rk.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};Rk.readString=function(t){return function(e){return Array.from(Dk(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};Rk.readUnsigned=function(t){return function(e){var i=Dk(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};Rk.readArray=function(t,e){return function(i,n,s){for(var r="function"==typeof e?e(i,n,s):e,a=Dk(t),o=new Array(r),l=0;l=n){var a=n-t.pos;e.push((0,i.readBytes)(a)(t)),s+=a;break}e.push((0,i.readBytes)(r)(t)),s+=r}for(var o=new Uint8Array(s),l=0,h=0;h>=a,g-=a,c>n||c==o)break;if(c==s){r=(1<<(a=d+1))-1,n=s+2,h=-1;continue}if(-1==h){C[m++]=A[c],h=c,f=c;continue}for(l=c,c==n&&(C[m++]=f,c=h);c>s;)C[m++]=A[c],c=S[c];f=255&A[c],C[m++]=f,n<_&&(S[n]=h,A[n]=f,0==(++n&r)&&n<_&&(a++,r+=n)),h=l}m--,x[v++]=C[m],u++}for(u=v;u{const e=Gk(t),i=Nk(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=Gk(this.attribute.gifImage),e=Nk(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=di.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=di.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const n=this.loadedFrames[this.frameIndex||0];2===n.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(n),this.manipulate(t,e,i);const s=(new Date).getTime()-this.lastTime;n.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,n){super.setAttribute(t,e,i,n),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function Kk(t){return new Xk(t)}class $k extends gf{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=gw,this._renderContribitions=void 0,this.builtinContributions=[qk],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=oh(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:u=l.fillStrokeOrder}=t.attribute,d=this.valid(t,l,a);if(!d)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=d,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-n,l),e.stroke()))};u?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,n,f,!1,p,!1,l,s,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,n,f,!1,p,!1,l,s,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,n,f,!1,p,!1,l,s,a)}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=oh(t).image;this._draw(t,s,!1,i)}}const qk=new class extends Tp{constructor(){super(...arguments),this.time=$i.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){t.renderFrame&&t.playing&&t.renderFrame(e,i,n)}};let Zk=!1;function Jk(t){Zk||(Zk=!0,t.bind($k).toDynamicValue((()=>new $k(BA(ag,t)))).inSingletonScope(),t.bind(gu).toService($k))}function Qk(){Fc.RegisterGraphicCreator("gif",Kk)}function tM(){if(tM.__loaded)return;tM.__loaded=!0;const t=xg();Qk(),Jk(t),vw(t)}tM.__loaded=!1;const eM=tM,iM=[{register:ty,bindModule:ev},{register:ey,bindModule:$v},{register:iy,bindModule:cv},{register:ny,bindModule:mv},{register:sy,bindModule:Rv},{register:ry},{register:ay,bindModule:jv},{register:oy,bindModule:ov},{register:ly,bindModule:Sv},{register:hy,bindModule:wv},{register:uy,bindModule:Qv},{register:dy,bindModule:sv},{register:py,bindModule:Gv},{register:gy,bindModule:Fv},{register:vy},{register:cy,bindModule:Bv},{register:fy,bindModule:pv},{register:my,bindModule:_v},{register:yy},{register:Qk}];let nM=!1;const sM=[fC,_C,SC,wC,BC,OC,LC,HC,YC,$C,JC,ew,sw,ow,cw,pw,vw];function rM(t){return{getContributions:t}}function aM(t,{envParams:e,force:i=!1}={}){Vf().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function oM(t,e,{bindEnv:i,bindCanvasModules:n,bindWindowContribution:s},r){Gf(t);const a=Wf();i(a),n(a),s(a),Hf(),aM(e,{envParams:r,force:!0})}function lM(t,e){oM(t,"browser",{bindEnv:Tw,bindCanvasModules:aA,bindWindowContribution:xw},e)}function hM(t,e){oM(t,"node",{bindEnv:ok,bindCanvasModules:yA,bindWindowContribution:rk},e)}function cM(t){Gf(t),function(){if(nM)return;const t=Wf();nM=!0,iM.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),Jk(t),Hf()}(),Xf(t),Yf(t)}function uM(t){Gf(t);const e=Wf();sM.forEach((t=>t(e))),yw(e),Kf(t,hC),function(t){const e=Wf(),i=rM((()=>t.registry.picker.getAll())),n=rM((()=>e.isBound(ou)?e.getAll(ou):[])),s=rM((()=>e.isBound(lu)?e.getAll(lu):[])),r=Vf();di.pickerServiceFactory=()=>new EA(i,{},n,s),di.global=r}(t)}function dM(t){Gf(t);gT(Wf()),Kf(t,PA),function(t){const e=Wf(),i=rM((()=>t.registry.picker.getAll())),n=rM((()=>e.isBound(ou)?e.getAll(ou):[])),s=rM((()=>e.isBound(lu)?e.getAll(lu):[]));di.pickerServiceFactory=()=>new Ew(i,n,s)}(t)}const pM=Td();function gM(){if(gM.__loaded)return;gM.__loaded=!0;const t=xg();ty(),ev({bind:t.bind}),pM?fC(t):Iw(t)}gM.__loaded=!1;const fM=gM;function mM(){if(mM.__loaded)return;mM.__loaded=!0;const t=xg();ey(),_f(),xf(),$v({bind:t.bind}),_C(t)}mM.__loaded=!1;const vM=mM;function yM(){if(yM.__loaded)return;yM.__loaded=!0;const t=xg();iy(),cv({bind:t.bind}),pM?SC(t):Fw(t)}yM.__loaded=!1;const _M=yM;function bM(){if(bM.__loaded)return;bM.__loaded=!0;const t=xg();ny(),mv({bind:t.bind}),pM?wC(t):jw(t)}bM.__loaded=!1;const xM=bM;function SM(){if(SM.__loaded)return;SM.__loaded=!0;const t=xg();sy(),Rv({bind:t.bind}),pM?BC(t):Hw(t)}SM.__loaded=!1;const AM=SM;function CM(){CM.__loaded||(CM.__loaded=!0,ry())}CM.__loaded=!1;const wM=CM;function TM(){if(TM.__loaded)return;TM.__loaded=!0;const t=xg();ay(),jv({bind:t.bind}),pM?OC(t):Yw(t)}TM.__loaded=!1;const kM=TM;function MM(){if(MM.__loaded)return;MM.__loaded=!0;const t=xg();oy(),ov({bind:t.bind}),pM?LC(t):$w(t)}MM.__loaded=!1;const BM=MM;function EM(){if(EM.__loaded)return;EM.__loaded=!0;const t=xg();ly(),Sv({bind:t.bind}),pM?HC(t):eT(t)}EM.__loaded=!1;const PM=EM;function OM(){if(OM.__loaded)return;OM.__loaded=!0;const t=xg();hy(),wv({bind:t.bind}),pM?YC(t):Jw(t)}OM.__loaded=!1;const RM=OM;function IM(){if(IM.__loaded)return;IM.__loaded=!0;const t=xg();uy(),_f(),xf(),Qv({bind:t.bind}),$C(t)}IM.__loaded=!1;const DM=IM;function LM(){if(LM.__loaded)return;LM.__loaded=!0;const t=xg();dy(),sv({bind:t.bind}),pM?JC(t):sT(t)}LM.__loaded=!1;const FM=LM;function UM(){if(UM.__loaded)return;UM.__loaded=!0;const t=xg();py(),Gv({bind:t.bind}),ew(t)}UM.__loaded=!1;const NM=UM;function jM(){if(jM.__loaded)return;jM.__loaded=!0;const t=xg();gy(),Fv({bind:t.bind}),pM?sw(t):oT(t)}jM.__loaded=!1;const zM=jM;function WM(){WM.__loaded||(WM.__loaded=!0,vy())}WM.__loaded=!1;const HM=WM;function VM(){if(VM.__loaded)return;VM.__loaded=!0;const t=xg();cy(),Bv({bind:t.bind}),ow(t)}VM.__loaded=!1;const GM=VM;function YM(){if(YM.__loaded)return;YM.__loaded=!0;const t=xg();fy(),pv({bind:t.bind}),pM?cw(t):cT(t)}YM.__loaded=!1;const XM=YM;function KM(){if(KM.__loaded)return;KM.__loaded=!0;const t=xg();my(),_v({bind:t.bind}),pM?pw(t):pT(t)}KM.__loaded=!1;const $M=KM;function qM(){qM.__loaded||(qM.__loaded=!0,yy())}qM.__loaded=!1;const ZM=qM;function JM(t){if(!t||!u(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}class QM{static registerBuiltInAnimate(t,e){QM.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._activeConfigList=null,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var n,s;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const n=this.resolveValue(t.delay,i,0),s=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=n+r+s,Object.assign(Object.assign({},t),{delay:n,delayAfter:s,duration:r})}));let n=0;l&&(n="number"==typeof l?l:l?e:0),o.oneByOneDelay=n;let s=1;if(r){const t=e+n*(this._target.count-2);s=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*s,delayAfter:t.delayAfter*s,duration:t.duration*s,effects:e.map((t=>{var e,i;const n=null!==(e=t.custom)&&void 0!==e?e:QM.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],s=JM(n);return Object.assign(Object.assign({},t),{custom:n,customType:s})}))})})),o.oneByOneDelay=n*s,o.startTime=a*s}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=u,o.custom=null!==(n=t.custom)&&void 0!==n?n:QM.builtInAnimateMap[null!==(s=t.type)&&void 0!==s?s:"fromTo"];const d=JM(o.custom);o.customType=d;const p=e+h+c+u*(this._target.count-2),g=A(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=u*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,n;return t.partitioner(null===(n=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===n?void 0:n[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var n,s,r,a;return t.sort(null===(s=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===s?void 0:s[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const n=e?(i,n,s)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,n,s);a&&this._trackAnimation(a)}:(i,n,s)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,n,s);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>n(t,e,i.length))):this._target.count<=1?n(this._target,0,1):this._target.forEachChildren(((t,e)=>n(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,n){var s,r,a,o,l,h,c,d;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:C=0,options:w,custom:T,customType:k,controlOptions:M}=t,B=e.animate();B.priority=C;const E=u(v)?v(null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],O=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&O&&(i=null!==(h=P[O])&&void 0!==h?h:i),B.startAt(b);const R=i*x+E;R>0&&B.wait(R);let I=null,D=t.to,L=t.from;const F=this.shouldCommitAttrOutChannel(p);D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.props),L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,T,k,L,D,_,m,f,M,w,p,e);let U=0;x&&(U=x*(n-i-1));const N=u(y)?y(null===(d=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===d?void 0:d[0],e,{}):y;return N>0&&(U+=N),U>0&&B.wait(U),S&&S>0&&B.loop(S),A&&B.bounce(!0),B}_handleRunAnimate(t,e,i,n,s,r,a,o,l,h,c,d){var p,g,f,m,v,y,_,b;if(e&&i){i=JM(e);let c=this.resolveValue(o,d);"function"==typeof c&&(c=c(null===(g=null===(p=d.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],d,{})),c=Object.assign({width:(null===(f=d.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=d.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=u(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=d.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],d,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,n,s,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,s,r,a,c)}else"to"===c?t.to(s,r,a):"from"===c&&t.from(s,r,a)}executeTimelineItem(t,e,i,n){var s,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:u,oneByOneDelay:d,priority:p,controlOptions:g}=t,f=null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*d),c&&c>0&&v.loop(c),u&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),d&&v.wait(d*(n-i-1)),v}applyTimeSliceToAnimate(t,e,i,n){var s,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:d=0}=t,p=u(c)?c(null===(r=null===(s=i.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],i,{}):c,g=u(d)?d(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):d;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var s;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let u=null,d=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);d||(u||(u=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),d=u.props),p||(u||(u=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=u.from),u.attrOutChannel&&i.setAttributes(u.attrOutChannel);const f=null!==(s=t.custom)&&void 0!==s?s:QM.builtInAnimateMap[r],m=t.custom?t.customType:JM(f);this._handleRunAnimate(e,f,m,p,d,h,l,o,n,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,n,s,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,n,s,a,o)=>{e(s,i,n,a,o,t.target,r)},t.to(i,n,s)}shouldCommitAttrOutChannel(t){return"update"!==t}createCustomAnimation(t,e,i,n,s,r,a){const o=new e(i,n,s,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,n){var s;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(s=e.context)||void 0===s?void 0:s.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var n,s,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(s=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===s?void 0:s[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==n?void 0:n[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var n,s;return void 0===t?i:"function"==typeof t&&e?t(null===(s=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===s?void 0:s[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,n=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!n)return null;let s=null;for(let e=0;ethis._executeItem(t,e,i,n))).filter(Boolean)}finally{this._activeConfigList=s}}return[this._executeItem(t,e,i,n)].filter(Boolean)}_executeItem(t,e,i=0,n=1){if(!e)return null;const s="timeSlices"in t;let r=null;const a=this.parseParams(t,s);return r=s?this.executeTimelineItem(a,e,i,n):this.executeTypeConfigItem(a,e,i,n),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=ss.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}QM.builtInAnimateMap={};class tB{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-tB.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*tB.bounceIn(2*t):.5*tB.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/At*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*At/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/At*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*At/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/At*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*At/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*At/e)*.5+1}}static registerFunc(t,e){tB[t]=e}}function eB(t,e){const i=1/e;let n=1;for(;t>i;)t-=i,n*=-1;const s=n*t/i;return s>0?s:1+s}tB.quadIn=tB.getPowIn(2),tB.quadOut=tB.getPowOut(2),tB.quadInOut=tB.getPowInOut(2),tB.cubicIn=tB.getPowIn(3),tB.cubicOut=tB.getPowOut(3),tB.cubicInOut=tB.getPowInOut(3),tB.quartIn=tB.getPowIn(4),tB.quartOut=tB.getPowOut(4),tB.quartInOut=tB.getPowInOut(4),tB.quintIn=tB.getPowIn(5),tB.quintOut=tB.getPowOut(5),tB.quintInOut=tB.getPowInOut(5),tB.backIn=tB.getBackIn(1.7),tB.backOut=tB.getBackOut(1.7),tB.backInOut=tB.getBackInOut(1.7),tB.elasticIn=tB.getElasticIn(1,.3),tB.elasticOut=tB.getElasticOut(1,.3),tB.elasticInOut=tB.getElasticInOut(1,.3*1.5),tB.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),tB.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},tB.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)tB[`flicker${t}`]=e=>eB(e,t);for(let t=2;t<10;t++)tB[`aIn${t}`]=e=>t*e*e+(1-t)*e;function iB(t,e,i){return t+(e-t)*i}const nB=new class{constructor(){this.opacity=(t,e,i,n,s,r)=>{r.attribute.opacity=iB(e,i,n)},this.baseOpacity=(t,e,i,n,s,r)=>{r.attribute.baseOpacity=iB(e,i,n)},this.fillOpacity=(t,e,i,n,s,r)=>{r.attribute.fillOpacity=iB(e,i,n)},this.strokeOpacity=(t,e,i,n,s,r)=>{r.attribute.strokeOpacity=iB(e,i,n)},this.zIndex=(t,e,i,n,s,r)=>{r.attribute.zIndex=iB(e,i,n)},this.backgroundOpacity=(t,e,i,n,s,r)=>{r.attribute.backgroundOpacity=iB(e,i,n)},this.shadowOffsetX=(t,e,i,n,s,r)=>{r.attribute.shadowOffsetX=iB(e,i,n)},this.shadowOffsetY=(t,e,i,n,s,r)=>{r.attribute.shadowOffsetY=iB(e,i,n)},this.shadowBlur=(t,e,i,n,s,r)=>{r.attribute.shadowBlur=iB(e,i,n)},this.fill=(t,e,i,n,s,r)=>{r.attribute.fill=sl(e,i,n,!1)},this.fillPure=(t,e,i,n,s,r)=>{r.attribute.fill=s.fromParsedProps.fill?cl(s.fromParsedProps.fill,s.toParsedProps.fill,n):s.toParsedProps.fill},this.stroke=(t,e,i,n,s,r)=>{r.attribute.stroke=sl(e,i,n,!1)},this.strokePure=(t,e,i,n,s,r)=>{r.attribute.stroke=s.fromParsedProps.stroke?cl(s.fromParsedProps.stroke,s.toParsedProps.stroke,n):s.toParsedProps.stroke},this.width=(t,e,i,n,s,r)=>{r.attribute.width=iB(e,i,n),r.addUpdateBoundTag()},this.height=(t,e,i,n,s,r)=>{r.attribute.height=iB(e,i,n),r.addUpdateBoundTag()},this.x=(t,e,i,n,s,r)=>{r.attribute.x=iB(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,n,s,r)=>{r.attribute.y=iB(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,n,s,r)=>{r.attribute.dx=iB(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,n,s,r)=>{r.attribute.dy=iB(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,n,s,r)=>{r.attribute.angle=iB(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,n,s,r)=>{r.attribute.scaleX=iB(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,n,s,r)=>{r.attribute.scaleY=iB(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,n,s,r)=>{r.attribute.lineWidth=iB(e,i,n),r.addUpdateBoundTag()},this.startAngle=(t,e,i,n,s,r)=>{r.attribute.startAngle=iB(e,i,n),r.addUpdateBoundTag()},this.endAngle=(t,e,i,n,s,r)=>{r.attribute.endAngle=iB(e,i,n),r.addUpdateBoundTag()},this.radius=(t,e,i,n,s,r)=>{r.attribute.radius=iB(e,i,n),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,n,s,r)=>{r.attribute.outerRadius=iB(e,i,n),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,n,s,r)=>{r.attribute.innerRadius=iB(e,i,n),r.addUpdateBoundTag()},this.size=(t,e,i,n,s,r)=>{r.attribute.size=iB(e,i,n),r.addUpdateBoundTag()},this.points=(t,e,i,n,s,r)=>{r.attribute.points=Vs(e,i,n),r.addUpdateBoundTag()}}};function sB(t,e,i,n,s,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*n,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const s=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:Yi.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=n?"function"==typeof n?n:null!==(s=tB[n])&&void 0!==s?s:tB.linear:tB.linear,"wait"===t&&(this.onUpdate=gB),this.id=ci.GenAutoIncrementId(),this.syncAttributeUpdate=gB}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],n=this.props[e];if(y(i)&&y(n)){const s=il.Get(i,el.Color255),r=il.Get(n,el.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=s,this.toParsedProps[e]=r,t.push(nB["fill"===e?"fillPure":"strokePure"])}else nB[e]?t.push(nB[e]):t.push(sB)}else nB[e]?t.push(nB[e]):t.push(sB)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const n=this.interpolateUpdateFunctions,s=this.propKeys;if(n&&s)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const n=e.getStartProps();let s=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,n),this.onUpdate(t,n,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class vB extends mB{constructor(t,e,i,n){super(t,e,i,n)}onStart(){super.onStart();const t=this.getFromProps();dB(this.target,t,Yi.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class yB extends mB{constructor(t,e,i,n,s){super("customAnimate",null!=e?e:{},i,n),this.type="customAnimate",this.customFrom=t,this.params=s,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.onUpdate(t,n,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class _B extends yB{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class bB extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===ss.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,n=i.getContext("2d");return!!n&&(n.clearRect(0,0,i.width,i.height),n.drawImage(e,0,0),i)}}class xB extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const n=this.target.getFinalAttribute(),s=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==n?void 0:n[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:s[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&pB(this.target,a)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),cB(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class SB extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((n=>{var s;e[n]=0,i[n]=null!==(s=t[n])&&void 0!==s?s:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,dB(this.target,i,Yi.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),cB(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class AB extends xB{constructor(t,e,i,n,s){super(t,e,i,n,s),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class CB extends SB{constructor(t,e,i,n,s){super(t,e,i,n,s),this.keys=["clipRange"]}}class wB extends xB{constructor(t,e,i,n,s){super(t,e,i,n,s),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class TB extends SB{constructor(t,e,i,n,s){super(t,e,i,n,s),this.keys=["opacity","fillOpacity","strokeOpacity"]}}class kB extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s),this.from=null!=t?t:{}}applyTransientFromAttributes(){dB(this.target,this.from,Yi.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.runInterpolateUpdate(this.from,this.props,n),this.onUpdate(t,n,i),this.syncAttributeUpdate()}}const MB=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==n?void 0:n.startAngle,endAngle:null==n?void 0:n.endAngle}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s,endAngle:s},to:{startAngle:null==n?void 0:n.startAngle,endAngle:null==n?void 0:n.endAngle}}})(t,e):((t,e,i)=>{const n=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==n?void 0:n.endAngle},to:{startAngle:null==n?void 0:n.startAngle}}:{from:{endAngle:null==n?void 0:n.startAngle},to:{endAngle:null==n?void 0:n.endAngle}}})(t,e)};class BB extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){cB(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){cB(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class EB extends BB{onBind(){var t,e,i;super.onBind();const{from:n,to:s}=MB(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&pB(this.target,r),this.determineUpdateFunction()}}class PB extends BB{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,n=this.params.options,this.params,!1!==(null!==(s=null==n?void 0:n.overall)&&void 0!==s&&s)?((t,e,i)=>{const n=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:n.startAngle,endAngle:n.endAngle},to:{startAngle:t,endAngle:t}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n.startAngle,endAngle:n.endAngle},to:{startAngle:s,endAngle:s}}})(i,n):((t,e,i)=>{const n=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:n.startAngle},to:{startAngle:null==n?void 0:n.endAngle}}:{from:{endAngle:n.endAngle},to:{endAngle:null==n?void 0:n.startAngle}}})(i,n));var i,n,s;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class OB extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const{from:n,to:s}=((t,e,i)=>{const n=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=n.x,e=n.x1,i=n.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=n.y,e=n.y1,i=n.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=n.x,e=n.x1,i=n.width,s=n.y,r=n.y1,a=n.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=s+a/2,o.height=0,o.y1=void 0):(o.y=(s+r)/2,o.y1=(s+r)/2,o.height=void 0),{from:o,to:{x:t,y:s,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&pB(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),cB(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class RB extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const n=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=n.x,e=n.x1,i=n.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=n.y,e=n.y1,i=n.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=n.x,e=n.y,i=n.x1,s=n.y1,r=n.width,a=n.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+s)/2,o.y1=(e+s)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),cB(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const IB=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n,s,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(n=i.groupHeight)&&void 0!==n?n:null===(s=e.layoutRect)||void 0===s?void 0:s.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const n=t.getFinalAttribute(),s=n.y,r=n.y1,a=n.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:s,y1:r,height:a}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:s,y1:r,height:a}}}(t,e)};class DB extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const{from:n,to:s}=IB(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&pB(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){uB(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class LB extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,n=this.params.options,s=this.params,!1!==(null!==(r=null==n?void 0:n.overall)&&void 0!==r&&r)?function(t,e,i){var n,s,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(n=i.groupHeight)&&void 0!==n?n:null===(s=e.layoutRect)||void 0===s?void 0:s.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,n,s):function(t,e,i){const n=t.getFinalAttribute(),s=n.y,r=n.y1,a=n.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,n));var i,n,s,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){uB(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const FB=(t,e,i)=>{const n=t.getFinalAttribute().points,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,e&&e.center&&(A(e.center.x)&&(s.x=e.center.x),A(e.center.y)&&(s.y=e.center.y)),"area"===t.type&&(s.x1=s.x,s.y1=s.y),n.map((t=>Object.assign({},t,s)))};class UB extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onUpdate(t,e,i){var n,s;const r=null===(n=this.from)||void 0===n?void 0:n.points,a=null===(s=this.to)||void 0===s?void 0:s.points;r&&a&&(cB(this.target,{points:r.map(((t,i)=>Hs(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class NB extends UB{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const n=t.getFinalAttribute();return{from:{points:FB(t,e)},to:{points:n.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&pB(this.target,e)}else this.valid=!1}}class jB extends UB{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:n,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:FB(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=n||i,this.to=s}else this.valid=!1;var t,e}}const zB=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class WB extends UB{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const n=t.getFinalAttribute();return{from:{points:zB(t,e)},to:{points:n.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&pB(this.target,e)}else this.valid=!1}}class HB extends UB{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:n,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:zB(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=n||i,this.to=s}else this.valid=!1;var t,e}}const VB=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class GB extends UB{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const n=t.getFinalAttribute();return{from:{points:VB(t,e)},to:{points:n.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&pB(this.target,e)}else this.valid=!1}}class YB extends UB{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:VB(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=null!=i?i:this.target.attribute,this.to=n}else this.valid=!1;var t,e}}const XB=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAttribute(),s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:s,outerRadius:s},to:{innerRadius:null==n?void 0:n.innerRadius,outerRadius:null==n?void 0:n.outerRadius}}})(t,e):((t,e,i)=>{const n=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==n?void 0:n.outerRadius},to:{innerRadius:null==n?void 0:n.innerRadius}}:{from:{outerRadius:null==n?void 0:n.innerRadius},to:{outerRadius:null==n?void 0:n.outerRadius}}})(t,e)};class KB extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),cB(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class $B extends KB{onBind(){var t,e,i;super.onBind();const{from:n,to:s}=XB(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&pB(this.target,r)}}class qB extends KB{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(n=null==i?void 0:i.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAttribute(),s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==n?void 0:n.innerRadius,outerRadius:null==n?void 0:n.outerRadius},to:{innerRadius:s,outerRadius:s}}})(e,i):((t,e,i)=>{const n=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==n?void 0:n.innerRadius},to:{innerRadius:null==n?void 0:n.outerRadius}}:{from:{outerRadius:null==n?void 0:n.outerRadius},to:{outerRadius:null==n?void 0:n.innerRadius}}})(e,i));var e,i,n;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const ZB=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n;const s=t.getFinalAttribute(),r=s.x,a=s.x1,o=s.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const n=t.getFinalAttribute(),s=n.x,r=n.x1,a=n.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:s,x1:r,width:a}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:s,x1:r,width:a}}}(t,e)};class JB extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const{from:n,to:s}=ZB(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&pB(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){uB(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class QB extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,n=this.params.options,s=this.params,!1!==(null!==(r=null==n?void 0:n.overall)&&void 0!==r&&r)?function(t,e,i){var n;const s=t.getFinalAttribute(),r=s.x1,a=s.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,n,s):function(t,e,i){const n=t.getFinalAttribute(),s=n.x,r=n.x1,a=n.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,n));var i,n,s,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){uB(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class tE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),cB(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class eE extends tE{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var n,s,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:d=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(n=p.width)&&void 0!==n?n:t.stage.viewWidth,f=null!==(s=p.height)&&void 0!==s?s:t.stage.viewHeight),g+=o,f+=o;const m=u(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=d.includes("x")?v:m&&A(m.x)?m.x:g,b=d.includes("y")?y:m&&A(m.y)?m.y:f;switch(h){case"x":return{from:{x:d.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&pB(this.target,e)}}class iE extends tE{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var n,s,r,a;const{offset:o=0,orient:l,direction:h,point:c}=null!=e?e:{},d=i.group?i.group.AABBBounds:null,p=null!==(n=d.width())&&void 0!==n?n:i.width,g=null!==(s=d.height())&&void 0!==s?s:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=u(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,y=v&&A(v.x)?v.x:f,_=v&&A(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class nE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s),this.formatTemplate=null,this.decimalLength=null==s?void 0:s.decimalLength,(null==s?void 0:s.formatTemplate)&&s.formatTemplate.includes("{{var}}")&&(this.formatTemplate=s.formatTemplate)}onFirstRun(){var t,e,i;const n=this.getLastProps(),s=this.getEndProps(),r=null!==(t=n.text)&&void 0!==t?t:0,a=null!==(e=s.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",u=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=u)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const n=this.fromNumber+(this.toNumber-this.fromNumber)*e;let s="";const r=this.format,a=("%"===r?100*n:n).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;s=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,dB(this.target,{text:s})}}class sE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),cB(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rE extends sE{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const n=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let s=0;return s=ot(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&pB(this.target,e)}}class aE extends sE{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const n=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let s=0;return s=ot(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class oE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f,m,v,y,_,b,x,S;let A,C;super.onBind();const w=this.target.getFinalAttribute(),T=null!==(t=this.target.attribute)&&void 0!==t?t:{},k=null===(e=this.params)||void 0===e?void 0:e.options,M=null!==(n=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==n?n:null==k?void 0:k.direction,B=null!==(l=null!==(a=null!==(r=null===(s=this.params)||void 0===s?void 0:s.fromScaleX)&&void 0!==r?r:null==k?void 0:k.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==k?void 0:k.fromScale,E=null!==(p=null!==(u=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==k?void 0:k.fromScaleY)&&void 0!==u?u:null===(d=this.params)||void 0===d?void 0:d.fromScale)&&void 0!==p?p:null==k?void 0:k.fromScale;switch(M){case"x":A={scaleX:null!==(g=null!=B?B:T.scaleX)&&void 0!==g?g:0},C={scaleX:null!==(f=null==w?void 0:w.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=E?E:T.scaleY)&&void 0!==m?m:0},C={scaleY:null!==(v=null==w?void 0:w.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=B?B:T.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=E?E:T.scaleY)&&void 0!==_?_:0},C={scaleX:null!==(b=null==w?void 0:w.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==w?void 0:w.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=C,this.from=A,this.to=C,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&pB(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const n={};e&&(n.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(n.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),cB(this.target,n)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class lE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i,n,s;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(n=null==o?void 0:o.scaleX)&&void 0!==n?n:1,scaleY:null!==(s=null==o?void 0:o.scaleY)&&void 0!==s?s:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),cB(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class hE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,n),this.onUpdate(t,n,i),this.syncAttributeUpdate()}}function cE(t,e,i,n){const s=function(t,e,i,n){var s;const r=t,a=null===(s=r.context)||void 0===s?void 0:s.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;tuE[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&cE(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,n),this.syncParentClipPathToTarget(),this.onUpdate(t,n,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,n=i.parent,s=null===(t=null==n?void 0:n.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==n?void 0:n.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(s)||!s.length)return;const r=this.getClipPathSyncChildIndex(n);if(r<0||r>=s.length)return;const a=s[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(cB(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,n)=>t===e&&(i=n,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const n=this.target,s=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&s&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=s[t])&&void 0!==e?e:null===(i=n.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const n=this.target;return null!==(i=null!==(e=null===(t=n.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:n.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,n={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var s;const r=null===(s=i.attribute)||void 0===s?void 0:s[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(n[e]=r)})),Object.keys(n).length?n:null}}class gE{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new QM(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function fE(t){return new gE(t)}class mE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==s?void 0:s.showCursor)&&(this.showCursor=s.showCursor),void 0!==(null==s?void 0:s.cursorChar)&&(this.cursorChar=s.cursorChar),void 0!==(null==s?void 0:s.blinkCursor)&&(this.blinkCursor=s.blinkCursor),void 0!==(null==s?void 0:s.beforeText)&&(this.beforeText=s.beforeText),void 0!==(null==s?void 0:s.afterText)&&(this.afterText=s.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),n=this.getEndProps(),s=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=n.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=s.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const n=this.toText.length,s=this.fromText.length;let r,a;s>n?(r=Math.round(s-(s-n)*e),a=this.fromText.substring(0,r)):(r=Math.round(s+(n-s)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=s?this.fromText.substring(0,r):this.toText.substring(0,r-s+Math.min(s,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;dB(this.target,{text:o})}}class vE extends _B{onBind(){super.onBind();const t=fE(this.target);this._animator=t;const e=this.duration,i=this.easing,n=this.target,{symbolStartOuterType:s="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(pB(n._symbolStart,{scaleX:0,scaleY:0}),t.animate(n._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===s?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),pB(n._symbolStartOuter,l),t.animate(n._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),pB(n._symbolEnd,{scaleX:0,scaleY:0}),t.animate(n._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),pB(n._line,{clipRange:0}),t.animate(n._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=n._titleTop.attribute.text;pB(n._titleTop,{text:""}),t.animate(n._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:mE});const i=n._titleBottom.attribute.text;pB(n._titleBottom,{text:""}),t.animate(n._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:mE})}else pB(n._titleTop,{dy:n._titleTop.AABBBounds.height()+10}),t.animate(n._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),pB(n._titleBottom,{dy:-(10+n._titleBottom.AABBBounds.height())}),t.animate(n._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[n._titleTopPanel,n._titleBottomPanel].forEach((n=>{var s;const r=null!==(s=n.attribute.scaleX)&&void 0!==s?s:1;pB(n,{scaleX:0}),t.animate(n,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[n._titleTopPanel,n._titleBottomPanel].forEach((n=>{const s=n.AABBBounds,r=2*(s.width()+s.height());pB(n,{lineDash:[0,10*r]}),t.animate(n,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class yE extends _B{onBind(){super.onBind();const t=fE(this.target);this._animator=t;const e=this.duration,i=this.easing,n=this.target,{mode:s}=this.params;"scale"===s?t.animate(n._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(n._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(n._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(n._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(n._titleTop,{type:"to",to:{dy:n._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(n._titleBottom,{type:"to",to:{dy:-(10+n._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(n._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(n._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(n._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class _E extends _B{onBind(){super.onBind();const t=fE(this.target);this._animator=t;const e=this.duration,i=this.easing,n=this.target,{wave:s}=this.params;if(pB(n,{scaleX:0,scaleY:0}),t.animate(n,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),n.titleShape&&t.animate(n.titleShape,{type:"custom",to:{text:n.titleShape.attribute.text},duration:e,easing:i,custom:mE}),n.contentShape&&t.animate(n.contentShape,{type:"custom",to:{text:n.contentShape.attribute.text},duration:e,easing:i,custom:mE}),s){const r=e/6;t.animate(n.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:s},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-s},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:s},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class bE extends _B{onBind(){super.onBind();const t=fE(this.target);this._animator=t;const e=this.duration,i=this.easing,n=this.target;t.animate(n,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class xE extends bB{constructor(t,e,i,n,s){super(t,e,i,n,s),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=wg.createCanvas({width:t.width,height:t.height,dpr:wg.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),n=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!n)return null;const s=this.gl.createProgram();return s?(this.gl.attachShader(s,i),this.gl.attachShader(s,n),this.gl.linkProgram(s),this.gl.getProgramParameter(s,this.gl.LINK_STATUS)?s:(console.error("Shader program link error:",this.gl.getProgramInfoLog(s)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=wg.createCanvas({width:t.width,height:t.height,dpr:wg.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==xE.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class SE extends xE{constructor(t,e,i,n,s){super(t,e,i,n,s)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class AE extends xE{constructor(t,e,i,n,s){super(t,e,i,n,s)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==AE.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==AE.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,n;let s=null;if(!1!==(null===(n=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===n?void 0:n.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(s=this.applyWebGLEffect(e),s)return s;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(s=this.applyCanvas2DEffect(e),s)return s;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(s=this.applyCanvas2DEffect(e),s)return s;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class CE{static createTempCanvas(t,e,i){return wg.createCanvas({width:t,height:e,dpr:i||wg.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const n=Math.max(0,Math.min(1,(i-t)/(e-t)));return n*n*(3-2*n)}static distance(t,e,i,n){const s=i-t,r=n-e;return Math.sqrt(s*s+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const n=Math.floor(t/i)*i,s=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*n+78.233*s);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,n,s)}static blendImageData(t,e,i){const{data:n,width:s,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(n.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=CE.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const n=this.createFullScreenQuad();return n?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(n),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),n=this.gl.getUniformLocation(this.program,"u_dissolveType"),s=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(s,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(n,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:n}=e,s=n.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(s,r);break;case"inward":a=this.applyInwardDissolve(s,r);break;case"radial":a=this.applyRadialDissolve(s,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(s,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(s,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(s,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(s,r);break;default:a=s}return n.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:n,height:s}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=n/2,o=s/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)d+=.4*(CE.pixelNoise(i,t,h)-.5),p=u>d?0:1;else if(this.dissolveConfig.fadeEdge){const t=d-.15;p=ud?0:1-(u-t)/(d-t)}else p=u>d?0:1;const g=4*(t*n+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,n,s)}applyInwardDissolve(t,e){const{data:i,width:n,height:s}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=n/2,o=s/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)d+=.4*(CE.pixelNoise(i,t,h)-.5),p=ut?1:(u-d)/(t-d)}else p=u0)u+=.3*(CE.pixelNoise(i,t,l)-.5),d=ct?1:(c-u)/(t-u)}else d=c0)o+=.3*(CE.pixelNoise(i,t,a)-.5),l=st?1:(s-o)/(t-o)}else l=s0)o+=.3*(CE.pixelNoise(i,t,a)-.5),l=s>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=so?0:1-(s-t)/(o-t)}else l=s>o?0:1;const h=4*(t*n+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,n,s)}applyTopToBottomDissolve(t,e){const{data:i,width:n,height:s}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(CE.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(CE.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*n+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,n,s)}}class kE extends AE{constructor(t,e,i,n,s){var r,a,o;super(t,e,i,n,s),this.distortionConfig={distortionType:(null===(r=null==s?void 0:s.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==s?void 0:s.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==s?void 0:s.options)||void 0===o?void 0:o.useWebGL)||s.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),n=this.gl.getUniformLocation(this.program,"u_distortionType"),s=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(s,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(n,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const n=i.getImageData(0,0,t.width,t.height),s=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(n,this.distortionConfig.strength,s);break;case"ripple":r=this.applyRippleDistortion(n,this.distortionConfig.strength,s);break;case"swirl":r=this.applySwirlDistortion(n,this.distortionConfig.strength,s);break;default:r=n}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:n,width:s,height:r}=t,a=new Uint8ClampedArray(n.length);for(let t=0;t=0&&c=0&&u=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class PE extends AE{constructor(t,e,i,n,s){var r,a,o,l,h;super(t,e,i,n,s),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==s?void 0:s.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==s?void 0:s.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==s?void 0:s.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==s?void 0:s.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==s?void 0:s.options)||void 0===h?void 0:h.useWebGL)||s.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:n}=e,s=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(n,t,s);break;case"gravity":this.applyCanvas2DGravity(n,t,s);break;case"vortex":this.applyCanvas2DVortex(n,t,s);break;default:n.globalAlpha=Math.max(0,1-s),n.drawImage(t,0,0)}return i}extractParticles(t){const e=CE.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const n=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const s=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const n=r/e.width*t.width,s=i/e.height*t.height,c={x:n,y:s,originX:n,originY:s,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,n=this.currentAnimationRatio,s=this.getDurationFromParent(),r=s<2e3,a=r?Math.max(1.5,3e3/s):1,o=r?Math.min(2,2e3/s):1;this.particles.forEach((s=>{const l=s.x-e,h=s.y-i,c=Math.sqrt(l*l+h*h),u=Math.atan2(h,l);this.applyParticleForces(s,u,c,n,o,t),this.updateParticleProperties(s,n,r,a,o)}))}applyParticleForces(t,e,i,n,s,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=n*this.particleConfig.strength*s*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,n,s,r,a);break;case"vortex":this.applyVortexEffect(t,n,s,r,e,i)}}applyGravityEffect(t,e,i,n,s){const r=(t.originX+.7*t.originY)/(n.width+n.height)*.8;if(e>r){const n=(e-r)/(1-r),a=this.particleConfig.strength*n*n*12*i;t.vy+=a;const o=Math.sin(3*s+.02*t.originX)*Math.cos(2*s+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,n,s,r){const a=n.width/2,o=n.height/2,l=s+e*Math.PI*.8,h=r+e*Math.max(n.width,n.height)*.7*1.8,c=a+Math.cos(l)*h,u=o+Math.sin(l)*h,d=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*d,t.vy+=(u-t.y)*d}updateParticleProperties(t,e,i,n,s){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/n);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),n=new Float32Array(this.particles.length);this.particles.forEach(((t,s)=>{e[2*s]=t.x,e[2*s+1]=t.y,i[4*s]=t.r,i[4*s+1]=t.g,i[4*s+2]=t.b,i[4*s+3]=Math.max(.1,t.a),n[s]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,n),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,n){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const s=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(s),t.vertexAttribPointer(s,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,n,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),n=t.getUniformLocation(this.program,"u_forceStrength"),s=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(n,this.particleConfig.strength),t.uniform1i(s,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const n=e.width/2,s=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(n,s);const r=1+.5*i;t.scale(r,r),t.translate(-n,-s),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const n=i*e.height*.3;t.drawImage(e,0,n),t.restore()}applyCanvas2DVortex(t,e,i){const n=e.width/2,s=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(n,s),t.rotate(i*Math.PI*2),t.translate(-n,-s),t.drawImage(e,0,0),t.restore()}}class OE extends xE{constructor(t,e,i,n,s){var r,a;super(t,e,i,n,s),this.pixelationConfig={maxPixelSize:(null===(r=null==s?void 0:s.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==s?void 0:s.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:n}=t,s=Math.ceil(i/e),r=Math.ceil(n/e),a=wg.createCanvas({width:s,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=wg.createCanvas({width:i,height:n,dpr:wg.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,s,r),h.drawImage(a,0,0,i,n),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class RE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==s?void 0:s.showCursor)&&(this.showCursor=s.showCursor),void 0!==(null==s?void 0:s.cursorChar)&&(this.cursorChar=s.cursorChar),void 0!==(null==s?void 0:s.blinkCursor)&&(this.blinkCursor=s.blinkCursor),void 0!==(null==s?void 0:s.fadeInChars)&&(this.fadeInChars=s.fadeInChars),void 0!==(null==s?void 0:s.fadeInDuration)&&(this.fadeInDuration=s.fadeInDuration),void 0!==(null==s?void 0:s.strokeFirst)&&(this.strokeFirst=s.strokeFirst),void 0!==(null==s?void 0:s.strokeToFillRatio)&&(this.strokeToFillRatio=s.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?hc.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=hc.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const n=this.toTextConfig.length,s=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(s>n)a=Math.round(s-(s-n)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(s+(n-s)*t)}else a=Math.round(s+(n-s)*e);if(o=s>n?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const s=Object.assign({},t);if(this.strokeFirst){const t=i/n*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in s&&s.fill&&(s.stroke=s.fill,l<1&&(s.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));s.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/n*r)/this.fadeInDuration;s.opacity=Math.max(0,Math.min(1,t))}return s}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}dB(this.target,{textConfig:o})}}class IE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==s?void 0:s.showCursor)&&(this.showCursor=s.showCursor),void 0!==(null==s?void 0:s.cursorChar)&&(this.cursorChar=s.cursorChar),void 0!==(null==s?void 0:s.blinkCursor)&&(this.blinkCursor=s.blinkCursor),void 0!==(null==s?void 0:s.beforeText)&&(this.beforeText=s.beforeText),void 0!==(null==s?void 0:s.afterText)&&(this.afterText=s.afterText),void 0!==(null==s?void 0:s.fadeOutChars)&&(this.fadeOutChars=s.fadeOutChars),void 0!==(null==s?void 0:s.fadeOutDuration)&&(this.fadeOutDuration=s.fadeOutDuration),void 0!==(null==s?void 0:s.direction)&&(this.direction=s.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=hc.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?hc.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const n=this.fromTextConfig.length,s=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/s);r=Math.round(n*(1-t))}else r=Math.round(n*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(n-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,n,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),dB(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/s);r=Math.round(n*(1-t))}else r=Math.round(n*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,n,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),dB(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,n){const s=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,s));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const n=[...t];return"forward"===this.direction?n[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):n[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),n}}return t}}class DE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==s?void 0:s.fadeOutDuration)&&(this.fadeOutDuration=s.fadeOutDuration),void 0!==(null==s?void 0:s.slideDirection)&&(this.slideDirection=s.slideDirection),void 0!==(null==s?void 0:s.slideDistance)&&(this.slideDistance=s.slideDistance),void 0!==(null==s?void 0:s.wordByWord)&&(this.wordByWord=s.wordByWord),void 0!==(null==s?void 0:s.wordRegex)&&(this.wordRegex=s.wordRegex),void 0!==(null==s?void 0:s.reverseOrder)&&(this.reverseOrder=s.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=hc.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?hc.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,n=0;for((this.fromTextConfig.forEach(((i,s)=>{if("text"in i){const r=String(i.text);t+=r,e[n]=s,n++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,n=i.index+i[0].length,s=[];for(let i=t;i0&&this.wordGroups.push(s)}const s=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>s.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const n=1-this.fadeOutDuration;let s;s=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,n):this.updateByCharacter(e,n),dB(this.target,{textConfig:s})}updateByWord(t,e){const i=this.wordGroups.length,n=[...this.singleCharConfig];for(let s=0;s0?hc.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=hc.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,n=0;for((this.toTextConfig.forEach(((i,s)=>{if("text"in i){const r=String(i.text);t+=r,e[n]=s,n++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,n=i.index+i[0].length,s=[];for(let i=t;i0&&this.wordGroups.push(s)}const s=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>s.add(t)))}));for(let t=0;t0?this.updateByWord(e,n):this.updateByCharacter(e,n),dB(this.target,{textConfig:s})}updateByWord(t,e){const i=this.wordGroups.length,n=[...this.singleCharConfig];for(let s=0;s{s[t]=e[t]+(i[t]-e[t])*n})),s}function NE(t,e){cB(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class jE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i,n,s,r,a,o,l,h,c,u;super.onBind();const d=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==n?n:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(s=d.y)&&void 0!==s?s:0)-g,v.y=null!==(r=d.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=d.y)&&void 0!==a?a:0)+g,v.y=null!==(o=d.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=d.x)&&void 0!==l?l:0)-g,v.x=null!==(h=d.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=d.x)&&void 0!==c?c:0)+g,v.x=null!==(u=d.x)&&void 0!==u?u:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,pB(this.target,m)}onUpdate(t,e,i){NE(this.target,UE(this.propKeys,this.from,this.to,e))}}class zE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i,n,s,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(s=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==s?s:0,u={opacity:c,baseOpacity:c},d={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(u.scaleX=l,d.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(u.scaleY=l,d.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=u,this.to=d,this.props=d,pB(this.target,u)}onUpdate(t,e,i){NE(this.target,UE(this.propKeys,this.from,this.to,e))}}class WE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i,n,s,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,u=null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==n?n:0,d=null!==(r=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==r?r:0,p={opacity:d,baseOpacity:d,angle:c,scaleX:u,scaleY:u},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,pB(this.target,p)}onUpdate(t,e,i){NE(this.target,UE(this.propKeys,this.from,this.to,e))}}class HE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,n=null!==(t=i.width)&&void 0!==t?t:100,s=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(n+s)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(n=t.radiusX)&&void 0!==n?n:50,i=null!==(s=t.radiusY)&&void 0!==s?s:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(d=null===(u=this.params)||void 0===u?void 0:u.dashLength)&&void 0!==d?d:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,pB(this.target,this.from)}onUpdate(t,e,i){var n;const s={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(n=this.params)||void 0===n?void 0:n.showFill)&&(s.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),dB(this.target,s)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class VE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,n=null!==(t=i.width)&&void 0!==t?t:100,s=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(n+s)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(n=t.radiusX)&&void 0!==n?n:50,i=null!==(s=t.radiusY)&&void 0!==s?s:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(d=null===(u=this.params)||void 0===u?void 0:u.dashLength)&&void 0!==d?d:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,pB(this.target,this.from)}onUpdate(t,e,i){var n;const s={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(n=this.params)||void 0===n?void 0:n.showFill)&&(s.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),dB(this.target,s)}}class GE extends yB{constructor(t,e,i,n,s){var r;super(t,e,i,n,s);const a=null!==(r=null==s?void 0:s.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,n,s,r;super.onBind();const a=new QM(this.target);a.execute({type:"custom",custom:jE,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==n?n:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:zE,customParameters:{fromScale:(null===(s=this.params)||void 0===s?void 0:s.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class YE extends yB{constructor(t,e,i,n,s){var r;super(t,e,i,n,s);const a=null!==(r=null==s?void 0:s.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,n,s,r;super.onBind();const a=new QM(this.target);a.execute({type:"custom",custom:jE,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==n?n:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:WE,customParameters:{fromAngle:(null===(s=this.params)||void 0===s?void 0:s.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class XE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onFirstRun(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==n?n:1,y=null!==(r=null===(s=this.params)||void 0===s?void 0:s.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(u=g.x)&&void 0!==u?u:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(d=g.x)&&void 0!==d?d:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){NE(this.target,UE(this.propKeys,this.from,this.to,e))}}class KE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onFirstRun(){var t,e,i,n,s,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,u=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",d=null!==(s=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==s?s:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:d,baseOpacity:d},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==u&&"xy"!==u||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==u&&"xy"!==u||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){NE(this.target,UE(this.propKeys,this.from,this.to,e))}}class $E extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}onFirstRun(){var t,e,i,n,s,r,a,o,l,h,c;const u=this.target.getAttributes(),d=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==n?n:0,g=null!==(r=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=u.angle)&&void 0!==l?l:0,scaleX:null!==(h=u.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=u.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:d,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){NE(this.target,UE(this.propKeys,this.from,this.to,e))}}class qE extends yB{constructor(t,e,i,n,s){var r;super(t,e,i,n,s);const a=null!==(r=null==s?void 0:s.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,n;const s=new QM(this.target);s.execute({type:"custom",custom:KE,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),s.execute({type:"custom",custom:XE,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(n=this.params)||void 0===n?void 0:n.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class ZE extends yB{constructor(t,e,i,n,s){var r;super(t,e,i,n,s);const a=null!==(r=null==s?void 0:s.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,n;const s=new QM(this.target);s.execute({type:"custom",custom:$E,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),s.execute({type:"custom",custom:XE,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(n=this.params)||void 0===n?void 0:n.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class JE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==s?void 0:s.pulseCount)&&(this.pulseCount=s.pulseCount),void 0!==(null==s?void 0:s.pulseScale)&&(this.pulseScale=s.pulseScale),void 0!==(null==s?void 0:s.pulseColor)&&(this.pulseColor=s.pulseColor),void 0!==(null==s?void 0:s.pulseColorIntensity)&&(this.pulseColorIntensity=s.pulseColorIntensity),void 0!==(null==s?void 0:s.strokeOnly)&&(this.strokeOnly=s.strokeOnly),void 0!==(null==s?void 0:s.fillOnly)&&(this.fillOnly=s.fillOnly),void 0!==(null==s?void 0:s.useScale)&&(this.useScale=s.useScale),void 0!==(null==s?void 0:s.useOpacity)&&(this.useOpacity=s.useOpacity),void 0!==(null==s?void 0:s.useStroke)&&(this.useStroke=s.useStroke),void 0!==(null==s?void 0:s.useFill)&&(this.useFill=s.useFill),void 0!==(null==s?void 0:s.useColor)&&(this.useColor=s.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const n=e*Math.PI*this.pulseCount,s=Math.abs(Math.sin(n)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*s;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*s;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,s),cB(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=sl(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=sl(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class QE extends yB{constructor(t,e,i,n,s){super(t,e,i,n,s)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),n=di.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=n,n.pathProxy=new Zn,i.add(n)}onStartRect(){var t,e,i;const n=this.target.attachShadow(),s=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=s?"height":"width",a=s?"width":"height",o=this.target.AABBBounds[r](),l=s?0:this.target.AABBBounds.y1,h=di.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,n.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var n,s,r,a,o,l,h,c,u,d,p,g,f,m,v,y;const _=null===(s=null===(n=this.params)||void 0===n?void 0:n.isHorizontal)||void 0===s||s,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,n=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,s=null!==(u=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==u?u:60,d=-s,p=d+(n-d)*e,g=Math.max(p,0),f=Math.min(Math.min(p+s,s),n-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Yi.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(d=b.height)&&void 0!==d?d:Math.abs(b.y1-b.y))&&void 0!==p?p:250,n=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,s=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(n+s)*e;let a=Math.min(r,i);const o=Math.min(i-r,s);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Yi.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const n=this.line||this.area;if(!n)return;const s=n.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(s,r,t,e,i):this._onUpdateLineWithoutCache(s,r,t,e,i);const a=r.attribute;n.setAttributes(Object.assign({stroke:a.stroke},n.attribute)),n.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,n,s){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const s=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,s,n)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,s=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,s,n)}}_updateCurves(t,e,i,n){var s,r;const a=i*n,o=Math.min(a+(null!==(r=null===(s=this.params)||void 0===s?void 0:s.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,n.p2&&n.p3){const[e,i]=un(n,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=n.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(n.p2&&n.p3){c&&(u=(o-a)/c.getLength());const[e]=un(c||n,u);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=n.getPointAt(u);t.lineTo(e.x,e.y)}break}if(h)if(n.p2&&n.p3){const e=c||n;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(n.p1.x,n.p1.y);l+=s}}_onUpdateLineWithoutCache(t,e,i,n,s){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&d.push(Ut.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pu){d.push(Ut.pointAtPP(o[t-1],o[t],1-(p+e-u)/e));break}d.length&&d.push(o[t]),p+=e}if(d.length&&!(d.length<2)){t.clear(),t.moveTo(d[0].x,d[0].y);for(let e=1;e({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var n,s,r,a;let o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get(e);return o?o(i,t):(o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let n=this.transitions.get(t);n||(n=new Map,this.transitions.set(t,n)),n.set(e,i)}}tP.getInstance();const eP="appear",iP="disappear",nP="update",sP="highlight",rP="unhighlight";class aP{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class oP{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const n={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);n.allowTransition=n.allowTransition&&i.allowTransition})),n.allowTransition&&(o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new QM(this.graphic)}),r.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new QM(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var s;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(s=this.stateList)&&void 0!==s?s:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==n)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([eP],[{name:eP,animation:t}],e)}applyDisappearState(t,e){this.applyState([iP],[{name:iP,animation:t}],e)}applyUpdateState(t,e){this.applyState([nP],[{name:nP,animation:t}],e)}applyHighlightState(t,e){this.applyState([sP],[{name:sP,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([rP],[{name:rP,animation:t}],e)}stopState(t,e){var i;const n=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));n&&n.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class lP{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new oP(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new aP(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((n=>{n.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class hP extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=ci.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const n=e.next;t(e.animate,i),i++,e=n}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===ss.END?this.removeAnimate(t,!0):t.status!==ss.RUNNING&&t.status!==ss.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const cP=new hP;function uP(t,e){for(let i=0;i{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const n=new mB(ns.to,t,e,i);return n.bind(this.target,this),this.updateStepAfterAppend(n),this}wait(t){const e=new vB(ns.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const n=new kB(t,{},e,i);return n.bind(this.target,this),this.updateStepAfterAppend(n),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===ss.RUNNING&&(this.status=ss.PAUSED)}resume(){this.status===ss.PAUSED&&(this.status=ss.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,n;if(this.status===ss.END)return void console.warn("aaa 动画已经结束,不能推进");const s=this.currentTime+t;if(s=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=ss.END,this.target.restoreStaticAttribute(),void(this.__skipRestoreStaticAttributeOnRemove=!0);this.status=ss.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=s;let r=s-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(s-this._startTime)%this._duration;const t=Math.floor((s-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&dB(this.target,this._startProps,Yi.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(n=this.lastRunStep)||void 0===n||n.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const gP=new gi;class fP{constructor(){this.released=!1}tick(t,e){gP.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class mP extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const n=t.getTime();this._lastTickTime=n,this.lastFrameTime<0&&(this.lastFrameTime=n-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const s=n-this.lastFrameTime,r=this.checkSkip(s);return r||(this._handlerTick(s),this.lastFrameTime=n,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===is.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=is.INITIAL,di.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),di.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new fP;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==is.INITIAL&&(this.status=is.PAUSE,!0)}resume(){return this.status!==is.INITIAL&&(this.status=is.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===is.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===is.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=is.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=is.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===is.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===is.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,di.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,n;return"performance"!==(null===(n=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===n?void 0:n.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}const yP=Symbol.for("vrender.bootstrap.state"),_P=new WeakMap;function bP(t,e){var i;const n=null!==(i=t[yP])&&void 0!==i?i:new Set;return t[yP]=n,!n.has(e)&&(n.add(e),!0)}function xP(t,e){var i,n,s,r;const a=null!==(i=null==t?void 0:t.type)&&void 0!==i?i:"unknown",o=null!==(n=null==t?void 0:t.numberType)&&void 0!==n?n:"unknown",l=null!==(r=null===(s=null==t?void 0:t.constructor)||void 0===s?void 0:s.name)&&void 0!==r?r:"anonymous";return`${e}:${String(o)}:${String(a)}:${l}`}function SP(t,e){let i=_P.get(t);i||(i=new Map,_P.set(t,i));let n=i.get(e);return n||(n=new Set,i.set(e,n)),n}function AP(t,e,i){const n=SP(t,e);i&&n.forEach((t=>i(t))),n.clear()}function CP(t){var e,i;const n=null!==(e=xg().getAll(gu))&&void 0!==e?e:[],s=SP(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;AP(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),n.forEach((e=>{var i;const n=xP(e,"vrender:legacy-renderer");r.has(n)||(r.add(n),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(n,e),s.add(n))}))}function wP(t,e){var i,n;const s=null!==(i=xg().getAll(e))&&void 0!==i?i:[],r=SP(t.registry.picker,"vrender:legacy-picker"),a=new Set;AP(t.registry.picker,"vrender:legacy-picker",null===(n=t.registry.picker.unregister)||void 0===n?void 0:n.bind(t.registry.picker)),s.forEach((e=>{const i=xP(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const TP=lM,kP=hM,MP={taro:{installEnv:function(t,e){oM(t,"taro",{bindEnv:dk,bindCanvasModules:xA,bindWindowContribution:ck},e)},loadEnv:pk},feishu:{installEnv:function(t,e){oM(t,"feishu",{bindEnv:AT,bindCanvasModules:hA,bindWindowContribution:Bw},e)},loadEnv:CT},tt:{installEnv:function(t,e){oM(t,"tt",{bindEnv:_k,bindCanvasModules:CA,bindWindowContribution:fk},e)},loadEnv:bk},wx:{installEnv:function(t,e){oM(t,"wx",{bindEnv:Mk,bindCanvasModules:kA,bindWindowContribution:Ck},e)},loadEnv:Bk},lynx:{installEnv:function(t,e){oM(t,"lynx",{bindEnv:ik,bindCanvasModules:fA,bindWindowContribution:GT},e)},loadEnv:nk},harmony:{installEnv:function(t,e){oM(t,"harmony",{bindEnv:NT,bindCanvasModules:dA,bindWindowContribution:BT},e)},loadEnv:jT}},BP=[ky,Cy,by,Sy,_f,xf],EP=[()=>{QM.registerBuiltInAnimate("increaseCount",nE),QM.registerBuiltInAnimate("fromTo",kB),QM.registerBuiltInAnimate("scaleIn",oE),QM.registerBuiltInAnimate("scaleOut",lE),QM.registerBuiltInAnimate("growHeightIn",DB),QM.registerBuiltInAnimate("growHeightOut",LB),QM.registerBuiltInAnimate("growWidthIn",JB),QM.registerBuiltInAnimate("growWidthOut",QB),QM.registerBuiltInAnimate("growCenterIn",OB),QM.registerBuiltInAnimate("growCenterOut",RB),QM.registerBuiltInAnimate("clipIn",AB),QM.registerBuiltInAnimate("clipOut",CB),QM.registerBuiltInAnimate("fadeIn",wB),QM.registerBuiltInAnimate("fadeOut",TB),QM.registerBuiltInAnimate("growPointsIn",NB),QM.registerBuiltInAnimate("growPointsOut",jB),QM.registerBuiltInAnimate("growPointsXIn",WB),QM.registerBuiltInAnimate("growPointsXOut",HB),QM.registerBuiltInAnimate("growPointsYIn",GB),QM.registerBuiltInAnimate("growPointsYOut",YB),QM.registerBuiltInAnimate("growAngleIn",EB),QM.registerBuiltInAnimate("growAngleOut",PB),QM.registerBuiltInAnimate("growRadiusIn",$B),QM.registerBuiltInAnimate("growRadiusOut",qB),QM.registerBuiltInAnimate("moveIn",eE),QM.registerBuiltInAnimate("moveOut",iE),QM.registerBuiltInAnimate("rotateIn",rE),QM.registerBuiltInAnimate("rotateOut",aE),QM.registerBuiltInAnimate("update",pE),QM.registerBuiltInAnimate("state",hE),QM.registerBuiltInAnimate("labelItemAppear",vE),QM.registerBuiltInAnimate("labelItemDisappear",yE),QM.registerBuiltInAnimate("poptipAppear",_E),QM.registerBuiltInAnimate("poptipDisappear",bE),QM.registerBuiltInAnimate("inputText",mE),QM.registerBuiltInAnimate("inputRichText",RE),QM.registerBuiltInAnimate("outputRichText",IE),QM.registerBuiltInAnimate("slideRichText",LE),QM.registerBuiltInAnimate("slideOutRichText",DE),QM.registerBuiltInAnimate("slideIn",jE),QM.registerBuiltInAnimate("growIn",zE),QM.registerBuiltInAnimate("spinIn",WE),QM.registerBuiltInAnimate("moveScaleIn",GE),QM.registerBuiltInAnimate("moveRotateIn",YE),QM.registerBuiltInAnimate("strokeIn",HE),QM.registerBuiltInAnimate("slideOut",XE),QM.registerBuiltInAnimate("growOut",KE),QM.registerBuiltInAnimate("spinOut",$E),QM.registerBuiltInAnimate("moveScaleOut",qE),QM.registerBuiltInAnimate("moveRotateOut",ZE),QM.registerBuiltInAnimate("strokeOut",VE),QM.registerBuiltInAnimate("pulse",JE),QM.registerBuiltInAnimate("MotionPath",FE),QM.registerBuiltInAnimate("streamLight",QE),QM.registerBuiltInAnimate("dissolve",TE),QM.registerBuiltInAnimate("grayscale",EE),QM.registerBuiltInAnimate("distortion",kE),QM.registerBuiltInAnimate("particle",PE),QM.registerBuiltInAnimate("glitch",BE),QM.registerBuiltInAnimate("gaussianBlur",ME),QM.registerBuiltInAnimate("pixelation",OE)},function(){V(Jl,lP),V(Jl,vP)}],PP=[fM,vM,_M,xM,AM,eM,wM,kM,BM,PM,RM,DM,FM,NM,zM,HM,XM,$M,ZM,GM];function OP(){BP.forEach((t=>t())),EP.forEach((t=>t()))}function RP(t,e){if(!bP(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==wg?void 0:wg.env)?wg.envParams:void 0}(e);return void 0===i?hM(t):kP(t,i),cM(t),dM(t),lk(),PP.forEach((t=>t())),CP(t),wP(t,PA),OP(),t}function IP(t,e,i){if(!bP(t,e))return t;const n=MP[e];return n.installEnv(t,i),cM(t),function(t){dM(t)}(t),n.loadEnv(),PP.forEach((t=>t())),CP(t),wP(t,PA),OP(),t}var DP=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);st())),CP(t),wP(t,hC),OP(),t):t}(kf(DP(t,["envParams"])),e)}var FP=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);sGP(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,n){let s=!1;return{app:n.app,env:e,key:i,release(){if(s)return;s=!0;const e=VP(t,!1);(null==e?void 0:e.get(i))!==n||n.released||(n.refCount-=1,n.refCount<=0&&GP(t,i,n))}}}(t,n,r,o)}function XP(t){const{env:e}=t,i=Object.assign({},t);return delete i.env,delete i.key,"browser"===e?LP(i):"node"===e?function(t={}){const{envParams:e}=t,i=jP(t,["envParams"]);return RP(zP(i),e)}(i):"taro"===e?function(t={}){return NP("taro",t)}(i):"feishu"===e?function(t={}){return NP("feishu",t)}(i):"tt"===e?function(t={}){return NP("tt",t)}(i):"wx"===e?function(t={}){return NP("wx",t)}(i):"lynx"===e?function(t={}){return NP("lynx",t)}(i):function(t={}){return NP("harmony",t)}(i)}const KP=e=>{switch(e){case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony";case t.RenderModeEnum.lynx:return"lynx";default:return"browser"}},$P={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},qP=(t,e)=>{const i=KP(t),n=$P[i];if(!n)return e;if(null==(s=e)||"object"!=typeof s&&"function"!=typeof s)return;var s;const r={};return n.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},ZP=(t,e)=>{const i=YP((n=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,n,XP,n.env);var n;return{app:i.app,releaseAppRef:()=>i.release()}};class JP{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,n,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterVRenderDraw)||void 0===s||s.call(n,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,n,s;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:u,autoPreventDefault:d,background:f}=this._option,m=qP(o,l);wg.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=m?m:{});const v=this._option.stage;if(this._isExternalStage=!!v,this._releaseVRenderAppRef=void 0,this._stage=v,!this._stage){const t=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const n=KP(i.mode),s=qP(i.mode,i.modeParams);return ZP(n,s)})({app:this._option.app,mode:o,modeParams:l});this._releaseVRenderAppRef=t.releaseAppRef;try{this._stage=(y=t.app,_=Object.assign({background:f,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,n;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(n=(i=this._option).beforeRender)||void 0===n||n.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:u,autoPreventDefault:d},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{}),y.createStage(_))}catch(t){throw null===(s=this._releaseVRenderAppRef)||void 0===s||s.call(this),this._releaseVRenderAppRef=void 0,t}}var y,_;this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const b=kc({x:0,y:0,width:this._width,height:this._height});b.name="root",this._stage.defaultLayer.appendChild(b),this._rootGroup=b;const x=(p(h)?h:Fy(o))&&!1!==c&&ux.getStageEventPlugin("gesture");x&&(this._gestureController=new x(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=XS.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),n=null==i?void 0:i.region;return!!_(n)&&n.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!Ly(this._option.mode))return!1;return!1===(p(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:wg.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(wg.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=wg.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>ZS(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>ZS(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,n,s,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{ZS(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.beforeVRenderDraw)||void 0===s||s.call(n,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===XS.before;(e||i)&&(Ey(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=XS.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=XS.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),Ey(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:n=!1,animation:s={},enableExitAnimation:r=!1}=t,a=JS(this._rootMarks),{update:o,exit:l}=function(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):n.enter.push({next:[t]})}));const a=QS(s,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=QS(s,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=$S(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=$S(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}(this._cachedMarks,a,{morph:i,morphAll:n,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const n=t[i];_(n)?e[i]="disappear"===i?n.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:tA,customParameters:{callBack:t.callBack}}))):n.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{ZS(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===GS.appear))?GS.appear:e.every((t=>t===GS.disappear))?GS.disappear:GS.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const n=this._width!==t||this._height!==e;this._width=t,this._height=e,n&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var n,s;if(!1!==this._option.interactive)if(t===ES.chart){const s=this.getRootGroup(),r=function(n){var r;const a=n.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=SS(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=SS(i.parent),i.context)return i;return null})(s,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,u=p(l.modelUserId)?l.modelUserId:null,d=p(l.markUserId)?l.markUserId:null,g={event:n,type:e,source:t,item:o,datum:CS(o),markId:h,modelId:c,markUserId:d,modelUserId:u};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(n=this._stage)||void 0===n||n.addEventListener(e,r)}else if(t===ES.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)}else if(t===ES.canvas){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._canvasListeners.set(i,{type:e,callback:n});const r=null===(s=this.getStage())||void 0===s?void 0:s.window;null==r||r.addEventListener(e,n)}}removeEventListener(t,e,i){var n,s,r,a,o;if(!1!==this._option.interactive)if(t===ES.chart){const t=null===(n=this._viewListeners.get(i))||void 0===n?void 0:n.callback;t&&(null===(s=this._stage)||void 0===s||s.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===ES.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)}else if(t===ES.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,n=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&n&&(null==t||t.removeEventListener(e,n)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,n=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==n||n(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{ZS(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=JS(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Ly(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&fa(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{ZS(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=wg.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){wg.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function QP(t,e){var n;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(n=null==e?void 0:e.onError)&&void 0!==n?n:Oy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const tO={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}},eO={poptip:U({},tO)};function iO(t){t.crosshair=G(t.crosshair||{}).map((e=>cx({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function nO(t,e,i){var n;const{width:s,height:r}=t;if(p(s)&&p(r))return{width:s,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=Ee(l,i.width,i.height);a=t,o=e}else if(h&&Ly(e.mode)){let t;t=y(h)?wg.getElementById(h):h;const{width:e,height:n}=Ee(t,i.width,i.height);a=e,o=n}else if(Uy(e.mode)&&(null===(n=e.modeParams)||void 0===n?void 0:n.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=s?s:a,o=null!=r?r:o,{width:a,height:o}}const sO=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function rO(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function aO(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function oO(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const n=t.effects;sO.forEach((t=>{i[t]&&(n[t]=n[t]||i[t])}))}))}(t,...e),t}function lO(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var hO,cO,uO,dO,pO,gO;t.LayoutZIndex=void 0,(hO=t.LayoutZIndex||(t.LayoutZIndex={}))[hO.SeriesGroup=0]="SeriesGroup",hO[hO.Axis_Grid=50]="Axis_Grid",hO[hO.CrossHair_Grid=100]="CrossHair_Grid",hO[hO.Region=450]="Region",hO[hO.Mark=300]="Mark",hO[hO.Node=400]="Node",hO[hO.Axis=100]="Axis",hO[hO.MarkLine=500]="MarkLine",hO[hO.MarkArea=100]="MarkArea",hO[hO.MarkPoint=500]="MarkPoint",hO[hO.DataZoom=500]="DataZoom",hO[hO.ScrollBar=500]="ScrollBar",hO[hO.Player=500]="Player",hO[hO.Legend=500]="Legend",hO[hO.CrossHair=500]="CrossHair",hO[hO.Indicator=500]="Indicator",hO[hO.Title=500]="Title",hO[hO.Label=500]="Label",hO[hO.Brush=500]="Brush",hO[hO.CustomMark=500]="CustomMark",hO[hO.Interaction=700]="Interaction",t.LayoutLevel=void 0,(cO=t.LayoutLevel||(t.LayoutLevel={}))[cO.Indicator=10]="Indicator",cO[cO.Region=20]="Region",cO[cO.Axis=30]="Axis",cO[cO.DataZoom=40]="DataZoom",cO[cO.Player=40]="Player",cO[cO.ScrollBar=40]="ScrollBar",cO[cO.Legend=50]="Legend",cO[cO.Title=70]="Title",cO[cO.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(uO=t.AttributeLevel||(t.AttributeLevel={}))[uO.Default=0]="Default",uO[uO.Theme=1]="Theme",uO[uO.Chart=2]="Chart",uO[uO.Base_Series=3]="Base_Series",uO[uO.Series=4]="Series",uO[uO.Mark=5]="Mark",uO[uO.User_Chart=6]="User_Chart",uO[uO.User_Series=7]="User_Series",uO[uO.User_Mark=8]="User_Mark",uO[uO.User_SeriesStyle=9]="User_SeriesStyle",uO[uO.Built_In=99]="Built_In";class fO{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,U({},fO.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=G(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}fO.defaultMarkInfo={};class mO{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class vO{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const n=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(n.spec,e,i),n}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const n=this._getDefaultSpecFromChart(e),s=t=>cx({},i,n,t);return _(t)?{spec:t.map((t=>s(t))),theme:i}:{spec:s(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class yO extends mO{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=vO,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new fO,this._lastLayoutRect=null,this.id=jy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new TS(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,n){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:n}=e,s=Object.assign({},e);i&&(s.style=this._convertMarkStyle(i)),n&&(s.state={},Object.keys(n).forEach((t=>{s.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(s)}stateKeyToSignalName(t,e){let i=`${Dx}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},n){const{type:s,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=ux.createMark(s,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),n&&l.setMarkConfig(n)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!d(e))return P(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class _O{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var n;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(n=null==e?void 0:e.getSpec)||void 0===n?void 0:n.call(e)}_setLayoutAttributeFromSpec(t,e){var i,n,s,r;if(this._spec&&!1!==this._spec.visible){let a=Jb(tx(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:Zb(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(n=this._maxHeight)&&void 0!==n?n:null:Zb(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(s=this._minWidth)&&void 0!==s?s:null:Zb(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:Zb(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:Zb(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:Zb(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=Zb(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=Zb(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,n,s,r;this._spec=t,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}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=Zb(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};d(n)||(r.width-=n),d(s)||(r.width-=s),d(e)||(r.height-=e),d(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(d(n)?d(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,d(e)?d(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var n,s,r,a;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),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(Qb(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class bO extends yO{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new _O(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&W(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=U(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=U(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,n,s;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(n=this._spec.orient)&&void 0!==n?n:this._orient,this.layoutLevel=null!==(s=this._spec.layoutLevel)&&void 0!==s?s:this.layoutLevel}}class xO extends vO{_initTheme(t,e){return{spec:t,theme:this._theme}}}class SO extends bO{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var n;super(e,i),this.transformerConstructor=xO,this.modelType="region",this.specKey="region",this.type=SO.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(n=e.coordinate)&&void 0!==n?n:"cartesian"}_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"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),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"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const n=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),n&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,n){var s,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:n});const o=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return W(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,n;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||G(t.userId).includes(e.userId))&&(!p(t.specIndex)||G(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(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})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function AO(t){const e=[],i=[],n=[];return t.forEach((t=>{d(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&n.push(t)})),{startItems:e,endItems:n,middleItems:i}}function CO(t,e,i){e?t.forEach((t=>{const e=Y(t),n=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,s=(i-n)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+s})}))})):t.forEach((t=>{const e=Y(t),n=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,s=(i-n)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+s,y:t.getLayoutStartPoint().y})}))}))}function wO(t,e,i,n){let s;t.forEach(((t,r)=>{t.length>1&&(s=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?s-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):s-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+n*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+n*a*r})})))}))}function TO(t,e,i,n,s,r){if(t.length){let a=0;const o="right"===s,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const u=[];let d=[];const p=[];t.forEach((t=>{const{rect:n}=EO(t,e,r),s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=s,c>i&&d.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+s,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),u.push(d),d=[t]):(a=Math.max(a,g),d.push(t))})),p.push(a),u.push(d),wO(u,!0,p,l),n&&CO(u,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function kO(t,e,i,n,s){if(t.length){let i=0;const r="right"===n,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{rect:n}=EO(t,e,s),d=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:n}=EO(t,e,r),s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&d.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=s,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),u.push(d),d=[t]):(l=Math.max(l,s),d.push(t))})),p.push(l),u.push(d),wO(u,!1,p,o),n&&CO(u,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function BO(t,e,i,n,s){if(t.length){const i="top"===n,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{layoutTag:n,layoutRect:u,rect:d}=EO(t,e,s),p=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-d.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),n=t.filter((t=>"region-relative-overlap"===t.layoutType)),s=i.concat(n),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return n.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:n,allRelatives:s,overlapItems:r}}layoutItems(t,e,i,n){var s,r,a;this._layoutInit(t,e,i,n);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(s=null==t?void 0:t.getSpec())||void 0===s?void 0:s.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:u,relativeOverlapItems:d,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,u,d,g,o,l),this._processAutoIndent(c,u,d,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},s,r,a,o=!1){if(s.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:u}=this._checkAutoIndent(s,r);(l||h||c||u)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-u,this.layoutRegionItems(t,e,i,n,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=EO(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),n=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=AO(t);s.length&&TO(s,e,i,!1,"left",n),r.length&&TO(r,e,i,!0,"left",n),a.length&&kO(a,e,0,"left",n)}(i,this,o,e),s.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=AO(t);s.length&&MO(s,e,i,!1,"top",n),r.length&&MO(r,e,i,!0,"top",n),a.length&&BO(a,e,0,"top",n)}(s,this,a,e),n.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=AO(t);s.length&&TO(s,e,i,!1,"right",n),r.length&&TO(r,e,i,!0,"right",n),a.length&&kO(a,e,0,"right",n)}(n,this,o,e),r.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=AO(t);s.length&&MO(s,e,i,!1,"bottom",n),r.length&&MO(r,e,i,!0,"bottom",n),a.length&&BO(a,e,0,"bottom",n)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:n}=EO(t,this,i);e.rect.width=Math.max(n.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(n.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{W(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=EO(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const n=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),s=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=n-t.layoutPaddingLeft-t.layoutPaddingRight,i=s-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:s,regionWidth:n}}layoutRegionItems(t,e,i,n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},s,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,s)})),this._layoutRelativeOverlap("left",n.left,s),this._layoutRelativeOverlap("right",n.right,s),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,s)})),this._layoutRelativeOverlap("top",n.top,s),this._layoutRelativeOverlap("bottom",n.bottom,s),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,s)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:u}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+u-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const n=t.find((t=>t.getModelId()===e));return n||(null!==(i=this._onError)&&void 0!==i?i:Oy)("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,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const n="left"===t.layoutOrient||"right"===t.layoutOrient,s=t.getLastComputeOutBounds(),r=this._getOutInLayout(s,t,e);n?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:n,y:s}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(n-t.x1),right:n+r+t.x2-i.right,top:i.top-(s-t.y1),bottom:s+a+t.y2-i.bottom}}}PO.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(dO||(dO={})),t.STATE_VALUE_ENUM=void 0,(pO=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",pO.STATE_HOVER="hover",pO.STATE_HOVER_REVERSE="hover_reverse",pO.STATE_DIMENSION_HOVER="dimension_hover",pO.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",pO.STATE_SELECTED="selected",pO.STATE_SELECTED_REVERSE="selected_reverse",pO.STATE_SANKEY_EMPHASIS="selected",pO.STATE_SANKEY_EMPHASIS_REVERSE="blur",pO.STATE_HIGHLIGHT="highlight",pO.STATE_BLUR="blur",pO.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(gO||(gO={}));const OO=["linear","radial","conical"],RO={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const IO={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{IO[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class DO extends mO{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(U(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class LO extends DO{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];p(n.domain)&&(s.domain=n.domain),p(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:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,KS.includes(t));var t}checkOneState(t,e,i){var n;let s=!1,r=!1;if(p(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e),r=!0;else if(i.items)s=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:this._mark.type};s=i.filter(null==e?void 0:e[0],n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){var i;const n=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!IO[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const n=e[0];if(_(t.datums)){const e=this._isMultiMark(),s=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Dx)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?s.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):s.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(Dx))),s=this._isMultiMark();i=e.every((e=>{var i,r;return s?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var n;let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(n=e[0])||void 0===n?void 0:n[r];if(P_(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n){var s;const r=this._isMultiMark()?null===(s=i[0])||void 0===s?void 0:s[e]:i[e];return rt[t.length-1]}release(){}}class FO extends mO{constructor(){super(...arguments),this.id=jy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=ux.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class UO extends FO{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const NO=1e3,jO="quadInOut",zO=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],WO=(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=sl(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},HO=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?sm(t):[],s=sm(e);i&&n&&(i.fromTransform&&rm(n,i.fromTransform.clone().getInverse()),rm(n,i.toTransfrom));const[r,a]=nm(n,s);return t?im(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},GO=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],YO=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!GO.includes(s))return;const r=e[s];if(!d(r)&&!d(t[s])&&r!==t[s]){if("fill"===s||"stroke"===s){const e=t=>"string"==typeof t?il.Get(t,el.Color255):t;i.push({from:_(t[s])?t[s].map(e):e(t[s]),to:_(r)?r.map(e):e(r),key:s})}else i.push({from:t[s],to:r,key:s});n=!0}})),n?i:null};class XO extends yB{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;HO(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&WO(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):dB(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const KO=(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=VO(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=YO(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const u=new XO({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:NO,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:jO);return c.play(u),c};class $O extends yB{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;HO(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&&WO(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const qO=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>zO.includes(t))(i)||(e[i]=t[i])})),e},ZO=(t,e,i)=>{const n=qO(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=di.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});s.appendChild(i),e.push(i)}))}},JO=(t,e,i)=>{const n=[],s=i?null:qO(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:qO(t.attribute);if("rect"===t.type)lm(t,e).forEach((t=>{n.push(di.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)hm(t,e).forEach((t=>{n.push(di.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)cm(t,e).forEach((t=>{n.push(di.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=pm(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(di.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?ym(t,e).forEach((t=>{n.push(di.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?dm(t,e).forEach((t=>{n.push(di.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&_m(t,e).forEach((t=>{"path"in t?n.push(di.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(di.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&ZO(t,n,e),n},tR=(t,e,i,n)=>"function"==typeof t?t(e,i,n):t,eR=(t,e,i,n,s)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=tR(l.delay,s,a,o),u=tR(l.duration,s,a,o),d=tR(l.oneByOne,s,a,o),p=tR(l.splitPath,s,a,o),g=A(d)&&d>0?t=>S(d)?t*d:!0===d?t*u:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var 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)?JO:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:QO)(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);KO(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:u,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)?JO:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:QO)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>VO(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>YO(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:Yi.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const u=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),d=e.animate(Object.assign({},i,{onEnd:r}));d.wait(u),d.play(new XO({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:NO,null!==(l=i.easing)&&void 0!==l?l:jO))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Yi.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new $O({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:NO,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:jO))}})(t,e[0],{delay:c,duration:u,easing:h,onEnd:n,individualDelay:g,splitPath:p}):KO(t[0],e[0],{delay:c,duration:u,easing:h,onEnd:n})},iR=(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))))},nR=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,n;const s=null===(n=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===n?void 0:n[0];s&&(t.context.morphKey=s[e.morphElementKey])}))}},sR=(t,e,i)=>{var n;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const s=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,s)?null===(n=t.invalidateResolver)||void 0===n||n.call(t):s.length?t.useStates(s,i):t.clearStates(i)},rR=(t,e,i=!0,n)=>{var s;if(!e)return;const r=i&&null!==(s=t.currentStates)&&void 0!==s?s:[],a=i?Array.from(new Set([...r,e])):[e];sR(t,a,n)},aR=(t,e,i)=>{var n;const s=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!s.length)return;const r=(null!==(n=t.currentStates)&&void 0!==n?n:[]).filter((t=>!s.includes(t)));sR(t,r,i)},oR=Symbol("statesClearedBeforeReInit");class lR extends FO{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const n=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var s,r;const a="function"==typeof n?n(t,e,i):n;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(s=e.context.compiler.getChart())||void 0===s?void 0:s.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},n={};Object.keys(t).forEach((e=>{const s=t[e];_(s)?n[e]=s.map(i):p(s)&&(n[e]=i(s))})),this._animationConfig=n}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new UO(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=kc("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var n;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Zn)),i&&(u(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,n,s;const r=t.context.diffState===dO.enter||t.context.diffState===dO.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(n=t.effectiveStates)||void 0===n?void 0:n.length)||t.resolvedStatePatch||(null===(s=t.registeredActiveScopes)||void 0===s?void 0:s.size));((null==r?void 0:r.length)||a)&&sR(t,r,e)},this.name=e,this.model=i.model,this.key=i.key,this.state=new LO(i,this),this._attributeContext=i.attributeContext,null===(n=i.map)||void 0===n||n.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,n=i.range();return i.range(n.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,Nt)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((s=>{let r=t[s];d(r)||(r=this._filterAttribute(s,r,e,i,n),this.setAttribute(s,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,n,s){let r=this._styleConvert(e);if(s)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var n;if(t)if(e&&i){const s=null!==(n=this.stateStyle[i])&&void 0!==n?n:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},s[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const n={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(n[i]=this._computeAttribute(i,e)(t))})),n}}setAttribute(t,e,i="normal",n=0){var s;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:n,style:e,referer:void 0});const r=null===(s=this.stateStyle[i][t])||void 0===s?void 0:s.level;p(r)&&r<=n&&cx(this.stateStyle[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(O_(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return y(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=Vb(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let n=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];n||(n=this.stateStyle.normal[t]);const s=this._computeStateAttribute(n,t,e),r=u(null==n?void 0:n.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=s(r);return a=n.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>n.postProcess(s(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return n=>i(t,n,e,s(n))}return s}_computeStateAttribute(t,e,i){var n;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):OO.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):O_(null===(n=t.style.scale)||void 0===n?void 0:n.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const n=i[e];if("style"in n){const i=n.style;let s={stateValue:e};"level"in n&&(s.level=n.level),"filter"in n&&(s=u(n.filter)?Object.assign({filter:n.filter},s):Object.assign(Object.assign({},n.filter),s)),this.state.addStateInfo(s),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(n,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,n,s,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let d=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(d=t),g||(g=e)}const f=Db(Ib(this.model.getColorScheme(),"series"===this.model.modelType?null===(n=(i=this.model).getSpec)||void 0===n?void 0:n.call(i):void 0),null!==(a=null===(r=null===(s=this.model)||void 0===s?void 0:s.getDefaultColorDomain)||void 0===r?void 0:r.call(s))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},RO[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((n=>{const s=m[n];"stops"===n?e.stops=s.map((e=>{const{opacity:n,color:s,offset:r}=e;let a=null!=s?s:null==d?void 0:d.scale(t[g]);return u(s)&&(a=s(t,this._attributeContext,i)),p(n)&&(a=we.SetOpacity(a,n)),{offset:u(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):u(s)?e[n]=s(t,this._attributeContext,i):e[n]=s})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:n}=t,s=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(s).forEach((e=>{const i=s[e];u(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)OO.includes(null===(a=s.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(s.stroke)(t));else{const s=Db(Ib(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=n;if(!(i&&n||"series"!==this.model.modelType)){const{scale:e,field:n}=this.model.getColorAttribute();i||(a=e),l||(l=n),o.stroke=(null==a?void 0:a.scale(t[l]))||s[0]}}return o}}_getDataByKey(t){return $S(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return ux.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=u(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[jx],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=$S(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===GS.appear))?GS.appear:t.every((t=>t===GS.disappear))?GS.disappear:t[0];return null!=e?e:GS.none}createAnimationStateList(t,e){var i;let n=e[t];return n&&Array.isArray(n)&&(n=1===n.length?n[0]:n),Array.isArray(n)?n.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):n?Object.assign(Object.assign({},n),{priority:"normal"===t?null!==(i=n.priority)&&void 0!==i?i:1/0:n.priority}):n}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const n=[],s=[];t.forEach((t=>{nR(t),n.push(...t.getGraphics())})),e.forEach((t=>{nR(t),s.push(...t.getGraphics())}));const r=t=>{var e,i,n;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(n=t.context)||void 0===n?void 0:n.key},a=new Map,o=new Map;if(n.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),s.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const u=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);eR([],e,i,u,{}),c+=1})),l.forEach((t=>{const e=a.get(t),n=o.get(t),s=Math.min(e.length,n.length);if(s>0){const t=iR(e,s),r=iR(n,s);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",n);if(s&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(n.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",n)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=n[e];if(i&&i.length>0){const n=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));n.forEach((e=>{e.animation.customParameters=t.context}));const s=[e];t.applyAnimationState(s,[1===n.length?n[0]:n])}"enter"===e&&n.normal&&(a=!0)})),a&&this._product&&(null===(i=n.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",n)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,n;const s=("component"===this.type?this.model.getAnimationStateCallback():null===(n=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===GS.exit?GS.exit:i===GS.update?GS.update:GS.appear}),r=s(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===dO.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,n=[],s=new Set(this._graphics.filter((t=>t.context.diffState===dO.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=dO.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=dO.enter,f.isExiting=!1,this._graphicMap.set(t,f),n.push(f)):(f=this._graphicMap.get(t),f&&(m=dO.update,n.push(f))),f&&(s.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=GS.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=GS.disappear}));s.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=n.length;n.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=n,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return qS(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=qS(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((n=>{this._unCompileChannel[n]||(this._option.noSeparateStyle||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||(!!u(s)||!(!(null==s?void 0:s.scale)||s.field===i))}(n,t,this._groupKey)?e[n]=t[n]:i[n]=t[n])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,n;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!s||s.referer||u(s.postProcess)||e in this._computeExChannel)return!1;const r=s.style;return!u(r)&&(!OO.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!O_(null===(n=null==r?void 0:r.scale)||void 0===n?void 0:n.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,n=new Map;i.forEach(((t,e)=>{n.set(t,e)}));const s={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=n.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),s[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==n?void 0:n.style)}:${this._getSharedStateDefinitionRefId(null==n?void 0:n.postProcess)}:${this._getSharedStateDefinitionRefId(null==n?void 0:n.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=s,this._product.sharedStateDefinitions=s)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const n=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);d(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const s=this._transformGraphicAttributes(t,i,null==n?void 0:n[t.context.groupKey]);t.context.finalAttrs=s}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,n)=>{var s,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,wS(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?n:n+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(s=this.renderContext)||void 0===s?void 0:s.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:n}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,n)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:n,overflow:s}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(n)){const e=_(n)?n:n(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(s)||(t.overflow=s),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=ux.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const n=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=ux.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(n,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const n=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],s=this._runBeforeTransform(n);let r;if(null==s?void 0:s.progressive){this.renderContext={beforeTransformProgressive:s.progressive};const t=s.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(s),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===XS.before||(this._product||this._initProduct(),Ey(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const n=i,s=n[oR],r=null==s?void 0:s.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?rR(i,t,!0,a):aR(i,t,a),r){const e=s.filter((e=>e!==t));e.length?n[oR]=e:delete n[oR]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===dO.exit&&!e.isExiting)if(e.context.animationState===dO.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const n=this.getAnimationConfig();if(n.exit&&n.exit.length){const s=n.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===s.length?s[0]:s],(()=>{e.context.diffState===dO.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((n=>{const s=this.renderContext.progressive.groupedData.get(n),r=this.renderContext.progressive.step,a=s.slice(t*r,(t+1)*r),o=[];a.forEach(((i,s)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:dO.enter,data:[i],uniqueKey:`${n}_${null!=a?a:t*r+s}`,key:a,groupKey:n})};o.push(l),e.push(l)})),i[n]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=kc({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,n;if(this._attrsByGroup&&t){const s=t.parent;s&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&s.setTheme({common:this._attrsByGroup[null===(n=t.context)||void 0===n?void 0:n.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[oR]=t.currentStates.slice())}))}}var hR;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(hR||(hR={}));class cR extends lR{constructor(){super(...arguments),this.type=cR.type,this._marks=[],this._diffState=dO.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Py("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?(Py("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return ZS(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===dO.update){const t=this.hasAnimation(),e=wS(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=dO.update}render(){this._isCommited&&(Ey(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}cR.type="group";const uR={measureText:Ix};class dR{static instance(){return dR.instance_||(dR.instance_=new dR),dR.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class pR{constructor(){this.id=jy(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Py("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class gR extends pR{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((n=>{n.onAfterModelSpecTransform&&n.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const fR=(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"},mR=(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 vR extends l{constructor(t,e={}){var i,n,s,r,a,o,l,h,c,u;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=wi.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.pressTimeout=null}),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=wi.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||fR(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,u=mR(l[0],l[1]);n.scale=u/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 i=wi.now(),s=this.lastMoveTime;if(i-s<100){const t=s-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=mR(i,s),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=fR(i,s),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(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},tap:{interval:null!==(u=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==u?u:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if("press"===e)return e;let s;return s=wi.now()-i>this.config.press.time&&mR(n[0],t){di.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n{var n,s;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(s=null===(n=t.points)||void 0===n?void 0:n.length)&&void 0!==s?s:0)})),i}return[]}onBind(){var t,e,i,n,s;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(n=l.finalAttrs)&&void 0!==n?n:{},c=null!==(s=l.diffAttrs)&&void 0!==s?s:{},u=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:u&&Object.prototype.hasOwnProperty.call(u,"points")&&(this.to.points=u.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:u&&Object.prototype.hasOwnProperty.call(u,"segments")&&(this.to.segments=u.segments),this.props=this.to;const d=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=d?Array.isArray(d)?d:[d]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),A(this.clipRange)?this.clipRange=ut(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Ft(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onFirstRun(){const t=this.target.attribute.clipRange;A(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&cE(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(cB(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const n=Hs(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));dB(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const n=t+this.segmentsCache[i],s=this.points.slice(t,n);return t=n,Object.assign(Object.assign({},e),{points:s})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const _R={type:"fadeIn"};function bR(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return _R;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const xR={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},SR={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},AR=()=>{ux.registerAnimation("scaleInOut",(()=>SR))},CR=(t,e)=>({appear:bR(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:yR,duration:xR.update.duration,easing:xR.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),wR=()=>{ux.registerAnimation("line",CR)},TR=()=>{QM.registerBuiltInAnimate("growPointsIn",NB),QM.registerBuiltInAnimate("growPointsOut",jB),QM.registerBuiltInAnimate("growPointsXIn",WB),QM.registerBuiltInAnimate("growPointsXOut",HB),QM.registerBuiltInAnimate("growPointsYIn",GB),QM.registerBuiltInAnimate("growPointsYOut",YB),QM.registerBuiltInAnimate("clipIn",AB),QM.registerBuiltInAnimate("clipOut",CB)},kR=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class MR{constructor(t){this._markSet=new fO,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const n=t.stateStyle;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const n=this.getMarkIdByState();return n&&n[e]&&n[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const BR={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class ER extends MR{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:n}=this.options;this._lastGraphic&&(n.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,n.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const n=t.item,s=n&&this._markSet.getMarkInId(n.context.markId);(this._resetType.includes("view")&&!s||this._resetType.includes("self")&&s)&&this.resetAll(t)},this.options=Object.assign({},BR,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:n,interaction:s}=this.options;if(this._lastGraphic===t)return;const r=s.updateStates(this,[t],s.getStatedGraphics(this),i,n);s.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&aR(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}ER.type="element-highlight",ER.defaultOptions=BR;const PR=()=>{ux.registerInteractionTrigger(ER.type,ER)},OR={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class RR extends MR{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:n}=this.options,s=n.getStatedGraphics(this);s&&s.length&&(n.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:s,options:this.options},t)),n.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const n=t.item,s=n&&this._markSet.getMarkInId(n.context.markId);(this._resetType.includes("view")&&!s||this._resetType.includes("self")&&s)&&this.resetAll(t)},this.options=Object.assign({},OR,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:n,resetType:s}=(t=>{const e=G(t),i=[],n=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(n.push(t.replace("view:","")),i.push("view")):(n.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:n,resetType:i}})(t);return n.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=s,i}start(t,e){const{state:i,reverseState:n,isMultiple:s,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const s=a&&a.filter((e=>e!==t));s&&s.length?r.setStatedGraphics(this,r.updateStates(this,s,a,i,n)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),rR(t,i,!0);const o=this.options.interaction.updateStates(this,s&&a?[...a,t]:[t],a,i,n);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&aR(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}RR.type="element-select",RR.defaultOptions=OR;const IR=()=>{ux.registerInteractionTrigger(RR.type,RR)};class DR extends pR{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const LR=(t,e=!0)=>{var i,n,s,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(s=(n=t).removeAllChild)||void 0===s||s.call(n,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},FR=t=>{var e,i;const n=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{n.push(...FR(t))})),n},UR=(t,e={})=>{var i,n;const{enableExitAnimation:s=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!s||!(null===(n=(i=t).releaseWithExitAnimation)||void 0===n?void 0:n.call(i,{removeFromParent:r,onComplete:a})))||(LR(t,r),!1)};class NR{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>ux.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>ux.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>ux.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return ux.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>ux.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){ux.registerTransform(t,e)}static registerFunction(t,e){t&&e&&dR.instance().registerFunction(t,e)}static unregisterFunction(t){t&&dR.instance().unregisterFunction(t)}static getFunction(t){return t?dR.instance().getFunction(t):null}static getFunctionList(){return dR.instance().getFunctionNameList()}static registerMap(t,e,i){const n=ux.getImplementInKey("registerMap");n&&n(t,e,i)}static unregisterMap(t){const e=ux.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,US.get(e);var e}static registerSVG(t,e,i){const n=ux.getImplementInKey("registerSVG");n&&n(t,e,i)}static unregisterSVG(t){const e=ux.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){Tx.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return nt.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,n){var s,r,a,o,l,h,c,u,d;this.id=jy(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=eA.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var n;this._reSetRenderState();const s=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;W(s.theme,this._spec.theme)?W(this._spec.background,s.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(s);if(r.reSize=a,this._spec.type!==s.type)return null===(n=this._compiler)||void 0===n||n.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=oO(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,n)=>{if(1!==n||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const n="series"===t[0]?ux.getSeriesBuiltInTheme(e):ux.getComponentBuiltInTheme(e);i=i?cx({},n,i[e]):n}n===t.length-1&&p(i)&&(i=Ex({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},M_(n),this._option=Object.assign(Object.assign({},this._option),n),(null==n?void 0:n.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),n.optimize)),this._onError=null===(s=this._option)||void 0===s?void 0:s.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Ly(v);if(S?kw(Tg):"node"===v&&lk(Tg),S&&f&&(this._container=y(f)?wg.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=kx.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const C=new nt(null!==(a=this._option.logLevel)&&void 0!==a?a:it.Error);nt.setInstance(C),(null===(o=this._option)||void 0===o?void 0:o.onError)&&C.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new JP({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new DS(this,this._compiler),this._event=new TS(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),Tx.registerInstance(this),null===(d=null===(u=this._option.performanceHook)||void 0===u?void 0:u.afterCreateVChart)||void 0===d||d.call(u,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=cx({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Px(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,n;NR.getFunctionList()&&NR.getFunctionList().length&&(t=Ox(t,NR)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=ux.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(n=this._chartSpecTransformer)||void 0===n?void 0:n.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=ux.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,n,s;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(n=this._option)||void 0===n||n.onError("chart is already initialized"));const r=ux.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=mt(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,n;return nO(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:Lx,height:null!==(n=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==n?n:Fx})}_initDataSet(t){this._dataSet=t instanceof ai?t:new ai,FS(this._dataSet,"dataview",ni),FS(this._dataSet,"array",n),LS(this._dataSet,"copyDataView",jS);for(const t in ux.transforms)LS(this._dataSet,t,ux.transforms[t]);for(const t in ux.dataParser)FS(this._dataSet,t,ux.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return u(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),rO(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,n,s,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(s=this._compiler)||void 0===s||s.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,n,s,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const n=e=>{var i;const n=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===n?GS.none:GS.appear:n};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(n)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(n)}))}}release(){var t,e,i,n;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(n=this._compiler)||void 0===n||n.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,Tx.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{LR(t)})),this._exitingVRenderComponents.clear())}updateData(t,e,n,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,n,s)}))}_updateDataById(t,e,i){const n=this._spec.data.find((e=>e.name===t||e.id===t));n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,n){return this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==n?void 0:n.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const n=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:s,fields:r}=t,a=n.find((t=>t.name===e));if(a)a instanceof oi?(a.setFields(I(r)),a.parse(i,I(s))):(a.values=i,p(s)&&(a.parser=s),p(r)&&(a.fields=r));else{const e=WS(t,this._dataSet,n);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,n,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,s);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:n,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,n){const s=this._updateSpec(t,e,n);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const n=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(n,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,n=!1,s){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,n,s)}))}updateModelSpecSync(t,e,i=!1,n){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),u(t)||function(t,e,i,n){Object.keys(t).forEach((s=>{if(g(e))e.type===s&&(_(t[s])?t[s].length>=e.index&&(t[s][e.index]=n?cx({},t[s][e.index],i):i):t[s]=n?cx({},t[s],i):i);else if(_(t[s])){const r=t[s].findIndex((t=>t.id===e));r>=0&&(t[s][r]=n?cx({},t[s][r],i):i)}else t.id===e&&(t[s]=n?cx({},t[s],i):i)}))}(this._spec,t,e,i),this._chart){const s=this._chart.getModelInFilter(t);if(s)return this._updateModelSpec(s,e,!0,i,n)}return this}_updateModelSpec(t,e,i=!1,n=!1,s){n&&(e=cx({},t.getSpec(),e));const r=t.updateSpec(e),a=rO(r),o=aO(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:s,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,n;return this._beforeResize(t,e)?(null===(n=(i=this._compiler).resize)||void 0===n||n.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,n,s,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===n||n.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterResizeWithUpdate)||void 0===r||r.call(s,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var n;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(n=this._event)||void 0===n||n.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const n=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));n>=0&&(this._userEvents.splice(n,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,n;const s=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=dx({},e,e.chart[t])),e};let l;if(E(s)&&E(r))l=Mx(this._currentThemeName),this._currentTheme=o(a,l);else{const t=dx({},Mx(g(r)&&r.type?r.type:g(s)&&s.type?s.type:this._currentThemeName),Mx(s),Mx(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),U(eO.poptip,tO,h),null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let n=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(n=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(n=!0);const s=this._autoSize;return this._autoSize=!!Ly(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==s&&(n=!0),n}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return Mx(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!kx.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const 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=p(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.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const 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.getComponentsByType(r.discreteLegend);n&&n[t]&&n[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield QP(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,n;return i(this,void 0,void 0,(function*(){if(!Ly(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(n=this._option)||void 0===n||n.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=y(this._canvas)?wg.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,n){var s;if(!this._chart)return null;if(E(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o){const e=Object.keys(t),s=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=s?o.dataToPosition(s,n):o.dataToPosition(t,n),a?ex(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var n,s;if(!this._chart||d(t)||E(e))return null;if(!_(t)){const{axisId:s,axisIndex:r}=e;let a;if(p(s)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===s)):p(r)&&(a=null===(n=this._chart.getComponentsByKey("axes"))||void 0===n?void 0:n[r]),!a)return Py("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o?ex(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Py("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return dR.instance().getFunction(t)}registerFunction(t,e){t&&e&&dR.instance().registerFunction(t,e)}unregisterFunction(t){t&&dR.instance().unregisterFunction(t)}getFunctionList(){return dR.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);n&&n[t]&&n[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var n,s;const a=null===(n=this._chart)||void 0===n?void 0:n.getRegionsInQuerier(t)[0],o=null===(s=this._chart)||void 0===s?void 0:s.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=ux.getChartPlugins();t.length>0&&(this._chartPlugin=new gR(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=ux.getVChartPlugins();e.length>0&&(this._vChartPlugin=new DR(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=eA.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;this._renderState=eA.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent()}}NR.InstanceManager=Tx,NR.ThemeManager=kx,NR.globalConfig={uniqueTooltip:!0},NR.Utils=uR,NR.vglobal=wg;ux.registerRegion("region",SO),ux.registerLayout("base",PO),HM(),wM(),ux.registerMark(cR.type,cR),ux.registerStageEventPlugin("gesture",vR),PR(),IR(),bx(lx.name,lx);const jR="monotone",zR="linear",WR="bevel";t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));class HR{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}function VR(t,e){return e("component",t)}function GR(t,e,i,n){if(t)return{formatFunc:t,args:[i,n]};const s=ux.getFormatter();return e&&s?{formatFunc:s,args:[i,n,e]}:{}}const YR=(t,e,i,n)=>{if(d(t[e]))return;const s=_(t[e]),r=s?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||n&&!n(t)||a.push({spec:t,specPath:s?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},XR=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},KR=(t,e,i,n)=>{let s;if(s=u(t)?t(e,i):m(t)&&p(t.field)?P(e,t.field):t,n){const{formatFunc:i,args:r}=GR(void 0,n,t,e);i&&r&&(s=i(...r))}return s},$R=(t,e,i)=>d(t)?t:u(t)?t(e,i):t;const qR=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function ZR(t,i,n,s,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},s),n),i):Object.assign(Object.assign({},s),i),{key:h,keyFormatter:c,keyTimeFormat:u,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=QR(KR(h,r,a,c),u,g),o.value=QR(KR(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=KR(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function JR(t,e,i,n,s,r,a){if(u(e)){ZR(t,e(s,a),i,n,r,a)}else e&&ZR(t,e,i,n,r,a)}const QR=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const n=Oe.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?n.timeFormat:n.timeUTCFormat)(e,t)};class tI{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:n}=this,s=n.getSeriesField();return{seriesFields:p(s)?G(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._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const n=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[n]},this._getSeriesStyle=(t,e,i)=>{var n;for(const i of G(e)){const e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let n=this._seriesCacheInfo.dimensionFields;return i[0]&&(n=n.filter((t=>t!==i[0]))),n.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var n,s,r,a,o,l,h,c,u,d,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(n=null==i?void 0:i.style)||void 0===n?void 0:n.shape),null==i?void 0:i[t]),null===(s=null==i?void 0:i[t])||void 0===s?void 0:s[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(u=m.shapeStroke)&&void 0!==u?u:this.shapeStrokeCallback,shapeHollow:null!==(d=m.shapeHollow)&&void 0!==d&&d,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,n,s,r){var a;return function(t,e,i,n,s,r){if(s&&s.length){const a=[];return s.forEach((s=>{_(t)?t.forEach((t=>{JR(a,t,e,i,n,s,r)})):u(t)?JR(a,t,e,i,n,s,r):t&&ZR(a,t,e,i,s,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,n,s,r)}getTitleResult(t,e,i,n,s){let r=u(e)?e(n,s):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(n),e={visible:KR(r.visible,t,s),value:QR(KR(r.value,t,s,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:KR(r.valueStyle,t,s),hasShape:r.hasShape};return Object.keys(i).forEach((n=>{e[n]=KR(i[n],t,s)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,n,s){var r,a;if(!(this.enableByType(t)&&qR(t,this.spec)&&("dimension"!==t||n&&n.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,n,s).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,n,s);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,s),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const eI={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const n of t)e[n]||(i.push(n),e[n]=1);return i}},iI=(t,e)=>{var i,n;let s=e.fields;if(u(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return{};s=lS([],s);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(n=(i=t[0]).getFields)||void 0===n?void 0:n.call(i);return nI(a,s,o)},nI=(t,e,i)=>{const n={};let s=[],r=[];return e.forEach((e=>{const a=e.key;n[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;s.length=0,t&&t.forEach((t=>{t&&s.push(t[a])}));const u=s.length;if(h){r.length=0,s.forEach(((t,e)=>{zy(t)&&r.push(t)}));const t=s;s=r,r=t,c=s.length===u}else s=l.some((t=>"array-min"===t||"array-max"===t))?s.reduce(((t,e)=>(e&&e.forEach((e=>{zy(e)&&t.push(e)})),t)),[]):s.filter((t=>void 0!==t));e.filter&&(s=s.filter(e.filter)),l.forEach((t=>{if(e.customize)n[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(n[a][t]=o.domain.slice())}else if("allValid"===t)return;n[a][t]=eI[t](s),"array-max"===t&&(n[a].max=n[a][t]),"array-min"===t&&(n[a].min=n[a][t])}})),h&&(n[a].allValid=c)})),n},sI=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();return"zero"!==n||s&&s.length&&t.forEach((t=>{s.forEach((e=>{zy(t[e])||(t[e]=0)}))})),t};function rI(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function aI(t,e,i){t&&(i.needDefaultSeriesField&&(t[zx]=i.defaultSeriesField),t[Nx]=e,t[jx]=i.getKey(t,e,i))}const oI={label:{name:"label",type:"text"}},lI=`${Dx}_rect_x`,hI=`${Dx}_rect_x1`,cI=`${Dx}_rect_y`,uI=`${Dx}_rect_y1`,dI={data:!0},pI={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},gI=[...Object.keys(xR),"normal"];function fI(t={},e,i){const n={};for(let s=0;s{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var n;let s=t;return bI(s)&&delete s.type,s.oneByOne&&(s=vI(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:yI,null==i?void 0:i.dataCount)),s})):o.map(((t,e)=>{var n;let s=cx({},o[e],a);return bI(s)&&delete s.type,s.oneByOne&&(s=vI(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:yI,null==i?void 0:i.dataCount)),s})),n[r]=l):n[r]=o}return n}function mI(t,e,i){var n,s,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(n=e.animationAppear[t])&&void 0!==n?n:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(s=e.animationDisappear[t])&&void 0!==s?s:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),xI(t,(t=>{var i;if(u(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function vI(t,e,i){const{oneByOne:n,duration:s,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=u(s)?s(t,i,a):A(s)?s:0,h=u(r)?r(t,i,a):A(r)?r:0;let c=u(n)?n(t,i,a):n;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=u(s)?s(t,r,o):A(s)?s:0,c=u(a)?a(t,r,o):A(a)?a:0;let d=u(n)?n(t,r,o):n;if(!1===d)return c;return d=!0===d?0:d,c+((i?i():r.parent.count-1)-l)*(h+d)},delete t.oneByOne,t}function yI(t,e){var i;return null!==(i=null==t?void 0:t[Nx])&&void 0!==i?i:e.context.graphicIndex}function _I(t,e){var i,n,s,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(s=null===(n=t.animationAppear)||void 0===n?void 0:n[e])&&void 0!==s?s:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function bI(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function xI(t,e,i=[]){if(_(t))t.forEach(((n,s)=>{t[s]=e(t[s],s),xI(t[s],e,i)}));else if(g(t)&&"function"!=typeof t)for(const n in t)i.includes(n)||(t[n]=e(t[n],n),xI(t[n],e,i))}function SI(t){var e,i,n,s,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(n=o.animationThreshold)&&void 0!==n?n:Number.MAX_SAFE_INTEGER;return null===(s=t.getMarks())||void 0===s||s.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class AI extends vO{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,n,s;const r=Pb(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=ux.getSeriesMarkMap(o)?function(t,e,i){const n=ux.getSeriesMarkMap(e);if(!n)return t;const s={};return Object.values(n).forEach((({type:e,name:n})=>{s[n]=cx({},i("mark",G(e)[0]),i("markByName",n),null==t?void 0:t[n])})),Object.assign(Object.assign({},t),s)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return cx({},l,h,(null!==(s=null!==(n=this.stack)&&void 0!==n?n:null==h?void 0:h.stack)&&void 0!==s?s:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const n=super.transformSpec(t,e,i);return this._transformLabelSpec(n.spec),Object.assign(Object.assign({},n),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",n="initLabelMarkStyle",s=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!s;this.addLabelSpec(u(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&d)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[n])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:n,innerRadius:s,direction:r}=t;return p(n)&&(i.outerRadius=n),p(s)&&(i.innerRadius=s),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const n=this._getDefaultSpecFromChart(e),s=t=>{const e=cx({},i,n,t),s=i.label;return s&&g(s)&&_(e.label)&&(e.label=e.label.map((t=>cx({},s,t)))),e};return _(t)?{spec:t.map((t=>s(t))),theme:i}:{spec:s(t),theme:i}}return{spec:t,theme:i}}}const CI=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(pI[e]||(t[e]=!0),t)),{}),wI={compileOnlyKeys:pI,dataRelatedKeys:CI,seriesOnlyKeys:{tooltip:!0}},TI={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},kI=t=>(t=>g(t)&&!_(t)&&!u(t))(t)?t:d(t)?{}:null,MI=(t,e,i)=>{const n=kI(t),s=kI(e);if(!n||!s)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(s),...Object.keys(n)]));for(const t of a)if(!W(n[t],s[t])){if(!i[t])return!1;r=!0}return r};function BI(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class EI extends yO{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${Dx}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var n;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=AI,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(n=this._spec)||void 0===n?void 0:n.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=SI(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return d(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(LS(this._rawData.dataSet,"invalidTravel",sI),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const n=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(n&&(this._rawData=WS(n,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=zS(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=zS(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new UO(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,n,s;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(n=this._rawData.getFields())||void 0===n?void 0:n[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=nI(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=U(null!==(s=this._rawStatisticsCache[t])&&void 0!==s?s:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){LS(this._dataSet,"dimensionStatistics",iI);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new oi(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&lS(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){LS(this._dataSet,"dimensionStatistics",iI);const n=new oi(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const n=lS(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&lS(n,[{key:this._seriesField,operations:["values"]}]),n},target:"latest"}},!1),n}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new oi(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return d(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:n}=i,s=this._getSeriesDataKey(t);return void 0===n.get(s)?(n.set(s,0),s):(n.set(s,n.get(s)+1),`${s}_${n.get(s)}`)}:y(t)?e=>e[t]:_(t)&&t.every((t=>y(t)))?e=>t.map((t=>e[t])).join("-"):u(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(LS(this._rawData.dataSet,"addVChartProperty",XR),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:rI.bind(this),call:aI}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:y(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,n,s){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${n}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),s.hasAnimation&&!1!==t.animation){const e=fI({},mI(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${n}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,s)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(n=this._option.mode)===t.RenderModeEnum["desktop-browser"]||n===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:Fy(n)||Uy(n)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var n;let s=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?s.enable=a:g(a)&&(s.enable=!0,s=cx(s,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=cx(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(s.enable){const t=kR(s,e);t.length&&l.push({trigger:this._defaultHoverConfig(s),marks:t})}if(r.enable){const t=kR(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,n=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:n,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=kR(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const n=null!==(e=this._seriesField)&&void 0!==e?e:zx;this.getMarksWithoutRoot().forEach((e=>{const s={},r={},a={};i.forEach((t=>{var i;const n=null===(i=t[e.name])||void 0===i?void 0:i.style;n&&(s[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(n).forEach((e=>{r[e]=!0,a[t.name][e]=n[e]})))})),e.state.addStateInfo({stateValue:Wx,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][n]]:!0===s[t[n]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var s,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(s=a[i[0][n]])||void 0===s?void 0:s[t]}return o=null===(r=a[i[n]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,Wx,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,n;(null===(n=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===n?void 0:n.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(ux.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new tI(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!W(e,t[i]))))&&(i.reCompile=!0,BI(i))}_getSpecUpdatePolicy(){return wI}_compareSpec(t,e,i){var n,s,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!W(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),u=null!==(n=c.compileOnlyKeys)&&void 0!==n?n:{},d=null!==(s=c.dataRelatedKeys)&&void 0!==s?s:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},u),d),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},dI),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(G(t.label),G(e.label),l),!l.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>MI(t[i],e[i],TI)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!W(t[i],e[i]))),_=h.filter((i=>g[i]&&!W(t[i],e[i]))),b=h.filter((i=>p[i]&&MI(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>d[t]))?BI(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&BI(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!W(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof oi||HS(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();SI(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,n;return null!==(n=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==n?n:void 0}}_getSeriesInfo(t,e){var i;const n=this.getDefaultShapeType(),s=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==s||s.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const s=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:s,style:this.getSeriesStyle(s),shapeType:n}}))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:zx,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),n=this._getDataScheme();return null===(e=(t=(new Wb).domain(i)).range)||void 0===e?void 0:e.call(t,n)}_getDataScheme(){return Ib(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:zx}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var n,s,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:u={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),d(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),d(h)||_.setGroupKey(h);const l=null!==(n=i.morph)&&void 0!==n&&n,p=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(s=e.morph)||void 0===s?void 0:s.morphKey)||(l?`${this.getSpecIndex()}_${p}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,cx({},u,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:jx}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),n=this.getDimensionField(),s=i?t[i]:void 0;let r,a=!1;for(let s=0;s0?"_":""}${d(l)?"":l}`,a||(a=o===i),r=l}return!i||a||n.length>1&&r===s||(e+=`_${s}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==Gx&&t!==Xx&&t!==Vx&&t!==Yx||(t=this.getStackValueField()),null!==(e=cS(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>zy(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),n=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=n?n:[]}_forEachStackGroup(t,e){var i,n;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(n=e.values)||void 0===n?void 0:n.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:zx]}}function PI(t,e,i){const n=t.getScale(0),s="isInverse"in t&&t.isInverse();P_(n.type)?i.sort(((t,i)=>(t[e]-i[e])*(s?-1:1))):i.sort(((t,i)=>(n.index(t[e])-n.index(i[e]))*(s?-1:1)))}function OI(t){return{dataIndex:e=>{var i,n;const s="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[s],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(n=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==n?n:[]).indexOf(r)||0},dataCount:()=>{var e,i,n;const s="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(n=(null!==(i=null===(e=null==s?void 0:s.domain)||void 0===e?void 0:e.call(s))&&void 0!==i?i:[]).length)&&void 0!==n?n:0}}}EI.mark=oI,EI.transformerConstructor=AI;class RI extends EI{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const n={key:i,operations:[]},s=e.axisHelper.getScale(0);P_(s.type)?(n.operations=["max","min"],"log"===s.type&&(n.filter=t=>t>0)):n.operations=["values"],t.push(n)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${Dx}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(Gx),this.setFieldX2(Vx)):(this.setFieldY(Gx),this.setFieldY2(Vx))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(Xx),this.setFieldX2(Yx)):(this.setFieldY(Xx),this.setFieldY2(Yx))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX($x),this.setFieldX2(Kx)):(this.setFieldY($x),this.setFieldY2(Kx))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=G(this._spec.xField),this._specYField=G(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,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(G(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,n,s,r){const a=s();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,n);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(G(this.getDatumPositionValues(t,o)),this._scaleConfig)))),s()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(PI("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function II(t){return"bottom"===t||"top"===t}function DI(t){return"left"===t||"right"===t}function LI(t){return"z"===t}function FI(t,e){return Kb(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function UI(t,e){var i;const n=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?II(t)?"linear":"band":II(t)?"band":"linear"}(t.orient,e);return{axisType:n,componentName:`${r.cartesianAxis}-${n}`}}const NI=(t,e,i)=>{var n;const s=null!==(n="band"===e?VR("axisBand",i):["linear","log","symlog"].includes(e)?VR("axisLinear",i):{})&&void 0!==n?n:{},r=II(t)?VR("axisX",i):DI(t)?VR("axisY",i):VR("axisZ",i);return cx({},VR("axis",i),s,r)};class jI{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,n;(null!==(n=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==n?n:Oy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:Oy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,n,s;const r=null!==(s=null===(n=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===n?void 0:n.call(i,this.chart,{x:t,y:e}))&&void 0!==s?s:[];return 0===r.length?null:r}dispatch(t,e){var i,n;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=s.filter((t=>R_(t.getScale().type))),a=r.length?r:s.filter((t=>{const e=t.getOrient();return II(e)||"angle"===e})),o=[],l=null===(n=this.chart)||void 0===n?void 0:n.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class zI extends jI{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.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:ES.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const WI=(t,e)=>{var i,n;return t===e||!d(t)&&!d(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))},HI=(t,e)=>{const i=t.tooltipFilterRange,n="function"==typeof i?i({scale:e}):i;return A(n)?[-n,n]:n},VI=(t,e,i,n)=>{var s;const r=e.getScale(),a=R_(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(n(h)),l=null===(s=h.getViewData())||void 0===s?void 0:s.latestData;if(i&&l)if(a){const e=[],n=[];l.forEach(((s,r)=>{var a;(null===(a=s[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(s),n.push(r))})),o.push({series:h,datum:e,key:GI(h,n)})}else if(p(i[1])){const e=[],n=[];l.forEach(((s,r)=>{var a;((null===(a=s[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(s[i[0]])&&p(s[i[1]])&&t>=s[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=s[0]&&r<=s[1]&&(a.push(e),c.push(n))}}));else{let e=1/0,n=0;l.forEach(((s,r)=>{if(p(s[i[0]])){const o=Math.abs(s[i[0]]-t),l=Math.sign(s[i[0]]-t);o`${t.id}_${e.join("_")}`,YI=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&e(n)&&((t,e,i)=>{const n=t.getRegionsInIds(G(e.layout.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})}))})(t,n,i)));return n.length?n:null};class XI extends jI{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,n,s;if(!t||(null===(s=null===(n=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===n?void 0:n.disableDimensionHoverEvent)||void 0===s?void 0:s.call(n)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!WI(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,n,s;t&&!(null===(s=null===(n=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===n?void 0:n.disableDimensionHoverEvent)||void 0===s?void 0:s.call(n))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:ES.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:ES.canvas}),callback:this.onMouseOut}),Fy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:ES.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Fy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var KI;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(KI||(KI={}));const $I={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qI={sampling:!0,samplingFactor:!0};class ZI{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,n=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark($I.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var n,s;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:WR,curveType:zR,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,o=a===jR?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark($I.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:_I(this._spec,$I.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new oi(this._option.dataSet,{name:`${Dx}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(KI.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const n in this._symbolMark.stateStyle[i])"visible"!==n&&(this._symbolActiveMark.stateStyle[i][n]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const n=this._symbolActiveMark;n&&(this._initSymbolMark(n),n&&(null===(i=null===(e=this._spec[$I.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(n.setVisible(!0),this.event.on(KI.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(n,cx({},this._spec[$I.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var n,s,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(s=null===(n=e.stateStyle.normal)||void 0===n?void 0:n[i])||void 0===s?void 0:s.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const JI=Object.assign(Object.assign({},oI),$I),QI=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>QI(t,e[i])));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]))},tD=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class eD extends lR{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return tD}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const n=this._getIgnoreAttributes(),s=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||n.includes(a))return;r&&s.includes(a)&&(O_(null==o?void 0:o.type)||(null==o?void 0:o.scale)||u(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let n=null;return t.forEach(((t,e)=>{n&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?QI(t,e):t===e))(n[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),n=t,i.push({attrs:n,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var n,s;const r=e.context.data,a=[],o=[],l={},h=null===(n=this.renderContext)||void 0===n?void 0:n.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var n;o[i]={},a[i]={},Object.keys(t).forEach((n=>{this._isValidPointChannel(n)?o[i][n]=t[n](e):this._segmentStyleKeys.includes(n)&&!h?a[i][n]=t[n](e):0!==i||h&&!c||(l[n]=t[n](e))})),o[i].context=null!==(n=this._keyGetter(e))&&void 0!==n?n:i})),h){const t=(null===(s=e.attribute)||void 0===s?void 0:s.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const n=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&n&&n.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,n)=>{const s=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=s.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:dO.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[n].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[jx]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const iD=new Uint32Array(33),nD=new Uint32Array(33);nD[0]=0,iD[0]=~nD[0];for(let t=1;t<=32;++t)nD[t]=nD[t-1]<<1|1,iD[t]=~nD[t];function sD(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:n=0,left:s=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+s+r+o)/o),h=~~((e+n+a+o)/o),c=t=>~~(t/o);return c.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:({x1:n,y1:s,x2:r,y2:a})=>{if(r<0||a<0||n>t||s>e)return!0;let o,l,h,c,u=a;for(;u>=s;--u)if(o=u*t+n,l=u*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&iD[31&o]&nD[1+(31&l)])return!0}else{if(i[h]&iD[31&o])return!0;if(i[c]&nD[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||s>e)return;let o,l,h,c,u;for(;s<=a;++s)if(o=s*t+i,l=s*t+r,h=o>>>5,c=l>>>5,h===c)n(h,iD[31&o]&nD[1+(31&l)]);else for(n(h,iD[31&o]),n(c,nD[1+(31&l)]),u=h+1;u{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+n,l=a>>>5,h=o>>>5,l===h)s(l,nD[31&a]|iD[1+(31&o)]);else for(s(l,nD[31&a]),s(h,iD[1+(31&o)]),c=l+1;ci<0||n<0||r>=e||s>=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}}}(l,h),c.x=t=>~~((t+s)/o),c.y=t=>~~((t+n)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function rD(t,e){const{x1:i,x2:n,y1:s,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=ut(i,-o,t.width+l),u=ut(n,-o,t.width+l),d=ut(s,-a,t.height+h),p=ut(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(u),y1:t.y(d),y2:t.y(p)}}function aD(t,e,i=!1){return i?rD(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function oD(t,e,i,n=!0,s=0){let r=i;s>0&&(r={x1:i.x1-s,x2:i.x2+s,y1:i.y1-s,y2:i.y2+s}),r=aD(t,r);const a=e.outOfBounds(r);return!(n&&a||(a&&(r=rD(t,r)),e.getRange(r)))}function lD(t,e,i,n=[],s=!0,r=0,a=!1){var o,l,h,c;const u=n.filter((t=>p(t))),d=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(s.AABBBounds,r,t,n.offset))),l=!1===i.restorePosition;return lD(t,e,s,o,h,c,l)}return!1}var d;if("moveY"===i.type){const n=(i.offset?u(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return lD(t,e,s,n,h,c)}if("moveX"===i.type){const n=(i.offset?u(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return lD(t,e,s,n,h,c)}return!1}const cD=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],uD=["top","inside-top","inside"];function dD(t,e,i,n={}){const{x1:s,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:u=0}=n,d=Math.min(s,r),p=Math.max(s,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+u;let y=0,_=0;return d<0-h?y=-d:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const pD={mode:"same-time",duration:300,easing:"linear"};function gD(t){return 3===t||4===t}function fD(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)}const mD=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function vD(t,e,i,n,s,r){return Math.abs(e/t)0?s:-s),y:n+e*s/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:n+(e>0?r:-r)}}class yD extends _B{onBind(){const t=fE(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:n,curText:s,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in s.attribute)n.attribute[t]!==s.attribute[t]&&(l[t]=s.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(n,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(n,{type:"increaseCount",to:{text:s.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class _D extends _B{onBind(){const t=fE(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:n,relatedGraphics:s,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?n.animates&&n.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?s&&s.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):n.animates&&n.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const bD=(t,e)=>Math.ceil(t)>Math.floor(e),xD=([t,e],[i,n])=>n>t&&e>i;function SD(t,e){const[i,n]=t,[s,r]=e,a=Math.max(i,s),o=Math.min(n,r);return Math.max(0,o-a)}const AD=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class CD extends Tc{constructor(t,e){super(t),this._skipRenderAttributes=AD,(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,n){const s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,n);if(s)return this._setAttributes(s,i);m(this.attribute[t])&&m(e)&&!u(this.attribute[t])&&!u(e)?U(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){d(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{kD(t,e,i)})),e}function MD(t,e){e&&(null==t||t.onComplete.push(e))}function BD(t){t.forEach((t=>{t()}))}function ED(t,e,i){const n=t=>{const n=e();n&&!n.finalized&&n.pendingAnimates.has(t)&&(n.pendingAnimates.delete(t),n.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>n(t))),t.onRemove((()=>n(t)))}))}var PD=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(e.states)||(e.addState(s_.hover,!0),Hy(this,(t=>{t===e||E(t.states)||t.addState(s_.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(Hy(this,(t=>{E(t.states)||(t.removeState(s_.hoverReverse),t.removeState(s_.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void Hy(this,(t=>{E(t.states)||(t.removeState(s_.selectedReverse),t.removeState(s_.selected))}));E(e.states)||(e.addState(s_.selected,!0),Hy(this,(t=>{t===e||E(t.states)||t.addState(s_.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,n,s,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===Yi.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Yi.ANIMATE_UPDATE&&(null===(n=t.detail.animationState)||void 0===n?void 0:n.isFirstFrameOfStep)){const e=null!==(r=null===(s=t.target)||void 0===s?void 0:s.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,n){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if($t(t,e,!0))return;const i=Math.min(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-n)/2,l=Math.abs(e.x2-s)/2,h=Math.abs(e.y2-r)/2,c=i+a,u=n+o,d=s+l,p=r+h,g=d-c,f=p-u;return[vD(g,f,c,u,a,o),vD(-g,-f,d,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const n=t_.line({points:i}),{line:s={}}=t.attribute;if(s.customShape){const i=s.customShape;n.pathProxy=n=>i({text:t,baseMark:e},n,new Zn)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&n.setAttribute("stroke",r.fill),this.attribute.line&&!E(this.attribute.line.style)&&n.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(n),n}}_finalizeExitRelease(){var t,e,i,n;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const r=this.parent,a=!!(null==s?void 0:s.removeFromParent),o=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(n=null!=r?r:this.parent)||void 0===n||n.removeChild(this)),BD(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,MD(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(pD),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const n=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&n.add(t.text),(null==t?void 0:t.labelLine)&&n.add(t.labelLine)})),!n.size)return!1;const s=kD(this);n.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=kD(this).filter((t=>!s.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},ED(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:n,customOverlapFunc:s}=this.attribute;let r=this.attribute.data;if(u(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}let a=this._initText(r);a=u(n)?n(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(a);const o=[],l=a;if(!c(t)&&u(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}u(s)?a=s(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),u(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return u_(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let n;if(n=u(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),n.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:s}=this.attribute;if(s&&0!==s.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),s),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let n=0;nl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,s,h,c):this._overlapByStrategy(t,s,h,c)}_overlapGlobal(t,e,i,n){let s=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,u=t=>o.get(t).x,d=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let s=t.length-1;s>=0;s--){const r=t[s],a=t[s-1],l=t[s+1];if(a&&bD(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=n(r);l&&bD(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:n,x2:s}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:n,x2:s,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(n>=o&&s<=l)i.push(e),h=!0;else if(ot(r,u(i[0]),void 0,5)){const r={start:Math.min(o,n),end:Math.max(l,s)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(SD([o,l],[n,s])/(l-o)>.5){const r={start:Math.min(o,n),end:Math.max(l,s)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:n,end:s},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==s.enable){const{maxIterations:e=10,maxError:n=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:u=Number.MAX_VALUE}=s;for(let s=0;sl(t)-l(e)));let e=0;for(let n=0;n=o)continue;let r,v=n+1;for(;(r=t[v])&&!xD([d(s),p(s)],[d(r),p(r)]);)v+=1;if(r){const t=c(s),n=h(s),o=c(r),d=o-(t+n);if(di){const e=t-(a-d),i=l(s)-e;Math.abs(i)<=u&&(f(s,e),m(s,g(s)+1))}else if(t-n<0){const t=o+(a-d),e=l(r)-t;Math.abs(e)<=u&&(f(r,t),m(r,g(r)+1))}else{const e=t-n,i=l(s)-e,a=o+n,h=l(r)-a;Math.abs(i)<=u&&Math.abs(h)<=u&&(f(s,e),f(r,a),m(s,g(s)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(s,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(s=this._baseMarks)||void 0===s||s.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&n.setRange(aD(i,e,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&n.setRange(aD(i,t.AABBBounds,!0))})):t.AABBBounds&&n.setRange(aD(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:n}=e;return{x1:i,x2:i,y1:n,y2:n}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:n=t,y1:s=i}=e;return{x1:(t+n)/2,x2:(t+n)/2,y1:(i+s)/2,y2:(i+s)/2}}const{x:n,y:s}=e;return{x1:n,x2:n,y1:s,y2:s}}_renderLabels(t){var e;const{syncState:i}=this.attribute,n=new Map,s=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,u=(null==s?void 0:s.get(c))?"update":"enter";let d;o&&(d=this._createLabelLine(t,h));const p=d?{text:t,labelLine:d}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u)r.push(t),n.set(c,p),this._addLabel(p,r,a,e);else if("update"===u){const t=s.get(c);s.delete(c),n.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(s),this._graphicToText=n}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:n}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var s;null===(s=e.setFinalAttributes)||void 0===s||s.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},n),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},n),{type:e===t?n.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:n}=t,{text:s,labelLine:r}=e;TD(i,null==s?void 0:s.attribute),TD(n,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:s,prevLabelLine:n,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,n){const{text:s,labelLine:r}=t,a=this.getRelatedGraphic(s.attribute);this._syncStateWithRelatedGraphic(a),s&&this.add(s),r&&this.add(r),this.runEnterAnimation(s,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:n,labelLine:s}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),i&&s&&t.labelLine.setAttributes(s.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,n,s,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:u,mode:d,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(n=l.brightColor)&&void 0!==n?n:"#ffffff",y=null!==(s=l.darkColor)&&void 0!==s?s:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{RD[t]=e};var DD=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),n&&0!==n.length||(n=[e]);const r="start"===i?0:n.length-1;return n[r]?{x1:n[r].x,x2:n[r].x,y1:n[r].y,y2:n[r].y}:void 0}labeling(t,e,i="end",n=0){return function(t,e,i="end",n=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:s,x2:r}=t,a=Math.abs(r-s),o=e.x1;let l=o;return"end"===i?l=o+a/2+n:"start"===i&&(l=o-a/2-n),{x:l,y:e.y1}}(t,e,i,n)}};LD.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const FD=()=>{ID("line",LD),ID("area",LD)};var UD=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{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,u=(e.y1+e.y2)/2;let d=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":d=-1;break;case"right":d=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":d=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":d=0,p=0}return{x:c+d*(n+g)+Math.sign(d)*(l/2),y:u+p*(n+f)+Math.sign(p)*(h/2)}})(t,e,i,n)}}ND.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const jD=()=>{ID("symbol",ND),ID("line-data",ND)};class zD extends eD{constructor(){super(...arguments),this.type=zD.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)===Bb.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}zD.type="line";const WD=()=>{ux.registerMark(zD.type,zD),HM(),BM(),FD(),jD(),TR(),ux.registerGraphicComponent("line",Mh)};class HD extends lR{constructor(){super(...arguments),this.type=HD.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var n,s,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(s=null!==(n=a.shape)&&void 0!==n?n:a.symbolType)&&void 0!==s?s:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}HD.type="symbol";const VD=()=>{ux.registerMark(HD.type,HD),HM(),XM(),jD(),ux.registerGraphicComponent("symbol",wh)};class GD extends AI{_transformLabelSpec(t){var e,i,n;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(n=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===n?void 0:n.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function YD(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function XD(t,e){var i;const n=Y(e)-e[0],s=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===n?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=n,a/=n);const o=t.getDomainSpec(),l={total:n,negative:r,positive:a,includeZero:s,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let n,s;0===i?(n=t._break.scope[i],s=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,s=[e[e.length-2],e[e.length-1]]):(n=t._break.scope[i-1],s=[e[i-1],e[i]],l.negative=n[0]+(0-s[0])/(s[1]-s[0])*(n[1]-n[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=s}return l}function KD(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:u}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),u[0]=-u[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),u[1]=-u[0]*t}return!0}function $D(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 qD(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 ZD(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)}const JD=t=>t.map(((t,e)=>({index:e,value:t}))),QD=(t,e,i,n)=>it?Math.min(t-e/2,i-e):i{var n,s,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let u=null!==(n=a.angle)&&void 0!==n?n:0;"vertical"===a.direction&&(u+=Nt(90));const d=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;d||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=o_(a),y=t.range();let _=[];for(let i=0;i{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;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const u=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==u?void 0:u.length))return t;const d=o.getScale();if(!d)return t;const p=d.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=u.map((t=>function(t,e,i,n,s){const r=Lt(t,e),a=Math.max(Dt(i),Dt(r));return s*(Math.round(r*10**a)/Math.round(i*10**a))+n}(t.value,p[0],g,f[0],m)));return JD(v)};class iL{constructor(t){this.id=jy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class nL extends iL{constructor(){super(nL.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!P_(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const n=this._checkEnableSync(i);if(!n)return;if(!n.zeroAlign)return;const s=this._getTargetAxis(i,n);s&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===s.id},(()=>{((t,e)=>{var i,n,s,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(s=null===(n=(i=t).getDomainAfterSpec)||void 0===n?void 0:n.call(i))&&void 0!==s?s:[0,1],u=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&u&&YD(c)&&YD(u)))return;const d=XD(t,c),p=XD(e,u);if(!0===d.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=d,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!$D(d,p))return}else if(0===_&&0===b){if(!$D(p,d))return}else if(y||A)if(y&&!A){if(!KD(d,p))return}else if(A&&!y){if(!KD(p,d))return}else{if(f===b)return;if(f>b){if(!qD(d,p))return}else if(!qD(p,d))return}else{if(0===f&&0===_){if(!ZD(d,p))return}else if(0===b&&0===g&&!ZD(p,d))return;if(0===f&&0===b)if(0===c[0]&&u[0]>0){if(!x)return;u[0]=0}else{if(!(0===u[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&u[1]>0){if(!S)return;u[1]=0}else{if(!(0===u[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(u)})(s,i)}))}onDidCompile(t,e){var i;const n=this._checkEnableSync(e);if(!n)return;const s=this._getTargetAxis(e,n);if(s&&n.tickAlign){LS(e.getOption().dataSet,"tickAlign",eL);const t={targetAxis:()=>s,currentAxis:()=>e},n=null===(i=s.getTickData())||void 0===i?void 0:i.getDataView();n&&n.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}nL.pluginType="component",nL.type="AxisSyncPlugin";const sL={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function rL(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 aL(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const oL=t=>"band"===t||"ordinal"===t||"point"===t;function lL(t,e){return{id:t,label:t,value:e,rawValue:t}}function hL(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class cL extends pR{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const uL=`${Dx}_ARC_TRANSFORM_VALUE`,dL=`${Dx}_ARC_RATIO`,pL=`${Dx}_ARC_START_ANGLE`,gL=`${Dx}_ARC_END_ANGLE`,fL=`${Dx}_ARC_K`,mL=`${Dx}_ARC_MIDDLE_ANGLE`,vL=`${Dx}_ARC_QUADRANT`,yL=`${Dx}_ARC_RADIAN`,_L=-Math.PI/2,bL=3*Math.PI/2,xL=(t,e,i)=>{var n;const s=null!==(n="band"===e?VR("axisBand",i):"linear"===e?VR("axisLinear",i):{})&&void 0!==n?n:{},r=VR("angle"===t?"axisAngle":"axisRadius",i);return cx({},VR("axis",i),s,r)};function SL(t,e,i,n){switch(t){case r.cartesianBandAxis:return NI(FI(i,["z"]),"band",e);case r.cartesianLinearAxis:return NI(FI(i,["z"]),"linear",e);case r.cartesianLogAxis:return NI(FI(i,["z"]),"log",e);case r.cartesianSymlogAxis:return NI(FI(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return NI(FI(i),void 0,e);case r.polarBandAxis:return xL(i.orient,"band",e);case r.polarLinearAxis:return xL(i.orient,"linear",e);case r.polarAxis:return xL(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,n;const s=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:u}=null!==(n=VR(r.crosshair,t))&&void 0!==n?n:{},d=s.find((t=>II(t.orient)));let g;g=p(d)?cx({},oL(d.type)?a:o,l):l;const f=s.find((t=>DI(t.orient)));let m;return m=p(f)?cx({},R_(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:u}})(e,n);case r.polarCrosshair:return((t,e)=>{var i,n;const s=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:u}=null!==(n=VR(r.crosshair,t))&&void 0!==n?n:{},d=s.find((t=>"angle"===t.orient));let g;g=p(d)?cx({},oL(d.type)?a:o,l):l;const f=s.find((t=>"radius"===t.orient));let m;return m=p(f)?cx({},R_(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:u}})(e,n);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return AL(i,VR(t,e));default:return VR(t,e)}}const AL=(t,e)=>{var i;const n=e[function(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}(null!==(i=t.orient)&&void 0!==i?i:e.orient)],s=cx({},e,n);return delete s.horizontal,delete s.vertical,s};class CL extends vO{getTheme(t,e){return SL(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:n}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:n}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:n}=t;i&&e&&n&&(t.padding=Object.assign(Object.assign({},tx(e)),{[n]:0}))}}class wL extends bO{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=CL,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,n=null,s=null)=>{var r,a;e instanceof Ci||this.event.emit(i,{model:this,node:t,event:e,item:n,datum:s,source:ES.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:n}=t,s=e(t,["spec"]);return new this(n,Object.assign(Object.assign({},i),s))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new cL(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!W(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,n;LR(t),null===(n=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===n||n.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=FR(t),n=UR(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,n,s;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(s=null===(n=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===s||s.call(n,t)}))}});return n?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,n;this._exitingVRenderComponents.add(t),null===(n=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===n||n.call(i,t)}))):void 0}LR(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var TL,kL;wL.transformerConstructor=CL,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(TL||(TL={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(kL||(kL={}));class ML extends lR{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,n,s,r;null===(r=null===(s=null===(n=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.globalInstance)||void 0===s?void 0:s._registerExitingVRenderComponent)||void 0===r||r.call(s,t)}_unregisterExitingComponent(t){var e,i,n,s,r;null===(r=null===(s=null===(n=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===r||r.call(s,t)}_releaseComponentWithExitAnimation(t,e){var i,n;const s=this._product;if(!t||(null===(n=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===n?void 0:n.call(i)))return!1;const r=UR(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&s?this._removeProductAfterExit(t,s):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?s:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?LR(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(LR(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=ux.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(kS.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}ML.type="component";const BL=()=>{ux.registerMark(ML.type,ML)};var EL,PL;!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.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(EL||(EL={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(PL||(PL={}));const OL={[PL.selectedReverse]:{},[PL.selected]:{},[PL.hover]:{},[PL.hoverReverse]:{}},RL=t=>t,IL={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class DL extends wL{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,n;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(n=t.hideWhenEmpty)&&void 0!==n&&n,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,n,s,r,a,o,l,h,c,u,d,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?TL.circleAxis:TL.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?kL.circleAxisGrid:kL.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(s=null===(n=this._spec.grid)||void 0===n?void 0:n.style)||void 0===s?void 0:s.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=fI(null===(h=ux.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(u=null!==(c=this._spec.animationAppear)&&void 0!==c?c:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==u?u:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:P(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:P(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:P(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:P(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:P(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:P(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:P(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new UO(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&T_(this._regions,(n=>{var s;let a=this.collectSeriesField(t,n);if(a=_(a)?P_(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=n.getFieldAlias(a[0])),a){const t=n.getViewData();if(e)a.forEach((t=>{i.push(n.getRawDataStatisticsByField(t,!!P_(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(s=n.getViewDataStatistics)||void 0===s?void 0:s.call(n),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((n=>{var s;(null===(s=null==e?void 0:e.latestData)||void 0===s?void 0:s[n])&&(o?i.push(Object.assign(Object.assign({},e.latestData[n]),{values:t.latestData.map((t=>t[n]))})):i.push(e.latestData[n]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return T_(this._regions,(e=>{var i;_(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;p(t)&&(this._seriesUserId=G(t)),p(i)&&(this._regionUserId=G(i)),p(e)&&(this._seriesIndex=G(e)),p(n)&&(this._regionIndex=G(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=function(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),T_(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,n,s,r,a,o,l,h,c,u;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(s=null===(n=this._axisMark)||void 0===n?void 0:n.getComponent)||void 0===s?void 0:s.call(n))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(u=this._spec.grid)||void 0===u?void 0:u.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&W(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):T_(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(T_(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;tW(null==e?void 0:e[i],null==t?void 0:t[i])||IL[i]))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var n;if(t.domainLine&&t.domainLine.visible?i.line=((n=_S(n=t.domainLine)).startSymbol=_S(n.startSymbol),n.endSymbol=_S(n.endSymbol),n):i.line={visible:!1},t.label&&t.label.visible){const e=N(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=u(t.label.style)?(e,i,n,s)=>{var r;const a=t.label.style(e.rawValue,i,e,n,s);return xS(cx({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:xS(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,n,s,r)=>xS(t[i](e.rawValue,n,e,s,r)):E(t[i])||(e[i]=xS(t[i]))})),e}(t.label.state)),u(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:u(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=u(t.tick.style)?(e,i,n,s)=>{var r;const a=t.tick.style(e,i,n,s);return xS(cx({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:xS(t.tick.style)),t.tick.state&&(i.tick.state=bS(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=u(t.subTick.style)?(e,i,n,s)=>{var r;const a=t.subTick.style(e,i,n,s);return xS(cx({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:xS(t.subTick.style)),t.subTick.state&&(i.subTick.state=bS(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const n=t.title,{autoRotate:s,angle:r,style:a={},background:o,state:l,shape:h}=n,c=e(n,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==t.orient&&"right"!==t.orient||s&&d(p)&&(p="left"===t.orient?-90:90,u=sL[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?Nt(p):null,textStyle:cx({},u,xS(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:xS(h.style)}),h.state&&(i.title.state.shape=bS(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:xS(o.style)}),o.state&&(i.title.state.background=bS(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=bS(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=xS(t.background.style)),t.background.state&&(i.panel.state=bS(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:Rx(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:u(t.grid.style)?(e,i)=>{var n,s;const r=t.grid.style(null===(n=e.datum)||void 0===n?void 0:n.rawValue,i,e.datum);return xS(cx({},null===(s=this._theme.grid)||void 0===s?void 0:s.style,r))}:xS(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:Rx(t.subGrid.alternateColor),style:xS(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=GR(t,e);return i?(t,n,s)=>i(n.rawValue,n,e):null}_initTickDataSet(t,e=0){FS(this._option.dataSet,"scale",RL);const i=this.registerTicksTransform();return new oi(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:n,tickStep:s,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:n,tickStep:s,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var n;null===(n=null==i?void 0:i.getDataView())||void 0===n||n.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===EL.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}DL.specKey="axes";const LL=()=>{BL(),ux.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},FL=[nL];class UL extends DL{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,n){super(i,n),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),T_(this._regions,(t=>{const e=this.getOrient();II(e)?hL(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):DI(e)?hL(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):LI(e)&&hL(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:n}=i,s=e(i,["grid"]),r=cx({x:t.x,y:t.y},this._axisStyle,s);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(cx({x:t.x,y:t.y},this._getGridAttributes(),n)),this._syncComponentVisibility()},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=II(this.getOrient()),s=t=>{var e;return(n?!II(t.getOrient()):II(t.getOrient()))&&P_(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&Y(t.getScale().domain())>=0)},r=i.filter((t=>s(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);n?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=FI(i,["z"]),LI(this._orient)&&(this.layoutType="absolute"),this._dataSet=n.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!aL(e))return null;const{axisType:t,componentName:n}=UI(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:n}]}const n=e.filter((t=>"z"===t.orient))[0];let s=!0;if(n){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>DI(t.orient)))[0];s=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));s||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!aL(t))return;const{axisType:n,componentName:s}=UI(t,i);t.type=n,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:s})})),a}static createComponent(t,i){const{spec:n}=t,s=e(t,["spec"]),r=ux.getComponentInKey(s.type);return r?new r(n,Object.assign(Object.assign({},i),s)):(i.onError(`Component ${s.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:n,top:s,bottom:r}=this._innerOffset;let a=[];return II(this.getOrient())?A(t)&&(a=this._inverse?[t-n,i]:[i,t-n]):LI(this.getOrient())?A(t)&&(a=this._inverse?[t-n,i]:[i,t-n],this._scale.range(a)):A(e)&&(a=this._inverse?[s,e-r]:[e-r,s]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(FL.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){II(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!II(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!LI(this.getOrient())&&this._spec.innerOffset){const t=this._spec;DI(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=Zb(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=Zb(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=II(this.getOrient())?t.fieldX:LI(this.getOrient())?t.fieldZ:t.fieldY,P_(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,n;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(n=this._spec.label)||void 0===n?void 0:n.flush})}axisHelper(){return{isContinuous:P_(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(kS.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(II(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=II(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return T_(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,n;let s;return s=t>0?null===(n=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===n?void 0:n[t]:II(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:LI(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,s}updateSeriesScale(){const t=this.getOrient();T_(this._regions,(e=>{II(t)?hL(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):DI(t)?hL(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):LI(t)&&hL(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=II(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&_(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const n={skipLayout:!1},s=II(this.getOrient());this.pluginService&&(s?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),n=cx(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(n);a&&!a.empty()||(a=(new ce).set(n.x,n.y,n.x,n.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,s)}return i}positionToData(t,e){const i=II(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?ut(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):ut(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const n=this._scale.range();return(t-n[0])*(t-Y(n))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,n,s,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(n=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==n?n:null===(s=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),n=e+t[0].getLayoutRect().width,s=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return lL(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,n=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:P_(this._scale.type)?i>=n[0]&&i<=Y(n):n.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let n=0,s=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;n=Math.max(n,e)}else if(e===a){const e=t.getLayoutRect().width;s=Math.max(s,e)}})),{left:n,right:s}}}}UL.type=r.cartesianAxis,UL.specKey="axes";const NL=(t,e,i,n)=>{const s=tL(t,e,i);return s&&s.map((t=>n?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},jL=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,zL=(t,e)=>t[1]{var i;const n=t.domain();if(!n.length)return[];const{tickCount:s,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?JD([n[n.length-1]]):JD([n[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(s)){const e=u(s)?s({axisLength:f,labelStyle:h}):s;m=t.ticks(e)}else if(e.sampling){const s=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(g),a=X(g);if(n.length<=f/s){const i=NL(t,n,e,c);if(i){const s=Math.min(...i.map((t=>t[2]))),l=(a-r)/n.length,h=HL(n,i,o,e.labelLastVisible,Math.floor(s/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(n[n.length-1]))}}else{const i=[n[0],n[Math.floor(n.length/2)],n[n.length-1]],s=NL(t,i,e,c);if(s){let i=null;s.forEach((t=>{i?i[2]0?Math.ceil(n.length*(o+i[2])/(a-r-o)):n.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===n[n.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(n[n.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=n=>{let s=!0,r=0;do{r+n{let n=t,s=e;for(;n=0?s=t:n=t+1}return n})(s,t.length,(t=>c(t)?1:-1));let d=u;do{if(d>u&&!r&&!c(d))d++;else{if(!n){o=d;break}{const n=t.length-1;let s,r=0;s=t.length%d>0?t.length-t.length%d+d:t.length;do{if(s-=d,s!==n&&!jL(e[s],e[n],i))break;r++}while(s>0);if(s===n){o=d,a=r;break}{const i=Math.floor(t.length/d)-r+1;if(i=0?zL(e[s-d],e[s]):t,u=Math.abs(t-c);if(u{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function GL(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=b_(t,!!s),o=b_(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=VL(e,t,!1,!!s),o=VL(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=b_(t,!!s),o=b_(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class YL extends CD{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&y_(this._innerView),this.removeAllChild(!0),this._innerView=t_.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return __(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=U({},this.attribute,this.getGridAttribute(t)),{type:n,items:s,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${EL.grid}-sub`:`${EL.grid}`;if(s.forEach(((t,i)=>{const{id:s,points:o}=t;let c="";if("line"===n||"polygon"===n)c=b_(o,!!a);else if("circle"===n){const{center:t}=this.attribute;c=VL(t,o,!1,!!a)}const d=t_.path(Object.assign({path:c,z:l},u(r)?U({},this.skipDefault?null:YL.defaultAttributes.style,r(t,i)):r));d.name=`${h}-line`,d.id=this._getNodeId(`${h}-path-${s}`),e.add(d)})),l&&"line"===n&&s.forEach(((t,i)=>{const{id:n,points:s}=t,o=[];o.push(s[0]);const c=s[1].x-s[0].x,d=s[1].y-s[0].y,p=Math.sqrt(c*c+d*d),g=l/p;o.push({x:s[0].x+c*g,y:s[0].y+d*g});const f=b_(o,!!a),m=Ct(o[0].x-o[1].x),v=Ct(o[0].y-o[1].y),y=t_.path(Object.assign({path:f,z:0,alpha:m>v?(s[1].x-s[0].x>0?-1:1)*bt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},u(r)?U({},this.skipDefault?null:YL.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${n}`),e.add(y)})),s.length>1&&o){const t=_(o)?o:[o,"transparent"],n=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!ot(a.value,0)&&!ot(l.value,0),u=!ot(a.value,1)&&!ot(l.value,1),d=[],p=a.value>l.value;(p&&u||!p&&c)&&d.push(this.getGridPointsByValue(p?1:0)),s.forEach((t=>{d.push(t.points)})),(p&&c||!p&&u)&&d.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,n=[];return i>=2&&this.data.forEach((i=>{let s=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;s=e}n.push({value:s})})),n}release(){super.release(),this._prevInnerView=null,this._innerView=null}}YL.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class XL{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:n=1}=this.attribute,s=Zy(this.getRelativeVector());return function(t,e){return[t[0]*e,t[1]*e]}([s[1],-1*s[0]],t*(e?1:-1)*n)}}class KL extends _B{onBind(){var t;const e=fE(this.target);this._animator=e;const i=this.duration,n=this.easing,{config:s,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),s=this.target.attribute.x,h=this.target.attribute.y;TD(this.target,{x:s,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:s,y:h},duration:i,easing:n})}e.animate(this.target,{type:null!==(t=s.type)&&void 0!==t?t:"fadeIn",to:s.to,duration:i*o,easing:n}),this.completeBind(e)}}class $L extends _B{onBind(){const t=fE(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:n}=this.params;TD(this.target,Object.assign({},n)),t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function qL(){wM(),BM(),zM(),$M(),QM.registerBuiltInAnimate("axisEnter",KL),QM.registerBuiltInAnimate("axisUpdate",$L)}wM(),PM();class ZL extends YL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:U({},YL.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n=6,startAngle:s=e_,endAngle:r=i_}=this.attribute;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2){const s=this._getPointsOfSubGrid(n,i);for(let i=0;i{let{point:r}=s;if(!i){const t=s.value-n/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:s.label,datum:s,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},s),{items:r})}}V(ZL,XL),wM(),BM(),RM(),XM();class JL extends CD{getStartAngle(){return Wt(this._startAngle)}getEndAngle(){return Wt(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:U({},JL.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:n,visible:s=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!s)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(q(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var s,r;const a=t_.line(Object.assign(Object.assign({points:t},_(i)?null!==(s=i[e])&&void 0!==s?s:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),E(null==n?void 0:n.line)||(a.states=_(n.line)?null!==(r=n.line[e])&&void 0!==r?r:n.line[n.line.length-1]:n.line),this.add(a),this.lines.push(a)}))}else{let t=t_.line;G(i)[0].cornerRadius&&(t=t_.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(null==n?void 0:n.line)||(e.states=[].concat(n.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:n=!0}=t;let s;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:u=0,refAngle:d=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+u*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+u*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+u*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+u*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),s=t_.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:n?v+d:0,strokeBoundsBuffer:0}),p)),s.name=`${this.name}-${i}-symbol`,s.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(s.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(s.states=o.startSymbol):E(null==o?void 0:o.endSymbol)||(s.states=o.endSymbol),this.add(s)}return s}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let n;return n=e?A(i)?t[i]:q(t):t,this._mainSegmentPoints=n,n}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let n=t;if(e.visible){const i=e.clip?e.size||10:0;n=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...n.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,s={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)};n=[...n.slice(0,n.length-1),s]}return n}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],n=t[t.length-2],s=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[s.x-n.x,s.y-n.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}function QL(){wM(),FM(),XM(),zM(),$M()}JL.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}};var tF=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);sh&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),C=0,w=0;let j=0;"left"===U||"start"===U?j=1:"right"===U||"end"===U?j=-1:"center"===U&&(j=0),j?j<0?(C-=T,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-B)):j>0&&x.setAttribute("x",b[3]):(C-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-B/2));const z="right"===_||"end"===_,W="left"===_||"start"===_,H=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:G(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=T-b[1]-b[3],e=I+B,i=1===j?(t-e)/2+B+I/2:b[0]+B-(T/2+e/2-B)+I/2;if(H(i,"center"),A){const t=i-I/2-B+F/2;A.setAttributes({x:t})}}if(W&&1!==j){const t=T-b[1]-b[3],e=0===j?-t/2+B/2:-T+b[3]+b[1]+B;if(H(e+B,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(z&&-1!==j){const t=T-b[1]-b[3],e=0===j?t/2+B/2:t;if(H(e,"right"),A){const t=e-I-B+F/2;A.setAttributes({x:t})}}"middle"===N?(w-=k/2,A&&A.setAttribute("y",0)):"bottom"===N?(w-=k,A&&A.setAttribute("y",-D/2),x.setAttribute("y",-b[2])):"top"===N&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",D/2)),E(null==m?void 0:m.text)||(R.states=m.text);const{visible:V}=a,Y=tF(a,["visible"]);if(f&&c(V)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:V&&!!n,width:T,height:k,x:C,y:w}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new Zn)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:U({},eF.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(s=null===(n=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===n?void 0:n.slice())&&void 0!==s?s:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(u=this._bgRect)||void 0===u||u.clearStates(),null===(d=this._symbol)||void 0===d||d.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}eF.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const iF={type:"default",duration:300,easing:"linear"};class nF extends wD{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=((t,e,i)=>{const n=t.target;return n!==i&&n.name&&!E(n.states)?(n.addState(s_.hover,!0),Hy(e,(t=>{t!==n&&t.name&&!E(t.states)&&t.addState(s_.hoverReverse,!0)})),n):i})(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=((t,e,i)=>i?(Hy(e,(t=>{t.name&&!E(t.states)&&(t.removeState(s_.hoverReverse),t.removeState(s_.hover))})),null):i)(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=((t,e,i)=>{const n=t.target;return i===n&&n.hasState(s_.selected)?(Hy(e,(t=>{t.name&&!E(t.states)&&(t.removeState(s_.selectedReverse),t.removeState(s_.selected))})),null):n.name&&!E(n.states)?(n.addState(s_.selected,!0),Hy(e,(t=>{t!==n&&t.name&&!E(t.states)&&t.addState(s_.selectedReverse,!0)})),n):i})(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=t_.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const n=this.parent,s=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),s&&(null===(e=null!=n?n:this.parent)||void 0===e||e.removeChild(this)),BD(r)}_runExitAnimationBeforeRelease(t={}){var e,i,n;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,MD(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=new Set;if(Hy(this._innerView,(t=>{"group"!==t.type&&s.add(t)})),!s.size)return!1;const r=kD(this),{delay:a=0,duration:o=iF.duration,easing:l=iF.easing}=this._animationConfig.exit;s.forEach((t=>{var e,i,n;const s={opacity:0,fillOpacity:0,strokeOpacity:0};TD(t,s,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.attribute.strokeOpacity)&&void 0!==n?n:1}),t.animate().wait(a).to(s,o,l)}));const h=kD(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(n=(i=this._innerView).removeAllEventListeners)||void 0===n||n.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},ED(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&y_(this._innerView),this.removeAllChild(!0),this._innerView=t_.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(iF)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:n,line:s,items:r}=this.attribute,a=t_.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=EL.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),s&&s.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),n&&n.visible&&this.renderTicks(a),i&&i.visible)){const t=t_.group({x:0,y:0,pickable:!1});t.name=EL.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const n=this.renderLabels(t,e,i),s=n.getChildren();this.beforeLabelsOverlap(s,e,n,i,r.length),this.handleLabelsOverlap(s,e,n,i,r.length),this.afterLabelsOverlap(s,e,n,i,r.length);let a=0,o=0,l="center",h="middle",c=0;s.forEach(((t,e)=>{var i;const n=t.attribute,s=null!==(i=n.angle)&&void 0!==i?i:0,r=t.AABBBounds;let u=r.width(),d=r.height();s&&(u=Math.abs(u*Math.cos(s)),d=Math.abs(d*Math.sin(s))),a=Math.max(a,u),o=Math.max(o,d),l=n.textAlign,h=n.textBaseline,0===e&&(c=n.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=t_.group({x:0,y:0,pickable:!1});i.name=EL.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=t_.line(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=EL.tick,r.id=this._getNodeId(t.id),E(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=r_;else{const t=this.data[n],e=U({},r_,this.attribute.tick.state);Object.keys(e).forEach((i=>{u(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(n&&n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=t_.line(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=EL.subTick,r.id=this._getNodeId(`${s}`),E(n.state))r.states=r_;else{const i=U({},r_,n.state);Object.keys(i).forEach((n=>{u(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&&u(n)&&(e=n(e,i));const s=this._transformItems(e),r=t_.group({x:0,y:0,pickable:!1});return r.name=`${EL.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),s.forEach(((t,e)=>{var n;const a=u_(this._getLabelAttribute(t,e,s,i));if(a.name=EL.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(n=this.attribute.label)||void 0===n?void 0:n.state))a.states=r_;else{const n=U({},r_,this.attribute.label.state);Object.keys(n).forEach((r=>{u(n[r])&&(n[r]=n[r](t,e,s,i))})),a.states=n}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new eF(Object.assign({},e));i.name=EL.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return __(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&u(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let o=0,h=0;Ct(n[0])>Ct(n[1])?o=bt/2*(l.x>e.x?1:-1):h=bt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?d+=(this.axisLabelLayerSize[n-1].height+P(this.attribute,"label.space",4))*n:d+=(this.axisLabelLayerSize[n-1].width+P(this.attribute,"label.space",4))*n);const f=this.getVerticalCoord(t.point,d,o),m=this.getVerticalVector(d||1,o,f),v=l?l(`${t.label}`,t,e,i,n):t.label;let{style:y}=this.attribute.label;y=u(y)?U({},p_.label.style,y(t,e,i,n)):y;y=U(this.getLabelAlign(m,o,y.angle),y),u(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:n}));let _=y.react;return u(_)&&(_=_(t,e,i,n)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,n){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const n=this._animationConfig;this._newElementAttrMap={},Hy(e,(e=>{var s;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=I(r.attribute),a=I(e.attribute),o=$f(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(s=a.opacity)&&void 0!==s?s:1,l=!0),n.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},TD(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},n.update),{type:"axisUpdate",customParameters:{config:n.update,diffAttrs:o,lastScale:t}})}]))}else n.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},n.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:n.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const sF={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&&x_(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function rF(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function aF(t,e,i,n,s=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;t{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},cF(t,e.attribute.angle)),{angle:hF(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({},uF(t,e.attribute.angle)),{angle:hF(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Jt({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),n=i.x-e.centerX,s=i.y-e.centerY;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}function hF(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function cF(t,e=0){let 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=hF(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 uF(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],n=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const s=(e=hF(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 dF(t,e){const{limitLength:i,verticalLimitLength:n,ellipsis:s="...",orient:r,axisLength:a}=e;if(E(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,p=c?Math.sin(h):0,f=v_(h),m=m_(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=n)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=n)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=n)return}}let r=null;if(f||m)r=v?f?n:i:"vertical"===y||m?n:i;else if(v){const{x1:e,x2:n}=t.AABBBounds,s=p/u,l=Math.abs(i/p);if(_&&s>0&&e<=a+o.right&&i/s+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(_&&s<0&&n>=-o.left&&i/s+n<-o.left){const t=(n+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:s})}))}function pF(t,e,i){let n;return A(e)&&(n=Math.abs(e-t)),A(i)&&(n=A(n)?Math.min(Math.abs(t-i),n):Math.abs(t-i)),n}var gF=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{startPoint:n,endPoint:s,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=t_.group({zIndex:999});e.name=EL.axisBreak,e.id=this._getNodeId(`${EL.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:n={},angle:s=.5*Math.PI}=t,r=U({},g_,n),a=null!==(e=r.size)&&void 0!==e?e:g_.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(s)} L ${a/2} ${-a*Math.sin(s)}`,symbolSize:a})}(r),l=t_.symbol(Object.assign({x:n.x,y:n.y},o));l.name=EL.axisBreakSymbol;const h=t_.symbol(Object.assign({x:s.x,y:s.y},o));h.name=EL.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,n=t.AABBBounds,s=t_.rect(Object.assign({x:n.x1,y:n.y1,width:n.width(),height:n.height()},i.style));s.name=EL.background,s.id=this._getNodeId("background"),s.states=U({},OL,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(s,t.firstChild)}const{labelHoverOnAxis:n}=this.attribute;n&&n.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new eF(Object.assign({},t));e.name=EL.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:n}=this.attribute,s=n,{startSymbol:r,endSymbol:a,style:o,state:l}=s,h=gF(s,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let n=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:s}=e;t.push([n,i]),n=s})),t.push([n,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:U({},OL,l),symbol:U({},OL,l)});const u=new JL(c);u.name=EL.line,u.id=this._getNodeId("line"),t.add(u)}getTextAlign(t){let e="center";return ot(t[0],0)?ot(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const n=this.attribute.title,{position:s="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=n,p=gF(n,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===s?g=0:"end"===s&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+P(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,n=this.axisLabelsContainer.AABBBounds;_+=(1===m?n.x2>i?Math.min(n.x2-i,n.width()):0:n.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),C=this.getVerticalCoord(v,S,!1),w=this.getVerticalVector(S,!1,{x:0,y:0});let T,k,{angle:M}=p;if(T="start"===s?"start":"end"===s?"end":"center",d(M)&&o){M=Jy(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;k=1==-1*t?"bottom":"top"}else T=this.getTextAlign(w),k=this.getTextBaseline(w,!1);let B=u;if(d(B)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,n=Math.min(t||1/0,e||1/0);if(A(n))if("bottom"===i||"top"===i)if(M!==Math.PI/2){const t=Math.abs(Math.cos(null!=M?M:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=n-S;else if(M&&0!==M){const t=Math.abs(Math.sin(M));B=t<1e-6?1/0:this.attribute.end.y/t}else B=n-S}const E=Object.assign(Object.assign(Object.assign({},C),p),{maxWidth:B,textStyle:Object.assign({textAlign:T,textBaseline:k},a),state:{text:U({},OL,c.text),shape:U({},OL,c.shape),panel:U({},OL,c.background)}});return E.angle=M,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,n=this.attribute.labelHoverOnAxis,{position:s=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=n,p=gF(n,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=s:g.y=s;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(d(b)&&a){b=Jy(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=u,A=h?h(c):c,C=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return C.angle=b,l&&l.visible&&(C.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),C}getTextBaseline(t,e){let i="middle";const{verticalFactor:n=1}=this.attribute,s=(e?1:-1)*n;return ot(t[1],0)?i=!ot(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===s?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const n=this.attribute.orient;if(["top","bottom","right","left"].includes(n)||0===t[0]&&0===t[1]){if("top"===n||"bottom"===n)return cF(e?"bottom"===n?"top":"bottom":n,i);if("left"===n||"right"===n)return uF(e?"left"===n?"right":"left":n,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,n,s){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:n}=this.attribute,s="bottom"===e||"top"===e,h=t[0],c=Y(t),u=s?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-d}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=u?c:h,e=u?h:c,s=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,d=n.y;rd&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+d-s}):t.setAttributes({y:d,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,n,s){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,s),{layoutFunc:h,autoRotate:c,autoRotateAngle:d,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(u(h))h(t,e,n,this);else{if(c)!function(t,e){if(E(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0,a=n;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);s{t.attribute.angle=Nt(e)})),lF(i,t),!oF(t))break}}(t,{labelRotateAngle:d,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:n,ellipsis:s="...",orient:r}=e;if(E(t)||!A(i))return;const a=t[0].attribute.angle,o=v_(a),l=m_(a),h="top"===r||"bottom"===r;let c=n/t.length;t.forEach(((e,n)=>{var r,a,u,d,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=pF(e.attribute.x,null===(r=t[n+1])||void 0===r?void 0:r.attribute.x,null===(a=t[n-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Mt(c,i))}}else{if(l){const i=pF(e.attribute.y,null===(u=t[n+1])||void 0===u?void 0:u.attribute.y,null===(d=t[n-1])||void 0===d?void 0:d.attribute.y);A(i)&&(c=Mt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:s,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);dF(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&function(t,e){if(E(t))return;const i=t.filter(rF);if(E(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=u(s)?s:sF[s]||sF.parity;if(n.length>=3&&S_(n,r)){do{n=a(n,r)}while(n.length>=3&&S_(n,r));const t=(t,e,i=!0)=>i&&t<3||e,s=t(n.length,e.firstVisible,!1);let o=t(n.length,e.lastVisible);const l=i[0],h=Y(i);x_(l,h,r)&&s&&o&&(h.setAttribute("opacity",0),o=!1),aF(l,n,s,(t=>x_(t,l,r))),aF(h,n,o,(t=>x_(t,h,r)||!(!s||t===l)&&x_(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,n,s){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,s);let e,n;h=Math.max(h,t),"left"===a?(e=l.x2-h,n=l.y1):"right"===a?(e=l.x1,n=l.y1):"top"===a?(e=l.x1,n=l.y2-h):"bottom"===a&&(e=l.x1,n=l.y1);const r=t_.rect({x:e,y:n,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=EL.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,n,s){"left"===n||"right"===n?"left"===s?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===s?t.forEach((t=>{var n;t.setAttributes({dx:(null!==(n=t.attribute.dx)&&void 0!==n?n:0)+e+i-t.AABBBounds.x2})})):"center"===s&&t.forEach((t=>{var n;t.setAttributes({dx:(null!==(n=t.attribute.dx)&&void 0!==n?n:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==n&&"top"!==n||("top"===s?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===s?t.forEach((t=>{var n;t.setAttributes({dy:(null!==(n=t.attribute.dy)&&void 0!==n?n:0)+e+i-t.AABBBounds.y2})})):"middle"===s&&t.forEach((t=>{var n;t.setAttributes({dy:(null!==(n=t.attribute.dy)&&void 0!==n?n:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,n,s,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,u=null!==(i=o.space)&&void 0!==i?i:4;let d=t,p=0,g=0;const f=h&&h.visible?null!==(n=h.style.lineWidth)&&void 0!==n?n:1:0,m=c&&c.visible?null!==(s=c.length)&&void 0!==s?s:4:0;if(l&&l.visible&&"string"==typeof l.text){p=l_(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=Be(l.padding);g=l.space+t[0]+t[2]}return d&&(d=(d-u-g-p-f-m)/e),d}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const n=this.axisContainer.AABBBounds,s=n.width(),r=n.height(),a=n.x1,o=n.y1,l=n.x2,h=n.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,n=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",n),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,n=i.width()-s,c=i.height()-r;n>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-n,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}fF.defaultAttributes=p_,V(fF,XL);const mF={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},vF={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},yF={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}};class _F extends UL{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new tb}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return LS(this._option.dataSet,t,WL),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=G_(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:n,bandSizeLevel:s=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};s=Math.min(s,this._scales.length-1);for(let t=s;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),u=e=>{const i=t===s?a:0;if(d(r)||t1)for(let e=0;e{this._onTickDataChange(n)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=n}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new UO(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const n=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},s=this._tickDataMap[t],r=null==s?void 0:s.getDataView().transformsArr.find((t=>t.type===n));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===n));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,n;if(0===t.length||0===this._scales.length)return 0;const{position:s,bandScale:r}=this.getPosition(t);return s+r.bandwidth()*(null!==(n=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==n?n:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((n,s)=>{var r;const a=this._tickDataMap[s],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):n.domain();if(l&&l.length)if(i&&i.length){const n=[],s=[];i.forEach((e=>{l.forEach((i=>{const r=G(e).concat(i);if(s.push(r),o){const e=lL(i,this._getNormalizedValue(r,t));n.push(e)}}))})),o&&e.push(n.filter((t=>t.value>=0&&t.value<=1))),i=s}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>lL(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}});const bF=()=>{ux.registerGraphicComponent(TL.lineAxis,((t,e)=>new fF(t,e))),ux.registerGraphicComponent(kL.lineAxisGrid,((t,e)=>new ZL(t,e))),LL(),ux.registerComponent(_F.type,_F,!1)},xF=(t,e,i)=>i.reduce(((t,n,s)=>(t.push([n,i.length===s+1?e:i[s+1]]),t)),[[t,i[0]]]);function SF(t,e){const i=t[0],n=t[t.length-1],s=e.filter((t=>t>i&&tt-e,CF=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let n=0,s=0;for(;n{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(s);return i[n]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function wF(t,e,i="count"){const n=CF(t,e),s="count"===i?t.length:n.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return n.forEach(((t,e)=>{if(0===s)r.push([0,e/n.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===n.length-1?1:Math.min((a+l)/s,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const TF=Math.sqrt(50),kF=Math.sqrt(10),MF=Math.sqrt(2);class BF{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=rL(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(u(i.tickCount)){const t=this._scale.range();let n=Math.abs(Y(t)-t[0]);if(1===n&&this._option){n=II(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=n,e=i.tickCount({axisLength:n,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:n,max:s}=null!==(t=this._domain)&&void 0!==t?t:{};return d(n)&&d(s)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(p(n)||p(this._softMinValue))&&d(s)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(n)||!d(this._softMinValue)||!p(s)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!u(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(Y(e)-e[0]);i<=1||A(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let n,s,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;n=void 0===n?e:Math.min(n,e),s=void 0===s?a:Math.max(s,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?s:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:n,scope:s}=function(t,e,i){return t.sort(AF),e.sort(AF),{domain:SF(t,e),scope:wF(t,e,i)}}(r,By(t),this._spec.breaks[0].scopeType);e=By(n),this._break={domain:n,scope:s,breakDomains:t,breaks:i}}else e=[n,s]}else e=[n,s]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=rL(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=TF?10:s>=kF?5:s>=MF?2:1)*Math.pow(10,n),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}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=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,n=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*n)/n:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function EF(t,e,i,n){let s;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();s=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||s.push(e)}));e.domain(a)}else s=n(i);return s}function PF(t,e,i,n,s=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){s?e.push(t):e.unshift(t);for(let t=0;t{var i,n,s,r;if(!P_(t.type))return JD(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return JD([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:d=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=EF(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const n=null!==(i=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=EF(e,t,n,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:d}):t.d3Ticks(e,{noDecimals:d})))}else{const i=null!==(n=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==n?n:5,s=u(e.tickMode)?e.tickMode:void 0;m=EF(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:d,customTicks:s}):t.ticks(e,{noDecimals:d,customTicks:s})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e,a=6;let l;if(m.length*a>o){const i=[],n=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%n!=0&&e!==m.length-1||i.push(t)})),l=null===(s=tL(t,i,e))||void 0===s?void 0:s.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=tL(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],s=Y(l),r=f&&f()?RF.greedy:RF.parity;for(;l.length>=3&&S_(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;x_(t,s,i)&&l.includes(s)&&l.length>1&&a&&o&&(l.splice(l.indexOf(s),1),o=!1),PF(t,l,a,(e=>x_(e,t,i))),PF(s,l,o,(e=>x_(e,s,i)||!(!a||e===t)&&x_(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&n&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return JD(m)},RF={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>!(n&&x_(i,t,e)||(i=t,0))))}},IF={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class DF extends UL{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new xb}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const n=super._getUpdateAttribute(t);if(!LI(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=II(this._orient),s=i?t:e;n.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:n,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/s;let o;o=$b(r)?Number(r.substring(0,r.length-1))/100:r/s;const l=A(null==n?void 0:n.angle)?n.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},n),{angle:l*Math.PI/180}),rawRange:e}}))}return n}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=By(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return LS(this._option.dataSet,t,OF),t}}DF.type=r.cartesianLinearAxis,DF.specKey="axes",DF.builtInTheme={axis:mF,axisLinear:IF,axisX:vF,axisY:yF},V(DF,BF);const LF=()=>{ux.registerGraphicComponent(TL.lineAxis,((t,e)=>new fF(t,e))),ux.registerGraphicComponent(kL.lineAxisGrid,((t,e)=>new ZL(t,e))),LL(),ux.registerComponent(DF.type,DF)},FF=`${Dx}_hide_`;function UF(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const NF=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:n,deltaMul:s=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[FF]&&(UF(t,!0),t[FF]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let n=-1/0,s=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+s)*i),r=(-1/0-l)**2+(n-h)**2,r<(o+s+e)**2?t.context.finalAttrs.forceShow||(t[FF]=!0,UF(t,!1)):n=h,s=e}))}(r,n,s):1===i?function(t,e,i){let n=-1/0,s=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+s)*i),Math.abs(o-n){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+s)*i),Math.abs(o-n){var i,n;const s=null===(n=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===n?void 0:n[r];return t[s]?t[s].push(e):t[s]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},jF=()=>{ux.registerGrammarTransform("symbolOverlap",{transform:NF,runType:"afterEncode"})},zF={min:K,max:X,average:function(t,e){let i=0,n=0;return t.forEach((t=>{const s=e?+t[e]:+t;A(s)&&(i+=s,n++)})),i/n},sum:A_};function WF(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,u=0;r[u++]=c;for(let t=1;to&&(o=l,h=t))}r[u++]=h,c=h}r[u-1]!==a-1&&(r[u++]=a-1);return r.map((t=>i?e[t].i:t))}function HF(t,e,i,n,s){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][s]=e[l][s];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function VF(t,e,i,n){return HF(t,e,i,"min",n)}function GF(t,e,i,n){return HF(t,e,i,"max",n)}function YF(t,e,i,n){return HF(t,e,i,"average",n)}function XF(t,e,i,n){return HF(t,e,i,"sum",n)}const KF=(t,e)=>{let i=u(t.size)?t.size():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{mode:s,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=WF;if("min"===s?l=VF:"max"===s?l=GF:"average"===s?l=YF:"sum"===s&&(l=XF),e.length){const t={};if(a){for(let i=0,n=e.length;i{const r=t[s];if(r.length<=i){const t=r.map((t=>t.i));n=n.concat(t)}else{const t=l(i,r,!0,o);n=n.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},$F=()=>{ux.registerGrammarTransform("dataSampling",{transform:KF})};class qF extends RI{constructor(){super(...arguments),this.type=Bb.line,this.transformerConstructor=GD,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qI)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,n;const s={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(fI(null===(i=ux.getAnimationInKey("line"))||void 0===i?void 0:i(s,r),mI("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=OI(this);this._symbolMark.setAnimationConfig(fI(null===(n=ux.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),mI("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var 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:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}qF.type=Bb.line,qF.mark=JI,qF.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},qF.transformerConstructor=GD,V(qF,ZI);class ZF{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(n,((t,e)=>{HS(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof oi)return;const n=this.getSeriesData(t.id,i);n&&e(t,n,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Py(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Py(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class JF{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)=>{Wy(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{lS(e,[{key:t,operations:P_(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&lS(e,[{key:i.field,operations:P_(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?Vb("colorOrdinal"):Vb(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(Wy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const 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(W(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;if(!W(r.specified,n.specified)){if("color"!==n.id)return e.reMake=!0,e;const t=s;if(t.setSpecified)t.setSpecified(n.specified);else{if(!n.specified||!t.specified)return e.reMake=!0,e;t.specified(n.specified)}e.reRender=!0}n.range&&!W(n.range,s.range())&&(s.range(n.range),e.reRender=!0),Wy(n.domain)?e.reRender=!0:W(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)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!Wy(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,n.domain().slice());let s;s=P_(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const n=P_(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,n);e&&(n?(d(s[0])?s[0]=e.min:s[0]=Math.min(e.min,s[0]),d(s[1])?s[1]=e.max:s[1]=Math.max(e.max,s[1])):e.values.forEach((t=>{s.add(t)})))}))}));const r=s;P_(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)return;if(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(P_(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const n=this._getSeriesBySeriesId(t.seriesId),s=P_(e.type),r=n.getRawDataStatisticsByField(t.field,s);if(!E(r))return"expand"===t.changeDomain?(s?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(s?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));P_(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(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(s=i.clone()),n.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:s})),s}}class QF{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,n,s){return this._disableTriggerEvent?[]:e&&e.length?(n&&s?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,s),this.toggleStateOfGraphics(t,e,i,n)):this.addBothStateOfGraphics(t,e,n,s):n&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,n):this.addStateOfGraphics(t,e,n)),e):[]}toggleReverseStateOfGraphics(t,e,i,n){const s=t.getMarkIdByState();i.forEach((t=>{var e;if(n&&s[n]&&s[n].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,s=i.hasAnimationByState&&i.hasAnimationByState("state");rR(t,n,!0,s)}})),e.forEach((t=>{var e;if(n&&s[n]&&s[n].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,s=i.hasAnimationByState&&i.hasAnimationByState("state");aR(t,n,s)}}))}toggleStateOfGraphics(t,e,i,n){const s=t.getMarkIdByState();i.forEach((t=>{var e;if(n&&s[n]&&s[n].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,s=i.hasAnimationByState&&i.hasAnimationByState("state");aR(t,n,s)}})),e.forEach((t=>{var e;if(n&&s[n]&&s[n].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,s=i.hasAnimationByState&&i.hasAnimationByState("state");rR(t,n,!0,s)}}))}addBothStateOfGraphics(t,e,i,n){const s=t.getMarks(),r=t.getMarkIdByState();s.forEach((t=>{var s;const a=n&&r[n]&&r[n].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)?o&&rR(t,i,!0,l):a&&rR(t,n,!0,l)}))}))}addStateOfGraphics(t,e,i){const n=t.getMarks(),s=t.getMarkIdByState();n.forEach((t=>{var n;const r=i&&s[i]&&s[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)&&r&&rR(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const n=this.getStatedGraphics(t);if(!n||!n.length)return;const s=t.getMarks(),r=t.getMarkIdByState();s.forEach((t=>{if(t){const s=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");s&&s.length&&(i&&r[i]&&r[i].includes(t.id)&&s.forEach((t=>{aR(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&s.forEach((t=>{n.includes(t)&&aR(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const tU={[r.markPoint]:!0,[r.markLine]:!0,[r.markArea]:!0},eU={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class iU extends mO{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const n=this.getCompiler();return n&&(n.updateLayoutTag(),t&&i&&n.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,n,s,r;super(e),this.type="chart",this.id=jy(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:Lx,height:Fx},this._viewRect={width:Lx,height:Fx},this._viewBox={x1:0,y1:0,x2:Lx,y2:Fx},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>G(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(eU).some((t=>!d(e[t])))},this._paddingSpec=tx(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new TS(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new ZF(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(n=this._option)||void 0===n?void 0:n.onError,disableTriggerEvent:!0===(null===(s=this._option)||void 0===s?void 0:s.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new QF;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const n=t.getInteractionTriggers();if(n&&n.length){const s=t.getRegion().id;n.forEach((({trigger:t,marks:n})=>{const r=i.find((e=>e.regionId===s&&W(e.config,t)));if(r)r.trigger.marks.push(...n);else{const r=Object.assign(Object.assign({},t),{marks:[...n]});i.push({regionId:s,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=ux.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(fI({},mI("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const n={width:t,height:e};this._canvasRect=n,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=N(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=ux.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:n}=i,s=e(i,["spec"]),r=new t(n,Object.assign(Object.assign({},this._modelOption),s));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:n}=i,s=e(i,["spec"]);let r;if(p(n.regionId)?r=this.getRegionsInUserId(n.regionId):p(n.regionIndex)&&(r=this.getRegionsInIndex([n.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(n,Object.assign(Object.assign(Object.assign({},this._modelOption),s),{type:n.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(u(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var n;if((null!==(n=i.specKey)&&void 0!==n?n:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const n=ux.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){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._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===s||s.call(n,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof yO)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const n=this.getComponentByUserId(t);return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof lR))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof lR)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&(s.markRunning(),s.parseNewData(e,n)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&HS(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=nO(this._spec,this._option,{width:Lx,height:Fx})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const n=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=Ib(n),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new JF(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){oO(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=Ib(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),n=new Set(e),s=[...t.filter((t=>!n.has(t))),...e.filter((t=>!i.has(t)))];return s.length>0&&s.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const n={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return n.reMake=!0,this.setLayoutTag(!0,null,!1),n;const s=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!W(s,r)&&!this._canChangeSpecKeysWithoutRemake(s,r))return n.reMake=!0,this.setLayoutTag(!0,null,!1),n;const a=Array.from(new Set([...s,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=n.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),n):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(n),n.reMake||(this.reInit(),u&&this._canSkipChartDataStages(n)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),n))}updateChartConfig(t,e){var i,n;this._paddingSpec=tx(null!==(i=this._spec.padding)&&void 0!==i?i:null===(n=this._option)||void 0===n?void 0:n.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{oO(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const n={},s={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===r.label||l.type===r.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));s[l.type]&&(s[l.type]=!1);const u=l.specKey||l.type,d=null!==(h=this._spec[u])&&void 0!==h?h:{};if(_(d)){if(n[u]=n[u]||{specCount:d.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(u,[l.getSpec()],d))return void a.push(l);n[u].componentCount++;const s=null!==(c=d[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(s,d);aO(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):W(r,s)||(i=!0),oO(t,o)}else{const n=l.getSpec(),s=l.updateSpec(d);aO(s)||this._isComponentScaleDomainOnlyUpdate(s)?e.push(l):W(n,d)||(i=!0),oO(t,s)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,n);for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const i=n[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(s).forEach((e=>{if(s[e]){const i=this._spec[e];(_(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(tU[t]&&_(e)&&_(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return tU[t]&&_(e)&&e.length>0&&_(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let n=!1;const s=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(n=!0,!0):W(t[i],e[i])));return n&&s}_isComponentSpecKey(t){return!!tU[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let n=!1;const s=t,r=e,a=i.every((t=>!!W(s[t],r[t])||!!this._isComponentSpecKey(t)&&(n=!0,!0)));return n&&a}_isOnlySeriesSpecsChanged(t,e,i){var n,s;let r=!1;const a=t,o=e,l=null!==(s=null===(n=this._specTransformer)||void 0===n?void 0:n.getSeriesRelatedSpecKeys())&&void 0!==s?s:{},h=i.every((t=>!!W(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var n,s;let r=!1;const a=t,o=e,l=null!==(s=null===(n=this._specTransformer)||void 0===n?void 0:n.getSeriesRelatedSpecKeys())&&void 0!==s?s:{},h=i.every((t=>!!W(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],n=i[i.length-1];return"number"==typeof n?n:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let n=0,s=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;tU[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,n++,s=s||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),n&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),s?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,n=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],n)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];oO(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:n=0,x2:s,y2:r}=e;i={width:s-t,height:r-n}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=Jb(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===n||n.call(i,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(E(t[n]))continue;const s=t[n];let r={stateValue:n};r=u(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(e,i,n){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,n)}setHovered(e,i,n){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,n)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(kS.AFTER_MARK_RENDER_END,e)};this._event.on(kS.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const n=(t=t?G(t):null)?Object.keys(t[0]):null,s=[],r=null!==(i=e.getDatum)&&void 0!==i?i:CS;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||u(e.filter)&&e.filter(o,l))){if(AS(l.type))h.filter((h=>{const c=r(h,l,o,i),u=c&&t.every(((t,e)=>n.every((i=>t[i]==c[e][i]))));u&&(a.push(h),s.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),u=h&&c.findIndex((t=>n.every((e=>t[e]==h[e]))));u>=0&&(c.splice(u,1),a.push(t),s.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const s=r(e,l,o,i);return s&&n.every((e=>t[0][e]==s[e]))}));c&&(a.push(c),s.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),s}_setStateInDatum(t,e,i,n){if(!e)return void this._interaction.clearByState(t);const s=this.filterGraphicsByDatum(e,{filter:i,region:n});this._interaction.updateStateOfGraphics(t,s)}setDimensionIndex(t,e){var i,n;let s=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:n,event:r}=i;if(n===KI.dimensionHover||n===KI.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(s=i)}}));const a=d(t)||!s||s.every((t=>R_(t.axis.getScale().type)&&d(t.index))),o=a||s.every((t=>R_(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(n=(i=t).hideTooltip)||void 0===n||n.call(i);else{const i={};s.forEach((t=>{const{axis:e,value:n,data:s}=t,r="left"===e.getOrient()||"right"===e.getOrient();s.forEach((t=>{var e,s,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(s=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===s?void 0:s[o])&&void 0!==a?a:n}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(s))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const n=this.getComponentsByKey("axes"),s=[];n.forEach((e=>{const i=t(e);!1!==i&&s.push({axis:e,value:i})})),i.showCrosshair(s)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const nU=(t,e)=>{var i;const n=t.spec,{regionId:s,regionIndex:r}=n;if(p(s)){const t=G(s);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)},sU={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class rU{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},sU),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,n,s)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=n,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,s),u=Object.assign(Object.assign({},n),c);e?u.theme=h.getTheme(r,t):hx(t,a,c.spec),hx(s,null!=o?o:a,u)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,n;e||(e=this.generateTransform(t,!0));const s={};return this.forEachRegionInSpec(t,e,s),this.forEachSeriesInSpec(t,e,s),null===(i=s.series)||void 0===i||i.forEach(((t,e)=>{var i,n;const r=(null!==(n=null!==(i=nU(t,s))&&void 0!==i?i:s.region)&&void 0!==n?n:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,s),Object.values(null!==(n=s.component)&&void 0!==n?n:{}).forEach((t=>t.forEach(((t,e)=>{var i,n,r;if(t){if(!t.regionIndexes){const e=null!==(n=null!==(i=nU(t,s))&&void 0!==i?i:s.region)&&void 0!==n?n:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const n=t.spec,{seriesId:s,seriesIndex:r}=n;if(p(s)){const t=G(s);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,s);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,n;const r=null===(i=s.region)||void 0===i?void 0:i[t];null===(n=null==r?void 0:r.seriesIndexes)||void 0===n||n.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),s}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var n,s,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(n=t.animation)&&void 0!==n?n:null===(s=this._option.globalInstance)||void 0===s?void 0:s.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var n;return(null!==(n=t.region)&&void 0!==n?n:[]).map(((t,n)=>e(ux.getRegionInType("region"),{spec:t,specPath:["region",n],type:"region",regionIndexes:[n]},i)))}forEachSeriesInSpec(t,e,i){var n;return(null!==(n=t.series)&&void 0!==n?n:[]).map(((t,n)=>e(ux.getSeriesInType(t.type),{spec:t,specPath:["series",n],type:t.type,seriesIndexes:[n]},i)))}forEachComponentInSpec(t,e,i){var n,s,a;const o=[],l=ux.getComponents();let h,c,u,d;const p=[];for(let e=0;e0&&(g=!0,n.forEach((t=>{const n=ux.getComponentInKey(t.type);o.push(e(n,t,i))})))}if(c&&!g){const n=c.getSpecInfo(t,i);(null==n?void 0:n.length)>0&&(g=!0,n.forEach((t=>{const n=ux.getComponentInKey(t.type);o.push(e(n,t,i))})))}return u&&!g&&(null===(s=u.getSpecInfo(t,i))||void 0===s||s.forEach((t=>{o.push(e(u,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:n})=>{var s;null===(s=n.getSpecInfo?n.getSpecInfo(t,i):YR(t,n.specKey,n.type))||void 0===s||s.forEach((t=>{o.push(e(n,t,i))}))})),d&&(null===(a=YR(t,d.specKey,d.type))||void 0===a||a.forEach((t=>{o.push(e(d,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const n="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!n.includes(i.orient))return!1;if(p(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:n,barMinWidth:s,barWidth:r,barGapInGroup:a}=i;let o=!1;S(s)?(t.minBandSize=s,o=!0):S(r)?(t.minBandSize=r,o=!0):S(n)&&(t.minBandSize=n,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class aU extends rU{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:n}=i;let s=null;"top"!==n&&"bottom"!==n||(e.x=!0,s=this._setDefaultXAxisSpec(t)),"left"!==n&&"right"!==n||(e.y=!0,s=this._setDefaultYAxisSpec(t)),"z"===n&&(e.z=!0,s=this._setDefaultZAxisSpec(t)),s&&Object.keys(s).forEach((t=>{d(i[t])&&(i[t]=s[t])})),P(i,"trimPadding")&&cx(i,lO(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class oU extends aU{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),iO(t)}}const lU=(t,e)=>{const i={nodes:{}},{fields:n}=u(e)?e():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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),n=i.some((t=>t.getStack()));if(!n)return;const s=i.some((t=>{var e,i,n,s;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(s=null===(n=t.getSpec())||void 0===n?void 0:n.totalLabel)||void 0===s?void 0:s.visible)})),r=s||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=uS(t,!0);for(const e in o)for(const i in o[e].nodes)fS(o[e].nodes[i],t.getStackInverse(),r,s);if(a)for(const t in o)for(const e in o[t].nodes)gS(o[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),n=t.getStackValueField();e&&n&&pS(o[i],n)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class cU{_beforeInit(){this._dataSet&&LS(this._dataSet,"stackSplit",lU)}_initStack(){this._stack=new hU(this),this._stack.init()}}const uU={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:KI.dimensionHover};class dU extends MR{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,n=i.getStatedGraphics(this);n&&n.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:n,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},uU,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),n=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{i.filter((e=>e.model===t.series&&e.getVisible())).forEach((i=>{const s=i.getGraphics();if(!s||!s.length)return;const r=s.filter((i=>{const n=CS(i);let s;return s=_(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s}));n.push(...r)}))}))})),n}}dU.type="dimension-hover",dU.defaultOptions=uU;const pU=()=>{ux.registerInteractionTrigger(dU.type,dU)},gU=()=>{ux.registerComposedEvent(KI.dimensionHover,XI),ux.registerComposedEvent(KI.dimensionClick,zI)},fU=t=>t.fieldX[0],mU=t=>t.fieldY[0],vU=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},yU=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},_U=(t,e)=>t?e?fU:vU:e?mU:yU,bU=(t,e,i)=>{var n,s;if(!t)return null;const{x:r,y:a}=e,o=null!==(n=YI(t,(t=>II(t.getOrient())),e))&&void 0!==n?n:[],l=null!==(s=YI(t,(t=>DI(t.getOrient())),e))&&void 0!==s?s:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,u=new Set;[o,l].forEach((t=>t.forEach((t=>{R_(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&u.add(t)}))));const d=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(u.size>0){if(u.has(t)){const n=xU(t,i,_U(e,R_(t.getScale().type)));n&&d.push(n)}}else{const n=h.size>0;if((n?h:c).has(t)){const s=xU(t,i,_U(e,n));s&&d.push(s)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===d.length&&p("x")):(p("x"),0===d.length&&p("y")),d.length?d:null},xU=(t,e,i)=>{const n=t.positionToData(e,!0);return d(n)?null:SU(t,n,i)},SU=(t,e,i)=>{const n=t.getScale();if(d(e))return null;let s=n.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));s<0&&(s=void 0);const r=VI(e,t,"cartesian",null!=i?i:II(t.getOrient())?fU:mU);return{index:s,value:e,position:n.scale(e),axis:t,data:r}},AU=(t,e,i,n=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((s=>{var r,a,o,l,h,c;const{currentValue:u,cacheInfo:d,labelsComp:g,attributes:f,coordKey:m}=t[s];let v=null,y=0,_=null;if(u.size){const t=Array.from(u.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!u.size&&Number.isFinite(y)&&!Number.isNaN(y),x=n&&!b&&p(d),S=x?d:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let C=0;if(f&&u.forEach((({axis:t,datum:i=""})=>{var n,r,a,o,l,h,c,u,d,p;let g=null;const m=t.getScale();if(R_(m.type))A=m.bandwidth(),0===A&&m.step&&(C=m.step());else if(P_(m.type)){const n="xField"===s?e.fieldX[0]:e.fieldY[0],r="xField"===s?e.fieldX2:e.fieldY2,a=function(t,e,i,n){for(let s=0,r=t.length;s=e)return r}}return null}(e.getViewData().latestData,+i,n,r);if(a){const t="xField"===s?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===s?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[n]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(n=f.label)||void 0===n?void 0:n.visible)&&!x){const e=function(t){let e=0;return P(t,"tick.visible")&&(e+=P(t,"tick.tickSize")),P(t,"label.visible")&&(e+=P(t,"label.space")),e}(t.getSpec()),n=t.getOrient(),s=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[n]&&(S.labels[n].visible=!0,S.labels[n].text=i,"left"===n?(S.labels[n].dx=-e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:s&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===n?(S.labels[n].dx=e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:s&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===n?(S.labels[n].y=0,S.labels[n].dy=-e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:s&&_&&null!==(u=_.attribute.textBaseline)&&void 0!==u?u:"bottom"}):"bottom"===n&&(S.labels[n].dy=e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(d=_.attribute.textAlign)&&void 0!==d?d:"center",textBaseline:s&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[n].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};wU(t,u),"xField"===s?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&CU(S.labels[t],t,f.label)}))}t[s].bandSize=null!=A?A:0,t[s].offsetSize=C,t[s].cacheInfo=S})),t),CU=(t,e,i)=>{const{formatMethod:n,formatter:s}=i,{formatFunc:r,args:a}=GR(n,s,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},wU=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:n}=e.getLayoutStartPoint(),{width:s,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,n),t.x2=Math.max(t.x2,i+s),t.y2=Math.max(t.y2,n+r)}))}))},TU=t=>{const{cacheInfo:e,attributes:i,bandSize:n,offsetSize:s,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+n/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=kU(i,n,s,e.axis),{coordRange:u}=e;c={visible:!0,start:{[r]:Math.max(o+t,u[0]),[a]:l[0]},end:{[r]:Math.min(o+h,u[1]),[a]:l[1]}}}return c},kU=(t,e,i,n)=>{var s,r,a;const o=0===e?i:e;let l=o;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=n.getLayoutRect();l=t.style.size(e,n)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},MU=(t,e)=>{var i;const n=new Map,s=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?s:n).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:n,attributes:{visible:!!n.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:s,attributes:{visible:!!s.size,type:"rect"}}};return AU(c,r,e),c.xField.cacheInfo?TU(c.xField):c.yField.cacheInfo?TU(c.yField):void 0},BU=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],EU=(t,e,i,n,s)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&BU.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,n,n[0].datum,s)))}break;case"dimension":if(null==n?void 0:n.length){if(PU(n).every((t=>{var e;return!qR("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return n.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,n,r.datum,s);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},PU=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},OU={dom:`${Dx}_TOOLTIP_HANDLER_DOM`,canvas:`${Dx}_TOOLTIP_HANDLER_CANVAS`},RU={key:"其他",value:"..."};var IU;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(IU||(IU={}));class DU{constructor(e){this._showTooltipByHandler=(e,i)=>{var n,s,r;if(d(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(d(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=d(null==o?void 0:o.key)&&d(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(n=a.handler)||void 0===n?void 0:n.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,n,s,r,a,o,l,h,c;const{changePositionOnly:u,model:g}=e;if(!u||!this._cacheActiveSpec){const u=this.component.getSpec();if(this._cacheActiveSpec=EU(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&p(u.handler)&&(this._cacheActiveSpec.handler=u.handler);const g=null!==(i=u[this.activeType])&&void 0!==i?i:{},f=null!==(n=this._cacheActiveSpec.updateTitle)&&void 0!==n?n:g.updateTitle,m=null!==(s=this._cacheActiveSpec.updateContent)&&void 0!==s?s:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},RU),t):RU;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,n;return!!this.component.enable&&(!d(e)&&qR(this.activeType,null===(n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===n?void 0:n.spec))}clearCache(){this._cacheActiveSpec=void 0}}class LU extends DU{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const n=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,n)}_getDimensionInfo(t){var e,i,n;let s;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),s=null!==(n=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==n?n:[],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!R_(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(p(n))break}return p(n)&&n.getDimensionField()[0]===n.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const FU=()=>{ux.registerTooltipProcessor("dimension",LU)};class UU extends DU{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var n,s,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,u=null===(n=o.getSpec())||void 0===n?void 0:n.tooltip,d=null===(s=null==u?void 0:u.mark)||void 0===s?void 0:s.checkOverlap;let p=!1;if(!0===d||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==d){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),n={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},n),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(n.x,n.y,Gi.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(CS(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,n;const s=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===s){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.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(n=!0)}else if("component"===s){const e=t.model,s=t.node;if("label"===e.name&&s){const t=e.getLabelInfoByTextGraphic(s),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:s.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(n=!0)}}return{tooltipInfo:i,ignore:n}}}const NU=()=>{ux.registerTooltipProcessor("mark",UU)};class jU extends DU{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:G(n),series:s}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let 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.group;if(null==r?void 0:r.has(t.mark)){const s=this.component.getSpec()[this.activeType];((null==s?void 0:s.triggerMark)?G(s.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(n={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:n,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:n}=t,s=e;if(["line","area"].includes(i.type))return G(n);const r=s.getViewData().latestData,a=s.getSeriesField();if(!a)return r;const o=G(n)[0][a];return r.filter((t=>t[a]===o))}}const zU=()=>{ux.registerTooltipProcessor("group",jU)};class WU extends iU{constructor(){super(...arguments),this.transformerConstructor=oU,this.type="line",this.seriesType=Bb.line}_setModelOption(){this._modelOption.getDimensionInfo=bU,this._modelOption.getDimensionInfoByValue=SU,this._modelOption.getRectByDimensionData=MU}}WU.type="line",WU.seriesType=Bb.line,WU.transformerConstructor=oU,V(WU,cU);function HU(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 VU=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:HU(t,e)}),GU=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:HU(t,e)}),YU={type:"fadeIn"},XU={type:"growCenterIn"};function KU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return YU;case"scaleIn":return XU;default:return VU(t)}}var $U=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);sthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=s.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=u(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=u(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===s[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:s[t].attribute.width:e.maxLineWidth=null!==(n=r.labelLimit)&&void 0!==n?n:s[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),s[t].setAttributes(e)}}return s}layoutArcLabels(t,e,i,n,s,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),n.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(n[i])&&!d(s[i])){const t=n[i]?n[i]:null,r=s[i]?s[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=Vt(h.endAngle-d/2),g=zt(c,h.outerRadius,o),f=zt(c,a+e.line.line1MinLength,o),m=new JU(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=zt(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):gD(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var n,s;const r=e,a=r.spaceWidth,o=null!==(n=r.position)&&void 0!==n?n:"inside",l=null!==(s=r.offsetRadius)&&void 0!==s?s:-a;return t.forEach((t=>{var i,n,s;const{labelSize:h,radian:c}=t,u=t.innerRadius,d=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(d,h.height))p=0;else{let t;t=c>=Math.PI?u:Math.max(u,h.height/2/Math.tan(c/2)),p=d-t-a}!0!==r.rotate&&(p=d-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?u-l+y:"inside-center"===o?u+(d-u)/2:d+l-y,t.labelPosition=zt(t.circleCenter,v,t.middleAngle),t.labelLimit=f,lt(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(n=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:t.middleAngle;let a=null!==(s=r.offsetAngle)&&void 0!==s?s:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var n,s,r;const a=null!==(n=i[0].attribute.x)&&void 0!==n?n:0,o=2*(null!==(s=i[0].attribute.y)&&void 0!==s?s:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=gD(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const n of t){const{labelPosition:t,labelSize:s}=n;n.labelLimit=s.width,n.pointB=gD(n.quadrant)?{x:t.x+s.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-s.width/2-this._line2MinLength-h,y:t.y},this._computeX(n,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const n=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,n,e,i);const{minY:s,maxY:a}=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(o,Math.max(n,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-s),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const n of t)this._computePointB(n,h,e,i),this._computeX(n,e,i)}const c=2*a;return t.forEach((t=>{var i,n;t.labelVisible&&(ht(t.pointB.x,this._line2MinLength+h)||lt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(n=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var n;const s=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(n=e.layout)||void 0===n?void 0:n.align,c=e.spaceWidth,{labelPosition:u,quadrant:d,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=gD(d)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+s.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):u.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,n,s,r,a,o;const l=e,h=null!==(n=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==n?n:null===(s=l.textStyle)||void 0===s?void 0:s.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?d(h)||"auto"===h?"edge"===c?gD(t.quadrant)?"left":"right":gD(t.quadrant)?"right":"left":h:d(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,n){var s;n[0].attribute.x;const r=2*(null!==(s=n[0].attribute.y)&&void 0!==s?s:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const n=t.length;if(n<=0)return;for(let s=0;s=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.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 o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,d)}else if(-1!==u&&-1===d){const i=p.labelPosition.y;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){const s=i;let r=0;n.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=s.line.line1MinLength;if("none"===s.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const n=t.circleCenter,s=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(s+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(n.y-r.y)**2)-h;A(c)?t.pointB={x:n.x+c*(gD(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const n=t.circleCenter,s={width:2*n.x,height:2*n.y};let r=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=s,c=this.computeRadius(a,e.width,e.height),u=this._computeLayoutRadius(h/2,e,i),d=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(ot(l/2,d))g=0,f=1,m=-p;else if(ot(h/2,p))g=1,f=0,m=-d;else{const t=-1/(p/d);g=t,f=-1,m=p-t*d}const v=function(t,e,i,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),u=-(e*h+i)/t;return 0===l?[{x:u,y:h}]:[{x:u,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-u,0,u);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?ot(v[0].y,v[1].y)?lt(t.middleAngle,-Math.PI)&&ht(t.middleAngle,0)||lt(t.middleAngle,Math.PI)&&ht(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-s;return Math.max((h**2+t**2)/(2*h),l)}_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{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const s=this.parent,r=!!(null==n?void 0:n.removeFromParent),a=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=s?s:this.parent)||void 0===i||i.removeChild(this)),BD(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,MD(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},n=[],s=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?n.push(t):(i.pendingCount-=1,s.push(t))})),n.length?(s.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}eN.defaultAttributes={pickable:!1};class iN extends lR{constructor(){super(...arguments),this.type=iN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}iN.type="rect";const nN=()=>{HM(),FM(),ID("rect",qU),ux.registerMark(iN.type,iN),QM.registerBuiltInAnimate("growHeightIn",DB),QM.registerBuiltInAnimate("growHeightOut",LB),QM.registerBuiltInAnimate("growWidthIn",JB),QM.registerBuiltInAnimate("growWidthOut",QB),QM.registerBuiltInAnimate("growCenterIn",OB),QM.registerBuiltInAnimate("growCenterOut",RB),ux.registerGraphicComponent("rect",Oh)},sN=Object.assign(Object.assign({},oI),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function rN(t,e,i){var n,s;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:n,width:s,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===n){const t=i-this._viewPosition.y,e=ut(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=ut(t-o/2,l,h);c=t/s,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:n,y:s}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?n:s,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=hN(),a="browser"===wg.env?wg:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:n}=this.stage.eventPointTransform(t);let s,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:u}=this.attribute,d=ut(u[1]-u[0],0,1);return"vertical"===e?(s=n,a=s-this._prePos):(s=i,a=s-this._prePos),r=c>0&&d<1?a/c*(1-d):0,[s,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[n,s]=this._computeScrollValue(t);this.setScrollRange([i[0]+s,i[1]+s],!0),this._prePos=n},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:cN[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,n=this.getScrollRange(),[s,r]=this._computeScrollValue(t),a=[n[0]+r,n[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:dt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:n=[0,1],range:s,realTime:r=!0}=this.attribute,a=dt(t,n[0],n[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:s,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",cN[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===wg.env?wg:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(),u=this._getSliderPos(dt(n,s[0],s[1])),d=u[1]-u[0];let p;this._sliderSize=d,p="horizontal"===t?{x:u[0],y:c.y1,width:d,height:c.height}:{x:c.x1,y:u[0],width:c.width,height:d};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Be(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]=Be(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:Math.max(0,t-(a+s)),height:Math.max(0,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,minSliderSize:i=0}=this.attribute,{width:n,height:s,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?n:s,l="horizontal"===e?r:a,h=ut(t[0],0,1),c=ut(t[1],0,1),u=ut(c-h,0,1),d=Math.max(u*o,i),p=Math.max(o-d,0),g=l+h/Math.max(1-u,1e-12)*p;return[g,g+d]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=dt(t,0,1),{width:s,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*s,a+n*s],a,s-l):dt([o+i*r,o+n*r],o,r-l)}_clearDragEvents(){const t=hN(),e="browser"===wg.env?wg:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===wg.env?wg:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}}uN.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class dN extends CD{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}wM(),BM();class pN extends dN{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:U({},pN.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})}}pN.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},wM(),FM();class gN extends dN{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:U({},gN.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})}}function fN(){wM(),XM(),$M()}gN.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};const mN={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};fN();class vN extends CD{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:U({},vN.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(AN.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,n,s;const r=t.target;if(r&&r.name&&r.name.startsWith(AN.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===AN.focus||"focus"===o){const n=a.hasState(xN.focus);a.toggleState(xN.focus),n?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[xN.unSelected,xN.unSelectedHover,xN.focus],t),this._setLegendItemState(e,xN.selected,t)})):(this._setLegendItemState(a,xN.selected,t),this._removeLegendItemState(a,[xN.unSelected,xN.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[xN.selected,xN.selectedHover,xN.focus],t),this._setLegendItemState(e,xN.unSelected,t))})))}else{null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((t=>{t.removeState(xN.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(xN.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(SN.legendItemClick,a,t);i?(this._removeLegendItemState(a,[xN.selected,xN.selectedHover],t),this._setLegendItemState(a,xN.unSelected,t)):(this._setLegendItemState(a,xN.selected,t),this._removeLegendItemState(a,[xN.unSelected,xN.unSelectedHover],t))}else this._setLegendItemState(a,xN.selected,t),this._removeLegendItemState(a,[xN.unSelected,xN.unSelectedHover],t),null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[xN.selected,xN.selectedHover],t),this._setLegendItemState(e,xN.unSelected,t))}))}this._dispatchLegendEvent(SN.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,xN.selected),this._removeLegendItemState(e,[xN.unSelected,xN.unSelectedHover])):(this._removeLegendItemState(e,[xN.selected,xN.selectedHover]),this._setLegendItemState(e,xN.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:n,defaultSelected:s,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=yN,spaceRow:l=_N,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:u,isHorizontal:d,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:d?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:C}=this._itemContext,w=0,T=0;const k=[];for(let t=g,e=u.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=u[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(s)&&(e=s.includes(y.label));const i=this._renderEachItem(y,e,t,u),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),d?(p(n)&&(f&&a?(C=Math.ceil((S+g)/n),b=C>1):S+g>n&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||k.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),C+=1,S=0,A+=T+l,T=0,k.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),k.push(i)):(p(v)&&(f&&a?(C=Math.ceil((A+m)/v),b=C>1):v<=m?(C+=1,b=!0,A=0,t>0&&(S+=w+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=C,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=C),r||(this._itemContext.startIndex=u.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:n,maxHeight:s}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,s-this._parsedPadding[0]-this._parsedPadding[2]);const a=t_.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:u,height:d}=t,g=[];p(c)&&g.push(c),p(u)&&g.push(u),g.length&&(p(n)&&g.push(n),this._itemWidthByUser=K(g)),p(d)&&(this._itemHeightByUser=d);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,n){var s,r;const{label:a,value:o}=this.attribute.item,l=n.AABBBounds,h=i.AABBBounds,c=l.width(),u=h.width();let d=!1;"labelFirst"===t?u>e?d=!0:n.setAttribute("maxLineWidth",e-u):"valueFirst"===t?c>e?d=!0:i.setAttribute("maxLineWidth",e-c):c+u>e&&(d=!0),d&&(n.setAttribute("maxLineWidth",Math.max(e*(null!==(s=a.widthRatio)&&void 0!==s?s:.5),e-u)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,n){var s,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:u,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,n),A=this._handleStyle(y,t,e,i,n),C=this._handleStyle(b,t,e,i,n),w=this._handleStyle(x,t,e,i,n),T=Be(c);let k;!1===x.visible?(k=t_.group({x:0,y:0,cursor:null===(s=w.style)||void 0===s?void 0:s.cursor}),this._appendDataToShape(k,AN.item,t,k)):(k=t_.group(Object.assign({x:0,y:0},w.style)),this._appendDataToShape(k,AN.item,t,k,w.state)),k.id=`${null!=a?a:o}-${i}`,k.addState(e?xN.selected:xN.unSelected);const M=t_.group({x:0,y:0,pickable:!1});k.add(M);let B,E=0,O=0,R=0;if(v&&!1!==v.visible){const i=P(S,"style.size",10);O=_(i)?i[0]||0:i,R=P(v,"space",8);const n=t_.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(n,AN.itemShape,t,k,S.state),n.addState(e?xN.selected:xN.unSelected),M.add(n)}let I=0;if(u){const e=P(g,"size",10);B=t_.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,AN.focus,t,k),I=e}const D=y.formatMethod?y.formatMethod(o,t,i):o,L=u_(Object.assign(Object.assign({x:O/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:D,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(L,AN.itemLabel,t,k,A.state),L.addState(e?xN.selected:xN.unSelected),M.add(L);const F=P(y,"space",8);if(p(l)){const n=P(b,"space",u?8:0),s=b.formatMethod?b.formatMethod(l,t,i):l,r=u_(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:C.style.fontSize},C.style),{text:s,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,AN.itemValue,t,k,C.state),r.addState(e?xN.selected:xN.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-O-R-F-I-n;this._autoEllipsis(m,t,L,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-O/2-T[1]-T[3]-I-n}):r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2))}else r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2));E=n+(r.AABBBounds.empty()?0:r.AABBBounds.x2),M.add(r)}else this._itemWidthByUser?(L.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-O-R-I),E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2)):E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2);B&&(B.setAttribute("x",E),M.add(B));const U=M.AABBBounds,N=U.width();if("right"===f){const t=U.x2,e=U.x1;M.forEachChildren(((i,n)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const j=U.height(),z=p(this.attribute.item.width)?this.attribute.item.width:N+T[1]+T[3],W=this._itemHeightByUser||j+T[0]+T[2];return k.setAttributes({width:z,height:W}),B&&B.setAttribute("visible",!1),M.translateTo(-U.x1+T[3],-U.y1+T[0]),k}_createPager(t){var e,i;const{disableTriggerEvent:n,maxRow:s}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new vN(Object.assign(Object.assign({layout:1===s?"horizontal":"vertical",total:r(this._itemContext.pages)},U({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:n})):new vN(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:n,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new uN(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new uN(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:n}=this.attribute,{totalPage:s,isHorizontal:r}=this._itemContext,a=n&&n.position||"middle";if(this._pagerComponent.setTotal(s),r){let n;n="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:n})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,n=e.AABBBounds;let s,r;return t?(r=n.width(),s=r/i.width()):(r=n.height(),s=r/i.height()),s}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:n,currentPage:s,totalPage:r}=this._itemContext,a=(s-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),n?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:n=!0,animationDuration:s=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:n}=e.attribute,{width:s,height:r}=e.getSliderRenderBounds(),a="vertical"===n?t.deltaY/r:t.deltaX/s;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",mt(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:n=2,item:s={},pager:r={}}=this.attribute,{spaceCol:a=yN,spaceRow:o=_N}=s,l=this._itemsContainer,{space:h=bN,defaultCurrent:c=1}=r,u=wN(r,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(d){if(m=(n-1)*o+this._itemHeight*n,f=e,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;v<_+i&&e>0&&(_=0,b+=n+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/n);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+n}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(d?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=t_.group({x:0,y:t,width:d?v:f,height:d?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(d?m+o:f+a,d?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:i,item:n={},pager:s={}}=this.attribute,{spaceCol:r=yN,spaceRow:a=_N}=n,o=this._itemsContainer,{space:l=bN,defaultCurrent:h=1}=s,c=wN(s,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,d=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(u)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=d-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],n=f,s=Math.floor(n/(a+e));f=s*(a+e),v=Math.ceil(t.length/s)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,n=v,s=m;v=Math.floor((m+i)/f)+1,m+=a+i,n!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=s+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(u){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=t_.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=s.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(u?g:f,u?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:n=16,gradientStops:s}=e;if(!i||!s)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=s.map((t=>({offset:n*t.offset/o,color:t.color}))),h=s.map((t=>({offset:(o-n*t.offset)/o,color:t.color}))),c=t_.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];ot(ut(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),ot(ut(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(xN.selected)?this._setLegendItemState(t,xN.selectedHover,e):this._setLegendItemState(t,xN.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===AN.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(SN.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(xN.unSelectedHover)||t.hasState(xN.selectedHover))&&(i=!0),t.removeState(xN.unSelectedHover),t.removeState(xN.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(xN.unSelectedHover)&&!t.hasState(xN.selectedHover)||(i=!0),t.removeState(xN.unSelectedHover),t.removeState(xN.selectedHover)}));const n=t.getChildren()[0].find((t=>t.name===AN.focus),!1);n&&n.setAttribute("visible",!1),i&&this._dispatchLegendEvent(SN.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(SN.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let n=!1;t.hasState(e)||(n=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==AN.focus&&(n||t.hasState(e)||(n=!0),t.addState(e,!0))})),n&&this._dispatchLegendEvent(SN.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let n=!1;e.forEach((e=>{!n&&t.hasState(e)&&(n=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==AN.focus&&e.forEach((e=>{!n&&t.hasState(e)&&(n=!0),t.removeState(e)}))})),n&&this._dispatchLegendEvent(SN.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(xN.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n,s={}){t.name=e,t.data=i,t.delegate=n,t.states=U({},TN,s)}_dispatchLegendEvent(t,e,i){const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(xN.selected),currentSelectedItems:n,currentSelected:s,event:i})}_handleStyle(t,e,i,n,s){const r={};return t.style&&(u(t.style)?r.style=t.style(e,i,n,s):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(u(t.state[a])?r.state[a]=t.state[a](e,i,n,s):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};kN.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:yN,spaceRow:_N,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:bN,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};const MN=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],n=[t.key,...e.map((t=>null==t?void 0:t.key))],s=[t.value,...e.map((t=>null==t?void 0:t.value))];return U(t,...e,{shape:i.every(d)?void 0:U({},...i),key:n.every(d)?void 0:U({},...n),value:s.every(d)?void 0:U({},...s)})},BN=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:G(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},EN={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:n_,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:n_,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:n_,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new ue).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},PN=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];wM(),FM(),XM(),$M(),zM();let ON=class t extends CD{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:U({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:n,panel:s,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const u=Be(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},s),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:u[3],y:u[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",U({symbolType:"circle"},d.shape,{visible:Vy(d)&&Vy(d.shape)}),"symbol"),"object"!=typeof d.value.text||null===d.value.text||"rich"!==d.value.text.type&&"html"!==d.value.text.type?d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:Vy(d)&&Vy(d.value)},BN(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=d.value.text)&&void 0!==e?e:"",visible:Vy(d)&&Vy(d.value)},d.value),"text"):"rich"===d.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:Vy(d)&&Vy(d.value)},BN(d.value)),"richtext"):"html"===d.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:d.value.text.text},a_),d.value),visible:Vy(d)&&Vy(d.value),width:d.value.width,height:d.value.height,wordBreak:d.value.wordBreak,textAlign:d.value.textAlign,textBaseline:d.value.textBaseline,singleLine:!1,textConfig:[]},d.value),"richtext"));const g=Vy(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:f,textBaseline:m}=d.value,v=s.width-u[3]-u[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",d.height):"middle"===m?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const y=Vy(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),n&&n.length){this._tooltipContent.setAttribute("x",u[3]),this._tooltipContent.setAttribute("y",u[0]+y);let e=0;n.forEach(((i,n)=>{const s=t.getContentAttr(this.attribute,n);if(!Vy(s))return;const l=`tooltip-content-${n}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),u=s.shape.size+s.shape.spacing;let d="right"===c?(o?u:0)+(Vy(s.key)?r+s.key.spacing:0)+(Vy(s.value)?a:0):0;this._createShape("right"===c?d-s.shape.size/2:d+s.shape.size/2,s,h,l),o&&("right"===c?d-=u:d+=u);const g=this._createKey(s,h,l);g&&(d_(c,g,s.key.textAlign,d,r),g.setAttribute("y",0),"right"===c?d-=r+s.key.spacing:d+=r+s.key.spacing);const f=this._createValue(s,h,l);if(f){let t="right";p(s.value.textAlign)?t=s.value.textAlign:Vy(s.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),d_(c,f,t,d,a),f.setAttribute("y",0)}e+=s.height+s.spaceRow}))}}_createShape(t,e,i,n){var s;if(Vy(e.shape))return i.createOrUpdateChild(`${n}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(s=$s(e.key.lineHeight,e.key.fontSize))&&void 0!==s?s:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var n;if(Vy(t.key)){let s;return s=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},BN(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(n=t.key.text)&&void 0!==n?n:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},BN(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},a_),t.key)},"richtext"),s}}_createValue(t,e,i){var n;if(Vy(t.value)){let s;return s=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},BN(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(n=t.value.text)&&void 0!==n?n:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},BN(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),s}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>PN.includes(t)))?(this._mergeAttributes(e,n),d(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,u=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?u-=i+s:"middle"===l?u-=i/2:u+=s,c+e>h.x2&&(c-=e+n),u+i>h.y2&&(u-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&Vy(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach((([e,i],a)=>{var c;const{key:u,value:d,shape:p,spaceRow:g}=i,f=Vy(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=o_(u),y=o_(d);let _=0;if(Vy(u)){const{width:t,height:e}=v.quickMeasure(u.text);l.push(t),_=Math.max(_,e)}if(Vy(d)){const{width:t,height:e}=y.quickMeasure(d.text);h.push(t),_=Math.max(_,e)}f&&ta[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=u,e.valueWidth=d}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return MN({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return MN({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};ON.defaultAttributes=EN;class RN extends DF{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),T_(this._regions,(t=>{II(this.getOrient())?hL(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):hL(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=cx({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new oi(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new UO(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,n,s,r,a,o;const l=Oe.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(n=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===n?void 0:n.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,u=(null===(r=null===(s=this._spec.layers)||void 0===s?void 0:s[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",d="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,n,s)=>{var r;let a;return a=0===s?d(u,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const n=[],s=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();s&&s.length&&n.push(s.map((e=>lL(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&n.push(r.map((e=>lL(e.value,this._getNormalizedValue([e.value],t))))),n}registerTicksTransform(){const t=`${this.type}-ticks`;return LS(this._option.dataSet,t,OF),t}transformScaleDomain(){}}RN.type=r.cartesianTimeAxis,RN.specKey="axes",RN.builtInTheme={axis:mF,axisX:vF,axisY:yF};class IN extends DF{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new wb}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return LS(this._option.dataSet,t,OF),t}transformScaleDomain(){}}IN.type=r.cartesianLogAxis,IN.specKey="axes",IN.builtInTheme={axis:mF,axisLinear:IF,axisX:vF,axisY:yF},V(IN,BF);class DN extends DF{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new Tb}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return LS(this._option.dataSet,t,OF),t}transformScaleDomain(){}}DN.type=r.cartesianSymlogAxis,DN.specKey="axes",DN.builtInTheme={axis:mF,axisLinear:IF,axisX:vF,axisY:yF},V(DN,BF);const LN={barWidth:!0,barMinWidth:!0,barMaxWidth:!0,barGapInGroup:!0,barMinHeight:!0,stackCornerRadius:!0};class FN extends RI{constructor(){super(...arguments),this.type=Bb.bar,this._barMarkName="bar",this._barMarkType="rect",this.transformerConstructor=oN,this._bandPosition=0,this._getLinearBarRange=(t,e)=>{let[i,n]=[t,e].sort(((t,e)=>t-e));const s=n-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,n=n-t}const r=n-i,a=ix(this._spec.barMinWidth||2,s);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[lI]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):Gb(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[hI]):Gb(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const n=Gb(this._dataToPosX(t),e,i),s=Gb(this._dataToPosX1(t),e,i);return this._getLinearBarRange(n,s)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[cI]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):Gb(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[uI]):Gb(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const n=Gb(this._dataToPosY(t),e,i),s=Gb(this._dataToPosY1(t),e,i);return this._getLinearBarRange(n,s)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),LN)})}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},FN.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:_I(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(FN.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const n=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let s;if(LS(this._option.dataSet,"addVChartProperty",XR),n){const t=([t],{scaleDepth:e})=>{var i,n;let s=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[n,s]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[n]}-${t[s]}`;r[e]||(r[e]={[n]:t[n],[s]:t[s]},i.push(r[e]))})),i};LS(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();s=new oi(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:rI.bind(this),call:aI}},!1),null==e||e.target.addListener("change",s.reRunAllTransform)}this._barBackgroundViewData=new UO(this._option,s)}init(t){super.init(t),this.initRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,n,s,r,a;e._bar_series_position_calculated=!0,t?(i=uI,n=cI,s="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=hI,n=lI,s="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=uS(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)rN(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:n,startMethod:s,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var n,s;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(s=(n=this[o]).getScale)||void 0===s?void 0:s.call(n,0),h=this[o].isInverse(),c=this._spec.barMinHeight,u=Gb(this[r](t),l,i),d=Gb(this[a](t),l,i);let p=Math.abs(u-d);p<=0&&!Yb(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,n;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&d(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}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),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let n=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,d=1/0,g=-1/0;i.values.forEach((e=>{const i=e[Vx],s=e[Gx],r=e[Yx],u=e[Xx];if(n=Math.min(n,i,s),o=Math.max(o,i,s),t){const t=e[a?cI:lI],i=e[a?uI:hI];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(u)&&(c=!0,d=Math.min(d,r,u),g=Math.max(g,r,u))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[Vx]:n,[Gx]:o}),c?{[Yx]:d,[Xx]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,s),x1:t?h:this._getBarXEnd(f,s),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(Oh(Object.assign(Object.assign({},m),{cornerRadius:u(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,n,s;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(s=null===(n=this._yAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>Gb(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>Gb(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,n,s,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(s=null===(n=this._yAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=d(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),n=X(t);return n<0?e.scale(n):i>0?e.scale(i):e.scale(0)}}},n=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,s=OI(this);this._barMark.setAnimationConfig(fI(null===(e=ux.getAnimationInKey("bar"))||void 0===e?void 0:e(i,n),mI(this._barMarkName,this._spec,this._markAttributeContext),s))}_getBarWidth(t,e){var i,n;const s=this._groups?this._groups.fields.length:1,r=d(e)?s:Math.min(s,e),a=null!==(n=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==n?n:6,o=p(this._spec.barWidth)&&r===s,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=ix(this._spec.barWidth,a)),l&&(c=Math.max(c,ix(this._spec.barMinWidth,a))),h&&(c=Math.min(c,ix(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,n){var s,r,a,o,l;let h,c,u;"horizontal"===t?(h=this.getYAxisHelper(),c="height",u="barBackground"===n?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",u="barBackground"===n?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(i)?f:Math.min(f,i),v=null!==(r=null===(s=h.getBandwidth)||void 0===s?void 0:s.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(this._spec.barGapInGroup);let n=0,s=0;for(let r=t.length-1;r>=1;r--){const c=t[r],u=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],d=u.length,p=ix(null!==(l=i[r-1])&&void 0!==l?l:Y(i),v),g=u.indexOf(e[c]);r===t.length-1?(n+=d*y+(d-1)*p,s+=g*(y+p)):(s+=g*(n+p),n+=n+(d-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-n/2+s}const _=P_(g.type||"band");return u(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,n=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,n;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(n=this._barBackgroundViewData)||void 0===n||n.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}FN.type=Bb.bar,FN.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},FN.mark=sN,FN.transformerConstructor=oN;const UN=()=>{$F(),nN(),ux.registerAnimation("bar",((t,e)=>({appear:KU(t,e),enter:VU(t,!1),exit:GU(t,!1),disappear:{duration:xR.disappear.duration}}))),bF(),LF(),ux.registerSeries(FN.type,FN)};class NN extends aU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),iO(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const n=t.series.some((t=>"horizontal"===t.direction)),s=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(n?["left","right"]:["top","bottom"]).includes(t.orient)));if(s&&!s.bandSize&&!s.maxBandSize&&!s.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:n,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(s,e,{barMaxWidth:n,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class jN extends iU{constructor(){super(...arguments),this.transformerConstructor=NN,this.type="bar",this.seriesType=Bb.bar}_setModelOption(){this._modelOption.getDimensionInfo=bU,this._modelOption.getDimensionInfoByValue=SU,this._modelOption.getRectByDimensionData=MU}}jN.type="bar",jN.seriesType=Bb.bar,jN.transformerConstructor=NN,V(jN,cU);const zN=[...tD,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class WN extends eD{constructor(){super(...arguments),this.type=WN.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return zN}_getIgnoreAttributes(){return[]}}WN.type="area";class HN extends tI{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var n,s,r,a;for(const i of G(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")),p(e))return e}return i}}}const VN=Object.assign(Object.assign(Object.assign({},oI),$I),{area:{name:"area",type:"area"}}),GN=()=>{ux.registerAnimation("area",CR),wR(),AR()};class YN extends GD{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,n;const s=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(n=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===n?void 0:n.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!s||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var n,s,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,u=!1!==l.visible&&!1!==(null===(n=l.style)||void 0===n?void 0:n.visible),d=!1!==h.visible&&!1!==(null===(s=h.style)||void 0===s?void 0:s.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||d&&!u)&&(g=h,f=l),l.style=cx({},f.style,g.style),l.state=cx({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class XN extends RI{constructor(){super(...arguments),this.type=Bb.area,this.transformerConstructor=YN,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qI)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(XN.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,n,s,r;const a=null!==(n=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==n?n:null===(r=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===r?void 0:r.curveType,o=a===jR?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return Gb(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return Gb(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[Gx]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,n;const s={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(fI(null===(e=ux.getAnimationInKey("line"))||void 0===e?void 0:e(s,r),mI("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(fI(null===(i=ux.getAnimationInKey("area"))||void 0===i?void 0:i(s,r),mI("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=OI(this);this._symbolMark.setAnimationConfig(fI(null===(n=ux.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),mI("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new HN(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,n,s,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}XN.type=Bb.area,XN.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},XN.mark=VN,XN.transformerConstructor=YN,V(XN,ZI);const KN=()=>{$F(),jF(),WD(),ux.registerMark(WN.type,WN),HM(),_M(),FD(),jD(),TR(),ux.registerGraphicComponent("area",mc),VD(),GN(),bF(),LF(),ux.registerSeries(XN.type,XN)};class $N extends aU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),iO(t)}}class qN extends iU{constructor(){super(...arguments),this.transformerConstructor=$N,this.type="area",this.seriesType=Bb.area}_setModelOption(){this._modelOption.getDimensionInfo=bU,this._modelOption.getDimensionInfoByValue=SU,this._modelOption.getRectByDimensionData=MU}}qN.type="area",qN.seriesType=Bb.area,qN.transformerConstructor=$N,V(qN,cU);class ZN extends EI{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=.6,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const n=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:n,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};P_(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:[]};P_(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&PI(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function JN(t){return zy(t)?Number.parseFloat(t):0}const QN=(t,e)=>{const{asStartAngle:i,asEndAngle:n,asMiddleAngle:s,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:u}=e,d=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&u&&tj(m,d,c))return[];const v=(t,e,a)=>{t[i]=e,t[n]=e+a,t[s]=e+a/2,t[r]=a,t[o]=Vt(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[d]))),S=g-p;let A=p,C=S,w=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const n=Math.pow(10,e),s=t.map((t=>(isNaN(t)?0:t)/i*n*100)),r=100*n,a=s.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=s.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/n))}(x);if(m.forEach(((t,e)=>{const i=t[uL],n=y?i/y:0;let s=n*S;s{v(e,p+i*t,t)}))}else{const t=C/w;A=p,m.forEach((e=>{const i=e[r]===f?f:e[uL]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][n]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},tj=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===JN(t[e])))||!i&&0===t.reduce(((t,i)=>t+JN(i[e])),0)));function ej(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const ij=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:ej(t,!0,GS.appear)}),nj={type:"fadeIn"},sj=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:ej(t,!0,GS.enter)}),rj=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:ej(t,!0,GS.exit)});function aj(t,e){if(!1===e)return{};switch(e){case"fadeIn":return nj;case"growRadius":return ij(Object.assign(Object.assign({},t),{growField:"radius"}));default:return ij(Object.assign(Object.assign({},t),{growField:"angle"}))}}class oj extends lR{constructor(t,e){super(t,e),this.type=lj.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",n)=>{var s;return n+(null!==(s=this.getAttribute("radiusOffset",e,i))&&void 0!==s?s:0)},this.computeCenter=(t,e,i="normal",n)=>zt({x:0,y:0},this.getAttribute("centerOffset",e,i),e[mL])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class lj extends oj{constructor(){super(...arguments),this.type=lj.type}}lj.type="arc";const hj=()=>{HM(),fM(),ID("arc",QU),QM.registerBuiltInAnimate("growRadiusIn",$B),QM.registerBuiltInAnimate("growRadiusOut",qB),QM.registerBuiltInAnimate("growAngleIn",EB),QM.registerBuiltInAnimate("growAngleOut",PB),ux.registerGraphicComponent("arc",_c),ux.registerMark(lj.type,lj)},cj=Object.assign(Object.assign({},oI),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class uj extends AI{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let n=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);n=cx({},this._theme,i,t);const s=(t,e)=>cx({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(n.label)?n.label=n.label.map((t=>s(t.position,t))):n.label=s(n.label.position,n.label)}return{spec:n,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:n,centerY:s}=t;return p(n)&&(i.centerX=n),p(s)&&(i.centerY=s),Object.keys(i).length>0?i:void 0}}const dj=`${Dx}_LABEL_VISIBLE`,pj={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},gj={outerRadius:!0};class fj extends ZN{constructor(){super(...arguments),this.transformerConstructor=uj,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:Zb(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:Zb(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=_L,this._endAngle=bL,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[mL];if(d(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t);return zt(this.computeCenter(t),(i+n)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,n,s,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,n=2*Math.PI;const s=p(t),r=p(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}}(p(this._spec.startAngle)?Nt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?Nt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?Nt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(n=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==n&&n,this._showAllZero=null!==(s=this._spec.showAllZero)&&void 0!==s&&s,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;LS(this._dataSet,"pie",QN),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?Nt(this._spec.minAngle):0,asStartAngle:pL,asEndAngle:gL,asRatio:dL,asMiddleAngle:mL,asRadian:yL,asQuadrant:vL,asK:fL,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new oi(this._dataSet,{name:`${Dx}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new UO(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},fj.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:jx,groupKey:this._seriesField,isSeriesMark:!0},{morph:_I(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return k_(pL)(t)}endAngleScale(t){return k_(gL)(t)}_computeLayoutRadius(){return((t,e,i,n)=>{const s=t();if(S(s))return s;if(u(s))return s(e(),i());const r=e();if("auto"===s&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=n();return Ht(r,i(),t,e)}return Math.min(r.width/2,r.height/2)})((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:Xb(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:Xb(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const n=this._emptyArcMark;n&&this.setMarkStyle(n,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const n in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[n]),n,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:k_(dj).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,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}computeRadius(t,e){return this._computeLayoutRadius()*t*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),gj),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),pj)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const n=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];n.forEach((t=>{i[t]=!0}));const s=super._compareSpec(t,e,i);return t=null!=t?t:{},n.some((i=>t[i]!==e[i]))&&(s.reRender=!0,s.change=!0),s}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[mL];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const n=this.computeDatumRadius(t);return zt(this.computeCenter(t),n,i)}initAnimation(){var t,e,i;const n={growFrom:(t,e,i)=>{var n,s;if(i===GS.appear)return this._startAngle;if(i===GS.disappear)return this._endAngle;const r=[GS.disappear,GS.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[Nx];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Nx]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Nx])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Nx])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+zt({x:0,y:0},a,e[mL]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+zt({x:0,y:0},a,e[mL]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+zt({x:0,y:0},a,e[mL]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+zt({x:0,y:0},a,e[mL]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=fI(null===(i=ux.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(n,null!=s?s:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}fj.transformerConstructor=uj,fj.mark=cj,fj.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class mj extends fj{constructor(){super(...arguments),this.type=Bb.pie}}mj.type=Bb.pie;const vj=()=>{hj(),ux.registerAnimation("pie",((t,e)=>({appear:aj(t,e),enter:sj(t),exit:rj(t),disappear:{duration:xR.disappear.duration}}))),ux.registerAnimation("emptyCircle",((t,e)=>({appear:aj(t,e)}))),ux.registerSeries(mj.type,mj)};class yj extends rU{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,n;const s=G(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 p(r)&&s.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),s}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class _j extends yj{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class bj extends iU{constructor(){super(...arguments),this.transformerConstructor=_j}}bj.transformerConstructor=_j;class xj extends bj{constructor(){super(...arguments),this.transformerConstructor=_j,this.type="pie",this.seriesType=Bb.pie}}xj.type="pie",xj.seriesType=Bb.pie,xj.transformerConstructor=_j;class Sj extends rU{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var n;if("bar"===e.type){const s=this._findBandAxisBySeries(e,i,t.axes);if(s&&!s.bandSize&&!s.maxBandSize&&!s.minBandSize){const t=g(e.autoBandSize)&&null!==(n=e.autoBandSize.extend)&&void 0!==n?n:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(s,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{P(e,"trimPadding")&&cx(e,lO(this.type,t))})),this._transformAxisSpec(t)}}const Aj=(t,e)=>{if(!t)return null;const i=YI(t,(t=>"angle"===t.getOrient()),e),n=YI(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||n&&n.length))return null;const s=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&R_(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=C_({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,n=K(e),s=X(e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(p,h);const g=w_(u),f=null===(e=n[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=VI(v,t,"polar",r);s.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),n&&n.forEach((t=>{var e;const n=t.getScale(),l=null==n?void 0:n.range();if(n&&R_(n.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=C_({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=w_(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=n.invert(p);if(d(m))return;let v=n.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=VI(m,t,"polar",r);s.push({index:v,value:m,position:n.scale(m),axis:t,data:y})}})),s.length?s:null};class Cj extends iU{constructor(){super(...arguments),this.transformerConstructor=Sj,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var n,s;return[...null!==(n=bU(t,e,i))&&void 0!==n?n:[],...null!==(s=Aj(t,e))&&void 0!==s?s:[]]},this._modelOption.getDimensionInfoByValue=SU,this._modelOption.getRectByDimensionData=MU}}Cj.type="common",Cj.transformerConstructor=Sj,V(Cj,cU);const wj={rect:Pj,symbol:Bj,arc:Rj,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=Bj(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:function(t,e,i){const n=t.series,s=t.labelSpec||{},r=n.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=s.position||"withChange",o=s.offset||0,l=e?e(r.data):r.data,h=kj(t,l,s.formatMethod);return h.x=function(t,e,i,n){if("horizontal"===e.direction)return"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+n:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-n:e.totalPositionX(t,"end")+(t.end>=t.start?n:-n);return e.totalPositionX(t,"index",.5)}(l,n,a,o),h.y=function(t,e,i,n){if("horizontal"===e.direction)return e.totalPositionY(t,"index",.5);if("middle"===i)return.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start"));if("max"===i)return e.totalPositionY(t,t.end>=t.start?"end":"start")-n;if("min"===i)return e.totalPositionY(t,t.end>=t.start?"start":"end")+n;return e.totalPositionY(t,"end")+(t.end>=t.start?-n:n)}(l,n,a,o),"horizontal"===n.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),_h(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const s=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[n.getDimensionField()[0]])}));s&&(s.data=i,e.push(s))})),e},overlap:{strategy:[]}}},line:Ij,area:Ij,rect3d:Pj,arc3d:Rj,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,n)=>{for(let s=0;s"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function Tj(t,e){var i;const{labelSpec:n}=e;n.overlap&&!g(n.overlap)&&(n.overlap={});const s=null!==(i=wj[t])&&void 0!==i?i:wj.point;return e.series.type===Bb.sankey?function(t){var e,i,n;const{series:s,labelSpec:r={}}=t,a=null!==(e=Mj(r.position))&&void 0!==e?e:"outside",o=s.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(n=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==n?n:Dj(s)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):s(e)}function kj(t,e,i,n){var s,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(s=h.text)&&void 0!==s?s:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==Bb.sankey){const{formatFunc:t,args:s}=GR(i,n,h.text,e);t&&(h._originText=h.text,h.text=t(...s,{series:o}))}return h}function Mj(t){return u(t)?e=>t(e.data):t}function Bj(t){var e,i,n;const{series:s,labelSpec:r}=t,a="horizontal"===s.direction?"right":"top",o=null!==(e=Mj(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(n=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==n?n:Ej(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function Ej(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function Pj(t){var e,i,n,s,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=Mj(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",u="horizontal"===o.direction?null===(n=o.getXAxisHelper())||void 0===n?void 0:n.isInverse():null===(s=o.getYAxisHelper())||void 0===s?void 0:s.isInverse();let d,p=h;p=t=>{var e;const{data:i}=t,n=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===n){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},n=(null==i?void 0:i[t])>=0&&u||(null==i?void 0:i[t])<0&&!u?1:0;return e[c][n]}return n},d=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:Oj(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:d,smartInvert:g}}function Oj(t){return[{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"]}}]}function Rj(t){var e;const{labelSpec:i}=t,n=null!==(e=Mj(i.position))&&void 0!==e?e:"outside",s=n;let r;return r=i.smartInvert?i.smartInvert:y(n)&&n.includes("inside"),{position:s,smartInvert:r}}function Ij(t){var e,i,n,s;const{labelSpec:r,series:a}=t,o=null===(n=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===n?void 0:n.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[zx]:a.getSeriesKeys()[0]}];return{position:null!==(s=r.position)&&void 0!==s?s:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function Dj(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class Lj extends wL{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover: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}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,W(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:n})=>{const s=i(),r=Fb({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=n(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:s}=t.context;s!==dO.exit&&e.forEach(((t,{})=>{const e=n(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},s)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:s}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}Lj.type=r.label;class Fj extends lR{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=Fj.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const n=super._transformGraphicAttributes(t,e,i),{text:s}=n;return g(s)&&p(s.text)&&("rich"===this._textType||"rich"===s.type)&&(n.textConfig=s.text),n}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?cc(t):_h(t)}}Fj.type="text";class Uj extends Fj{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}Uj.type="text",Uj.constructorType="label";const Nj=()=>{ux.registerMark(Fj.type,Fj),HM(),$M(),zM(),ux.registerGraphicComponent("text",_h),ux.registerGraphicComponent("richtext",cc),ux.registerMark(Uj.constructorType,Uj)};class jj extends CL{_initTheme(t,e){return{spec:t,theme:this._theme}}}class zj extends Lj{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=jj,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],n=(null==e?void 0:e.region)||[];return n.forEach(((n,s)=>{(n.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:n={}}=i;return Object.values(n).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,s],regionIndexes:[s]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(kS.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(kS.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),T_(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),n=t.getRegion();this._labelInfoMap.get(n)||this._labelInfoMap.set(n,[]);for(let s=0;s{var s,o,l;if(e.visible){const h=this._labelInfoMap.get(n),c=this._createMark({type:"label",name:`${null!==(s=t.userId)&&void 0!==s?s:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let n=!1;const s=`${i.getGroupMark().name}-label-component`;let r=t[s];r||(n=!0,r=this._createMark({type:"component",name:s},{componentType:"label"},{support3d:this._spec.support3d})),r&&(n&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[s]=null)}else e.forEach(((e,n)=>{var s;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(s=e.baseMark.getData())||void 0===s||s.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[n])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,n;const{labelMark:s,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(s,r),u(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,s,r)}(null===(n=null===(i=s.stateStyle)||void 0===i?void 0:i.normal)||void 0===n?void 0:n.lineWidth)&&s.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const n=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,s;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),u=null!==(s=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==s?s:0;let d=cx({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:n.map((t=>t.getMarks()[0].getProductId()))}},Tj(h,r),Object.assign(Object.assign(Object.assign({},N(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:u}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[Qx])):t=>t.filter((t=>t.data[Jx]))}:{});return l&&l.parseLabelStyle&&(d=l.parseLabelStyle(d,a,o)),"line"!==h&&"area"!==h||(d.type=h),d},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?kj(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,n=null==i?void 0:i.parent;if(n){const t=n.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,s)=>{s.getComponent()===n&&(e=G(i())[t])}))}return e}}zj.type=r.label,zj.specKey="label",zj.transformerConstructor=jj;var Wj;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(Wj||(Wj={}));const Hj={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},Vj={labelZIndex:!0,gridZIndex:!0},Gj={xField:!0,yField:!0,categoryField:!0,valueField:!0},Yj={visible:!0,width:!0,style:!0};class Xj extends wL{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=mt((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:n}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,n,e,t.activeType);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let n=!1;if(t.forEach((t=>{R_(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!this.enable)return!1;const{currentValue:s}=this._stateByField[i];return t.forEach(((t,i)=>{const n=t.axis;s.set(i,{datum:this._getDatumAtPoint(n,e),axis:n})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:n}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:n}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:n=0,datum:s}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===n));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(n,{axis:r,datum:s}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!W(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>W(null==e?void 0:e[i],null==t?void 0:t[i])||Vj[i]||Gj[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>W(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>W(null==t?void 0:t[i],null==e?void 0:e[i])||Yj[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var n;if(!1===(null===(n=this._option.componentShowContent)||void 0===n?void 0:n.crosshair))return;const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:PS.chart}:{source:ES.chart};_(t)?t.forEach((t=>{this.event.on(t,r,s)})):this.event.on(t,r,s)}_eventOff(t,e,i){const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,n)})):this.event.off(t,n)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),n={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},n),{x:n.x-this.getLayoutStartPoint().x,y:n.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Fy(e)||Uy(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=G(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const n=[];return t.forEach((t=>{n.push({click:"click"===t,in:i[t],out:e(t)})})),n}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:ES.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:ES.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:ES.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const n=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==n?void 0:n.length))return null;let s=P(this._spec,`${t}Field.bindingAxesIndex`);if(s||(s=[],n.forEach(((e,i)=>{Hj[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:u}=this.getLayoutStartPoint();return s.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const s=n.find((e=>e.getSpecIndex()===t));if(!s)return;const d=(null===(i=(e=s).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};s.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+d.left),o=Math.min(o,i-u+d.top),l=Math.max(l,e+t.getLayoutRect().width-c-d.right),h=Math.max(h,i+t.getLayoutRect().height-u-d.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:s})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:n}=this._stateByField[t].attributes,s="rect"===n?"rectStyle":"lineStyle";i.setAttributes({[s]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:n}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==n&&(this.gridZIndex=n)}_parseField(t,i){var n,s,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:u,fillOpacity:d,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?u:d;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=P(o,"width",h||2);else{a.style.fill=l||r,(null===(s=null===(n=null==t?void 0:t.line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.stroke)&&(a.style.stroke=t.line.style.stroke);const e=P(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,n=l.style||{},s=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:u}=s,d=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},n),{fill:n.fill||"#fff",stroke:P(n,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},u)},d):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((n=>{const s=n.axis;var r,a,o;if(a=e,o=i,((r=n).x1>a||r.x2o||r.y2a||os&&(d=s-l),h>r&&(p=r-h),d&&t.setAttribute("dx",d+c),p&&t.setAttribute("dy",p+u)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:n}=this._stateByField[e];return i&&t.push(i),n&&Object.keys(n).forEach((e=>{n[e]&&t.push(n[e])})),t}),[])}}Xj.specKey="crosshair";const Kj={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class $j extends Xj{static getSpecInfo(t){return YR(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}_getDatumAtPoint(t,e){const i=II(t.getOrient())?"x":"y",n=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(n)}setAxisValue(t,e){II(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,n){var s;let r=t,a=e;if(i&&i.length)if("dimension"===n){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let n;if(e>-1){const i=t.data[e];n=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:DI(null===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.getOrient()))?a=null==n?void 0:n.y:r=null==n?void 0:n.x}else if("mark"===n){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=((t,e)=>{for(let i=0;i{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:n,bandSize:s,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=TU(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,u,d;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+s/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(u=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==u?u:0,textStyle:Object.assign(Object.assign({},null===(d=i.label)||void 0===d?void 0:d.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(n[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,n[l]=e}))}else n[l]&&n[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:n}=this._stateByField[t];let{crosshairComp:s}=this._stateByField[t];if(s)s.setAttributes(e);else{const r=n.style;"line"===n.type?s=new pN(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===n.type&&(s=new gN(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(s),this._stateByField[t].crosshairComp=s}}}$j.specKey="crosshair",$j.builtInTheme={crosshair:Kj},$j.type=r.cartesianCrosshair;const qj=(t,e)=>p(e)?t.map((t=>e[t])):void 0,Zj=(t,e)=>i=>t.every(((t,n)=>i[t]===(null==e?void 0:e[n]))),Jj=t=>!d(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function Qj(t,e,i){var n,s,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),u=i.getOption(),g=u.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=tz(t,g),m=null!==(n=c.activeType)&&void 0!==n?n:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=u.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:n,measureFields:s,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>Zj(i,n)(t)&&Zj(s,r)(t)&&(d(a)||Zj([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const n=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),s=null!==(e=c.x)&&void 0!==e?e:v.x+n.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+n.y,a={x:0,y:0};S.transformPoint({x:s,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const n=new Map;f.forEach((t=>{var e;n.has(t.series)||n.set(t.series,[]),null===(e=n.get(t.series))||void 0===e||e.push(t)}));const l=[{value:t[e.data.dimensionFields[0]],data:[...n.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=n.get(t))||void 0===e?void 0:e.map((t=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(s=u.globalInstance.getChart())&&void 0!==s?s:void 0,datum:void 0,model:void 0,source:ES.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=u.globalInstance;return NR.globalConfig.uniqueTooltip&&NR.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const n=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),s=[{datum:[n],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:n[e.data.dimensionFields[0]],data:s}],chart:null!==(h=u.globalInstance.getChart())&&void 0!==h?h:void 0,datum:n,model:e.series,source:ES.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:n,mark:null,series:e.series},r,!1);const a=u.globalInstance;return NR.globalConfig.uniqueTooltip&&NR.hideTooltip(a.id),m}return"none"}const tz=(t,e)=>{const i=e.getSeries(),n=[];return i.forEach((e=>{var i,s,r,a,o,l,h;const c=e.getDimensionField(),u=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(s=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=qj(c,t);let y=qj(u,t);const _=Jj(y),b=!_&&p(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(Zj(c,v));if(!_&&(y=qj(u,i),!Jj(y)))return;const s=e.type===Bb.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(s)||isNaN(s.x)||isNaN(s.y)||n.push({pos:s,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=R_(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",s=c.map(((t,e)=>[t,e])).filter((([,t])=>d(null==v?void 0:v[t])));let r=[null!=v?v:[]];s.length>0&&s.forEach((([t,i])=>{var n,s,a,o;const l=null!==(o=null===(a=null===(s=null===(n=e.getViewDataStatistics)||void 0===n?void 0:n.call(e))||void 0===s?void 0:s.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var n;const s=null!==(n=null==t?void 0:t.slice())&&void 0!==n?n:[];s[i]=e,h.push(s)}))})),r=h})),r.forEach((s=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(Zj(c,s));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=qj(u,o),!Jj(y))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||n.push({pos:l,data:{dimensionFields:c,dimensionData:s,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(Zj(c,s));if(!_&&(y=qj(u,r),!Jj(y)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;n.push({pos:o,data:{dimensionFields:c,dimensionData:s,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===Bb.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(Zj(c,v))).find((t=>t[g]===f));m.forEach((s=>{if(y=qj(u,i),!Jj(y))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||n.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:s},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,s,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(Zj(c,v));const o=e.getNameMap(),l=null===(r=null===(s=e.getMapViewData)||void 0===s?void 0:s.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=qj(u,a),h=y,!Jj(y)&&!a)return;Jj(y)||(y=[null])}const p=e.dataToPosition(a);d(p)||isNaN(p.x)||isNaN(p.y)||n.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),n},ez=t=>p(t)&&!_(t),iz=t=>p(t)&&_(t),nz=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class sz extends CL{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:n}=super._initTheme(t,e),s=cx({},...nz.map((t=>void 0!==(null==n?void 0:n[t])?{[t]:n[t]}:void 0)),null==n?void 0:n.style),r=cx({},n);nz.forEach((t=>{delete r[t]})),delete r.style;const a=cx({},r,i);return a.style=cx({},s,a.style),{spec:a,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var n,s,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(n=t.visible)||void 0===n||n,t.activeType=(t=>{var e,i,n;if(!1===(null==t?void 0:t.visible))return[];const s={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(n=null==t?void 0:t.group)||void 0===n?void 0:n.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(s).forEach((e=>{var i;s[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(s).filter((t=>s[t]))})(t),t.renderMode=null!==(s=t.renderMode)&&void 0!==s?s:Uy(this._option.mode)||!Ly(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=wg.getElementById(t.parentElement)):Ly(this._option.mode)&&(t.parentElement=null==Dy?void 0:Dy.body)}}const rz={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class az extends wL{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=sz,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,n,s,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i)))return;const o=Ly(null===(s=this._option)||void 0===s?void 0:s.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,n,s,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(s=this._spec)||void 0===s?void 0:s.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:n},ignore:{mark:s}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let n=0,s=a.length;n!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(s&&ez(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(n)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(n)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,n,s)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),s)o=!a.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],s=this._isSameAsCache(n,i,t);o=!a.showTooltip(n,i,s),o&&(this._cacheInfo=n,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,n&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&NR.globalConfig.uniqueTooltip&&l&&NR.hideTooltip(l.id),o},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=e=>{var i,n,s;if(!this._isTooltipShown&&!(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:ES.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:ES.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!W(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const n=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",s=this._option.globalInstance.getTooltipHandlerByUser();if(s)this.tooltipHandler=s,this._enterable=!1;else{const t="canvas"===n?OU.canvas:OU.dom,s=ux.getComponentPluginInType(t);s||Oy("Can not find tooltip handler: "+t);const r=new s;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===n&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,n;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const s=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);s&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===s[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(n=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==n?n:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=ux.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),n=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(Fy(n)||Uy(n))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,mt(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,n;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",s=this._spec.enterable&&"html"===t;s&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=s,null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===n||n.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const n=Qj(t,e,this);return"none"!==n&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=n),n}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(iz(t)){if(ez(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>WI(t,e[i])))}if(iz(this._cacheInfo))return!1;const n=this._cacheInfo;if(!((null==t?void 0:t.datum)===n.datum&&(null==t?void 0:t.mark)===n.mark&&(null==t?void 0:t.series)===n.series))return!1;const s=this._cacheParams;return!d(s)&&!d(e)&&(s.mark===e.mark&&s.model===e.model&&s.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:n,y:s}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return n>=a&&n<=a+l&&s>=o&&s<=o+h}getVisible(){return!1!==this._spec.visible}}az.type=r.tooltip,az.transformerConstructor=sz,az.builtInTheme={tooltip:rz},az.specKey="tooltip";function oz(t){const e=t=>function(t){return p(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:p(t.texturePadding)?t.texturePadding:1,textureSize:p(t.textureSize)?t.textureSize:4}):t}(t);if(u(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else E(t.style)||(t.style=e(t.style));return E(t.state)||Object.keys(t.state).forEach((i=>{if(u(t.state[i])){const n=t.state[i];t.state[i]=(...t)=>e(n(...t))}else E(t.state[i])||(t.state[i]=e(t.state[i]))})),t}function lz(t,i,n){const{title:s={},item:r={},pager:a={},background:o={},type:l,id:h,visible:c,orient:d,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=t,S=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:C={},pager:w={},background:T={}}=t;A=I(A),C=I(C),w=I(w),T=I(T);const k=S;if(u(k.maxRow)||u(k.maxCol)){const t=Kb(n)?n:Kb(d)?d:"left";u(k.maxRow)&&(k.maxRow=k.maxRow({rect:i,orient:t,id:h})),u(k.maxCol)&&(k.maxCol=k.maxCol({rect:i,orient:t,id:h}))}return A.visible?k.title=function(t){var e,i;const n=Object.assign({},t);return E(t.style)||(n.textStyle=xS(t.style)),E(t.textStyle)||cx(n.textStyle,xS(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&xS(n.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&xS(n.background.style),n}(A):k.title={visible:!1},E(C.focusIconStyle)||xS(C.focusIconStyle),C.shape&&(C.shape=oz(_S(C.shape))),C.label&&(C.label=_S(C.label)),C.value&&(C.value=_S(C.value)),C.background&&(C.background=_S(C.background)),$b(C.maxWidth)&&(C.maxWidth=Number(C.maxWidth.substring(0,C.maxWidth.length-1))*i.width/100),$b(C.width)&&(C.width=Number(C.width.substring(0,C.width.length-1))*i.width/100),$b(C.height)&&(C.height=Number(C.height.substring(0,C.height.length-1))*i.width/100),k.item=C,"scrollbar"===w.type?(E(w.railStyle)||xS(w.railStyle),E(w.sliderStyle)||xS(w.sliderStyle)):(E(w.textStyle)||xS(w.textStyle),w.handler&&_S(w.handler)),k.pager=w,T.visible&&!E(T.style)&&(cx(k,T.style),p(T.padding)&&(k.padding=T.padding)),k}const hz=(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},cz=(t,e)=>{var i,n,s;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),u=l();if(0===c.length&&u.length)return[];if(c.length===u.length)return t;const d={};c.forEach((t=>{d[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:zx;return h?h(t,c,g):(_(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])))):p(g)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,g)]))),t)},uz={position:!0,item:!0,title:!0,pager:!0,background:!0};class dz extends wL{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{T_(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),T_(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=Kb(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;p(n)&&(this._seriesUserId=G(n)),p(e)&&(this._regionUserId=G(e)),p(s)&&(this._seriesIndex=G(s)),p(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const n=!W(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):n&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(n&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,n=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>W(null==i?void 0:i[t],null==n?void 0:n[t])||uz[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new UO(this._option,e),this._initSelectedData(),T_(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,n,s;const r=this._selectedData;d(e)||JSON.stringify(r)===JSON.stringify(e)||(T_(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(n=(i=this.effect).onSelectedDataChange)||void 0===n||n.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(n.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)W(n,this._cacheAttrs)||this._legendComponent.setAttributes(cx({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(cx({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:n,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(n-s)/2:"end"===i&&(o=n-s):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+s,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());W(t,this._cacheAttrs)||this._legendComponent.setAttributes(cx({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}dz.specKey="legends";class pz extends dz{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return YR(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),T_(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){LS(this._option.dataSet,"discreteLegendFilter",cz),LS(this._option.dataSet,"discreteLegendDataMake",hz);const t=new oi(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return T_(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,n;const s=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return s;if(!t.getRawData())return s;const a=this._option.globalScale.getScaleSpec(r);if(!a)return s;if(this._spec.field)return this._spec.field;if(!Wy(a.domain))return s;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(n=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==n?n:s}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return u(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(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=cS(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},lz(this._spec,t,this.layoutOrient)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return kN}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(SN.legendItemClick,(i=>{const n=P(i,"detail.currentSelected");e&&this.setSelectedData(n),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:n,event:i})})),this._legendComponent.addEventListener(SN.legendItemHover,(e=>{const i=P(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(SN.legendItemUnHover,(e=>{const i=P(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const n=t.style("fillOpacity"),s=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,datum:t.datum,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(n)?n:1,strokeOpacity:A(s)?s:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return u(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,n,s;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(s=null===(n=this._spec.item)||void 0===n?void 0:n.value)&&void 0!==s?s:{},{formatFunc:h}=GR(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=GR(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}pz.specKey="legends",pz.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},pz.type=r.discreteLegend;const gz="vchart-tooltip",fz=`${gz}-container`,mz=`${gz}-title`,vz=`${gz}-content-box`,yz={offsetX:10,offsetY:10},_z="99999999999999";function bz(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const xz=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,Sz=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?bz(t):"",Az=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(u(t)){const n=t(e);S(n)&&(i=n)}return i},Cz={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},wz=(t,e,i=2)=>{var n,s;return null!==(s=null===(n=Cz[t])||void 0===n?void 0:n["x"===e?0:1])&&void 0!==s?s:i};class Tz extends iL{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:n}=i;return n?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,n,s,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const u=h.activeType;if(h.handler)return null!==(s=null===(n=(i=h.handler).showTooltip)||void 0===n?void 0:n.call(i,u,e,t))&&void 0!==s?s:0;const d=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[u])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==d?void 0:d.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var n,s,r,a,o,l,h,c,d;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(s=null===(n=b[0])||void 0===n?void 0:n.data)||void 0===s?void 0:s[0]:null==b?void 0:b[0],{offsetX:C,offsetY:w}=this._option,T=m[_],k=$R(null==T?void 0:T.position,b,e),M=null!==(r=$R(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,O=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==O?void 0:O.width)&&void 0!==o?o:Lx,I=null!==(l=null==O?void 0:O.height)&&void 0!==l?l:Fx;let D=!1;const L={width:0,height:0};let F,U={x:0,y:0},N={x:0,y:0},j=1,z=1;const W=Ly(this._env);if(W&&!m.confine?(L.width=window.innerWidth,L.height=window.innerHeight):(L.width=R,L.height=I),W&&!P){const t=this._getParentElement(m);N=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(d=this._compiler.getCanvas())&&void 0!==d?d:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),U={x:F.x-N.x,y:F.y-N.y},j=xz(e,F),z=xz(t,N)}const H=z/j,V={},G={x:k,y:k},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:n},s)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=n?n:"x"===s?C:w;if("mark"===i){D=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===s?i.x1:i.y1)+h[s],o=("x"===s?i.x2:i.y2)+h[s])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){D=!0;const t=f(x,h);t&&(a=t.start[s],o=t.end[s])}else G[s]=t;if(D){const e=Y[s][0],i="x"===s?B:E;switch(wz(t,s)){case-2:V[e]=a-i*H-c;break;case-1.5:V[e]=a+c;break;case 0:V[e]=(a+o)/2-i*H/2;break;case-1:V[e]=(a+o)/2-i*H-c;break;case 1:V[e]=(a+o)/2+c;break;case 1.5:V[e]=o-i*H-c;break;case 2:V[e]=o+c}}},K=["x","y"];if(g(k))if((t=>g(t)&&(p(t.left)||p(t.right)||p(t.top)||p(t.bottom)))(k)){const{left:t,right:e,top:i,bottom:n}=k;V.left=Az(t,y),V.top=Az(i,y),V.right=Az(e,y),V.bottom=Az(n,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(k)&&K.forEach((t=>{const e=k[t];S(e)||u(e)?V[Y[t][0]]=Az(e,y):X(e,t)}));else p(k)&&(X({orient:k,mode:M},"x"),X({orient:k,mode:M},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?B:E,n="x"===t?R:I,s="x"===t?C:w,r=wz(G[t],t);if(A(V[Y[t][0]]))$[t]=V[Y[t][0]];else if(A(V[Y[t][1]]))$[t]=n-i*H-V[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+s:0===r?e-i*H/2:e-i*H-s}$[t]*=j,W&&($[t]+=U[t]),$[t]/=z;const a="x"===t?L.width:L.height,o=m.confine?-(N[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/z:-N[t]/z,l=a/z+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(D?$[t]=l:($[t]-=0===r?s+i/2:2*s+i,$[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",Mz=(t={},e={})=>{var i,n;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const s=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(s)&&(e.color=s),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=kz(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=kz(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(n=t.wordBreak)&&void 0!==n?n:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},Bz=(t={})=>{const{lineHeight:e}=t;return t.fontSize?Zb(e,t.fontSize):0},Ez=t=>{var e;const{backgroundColor:i,border:n,shadow:s,padding:r}=t,a={borderWidth:`${null!==(e=null==n?void 0:n.width)&&void 0!==e?e:0}px`};let o=null;(null==n?void 0:n.color)&&(a.borderColor=n.color),i&&(a.backgroundColor=i),a.boxShadow=s?`${s.x}px ${s.y}px ${s.blur}px ${s.spread}px ${s.color}`:"initial";const{radius:l}=null!=n?n:{};return p(l)&&(a.borderRadius=A(l)?`${l}px`:`${l}`),p(r)&&(o=Be(r),a.padding=kz(o)),{panelStyle:a,panelPadding:o}};function Pz(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class Oz extends Tz{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(Oz.type),this.type=OU.dom,this._tooltipContainer=null==Dy?void 0:Dy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Dy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,n,s;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=Ez(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),A(g)&&(y.marginBottom=`${g}px`);const _={width:kz(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=Mz(h),x=Mz(u),S=Mz(p),C="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[C]=kz(null!==(i=c.spacing)&&void 0!==i?i:8),x[C]=kz(null!==(n=u.spacing)&&void 0!==n?n:26),S[C]=kz(null!==(s=p.spacing)&&void 0!==s?s:0);const w=Math.max(Bz(p),Bz(u));return y.lineHeight=w>0?`${w}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:n}=t,s=n&&n.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(mz))),l=a.find((t=>t.className.includes(vz)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(mz),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(Pz(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),s?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&s&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${gz}-column`),e.classList.add(`${gz}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(vz),this._rootDom.appendChild(l)),l&&s){const t=[...l.children];Pz(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&n.every((t=>!t.hasShape||!t.shapeType));Pz(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const s=[...t.children];s.slice(n.length).forEach((t=>{t.parentNode.removeChild(t)})),n.forEach(((e,a)=>{let o=s[a];o||(o=document.createElement("div"),o.classList.add(`${gz}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===n.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=Sz(e.key),e.keyStyle&&Mz(e.keyStyle,l)):"value"===i?(o.innerHTML=Sz(e.value),e.valueStyle&&Mz(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,n,s,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:u=!1,shapeFill:d}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?bz(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?bz(c):m,_=p,b=t=>new Ch({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,C;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;C=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(C=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new ce));let w=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,n]=w.split(" ").map((t=>Number(t))),s=Number(f.slice(0,-2));w=`${t-s/2} ${e-s/2} ${i+s} ${n+s}`}const T=Bo.IsGradientStr(d);if(!d||y(d)&&!T||u)return m=u?"none":d?bz(d):"currentColor",`\n \n \n \n `;const k=T?Bo.Parse(d):g(d)?d:null;if(k){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(n=k.stops)&&void 0!==n?n:[]).map((t=>``)).join("");return"radial"===k.gradient?t=`\n ${i}\n `:"linear"===k.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),Pz(o,l)}))}}))}else l&&!s&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,n,s,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(vz))),h=[...o.children].find((t=>t.className.includes(mz)));if(l){const o=this._component.getSpec(),c={},u=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(u&&u.autoWidth&&!1!==u.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(n=null==o?void 0:o.style)||void 0===n?void 0:n.maxContentHeight)){const t=h&&h.className.includes(mz)?h.getBoundingClientRect().height+(null!==(s=o.style.spaceRow)&&void 0!==s?s:0):0,e=this._chartOption.getChartViewRect(),i=Zb(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,Pz(l,c))}const d=l.children,g=[];if(d){for(let i=0;i{var i;let n,s;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(n=t.split("\n"),n=n.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(s=t.text,n=t);const r=Yc({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:s});return{width:r.width(),height:r.height(),text:n}};function Dz(t={},e,i){var n,s;return Object.assign(Object.assign({},null!=i?i:Rz),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const Lz=t=>{var e;const{backgroundColor:i,border:n,shadow:s}=t,r={lineWidth:null!==(e=null==n?void 0:n.width)&&void 0!==e?e:0,shadow:!!s};(null==n?void 0:n.color)&&(r.stroke=n.color),i&&(r.fill=i),s&&(r.shadowColor=s.color,r.shadowBlur=s.blur,r.shadowOffsetX=s.x,r.shadowOffsetY=s.y,r.shadowSpread=s.spread);const{radius:a}=null!=n?n:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class Fz extends Tz{constructor(){super(Fz.type),this.type=OU.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new ON({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,n;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var n,s,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:u={},titleLabel:d,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=Be(u.padding),b=tx(u.padding),x=Dz(Object.assign({textAlign:"right"===y?"right":"left"},d),i),S=Dz(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=Dz(m,i),C={fill:!0,size:null!==(n=null==g?void 0:g.size)&&void 0!==n?n:8,spacing:null!==(s=null==g?void 0:g.spacing)&&void 0!==s?s:6},w={panel:Lz(u),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:C,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:k=[]}=t;let M=b.left+b.right,B=b.top+b.bottom,E=0;const P=!!k.length;let O=0,R=0,I=0,D=0;if(P){const t=[],e=[],i=[],n=[];let s=0;w.content=k.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:u,shapeStroke:d,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:w}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=cx({},S,Dz(b,void 0,{})),{width:n,height:s,text:r}=Iz(h,i);T.key=Object.assign(Object.assign({width:n,height:s},i),{text:r}),y?e.push(n):t.push(n),o=Math.max(o,s)}if(p(m)){const t=cx({},A,Dz(x,void 0,{})),{width:e,height:n,text:s}=Iz(m,t);T.value=Object.assign(Object.assign({width:e,height:n},t),{text:s}),i.push(e),o=Math.max(o,n)}if(l){const t={visible:!0,symbolType:c};w?t.stroke=u:t.fill=u,t.stroke=null!=d?d:u,t.lineWidth=g,T.shape=t;const e=null!=f?f:C.size;o=Math.max(e,o),n.push(e)}else T.shape={visible:!1};return T.height=o,s+=o,aH.autoWidth&&!1!==H.multiLine;if(N){H=cx({},x,Dz(z,void 0,{})),V()&&(H.multiLine=null===(r=H.multiLine)||void 0===r||r,H.maxWidth=null!==(a=H.maxWidth)&&void 0!==a?a:P?Math.ceil(E):void 0);const{text:t,width:e,height:i}=Iz(j,H);w.title.value=Object.assign(Object.assign({width:V()?Math.min(e,null!==(o=H.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},H),{text:t}),L=w.title.value.width,F=w.title.value.height,U=F+(P?w.title.spaceRow:0)}return B+=U,w.title.width=L,w.title.height=F,V()?M+=E||L:M+=Math.max(L,E),P&&w.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=M-b.left-b.right-D-O-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),w.valueWidth=Math.max(w.valueWidth,i.width))})),w.panel.width=M,w.panel.height=B,w})(t,this._component.getSpec(),e)}const{panel:s}=null!==(n=this._attributes)&&void 0!==n?n:{};return{width:s.width+s.lineWidth,height:s.height+s.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:n}=e,s=n.position;e.changePositionOnly?p(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),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()}}Fz.type=OU.canvas;const Uz=/\{([^}]+)\}/,Nz=/\{([^}]+)\}/g,jz=/:/;class zz extends iL{constructor(){super(zz.type),this.type="formatterPlugin",this._timeModeFormat={utc:Oe.getInstance().timeUTCFormat,local:Oe.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=je.getInstance().format,this._numericSpecifier=je.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:n}=t;if(!n)return;this._spec=null!==(i=null==e?void 0:e[zz.specKey])&&void 0!==i?i:{};const{timeMode:s,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;u(r)?this._formatter=r:(this._formatter=this._format.bind(this),u(o)?this._timeFormatter=o:s&&this._timeModeFormat[s]&&(this._timeFormatter=this._timeModeFormat[s]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),ux.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,n)=>{const s=_(i)?i[n]:i;return s?this._formatSingleLine(t,e,s):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let n;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?n=this._isNumericFormatterCache.get(i):(n=Uz.test(i),this._isNumericFormatterCache.set(i,n))),n){return i.replace(Nz,((t,i)=>{if(!jz.test(i)){const n=e[i.trim()];return void 0!==n?n:t}const n=i.split(":"),s=e[n.shift()],r=n.join(":");return this._formatSingleText(s,r)}))}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(Fe.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}zz.pluginType="chart",zz.specKey="formatter",zz.type="formatterPlugin";NR.useRegisters([()=>{FU(),NU(),zU(),gU(),pU(),$F(),jF(),WD(),VD(),wR(),AR(),bF(),LF(),ux.registerSeries(qF.type,qF),ux.registerChart(WU.type,WU)},()=>{FU(),NU(),zU(),pU(),KN(),gU(),ux.registerChart(qN.type,qN)},()=>{FU(),NU(),zU(),pU(),UN(),gU(),ux.registerChart(jN.type,jN)},()=>{NU(),vj(),ux.registerChart(xj.type,xj)},()=>{FU(),NU(),zU(),gU(),ux.registerChart(Cj.type,Cj),pU()},LF,bF,()=>{ux.registerComponent(pz.type,pz)},()=>{ux.registerComponent(az.type,az)},()=>{ux.registerComponent($j.type,$j)},()=>{ux.registerGraphicComponent(zj.type,(t=>new eN(t))),Nj(),BL(),ux.registerComponent(zj.type,zj,!0,1/0)},()=>{var t;t=Fz,ux.registerComponentPlugin(t.type,t)},()=>{var t;t=zz,ux.registerChartPlugin(t.type,t)},PR,IR]),NR.useRegisters([()=>{Bk(Tg)}]),t.DEFAULT_CHART_HEIGHT=Fx,t.DEFAULT_CHART_WIDTH=Lx,t.DEFAULT_CLOSE_STROKE_JOIN=WR,t.DEFAULT_DATA_INDEX=Nx,t.DEFAULT_DATA_KEY=jx,t.DEFAULT_DATA_SERIES_FIELD=zx,t.DEFAULT_KEY=aS,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=zR,t.DEFAULT_MAP_LOOK_UP_KEY=oS,t.DEFAULT_MEASURE_CANVAS_ID=Ux,t.DEFAULT_SERIES_STYLE_NAME=Wx,t.DEFAULT_SMOOTH_INTERPOLATE=jR,t.Factory=ux,t.MOSAIC_CAT_END_PERCENT=nS,t.MOSAIC_CAT_START_PERCENT=iS,t.MOSAIC_VALUE_END_PERCENT=eS,t.MOSAIC_VALUE_START_PERCENT=tS,t.ManualTicker=class extends mP{constructor(t){super(t),this.lastFrameTime=0,this.status=is.RUNNING}setupTickHandler(){const t=new HR;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===is.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===is.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=is.RUNNING,!0}},t.PREFIX=Dx,t.SEGMENT_FIELD_END=rS,t.SEGMENT_FIELD_START=sS,t.STACK_FIELD_END=Gx,t.STACK_FIELD_END_OffsetSilhouette=$x,t.STACK_FIELD_END_PERCENT=Xx,t.STACK_FIELD_KEY=Hx,t.STACK_FIELD_START=Vx,t.STACK_FIELD_START_OffsetSilhouette=Kx,t.STACK_FIELD_START_PERCENT=Yx,t.STACK_FIELD_TOTAL=qx,t.STACK_FIELD_TOTAL_BOTTOM=Qx,t.STACK_FIELD_TOTAL_PERCENT=Zx,t.STACK_FIELD_TOTAL_TOP=Jx,t.StreamLight=QE,t.ThemeManager=kx,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=NR,t.boundsInRect=Qb,t.builtinThemes=fx,t.calcLayoutNumber=Zb,t.calcPadding=Jb,t.computeActualDataScheme=Db,t.convertPoint=ex,t.createArc=_c,t.createArea=mc,t.createGroup=kc,t.createLine=Mh,t.createRect=Oh,t.createRichText=cc,t.createSymbol=wh,t.createText=_h,t.darkTheme=lx,t.dataScheme=nx,t.default=NR,t.defaultThemeName=mx,t.getActualColor=Fb,t.getActualNumValue=ix,t.getColorSchemeBySeries=zb,t.getDataScheme=Ib,t.getFunnelTheme=gx,t.getMergedTheme=Cx,t.getSpecInfo=YR,t.getTheme=xx,t.hasThemeMerged=_x,t.isColorKey=Ub,t.isPercent=$b,t.isPercentOffset=qb,t.isProgressiveDataColorScheme=Nb,t.isTokenKey=rx,t.isValidOrient=Kb,t.lightTheme=ox,t.lookup=(t,e)=>{var i;const n=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!n)return t;const s=(r=e.fields,u(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[s],c=n.reduce((function(t,e){return e[s]&&t.set(`${e[s]}`,e),t}),new Map);let g;if(u(e.set))g=function(t){const i=c.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=c.get(`${e[a]}`);if(d(i))for(let i=0;i(g(t),t)))},t.measureText=Ix,t.normalizeLayoutPaddingSpec=tx,t.queryColorFromColorScheme=Lb,t.queryToken=sx,t.registerDataSetInstanceParser=FS,t.registerDataSetInstanceTransform=LS,t.registerTheme=bx,t.removeTheme=Sx,t.themeExist=Ax,t.themes=vx,t.token=ax,t.transformColorSchemeToStandardStruct=jb,t.transformToGraphic=xS,t.version="2.1.0",t.vglobal=wg,t.warn=Py,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/vchart/package.json b/packages/vchart/package.json index 874685206a..65c9d70bef 100644 --- a/packages/vchart/package.json +++ b/packages/vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart", - "version": "2.0.22", + "version": "2.1.0", "description": "charts lib based @visactor/VGrammar", "main": "cjs/index.js", "module": "esm/index.js", @@ -133,10 +133,10 @@ "@visactor/vrender-kits": "1.1.0", "@visactor/vrender-components": "1.1.0", "@visactor/vrender-animate": "1.1.0", - "@visactor/vutils-extension": "workspace:2.0.22" + "@visactor/vutils-extension": "workspace:2.1.0" }, "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" } -} \ No newline at end of file +} diff --git a/packages/vutils-extension/package.json b/packages/vutils-extension/package.json index 1cd1c38a3b..ae76b76242 100644 --- a/packages/vutils-extension/package.json +++ b/packages/vutils-extension/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vutils-extension", - "version": "2.0.22", + "version": "2.1.0", "description": "The extension module for VUtil from VisActor", "sideEffects": false, "main": "cjs/index.js", diff --git a/packages/wx-vchart/miniprogram/src/vchart/index.js b/packages/wx-vchart/miniprogram/src/vchart/index.js index 2000a83659..d7dff89ad2 100644 --- a/packages/wx-vchart/miniprogram/src/vchart/index.js +++ b/packages/wx-vchart/miniprogram/src/vchart/index.js @@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function V(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function U(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(V(t)!==V(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=N(t),n=N(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!U(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function et(t){return Number(t)}function it(t,e,i=et){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&S(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(t=rt.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):nt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=rt.Warn&&nt(this._method||"warn","WARN",t),this}info(...t){return this._level>=rt.Info&&nt(this._method||"log","INFO",t),this}debug(...t){return this._level>=rt.Debug&&nt(this._method||"log","DEBUG",t),this}}function ot(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;tt(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(tt)),it(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e,i=ut,s=dt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function ft(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var vt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function yt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=m(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function St(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xt(t,e,{leading:s,trailing:n,maxWait:e})}function At(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Mt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Tt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}bt=!1;const wt=4294967296;const Ct=t=>e=>L(e,t),Et=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Ct)(i)},Bt=(t,e={})=>{if(y(t)){const i=t.map((t=>Et(t,e)));return t=>i.map((e=>e(t)))}return Et(t,e)},Pt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Lt=t=>0,Rt=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function It(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Dt(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:It(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Ot(f.min,f);for(let r=0;r=1?jt:t<=-1?-jt:Math.asin(t)}function Zt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Jt(t,e){return t[0]*e[1]-t[1]*e[0]}function Qt(t,e){let i=0;for(let s=0;s0?i:0}function ie(t,e){return te(t+e,10**Math.max(ee(t),ee(e)))}function se(t,e){return te(t-e,10**Math.max(ee(t),ee(e)))}class ne{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ne(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class re{static distancePP(t,e){return $t(Kt(t.x-e.x,2)+Kt(t.y-e.y,2))}static distanceNN(t,e,i,s){return $t(Kt(t-i,2)+Kt(e-s,2))}static distancePN(t,e,i){return $t(Kt(e-t.x,2)+Kt(i-t.y,2))}static pointAtPP(t,e,i){return new ne((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ae(t){return t*(Math.PI/180)}function oe(t){return 180*t/Math.PI}const le=(t=0)=>{if(t<0)for(;t<-Ht;)t+=Ht;else if(t>0)for(;t>Ht;)t-=Ht;return t};function he(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function ce(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function de(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ue(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function pe(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ue(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function ge(t){return(t=ue(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function fe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function me(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function _e(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var ye;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(ye||(ye={}));const be=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function xe(t,e,i){if(!t||!e)return ye.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Me({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Te(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?ae(t.angle):t.angle,s=Te(t);return[Me({x:t.x1,y:t.y1},i,s),Me({x:t.x2,y:t.y1},i,s),Me({x:t.x2,y:t.y2},i,s),Me({x:t.x1,y:t.y2},i,s)]}function Ce(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Te(t),Te(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ae(t.angle):t.angle;let u=i?ae(90-t.angle):t.angle+jt;const p=i?ae(e.angle):e.angle;let g=i?ae(90-e.angle):e.angle+jt;u>Vt&&(u-=Vt),g>Vt&&(g-=Vt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ee=1e-8;function Be(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function Ie(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class De{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=Ie(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(_(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(De.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/De.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(De.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(De.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/De.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}De.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",De.NUMBERS_CHAR_SET="0123456789",De.FULL_SIZE_CHAR="字";const Fe=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),ze=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return je(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends He{}class Ne extends He{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ce(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ne(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Me({x:this.x1,y:this.y1},this.angle,t),Me({x:this.x2,y:this.y1},this.angle,t),Me({x:this.x1,y:this.y2},this.angle,t),Me({x:this.x2,y:this.y2},this.angle,t)]}}class Ue{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ue,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ue;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ue(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=oe(r.rotateDeg),r}}class We{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Ge(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Ye(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Xe=/^#([0-9a-f]{3,8})$/,$e={transparent:4294967040},Ke={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function qe(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ze(t){return S(t)?new ii(t>>16,t>>8&255,255&t,1):y(t)?new ii(t[0],t[1],t[2]):new ii(255,255,255)}function Je(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Qe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ti=(t,e)=>{const i=Xe.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ii((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ze(t):8===e?new ii(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ei{static Brighter(t,e=1){return 1===e?t:new ei(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ei(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ei?t:new ei(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p($e[t]))return function(t){return S(t)?new ii(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ii(t[0],t[1],t[2],t[3]):new ii(255,255,255,1)}($e[t]);if(p(Ke[t]))return Ze(Ke[t]);const e=`${t}`.trim().toLowerCase(),i=ti(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ii(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Ge(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ii(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ei.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ii(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Ye(this.color.r,this.color.g,this.color.b),r=Ge(u(t)?n.h:vt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ii(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ti(e,!0);return null!=i?i:this}setColorName(t){const e=Ke[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ei(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ii{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${qe(this.r)+qe(this.g)+qe(this.b)+(1===this.opacity?"":qe(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Ye(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function si(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new ii(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Ye});function ri(t){if(k(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ai(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function oi(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function li(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const hi=1e-10;function ci(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+hi)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=gi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=re.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=di(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-hi,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function di(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function ui(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return di(t,t-(i*i-e*e+t*t)/(2*i))+di(e,s)}function pi(t,e){const i=re.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function gi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let vi;function _i(t,e){const i=mi(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class yi{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const bi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xi(t){let e;if(e=bi.exec(t))return new yi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const Si=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ai{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return Ai.instance||(Ai.instance=new Ai),Ai.instance}newFormat(t){const e=xi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):ki[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=ki[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?m:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?Si[8+vi/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=xi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=mi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Si[8+n/3];return function(t){return s(r*t)+a}}}const ki={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>_i(100*t,e),r:_i,s:function(t,e){const i=mi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(vi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+mi(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function Mi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ei(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ei(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Qt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ci(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Qi=Math.sqrt,ts=Math.tan;function es(t){return t>1?0:t<-1?zi:Math.acos(t)}function is(t){return t>1?ji:t<-1?-ji:Math.asin(t)}function ss(){}function ns(t,e){t&&as.hasOwnProperty(t.type)&&as[t.type](t,e)}var rs={Feature:function(t,e){ns(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++szi?t+Math.round(-t/Vi)*Vi:t,e]}function ys(t,e,i){return(t%=Vi)?e||i?vs(xs(t),Ss(e,i)):xs(t):e||i?Ss(e,i):_s}function bs(t){return function(e,i){return[(e+=t)>zi?e-Vi:e<-zi?e+Vi:e,i]}}function xs(t){var e=bs(t);return e.invert=bs(-t),e}function Ss(t,e){var i=Xi(t),s=Zi(t),n=Xi(e),r=Zi(e);function a(t,e){var a=Xi(e),o=Xi(t)*a,l=Zi(t)*a,h=Zi(e),c=h*i+o*s;return[Yi(l*n-c*r,o*i-h*s),is(c*n+l*r)]}return a.invert=function(t,e){var a=Xi(e),o=Xi(t)*a,l=Zi(t)*a,h=Zi(e),c=h*n-l*r;return[Yi(l*n+h*r,o*i+c*s),is(c*i-o*s)]},a}function As(t,e){(e=ds(e))[0]-=t,ms(e);var i=es(-e[1]);return((-e[2]<0?-i:i)+Vi-Fi)%Vi}function ks(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ss,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ms(t,e){return Wi(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function Cs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Os(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function Is(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ks(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Os(a);var t=function(t,e){var i=Ls(e),s=e[1],n=Zi(s),r=[Zi(i),-Xi(i),0],a=0,o=0;Ps.reset(),1===n?s=ji+Fi:-1===n&&(s=-ji-Fi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>zi,w=f*x;if(Ps.add(Yi(w*k*Zi(M),m*S+w*Xi(M))),a+=T?A+k*Vi:A,T^p>=i^y>=i){var C=ps(ds(u),ds(_));ms(C);var E=ps(r,C);ms(E);var B=(T^A>=0?-1:1)*is(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Fi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Ds))}return u}}function Ds(t){return t.length>1}function Fs(t,e){return((t=t.x)[0]<0?t[1]-ji-Fi:ji-t[1])-((e=e.x)[0]<0?e[1]-ji-Fi:ji-e[1])}1===(Es=Rs).length&&(Bs=Es,Es=function(t,e){return Rs(Bs(t),e)});var zs=Is((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?zi:-zi,l=Wi(r-i);Wi(l-zi)0?ji:-ji),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=zi&&(Wi(i-n)Fi?Gi((Zi(e)*(r=Xi(s))*Zi(i)-Zi(s)*(n=Xi(e))*Zi(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*ji,s.point(-zi,n),s.point(0,n),s.point(zi,n),s.point(zi,0),s.point(zi,-n),s.point(0,-n),s.point(-zi,-n),s.point(-zi,0),s.point(-zi,n);else if(Wi(t[0]-e[0])>Fi){var r=t[0]0,n=Wi(e)>Fi;function r(t,i){return Xi(t)*Xi(i)>e}function a(t,i,s){var n=[1,0,0],r=ps(ds(t),ds(i)),a=us(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ps(n,r),u=fs(n,h);gs(u,fs(r,c));var p=d,g=us(u,p),f=us(p,p),m=g*g-f*(us(u,u)-1);if(!(m<0)){var v=Qi(m),_=fs(p,(-g-v)/f);if(gs(_,u),_=cs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Wi(_[0]-b)zi^(b<=_[0]&&_[0]<=x)){var T=fs(p,(-g+v)/f);return gs(T,u),[_,cs(T)]}}}function o(e,i){var n=s?t:zi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Is(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?zi:-zi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ms(e,p)||Ms(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&Ms(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Xi(e),o=Zi(e),l=s*i;null==n?(n=e+s*Vi,r=e-l/2):(n=As(a,n),r=As(a,r),(s>0?nr)&&(n+=s*Vi));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Wi(s[0]-t)0?0:3:Wi(s[0]-i)0?2:1:Wi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,_,y=a,b=ks(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=Os(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ws(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&m)y.point(r,a);else{var l=[g=Math.max(Vs,Math.min(Hs,g)),f=Math.max(Vs,Math.min(Hs,f))],b=[r=Math.max(Vs,Math.min(Hs,r)),a=Math.max(Vs,Math.min(Hs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Us(t){return t}var Ws,Gs,Ys,Xs,$s=Ri(),Ks=Ri(),qs={point:ss,lineStart:ss,lineEnd:ss,polygonStart:function(){qs.lineStart=Zs,qs.lineEnd=tn},polygonEnd:function(){qs.lineStart=qs.lineEnd=qs.point=ss,$s.add(Wi(Ks)),Ks.reset()},result:function(){var t=$s/2;return $s.reset(),t}};function Zs(){qs.point=Js}function Js(t,e){qs.point=Qs,Ws=Ys=t,Gs=Xs=e}function Qs(t,e){Ks.add(Xs*t-Ys*e),Ys=t,Xs=e}function tn(){Qs(Ws,Gs)}var en=qs,sn=1/0,nn=sn,rn=-sn,an=rn;var on,ln,hn,cn,dn={point:function(t,e){trn&&(rn=t);ean&&(an=e)},lineStart:ss,lineEnd:ss,polygonStart:ss,polygonEnd:ss,result:function(){var t=[[sn,nn],[rn,an]];return rn=an=-(nn=sn=1/0),t}},un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn={point:Sn,lineStart:An,lineEnd:Tn,polygonStart:function(){xn.lineStart=wn,xn.lineEnd=Cn},polygonEnd:function(){xn.point=Sn,xn.lineStart=An,xn.lineEnd=Tn},result:function(){var t=bn?[_n/bn,yn/bn]:vn?[fn/vn,mn/vn]:gn?[un/gn,pn/gn]:[NaN,NaN];return un=pn=gn=fn=mn=vn=_n=yn=bn=0,t}};function Sn(t,e){un+=t,pn+=e,++gn}function An(){xn.point=kn}function kn(t,e){xn.point=Mn,Sn(hn=t,cn=e)}function Mn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,Sn(hn=t,cn=e)}function Tn(){xn.point=Sn}function wn(){xn.point=En}function Cn(){Bn(on,ln)}function En(t,e){xn.point=Bn,Sn(on=hn=t,ln=cn=e)}function Bn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,_n+=(n=cn*t-hn*e)*(hn+t),yn+=n*(cn+e),bn+=3*n,Sn(hn=t,cn=e)}var Pn=xn;function Ln(t){this._context=t}Ln.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Vi)}},result:ss};var Rn,On,In,Dn,Fn,zn=Ri(),jn={point:ss,lineStart:function(){jn.point=Hn},lineEnd:function(){Rn&&Vn(On,In),jn.point=ss},polygonStart:function(){Rn=!0},polygonEnd:function(){Rn=null},result:function(){var t=+zn;return zn.reset(),t}};function Hn(t,e){jn.point=Vn,On=Dn=t,In=Fn=e}function Vn(t,e){Dn-=t,Fn-=e,zn.add(Qi(Dn*Dn+Fn*Fn)),Dn=t,Fn=e}var Nn=jn;function Un(){this._string=[]}function Wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Gn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),hs(t,i(s))),s.result()}return r.area=function(t){return hs(t,i(en)),en.result()},r.measure=function(t){return hs(t,i(Nn)),Nn.result()},r.bounds=function(t){return hs(t,i(dn)),dn.result()},r.centroid=function(t){return hs(t,i(Pn)),Pn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Us):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Un):new Ln(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Yn(t){return function(e){var i=new Xn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Xn(){}function $n(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),hs(i,t.stream(dn)),e(dn.result()),null!=s&&t.clipExtent(s),t}function Kn(t,e,i){return $n(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function qn(t,e,i){return Kn(t,[[0,0],e],i)}function Zn(t,e,i){return $n(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Jn(t,e,i){return $n(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Un.prototype={_radius:4.5,_circle:Wn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Wn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Xn.prototype={constructor:Xn,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Qn=16,tr=Xi(30*Ui);function er(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=Qi(b*b+x*x+S*S),k=is(S/=A),M=Wi(Wi(S)-1)e||Wi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ui:0,E()):[m*Ni,v*Ni,_*Ni]},w.angle=function(t){return arguments.length?(y=t%360*Ui,E()):y*Ni},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=er(o,T=t*t),B()):Qi(T)},w.fitExtent=function(t,e){return Kn(w,t,e)},w.fitSize=function(t,e){return qn(w,t,e)},w.fitWidth=function(t,e){return Zn(w,t,e)},w.fitHeight=function(t,e){return Jn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function or(t){var e=0,i=zi/3,s=ar(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ui,i=t[1]*Ui):[e*Ni,i*Ni]},n}function lr(t,e){var i=Zi(t),s=(i+Zi(e))/2;if(Wi(s)2?t[2]*Ui:0),e.invert=function(e){return(e=t.invert(e[0]*Ui,e[1]*Ui))[0]*=Ni,e[1]*=Ni,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===fr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function vr(t){return ts((ji+t)/2)}function _r(t,e){var i=Xi(t),s=t===e?Zi(t):Ki(i/Xi(e))/Ki(vr(e)/vr(t)),n=i*qi(vr(t),s)/s;if(!s)return fr;function r(t,e){n>0?e<-ji+Fi&&(e=-ji+Fi):e>ji-Fi&&(e=ji-Fi);var i=n/qi(vr(e),s);return[i*Zi(s*t),n-i*Xi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Ji(s)*Qi(t*t+i*i),a=Yi(t,Wi(i))*Ji(i);return i*s<0&&(a-=zi*Ji(t)*Ji(i)),[a/s,2*Gi(qi(n/r,1/s))-ji]},r}function yr(t,e){return[t,e]}function br(t,e){var i=Xi(t),s=t===e?Zi(t):(i-Xi(e))/(e-t),n=i/s+t;if(Wi(s)Fi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Er.invert=ur(is),Br.invert=ur((function(t){return 2*Gi(t)})),Pr.invert=function(t,e){return[-e,2*Gi($i(t))-ji]};var Or={exports:{}},Ir=function(t,e){this.p1=t,this.p2=e};Ir.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ir.prototype.run=function(){return this.p2[0]-this.p1[0]},Ir.prototype.slope=function(){return this.rise()/this.run()},Ir.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ir.prototype.isVertical=function(){return!isFinite(this.slope())},Ir.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ir.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ir.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ir.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},Ir.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Dr=Ir,Fr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Dr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Fr(t.slice(0,s),e),o=Fr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},zr=Fr;!function(t){var e=zr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Hr(Ur,e),{tolerance:s}=i;return jr(t,s)};var Gr;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Gr||(Gr={}));const Yr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let M=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/M:0,T.push(_[t])}return T},$r=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],w=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=w.length?w:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:M,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!T.length)return Xr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...w,...T];return Xr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},Kr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",w=null!==(o=k.mean)&&void 0!==o?o:"mean",C=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",L=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",O=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",I=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,j=new Map,H=new Map,V=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&j.set(r,[]),y(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=j.get(r);t&&t.push(i)}}y(S)&&(S=[vt(Math.min.apply(null,S),0,1),vt(Math.max.apply(null,S),0,1)]);const N=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[w]=o,f[C]=l,f[E]=h,f[B]=c,f[P]=d,f[L]=n,f[R]=r,f[O]=u,f[I]=p,f[D]=g,A&&(f[F]=j.get(t)||[]),N.push(f)}return N};var qr={},Zr={};function Jr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Qr(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ta(t,e){var i=t+"",s=i.length;return s9999?"+"+ta(e,6):ta(e,4))+"-"+ta(t.getUTCMonth()+1,2)+"-"+ta(t.getUTCDate(),2)+(r?"T"+ta(i,2)+":"+ta(s,2)+":"+ta(n,2)+"."+ta(r,3)+"Z":n?"T"+ta(i,2)+":"+ta(s,2)+":"+ta(n,2)+"Z":s||i?"T"+ta(i,2)+":"+ta(s,2)+"Z":"")}function ia(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Zr;if(h)return h=!1,qr;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a0}function pa(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=aa(t));var r=[];switch(t.type){case"GeometryCollection":return ga(t,(function(t){ma(t,s)})),t;case"FeatureCollection":return pa(t,(function(t){pa(ma(t,s),(function(t){r.push(t)}))})),li(r)}return ma(t,s)}function ma(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ga(t,(function(t){ma(t,e)})),t;case"LineString":return va(da(t),e),t;case"Polygon":return _a(da(t),e),t;case"MultiLineString":return da(t).forEach((function(t){va(t,e)})),t;case"MultiPolygon":return da(t).forEach((function(t){_a(t,e)})),t;case"Point":case"MultiPoint":return t}}function va(t,e){ua(t)===e&&t.reverse()}function _a(t,e){ua(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ya(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Aa=(t,e={},i)=>{i.type=Gr.GEO;const s=Hr(xa,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Sa(t))})):e.push(Sa(t))})),e})(t);let l=t.features;return o&&(l=fa(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=ba.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=ba.bounds(t);t.bbox=e}})),t.features=l,t},ka={},Ma=(t,e,i)=>{i.type=Gr.GEO;const s=Hr(xa,ka,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Rr(a,t)}))}:Rr(a,o));var a,o;return Aa(r,s,i)},Ta=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let wa=0;function Ca(t="dataset"){return wa>1e8&&(wa=0),t+"_"+wa++}class Ea{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:Ca("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Ba{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ca("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Ba||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?j({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Yr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Gn();const Pa={},La={albers:cr,albersusa:function(){var t,e,i,s,n,r,a=cr(),o=hr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=hr().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}},Ra=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Oa(t,e){return function i(){const s=e();return s.type=t,s.path=Gn().projection(s),s.copy=s.copy||function(){const t=i();return Ra.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Ia{static GenAutoIncrementId(){return Ia.auto_increment_id++}}Ia.auto_increment_id=0;class Da{constructor(t){this.id=Ia.GenAutoIncrementId(),this.registry=t}}const Fa="named",za="inject",ja="multi_inject",Ha="inversify:tagged",Va="inversify:paramtypes";class Na{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Fa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Ua=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Wa(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Ua.hasOwnMetadata(t,e)&&(r=Ua.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Ua.defineMetadata(t,r,e)}(Ha,t,i.toString(),s)}function Ga(t){return(e,i,s)=>{Wa(e,0,s,t)}}function Ya(t){return e=>(i,s,n)=>Ga(new Na(t,e))(i,s,n)}const Xa=Ya(za),$a=Ya(ja);function Ka(){return function(t){return Ua.defineMetadata(Va,null,t),t}}function qa(t){return Ga(new Na(Fa,t))}const Za="Singleton",Ja="Transient",Qa="ConstantValue",to="DynamicValue",eo="Factory",io="Function",so="Instance",no="Invalid";class ro{constructor(t,e){this.id=Ia.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=no,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new ro(this.serviceIdentifier,this.scope);return t.activated=t.scope===Za&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class ao{getConstructorMetadata(t){return{compilerGeneratedMetadata:Ua.getMetadata(Va,t),userGeneratedMetadata:Ua.getMetadata(Ha,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const oo=(lo=Fa,t=>{const e=e=>{if(null==e)return!1;if(e.key===lo&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const uo=Symbol("ContributionProvider");class po{constructor(t,e){this.serviceIdentifier=t,this.container=e,fo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function go(t,e){t(uo).toDynamicValue((({container:t})=>new po(e,t))).inSingletonScope().whenTargetNamed(e)}class fo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}fo.store=new Map;class mo{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class vo extends mo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const _o=Symbol.for("EnvContribution"),yo=Symbol.for("VGlobal"),bo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Ja,this.options=e,this.id=Ia.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new ao}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,Fa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new ro(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new co(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[za],multiInject:s[ja]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Qa:case io:e=t.cache;break;case so:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Za&&(t.cache=e,t.activated=!0)}},xo=Symbol.for("RenderService");const So=new class{get renderService(){return this._renderService||(this._renderService=bo.get(xo)),this._renderService}};let Ao=0;class ko{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=So.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Ao,t),this.tryRunAnimationFrameNextFrame(),Ao}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class Mo{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var To=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Co=function(t,e){return function(i,s){e(i,s,t)}},Eo=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let Bo=class extends Mo{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Ia.GenAutoIncrementId(),this.hooks={onSetEnv:new vo(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new ko);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Eo(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Po,Lo,Ro,Oo;Bo=To([Ka(),Co(0,Xa(uo)),Co(0,qa(_o)),wo("design:paramtypes",[Object])],Bo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Po||(Po={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Lo||(Lo={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Ro||(Ro={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Oo||(Oo={}));const Io=Ht-1e-8;class Do{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Io)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Ht)<0&&(s+=Ht),(n%=Ht)<0&&(n+=Ht),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const zo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,jo={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},Ho={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Vo,No,Uo,Wo,Go,Yo;var Xo,$o,Ko,qo,Zo,Jo;function Qo(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),f=Math.cos(n),m=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,A=i+m,k=S+y*m,M=A-y*f;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function tl(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=ae(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Ht:C>0&&0===r&&(C-=Ht);const E=Math.ceil(Math.abs(C/(jt+.001))),B=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function il(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=hl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function dl(t,e){const{p0:i,p1:s}=t,n=re.pointAtPP(i,s,e);return[new ul(i,n),new ul(n,s)]}class ul extends sl{constructor(t,e){super(),this.type=Zo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return re.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Ut(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?re.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===qo.ROW?Nt(this.p0.x-this.p1.x):t===qo.COLUMN?Nt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class pl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new cl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new ul(new ne(this._lastX,this._lastY),new ne(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===qo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Nt(t.p0.y-s.y)}if(t===qo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Nt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class gl extends pl{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function fl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function ml(t,e,i){const s=null!=e?e:Nt(i[i.length-1].x-i[0].x)>Nt(i[i.length-1].y-i[0].y)?qo.ROW:qo.COLUMN;return"monotoneY"===t?new gl(t,s):new pl(t,s)}class vl{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 _l(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=ml("linear",i,t);return function(t,e){fl(t,e,1)}(new vl(n,s),t),n}function yl(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class bl{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&yl(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:yl(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 xl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return _l(t,e);const n=ml("basis",i,t);return function(t,e){fl(t,e,2)}(new bl(n,s),t),n}function Sl(t){return t<0?-1:1}function Al(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Sl(r)+Sl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function kl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ml(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class Tl{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Ml(this,this._t0,kl(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Ml(this,kl(this,e=Al(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ml(this,this._t0,e=Al(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class wl extends Tl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Cl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return _l(t,e);const n=ml("monotoneX",i,t);return function(t,e){fl(t,e,2)}(new Tl(n,s),t),n}function El(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return _l(t,e);const n=ml("monotoneY",i,t);return function(t,e){fl(t,e,2)}(new wl(n,s),t),n}let Bl=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class Pl extends Bl{lineEnd(){this.context.closePath()}}function Ll(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new pl("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?qo.ROW:qo.COLUMN);return Rl(new Bl(r,e,n),t),r}function Rl(t,e){return fl(t,e,1)}class Ol extends vl{lineEnd(){this.context.closePath()}}function Il(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=ml("linear",i,t);return function(t,e){fl(t,e,1)}(new Ol(n,s),t),n}function Dl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ft){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ft){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function Fl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return _l(i,n);const o=ml(t,r,i);return fl(new e(o,s,a),i,2),o}}const zl=Fl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Dl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const jl=Fl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Dl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Hl extends sl{constructor(t,e,i){super(),this.type=Zo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return ll(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,nl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===qo.ROW?Nt(this.p0.x-this.p2.x):t===qo.COLUMN?Nt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Ut(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=ll(i,s,n,e),a=re.pointAtPP(i,s,e),o=re.pointAtPP(s,n,e);return[new Hl(i,a,r),new Hl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Vl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new ul(new ne(this._lastX,this._lastY),new ne(t,e))}quadraticCurveTo(t,e,i,s){const n=new Hl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new cl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Nl(t,e,i){var s,n;switch(e){case"linear":default:return _l(t,i);case"basis":return xl(t,i);case"monotoneX":return Cl(t,i);case"monotoneY":return El(t,i);case"step":return Ll(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new pl("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?qo.ROW:qo.COLUMN);return Rl(new Pl(r,e,n),t),r}(t,.5,i);case"stepBefore":return Ll(t,0,i);case"stepAfter":return Ll(t,1,i);case"catmullRom":return zl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return jl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Il(t,i)}}class Ul extends Fo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Do(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Ho.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Ho.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Ho.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([Ho.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([Ho.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([Ho.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([Ho.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([Ho.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Ho.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Vl(this);il(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Ho.M]=t=>`M${t[1]} ${t[2]}`,t[Ho.L]=t=>`L${t[1]} ${t[2]}`,t[Ho.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Ho.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Ho.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Ho.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tYo){let t,e=Uo;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),il(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===qo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.y-e.p1.y)}if(this.direction===qo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{at.getInstance().warn("空函数")}}),oh=Object.assign(Object.assign({},Ql),{points:[],cornerRadius:0,closePath:!0}),lh=Object.assign(Object.assign({},Ql),{width:100,height:100,spikes:5,thickness:.5}),hh=Object.assign(Object.assign({},Ql),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Ql),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const ch=Object.assign(Object.assign({},Ql),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),dh=Object.assign(Object.assign(Object.assign({},Ql),ql),{strokeBoundsBuffer:0,keepDirIn3d:!0}),uh=Object.assign(Object.assign(Object.assign({},Ql),ql),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ph=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Ql),{fill:!0,cornerRadius:0,cornerType:"round"}),gh=Object.assign(Object.assign({},ph),{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}),fh=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=m("shape",/^(circle)/i,0);return t&&(t.style=f()||h()),t}()||function(){const t=m("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return m("extent-keyword",t.extentKeywords,1)}function c(){if(m("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=m("hex",t.hexColor,1)||m("rgba",t.rgbaColor,1)||m("rgb",t.rgbColor,1)||m("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return m("%",t.percentageValue,1)||m("position-keyword",t.positionKeywords,1)||f()}function f(){return m("px",t.pixelValue,1)||m("em",t.emValue,1)}function m(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class mh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(mh.IsGradientStr(t))try{const e=fh(t)[0];if(e){if("linear"===e.type)return mh.ParseLinear(e);if("radial"===e.type)return mh.ParseRadial(e);if("conic"===e.type)return mh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2,n=parseFloat(e.value)/180*zt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Vt,stops:mh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:mh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2;let n="angular"===e.type?parseFloat(e.value)/180*zt:0;for(;n<0;)n+=Vt;for(;n>=Vt;)n-=Vt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const yh={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"}},bh=!0,xh=!1,Sh=/\w|\(|\)|-/,Ah=/[.?!,;:/,。?!、;:]/,kh=/\S/,Mh=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Th(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=So.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=wh(t,a)),a}function wh(t,e,i=!1){let s=e;for(;Sh.test(t[s-1])&&Sh.test(t[s])||Ah.test(t[s]);)if(s--,s<=0)return i?Ch(t,e):e;return s}function Ch(t,e){let i=e;for(;Sh.test(t[i+1])&&Sh.test(t[i])||Ah.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Eh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=So.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Bh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ph=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=dh.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wh(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){at.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=wh(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};Ph=Bh([Ka()],Ph);var Lh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Rh=Symbol.for("TextMeasureContribution");let Oh=class extends Ph{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Oh=Lh([Ka()],Oh);const Ih=Symbol.for("CanvasFactory"),Dh=Symbol.for("Context2dFactory");function Fh(t){return bo.getNamed(Ih,So.global.env)(t)}const zh=1e-4,jh=Math.sqrt(3),Hh=1/3;function Vh(t){return t>-tc&&ttc||t<-tc}const Uh=[0,0],Wh=[0,0],Gh=[0,0];function Yh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Xh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function $h(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function Kh(t){return(t%=Vt)<0&&(t+=Vt),t}function qh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Vt);let d=Math.atan2(l,o);return d<0&&(d+=Vt),d>=s&&d<=n||d+Vt>=s&&d+Vt<=n}function Qh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(Vh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const ic=[-1,-1,-1],sc=[-1,-1];function nc(){const t=sc[0];sc[0]=sc[1],sc[1]=t}function rc(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Vh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Hh):Math.pow(i,Hh),s=s<0?-Math.pow(-s,Hh):Math.pow(s,Hh);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+jh*Math.sin(e)))/(3*a),h=(-o+i*(s-jh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,ic);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&nc(),p=$h(e,s,r,o,sc[0]),u>1&&(g=$h(e,s,r,o,sc[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Vh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,ic);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=Xh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);ic[0]=-l,ic[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Vt-1e-4){s=0,n=Vt;const e=r?1:-1;return a>=ic[0]+t&&a<=ic[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Vt,n+=Vt);let c=0;for(let e=0;e<2;e++){const i=ic[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Vt+t),(t>=s&&t<=n||t+Vt>=s&&t+Vt<=n)&&(t>zt/2&&t<1.5*zt&&(e=-e),c+=e)}}return c}function lc(t){return Math.round(t/zt*1e8)/1e8%2*zt}function hc(t,e){let i=lc(t[0]);i<0&&(i+=Vt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Vt?n=i+Vt:e&&i-n>=Vt?n=i-Vt:!e&&i>n?n=i+(Vt-lc(i-n)):e&&i1&&(i||(h+=Le(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;cc[0]=S,cc[1]=A,hc(cc,Boolean(a[6])),S=cc[0],A=cc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Ho.M:u=m,p=v,c=u,d=p;break;case Ho.L:if(i){if(Qh(c,d,m,v,e,s,n))return!0}else h+=Le(c,d,m,v,s,n)||0;c=m,d=v;break;case Ho.C:if(i){if(Zh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=rc(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Ho.Q:if(i){if(qh(c,d,m,v,_,y,e,s,n))return!0}else h+=ac(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Ho.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Le(c,d,o,l,s,n),i){if(Jh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=oc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Ho.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Qh(u,p,o,p,e,s,n)||Qh(o,p,o,l,e,s,n)||Qh(o,l,u,l,e,s,n)||Qh(u,l,u,p,e,s,n))return!0}else h+=Le(o,p,o,l,s,n),h+=Le(u,l,u,p,s,n);break;case Ho.Z:if(i){if(Qh(c,d,u,p,e,s,n))return!0}else h+=Le(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const fc=Symbol.for("VWindow"),mc=Symbol.for("WindowHandlerContribution");let vc=class extends Mo{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){super(),this.hooks={onChange:new vo(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(bo.getNamed(mc,t.env).configure(this,t),this.actived=!0)},this._uid=Ia.GenAutoIncrementId(),this.global=So.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&pt(this.width,t.width())&&pt(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};vc=pc([Ka(),gc("design:paramtypes",[])],vc);var _c=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bc=function(t,e){return function(i,s){e(i,s,t)}};let xc=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=So.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=uc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:ql.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new De(Object.assign({defaultFontParams:{fontFamily:ql.fontFamily,fontSize:ql.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=bo.get(fc),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Sc;xc=_c([Ka(),bc(0,Xa(uo)),bc(0,qa(Rh)),yc("design:paramtypes",[Object])],xc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Sc||(Sc={}));const Ac=new Ue;let kc=class{constructor(){this.matrix=new Ue}init(t){return this.mode=Sc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Sc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Ac.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Ac.a,Ac.b,Ac.c,Ac.d,Ac.e,Ac.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Ac.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Ac.a,Ac.b,Ac.c,Ac.d,Ac.e,Ac.f),this}scale(t,e,i){return this.mode===Sc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Sc.matrix?this.rotateMatrix(t,e):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===Sc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Sc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};kc=_c([Ka(),yc("design:paramtypes",[])],kc);const Mc={arc:th,area:eh,circle:ih,line:rh,path:ah,symbol:ch,text:dh,rect:hh,polygon:oh,star:lh,richtext:uh,richtextIcon:gh,image:ph,group:sh,glyph:nh},Tc=Object.keys(Mc);function wc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Cc={arc:Object.assign({},Mc.arc),area:Object.assign({},Mc.area),circle:Object.assign({},Mc.circle),line:Object.assign({},Mc.line),path:Object.assign({},Mc.path),symbol:Object.assign({},Mc.symbol),text:Object.assign({},Mc.text),rect:Object.assign({},Mc.rect),polygon:Object.assign({},Mc.polygon),star:Object.assign({},Mc.star),richtext:Object.assign({},Mc.richtext),richtextIcon:Object.assign({},Mc.richtextIcon),image:Object.assign({},Mc.image),group:Object.assign({},Mc.group),glyph:Object.assign({},Mc.glyph)};class Ec{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Tc.forEach((t=>{this._defaultTheme[t]=Object.create(Cc[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Tc.forEach((s=>{const n=Object.create(Cc[s]);t&&t[s]&&wc(n,t[s]),i[s]&&wc(n,i[s]),e[s]&&wc(n,e[s]),this.combinedTheme[s]=n})),e.common&&Tc.forEach((t=>{wc(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Bc=new Ec;function Pc(t,e){return t.glyphHost?Pc(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)):Bc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Pc(t.attachedThemeGraphic)||Bc.getTheme()}var Lc=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Rc extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=Ia.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Lc(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Dc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Hc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof Dc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Hc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof Dc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Hc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Dc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Hc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Dc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=jc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Hc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(Hc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,Hc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Dc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Hc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof Fc))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=jc.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Vc(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Dc,this.rootWheelEvent=new Fc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class Gc{static GetImage(t,e){var i;const s=Gc.cache.get(t);s?"fail"===s.loadState?So.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Gc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Gc.cache.get(t);s?"fail"===s.loadState?So.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Gc.cache.set(t,s),s.dataPromise=So.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Gc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Gc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=So.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=So.global.loadBlob(t):"json"===e&&(i.dataPromise=So.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Gc.isLoading&&Gc.toLoadAueue.length){Gc.isLoading=!0;const t=Gc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Gc.cache.set(i,n),n.dataPromise=So.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Gc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Gc.loading()})).catch((t=>{console.error(t),Gc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Gc.loading()}))}}),0)}static loadImage(t,e){const i=Yc(t,Gc.toLoadAueue);if(-1!==i)return Gc.toLoadAueue[i].marks.push(e),void Gc.loading();Gc.toLoadAueue.push({url:t,marks:[e]}),Gc.loading()}static improveImageLoading(t){const e=Yc(t,Gc.toLoadAueue);if(-1!==e){const t=Gc.toLoadAueue.splice(e,1);Gc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Yc(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Kc[0]=t[0],Kc[2]=t[0],Kc[1]=t[1],Kc[3]=t[1],Kc):t:t:0,Zc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Jc=[1,2,3,0,1,2,3,0];function Qc(t,e,i,s){for(;t>=Vt;)t-=Vt;for(;t<0;)t+=Vt;for(;t>e;)e+=Vt;Zc[0].x=i,Zc[1].y=i,Zc[2].x=-i,Zc[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Wt(t)*i,Xt(t)*i),s.add(Wt(e)*i,Xt(e)*i),n!==r||e-t>zt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}sd.TimeOut=1e3/60;const nd=new sd,rd=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class ad{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function od(t,e,i,s,n){return n?t.arc(i,s,e,0,Ht,!1,n):t.arc(i,s,e,0,Ht),!1}var ld=new class extends ad{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return od(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return od(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var hd=new class extends ad{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function cd(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var dd=new class extends ad{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return cd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return cd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return cd(t,this.parseSize(e)/2+n,i,s,r)}};function ud(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var pd=new class extends ad{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return ud(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ud(t,this.parseSize(e)/2+n,i,s)}};function gd(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class fd extends ad{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return gd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return gd(t,this.parseSize(e)/2,i,s,n)}}var md=new fd;var vd=new class extends fd{constructor(){super(...arguments),this.type="triangle"}};const _d=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),yd=Math.sin(Ht/10)*_d,bd=-Math.cos(Ht/10)*_d;function xd(t,e,i,s){const n=yd*e,r=bd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Ht*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Sd=new class extends ad{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return xd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return xd(t,this.parseSize(e)/2+n,i,s)}};const Ad=$t(3);function kd(t,e,i,s){const n=e,r=n/Ad,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Md=new class extends ad{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return kd(t,this.parseSize(e)/2+n,i,s)}};function Td(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var wd=new class extends ad{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Td(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Td(t,this.parseSize(e)/2+n,i,s)}};function Cd(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Ed=new class extends ad{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Cd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Cd(t,this.parseSize(e)/2+n,i,s)}};const Bd=-.5,Pd=$t(3)/2,Ld=1/$t(12);function Rd(t,e,i,s){const n=e/2,r=e*Ld,a=n,o=e*Ld+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Bd*n-Pd*r+i,Pd*n+Bd*r+s),t.lineTo(Bd*a-Pd*o+i,Pd*a+Bd*o+s),t.lineTo(Bd*l-Pd*h+i,Pd*l+Bd*h+s),t.lineTo(Bd*n+Pd*r+i,Bd*r-Pd*n+s),t.lineTo(Bd*a+Pd*o+i,Bd*o-Pd*a+s),t.lineTo(Bd*l+Pd*h+i,Bd*h-Pd*l+s),t.closePath(),!1}var Od=new class extends ad{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/2+n,i,s)}};function Id(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var Dd=new class extends ad{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return Id(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s,n)}};function Fd(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var zd=new class extends ad{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return Fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Fd(t,this.parseSize(e)/2,i,s,n)}};function jd(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var Hd=new class extends ad{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return jd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return jd(t,this.parseSize(e)/2,i,s,n)}};const Vd=$t(3);function Nd(t,e,i,s){const n=e*Vd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Ud=new class extends ad{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Nd(t,this.parseSize(e)/2/Vd,i,s)}drawOffset(t,e,i,s,n){return Nd(t,this.parseSize(e)/2/Vd+n,i,s)}};function Wd(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var Gd=new class extends ad{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return Wd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Wd(t,this.parseSize(e)/4+n,i,s)}};function Yd(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var Xd=new class extends ad{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return Yd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Yd(t,this.parseSize(e)/4+n,i,s)}};function $d(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var Kd=new class extends ad{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return $d(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return $d(t,this.parseSize(e)/4+n,i,s)}};function qd(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var Zd=new class extends ad{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return qd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return qd(t,this.parseSize(e)/4+n,i,s)}};function Jd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Qd=new class extends ad{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Jd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Jd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function tu(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var eu=new class extends ad{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return tu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return tu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function iu(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var su=new class extends ad{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return iu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return iu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function nu(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function ru(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var au=new class extends ad{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?ru(t,e,i,s):nu(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?ru(t,e+2*n,i,s):nu(t,[e[0]+2*n,e[1]+2*n],i,s)}};const ou=new Ve;class lu{constructor(t,e,i=!1){this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),il(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(il(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{ou.x1=i.bounds.x1*t,ou.y1=i.bounds.y1*t,ou.x2=i.bounds.x2*t,ou.y2=i.bounds.y2*t,e.union(ou)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const hu={};[ld,hd,dd,pd,Ud,vd,Sd,Md,wd,Ed,Od,Dd,zd,md,Hd,Gd,Xd,Kd,Zd,au,Qd,eu,su].forEach((t=>{hu[t.type]=t}));const cu={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class du{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function uu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function pu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=pu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=uu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=pu(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new du(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new du(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function mu(t,e){return vu(t)}function vu(t,e){const i={};for(let e=0;eTu.set(t,!0)));const wu=new Map;function Cu(t){if(Tu.has(t))return!0;if(wu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>wu.set(t,!0)));const Eu=ku(),Bu=ku(),Pu=ku(),Lu=ku(),Ru=ku(),Ou=ku(),Iu=ku(),Du=ku(),Fu=ku(),zu=ku();ku();const ju=ku();ku();const Hu=ku();ku();const Vu=ku(),Nu=ku(),Uu=Symbol.for("GraphicService"),Wu=Symbol.for("GraphicCreator"),Gu={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Yu=Object.keys(Gu),Xu={duration:200,easing:"cubicOut"};function $u(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Ku(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function qu(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 Zu(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*f,t[1]=y*n+b*l+x*u+S*m,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*f,t[5]=y*n+b*l+x*u+S*m,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*f,t[9]=y*n+b*l+x*u+S*m,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Ju(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class Qu{constructor(){this.pools=[]}static identity(t){return $u(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return Qu.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const np=new Ue(1,0,0,1,0,0),rp={x:0,y:0};let ap=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this.path=new Ul,this._clearMatrix=new Ue(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return tp.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(tp.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(tp.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},rp),function(t,e,i){return dc(t,0,!1,e,i)}(this.path.commandList,rp.x,rp.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},rp);const i=vh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return dc(t,e,!0,i,s)}(this.path.commandList,i,rp.x,rp.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(np,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>tp.free(t))),this.stack.length=0}};ap=ip([Ka(),sp("design:paramtypes",[Object,Number])],ap);const op={WIDTH:500,HEIGHT:500,DPR:1};class lp{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=op.WIDTH,height:n=op.HEIGHT,dpr:r=op.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var hp;lp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(hp||(hp={}));class cp{static Get(t,e=hp.Color1,i=[0,0,0,1]){if(e===hp.Color1){const e=cp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ei.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];cp.store1[t]=e,cp.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=cp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ei.parseColorString(t);return n&&(cp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],cp.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===hp.Color1){if(cp.store1[t])return;cp.store1[t]=i,cp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(cp.store255[t])return;cp.store255[t]=i,cp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function dp(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function up(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return pp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):pp(t,e,i,s,n)}function pp(t,e,i,s,n){if(!t||!e)return t&&dp(t)||e&&dp(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=cp.Get(t,hp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=cp.Get(e,hp.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:dp(a)})))});return o?up(r,l,i,s,n):up(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:vp(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:vp(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:vp(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),dp(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}function gp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}cp.store255={},cp.store1={};const fp=[0,0,0,0],mp=[0,0,0,0];function vp(t,e,i){return cp.Get(t,hp.Color255,fp),cp.Get(e,hp.Color255,mp),`rgba(${Math.round(fp[0]+(mp[0]-fp[0])*i)},${Math.round(fp[1]+(mp[1]-fp[1])*i)},${Math.round(fp[2]+(mp[2]-fp[2])*i)},${fp[3]+(mp[3]-fp[3])*i})`}class _p{static GetCanvas(){try{return _p.canvas||(_p.canvas=So.global.createCanvas({})),_p.canvas}catch(t){return null}}static GetCtx(){if(!_p.ctx){const t=_p.GetCanvas();_p.ctx=t.getContext("2d")}return _p.ctx}}class yp extends We{static getInstance(){return yp._instance||(yp._instance=new yp),yp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=_p.GetCanvas(),s=_p.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new yp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class bp{static GetSize(t){for(let e=0;e=t)return bp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=bp.GenKey(t,e,i,s,n),l=bp.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=bp.GenKey(t,e,i,s,n);bp.cache[l]?bp.cache[l].push({width:a,height:o,pattern:r}):bp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}bp.cache={},bp.ImageSize=[20,40,80,160,320,640,1280,2560];const xp=new Ve,Sp=new Ue;new Ve;const Ap=["lineWidth","scaleX","scaleY","angle","anchor","visible"],kp=["x","y"],Mp=["scaleX","scaleY"],Tp=["angle"],wp=new ne,Cp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Ep extends Rc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=hu[t];if(e)return e;if(e=Ep.userSymbolMap[t],e)return e;if(!0===((i=t=cu[t]||t).startsWith("{const e=(new Ul).fromString(t.d),i={};Yu.forEach((e=>{t[e]&&(i[Gu[e]]=t[e])})),n.push({path:e,attribute:i}),xp.union(e.bounds)}));const r=xp.width(),a=xp.height(),o=1/Gt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new lu(t,n,!0);return Ep.userSymbolMap[t]=l,l}var i;const s=(new Ul).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Gt(n,r);s.transform(0,0,a,a);const o=new lu(t,s);return Ep.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=qc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Do(t);return il(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Xo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Xo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Xo.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&Xo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Xo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===$o.GLOBAL){const i=new ne(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i))}_setAttributes(t,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Xu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:Ko.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:Ko.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:Ko.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if(this.currentStates){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stateSort&&(t=t.sort(this.stateSort));const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=Xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Xo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Xo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Xo.UPDATE_SHAPE_AND_BOUNDS)===Xo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Xo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Xo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Xo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Xo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Xo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Xo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Xo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Xo.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Yl.x,y:e=Yl.y,scaleX:i=Yl.scaleX,scaleY:s=Yl.scaleY,angle:n=Yl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Wt(a),f=Xt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+d*v-x*_-A*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),So.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Yl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Sp.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Ko.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:So.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new Ul).fromString(t):this.pathProxy=new Ul,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),So.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new zc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||So.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new ap(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Bp;Ep.userSymbolMap={},Ep.mixin(Nc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Bp||(Bp={}));let Pp=class t extends Ep{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ou,this._childUpdateTag=Xo.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 Ec),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Ec)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===$o.GLOBAL){const i=new ne(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&Xo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Yl.x,y:e=Yl.y,dx:i=Yl.dx,dy:s=Yl.dy,scaleX:n=Yl.scaleX,scaleY:r=Yl.scaleY,angle:a=Yl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Pc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return So.graphicService.updateTempAABBBounds(i),So.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Xo.CLEAR_BOUNDS,this._childUpdateTag&=Xo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Xo.UPDATE_BOUNDS||(this._childUpdateTag|=Xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&Xo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=So.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Lp(t){return new Pp(t)}Pp.NOWORK_ANIMATE_ATTR=Cp;class Rp extends Pp{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Ec,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{So.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{So.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Op=Symbol.for("TransformUtil"),Ip=Symbol.for("GraphicUtil"),Dp=Symbol.for("LayerService"),Fp=Symbol.for("StaticLayerHandlerContribution"),zp=Symbol.for("DynamicLayerHandlerContribution"),jp=Symbol.for("VirtualLayerHandlerContribution");var Hp,Vp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Np=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Up=Hp=class{static GenerateLayerId(){return`${Hp.idprefix}_${Hp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=So.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?bo.get(Fp):"dynamic"===t?bo.get(zp):bo.get(jp),e}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Rp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Hp.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};Up.idprefix="visactor_layer",Up.prefix_count=0,Up=Hp=Vp([Ka(),Np("design:paramtypes",[])],Up);var Wp=new Da((t=>{t(yo).to(Bo).inSingletonScope(),t(fc).to(vc),t(Ip).to(xc).inSingletonScope(),t(Op).to(kc).inSingletonScope(),t(Dp).to(Up).inSingletonScope()}));function Gp(t,e){return!(!t&&!e)}function Yp(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Xp(t,e,i){return i&&t*e>0}function $p(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Kp(t,e){return t*e>0}function qp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Zp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Jp(t,e,i,s,n){const r=Nt(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Wt(c),k=n*Xt(c),M=s*Wt(u),T=s*Xt(u);let w,C,E,B;if((b>Ft||_>Ft)&&(w=n*Wt(d),C=n*Xt(d),E=s*Wt(p),B=s*Xt(p),r1?0:P<-1?zt:Math.acos(P))/2),l=$t(t[0]*t[0]+t[1]*t[1]);S=Yt(b,(s-l)/(o-1)),x=Yt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Qp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Nt(l-o),c=l>o;let d=!1;if(n=Vt-Ft)e.moveTo(i+n*Wt(o),s+n*Xt(o)),e.arc(i,s,n,o,l,!c),r>Ft&&(e.moveTo(i+r*Wt(l),s+r*Xt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Jp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Ft){const t=Yt(v,m),r=Yt(_,m),o=Zp(g,f,u,p,n,t,Number(c)),l=Zp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,n,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Wt(Ut(l.y01,l.x01)),s+l.cy+r*Xt(Ut(l.y01,l.x01))):e.moveTo(i+b,s+n*Xt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Wt(M),s+n*Xt(M));if(!(r>Ft)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>Ft){const t=Yt(B,T),n=Yt(P,T),o=Zp(S,A,b,x,r,-n,Number(c)),l=Zp(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,r,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Wt(Ut(l.y01,l.x01)),s+l.cy+t*Xt(Ut(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Wt(E),s+r*Xt(E))}return a?a[3]&&e.lineTo(i+n*Wt(o),s+n*Xt(o)):e.closePath(),d}const tg=Symbol.for("ArcRenderContribution"),eg=Symbol.for("AreaRenderContribution"),ig=Symbol.for("CircleRenderContribution"),sg=Symbol.for("GroupRenderContribution"),ng=Symbol.for("ImageRenderContribution"),rg=Symbol.for("PathRenderContribution"),ag=Symbol.for("PolygonRenderContribution"),og=Symbol.for("RectRenderContribution"),lg=Symbol.for("SymbolRenderContribution"),hg=Symbol.for("TextRenderContribution"),cg=Symbol.for("InteractiveSubRenderContribution");function dg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function ug(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var pg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fg=function(t,e){return function(i,s){e(i,s,t)}};function mg(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if($u(t),Ku(t,t,[n+o,r+l,a+h]),Ku(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),Ku(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=ep.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}Ku(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,f),Ku(i,i,[-s[0],-s[1],0]),Zu(t,t,i)}}let vg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new vo(["graphic"]),onSetStage:new vo(["graphic","stage"]),onRemove:new vo(["graphic"]),onRelease:new vo(["graphic"]),onAddIncremental:new vo(["graphic","group","stage"]),onClearIncremental:new vo(["graphic","group","stage"]),beforeUpdateAABBBounds:new vo(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new vo(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new vo(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Do(t);return il(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=ug(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=dg(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Su(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Su(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&je(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};vg=pg([Ka(),fg(0,Xa(Wu)),gg("design:paramtypes",[Object])],vg);const _g=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},yg=["radius","startAngle","endAngle",...Ap];class bg extends Ep{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Lu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Pc(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=So.graphicService.updateTempAABBBounds(i);return _g(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,So.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Vt-Ft?i.set(-r,-r,r,r):Qc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,yg)}needUpdateTag(t){return super.needUpdateTag(t,yg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Ul,s.arc(0,0,r,a,o),s}clone(){return new bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return bg.NOWORK_ANIMATE_ATTR}}function xg(t){return new bg(t)}bg.NOWORK_ANIMATE_ATTR=Cp;class Sg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Po.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Nu,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Pc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new kg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Me(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=So.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Su(n,o/Math.abs(r+a),!0,l),i.union(n)}return So.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||So.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,je(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=So.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Sg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const M=So.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new Sg(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const t=dg(_,a),e=this.cache.verticalList.length*v,i=ug(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Mu.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const x=dg(_,a),S=this.cache.verticalList.length*v,A=ug(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=rd(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Ag){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Ag){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return kg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return kg.baselineMapAlign}getAlignMapBaseline(){return kg.alignMapBaseline}}function Mg(t){return new kg(t)}kg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Cp),kg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},kg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Tg=["symbolType","size",...Ap];let wg=class t extends Ep{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Vu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Pc(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=So.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Su(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Tg)}needUpdateTag(t){return super.needUpdateTag(t,Tg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Ul).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Ul).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Cg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Cp);const Eg=["segments","points","curveType","curveTension",...Ap];let Bg=class t extends Ep{constructor(t={}){super(t),this.type="line",this.numberType=Du}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=ed(i,s,e))}getGraphicTheme(){return Pc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),So.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Eg)}needUpdateTag(t){return super.needUpdateTag(t,Eg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Ul;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Pg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const Lg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},Rg=["width","x1","y1","height","cornerRadius",...Ap];class Og extends Ep{constructor(t){super(t),this.type="rect",this.numberType=ju}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Pc(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=So.graphicService.updateTempAABBBounds(i);return _g(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,So.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Rg)}needUpdateTag(t){return super.needUpdateTag(t,Rg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Lg(e);return t=new Ul,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Og(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Og.NOWORK_ANIMATE_ATTR}}function Ig(t){return new Og(t)}Og.NOWORK_ANIMATE_ATTR=Cp;class Dg extends Ep{constructor(t){super(t),this.type="glyph",this.numberType=Ru,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Pc(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Dg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Dg.NOWORK_ANIMATE_ATTR}}function Fg(t){return new Dg(t)}Dg.NOWORK_ANIMATE_ATTR=Cp;class zg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=yh[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function jg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Hg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=rd(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Eh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Eh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Th(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Eh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=jg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Th(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Eh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=jg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=jg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=jg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=jg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Th(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Eh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Vg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...Ap];class Ng extends Ep{constructor(t){super(t),this.type="image",this.numberType=Iu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Pc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=So.graphicService.updateTempAABBBounds(i);return _g(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,So.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ph[t]}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}clone(){return new Ng(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ng.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Ng(t)}Ng.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Cp);class Wg extends Ng{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=qc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=qc(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=ph.width,height:e=ph.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Gg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Wg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=yh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Hg){const e=kh.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Wg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Eh(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||xh;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Mh(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||bh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?_h(t,s,{AABBBounds:i}):s,Mh(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Wg)break;const{width:n}=Eh(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Wg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Yg{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=yh[this.direction]}store(t){if(t instanceof Wg){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 Gg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Wg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Th(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Hg(i,t.newLine,t.character,t.ascentDescentMode),new Hg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Xg=!1;try{Xg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Xg=!1}const $g=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Ap];class Kg extends Ep{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Hu,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:uh.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:uh.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:uh.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:uh.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:uh.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:uh.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:uh.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:uh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Pc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&Kg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&Kg.splitText(t.text).length>1)))}static splitText(t){if(Xg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Kg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),So.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||So.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,So.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!Kg.AllSingleCharacter(_)&&(_=Kg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new zg(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new Yg(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Kg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function qg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Cp);const Zg=["path","customPath",...Ap];class Jg extends Ep{constructor(t){super(t),this.type="path",this.numberType=Fu}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Ul?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Ul?this.cache:t.path)}getGraphicTheme(){return Pc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=So.graphicService.updateTempAABBBounds(i);_g(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new Ul).fromString(t.path):t.customPath&&(this.cache=new Ul,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Zg)}needUpdateTag(t){return super.needUpdateTag(t,Zg)}toCustomPath(){return(new Ul).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Jg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Jg.NOWORK_ANIMATE_ATTR}}function Qg(t){return new Jg(t)}Jg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Cp);const tf=["segments","points","curveType","curveTension",...Ap];class ef extends Ep{constructor(t){super(t),this.type="area",this.numberType=Pu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Pc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),So.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=ed(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,tf)}needUpdateTag(t){return super.needUpdateTag(t,tf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Ul;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new ef(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ef.NOWORK_ANIMATE_ATTR}}function sf(t){return new ef(t)}ef.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const nf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Ap];class rf extends Ep{constructor(t){super(t),this.type="arc",this.numberType=Eu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=le(e),i=e+r,s&&Nt(r)Ft&&o>Ft)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=$t(a*a+o*o)}=this.attribute,h=Nt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Ft&&l>Ft){const i=e>t?1:-1;let s=qt(Number(l)/o*Xt(g)),n=qt(Number(l)/a*Xt(g));return(f-=2*s)>Ft?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Ft?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Pc(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=So.graphicService.updateTempAABBBounds(i);_g(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Ft?i.set(0,0,0,0):Math.abs(o-l)>Vt-Ft?i.set(-s,-s,s,s):(Qc(l,o,s,i),Qc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,nf)}needUpdateTag(t){return super.needUpdateTag(t,nf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Nt(o-a),d=o>a;if(h=Vt-Ft)n.moveTo(0+h*Wt(a),0+h*Xt(a)),n.arc(0,0,h,a,o,!d),l>Ft&&(n.moveTo(0+l*Wt(o),0+l*Xt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Wt(a),e=h*Xt(a),i=l*Wt(o),s=l*Xt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new rf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rf.NOWORK_ANIMATE_ATTR}}function af(t){return new rf(t)}rf.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);const of=["points","cornerRadius",...Ap];class lf extends Ep{constructor(t){super(t),this.type="polygon",this.numberType=zu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Pc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),So.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=ed(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,of)}needUpdateTag(t){return super.needUpdateTag(t,of)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Ul,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new lf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return lf.NOWORK_ANIMATE_ATTR}}function hf(t){return new lf(t)}lf.NOWORK_ANIMATE_ATTR=Cp;class cf extends Pp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function df(t){return new cf(t)}const uf=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let pf,gf;function ff(t){return pf||(pf=uf.CreateGraphic("text",{})),pf.initAttributes(t),pf.AABBBounds}var mf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_f=function(t,e){return function(i,s){e(i,s,t)}};class yf{constructor(){this.time=Jo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(Sf(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Pc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){Cf(t,e,i,s)}}const bf=new yf,xf=new Set(["top","center","bottom"]);function Sf(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Af({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const kf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Mf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Tf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:xf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Mf(s,e,"left","center","right"),y:Mf(n,i,"top","center","bottom")}}function wf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Cf(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=function(t){if(!t)return null;const e=wf(t.naturalWidth,t.videoWidth,t.width),i=wf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}(e),{backgroundRepeatMode:m,backgroundSizing:v}=function({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=kf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Af({backgroundFit:e,backgroundKeepAspectRatio:i})}}({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let _=p,y=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Tf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(_=i*(g/s),y=g):"repeat-y"===m&&(y=s*(p/i),_=p);const n=t.dpr,r=uc.allocate({width:_,height:y,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,_,y),a.drawImage(e,0,0,_,y),e=r.nativeCanvas),uc.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}let Ef=class{constructor(t){this.subRenderContribitions=t,this.time=Jo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Ef=mf([Ka(),_f(0,Xa(uo)),_f(0,qa(cg)),vf("design:paramtypes",[Object])],Ef);const Bf=new class{constructor(){this.time=Jo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Pf=new class{constructor(){this.time=Jo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class Lf{constructor(){this.time=Jo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=uc.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),uc.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Vt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=uc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Cg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:vh(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),Qp(t,e,i,s,w+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},If=Rf,Df=bf;const Ff=new class{constructor(){this.time=Jo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:vh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},zf=Rf,jf=bf;const Hf=new class extends yf{constructor(){super(...arguments),this.time=Jo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:_=l.backgroundScale,backgroundOffsetX:y=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Sf(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:_,backgroundOffsetX:y,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Vf=zt/2;function Nf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Nt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Nt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Nt(t[0]),i=Nt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Nt(l[0]),l[1]=Nt(l[1]),l[2]=Nt(l[2]),l[3]=Nt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Vf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Vf,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Vf,zt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],zt,zt+Vf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Uf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Wf{constructor(){this.time=Jo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:vh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),Nf(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let Gf=class{constructor(){this.time=Jo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Gf=Uf([Ka()],Gf);let Yf=class{constructor(){this.time=Jo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return Nf(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Yf=Uf([Ka()],Yf);const Xf=new Wf,$f=Rf,Kf=bf;const qf=new class extends Wf{constructor(){super(...arguments),this.time=Jo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},Zf=bf;const Jf=new class{constructor(){this.time=Jo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:vh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Qf=new class{constructor(){this.time=Jo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},tm=Rf,em=bf;const im={x:0,y:0,z:0,lastModelMatrix:null};class sm{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Bf),this.builtinContributions.push(Pf),this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Jo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Jo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Pc(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,_=Xp(d,u,h),y=Kp(d,g),b=Gp(h),x=Yp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return il(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Xp(o,l,n),p=Kp(o,c),g=Gp(n,r),f=Yp(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;im.x=n,im.y=r,im.z=a,im.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=ep.allocate(),n=ep.allocate();mg(n,t,e),Zu(s,d||s,n),im.x=0,im.y=0,im.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ep.free(n)}if(g&&!d){const s=t.getOffsetXY(e);im.x+=s.x,im.y+=s.y,im.z=a,i.setTransformForCurrent()}else if(p)im.x=0,im.y=0,im.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);im.x+=s.x,im.y+=s.y,this.transformWithoutTranslate(i,im.x,im.y,im.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),im.x=0,im.y=0,im.z=0;return im}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,f,m,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ep.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var nm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},am=function(t,e){return function(i,s){e(i,s,t)}};let om=class extends sm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eu,this.builtinContributions=[Of,Df,If],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nFt){const t=Yt(b,y),r=Yt(x,y),a=Zp(v,_,f,m,n,t,Number(u)),o=Zp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Ut(o.y11,o.x11),Ut(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Ft)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>Ft){const t=Yt(B,w),n=Yt(P,w),a=Zp(M,T,A,k,r,-n,Number(u)),o=Zp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Ut(a.y01,a.x01),Ut(a.y11,a.x11),!u);const t=Ut(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Wt(E),s+r*Xt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Pc(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Nt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)$c[s]=t,i&&(i=!(null!==(e=$c[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)$c[e]=!!t[e],i&&(i=!!$c[e]);else $c[0]=!1,$c[1]=!1,$c[2]=!1,$c[3]=!1;return{isFullStroke:i,stroke:$c}})(d);if((_||E)&&(e.beginPath(),Qp(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),Qp(t,e,i,s,k,M,B),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Nt(h-r)>=Vt-Ft){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Vt;for(;i>Vt;)i-=Vt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),up(o.color,l.color,h,!1)}(0,0,h,n);a||Xp&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};om=nm([Ka(),am(0,Xa(uo)),am(0,qa(tg)),rm("design:paramtypes",[Object])],om);var lm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cm=function(t,e){return function(i,s){e(i,s,t)}};let dm=class extends sm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[Ff,jf,zf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Pc(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function um(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=hl(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function pm(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function gm(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=pm(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),um(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=qo.ROW:"y"===s?u=qo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let mm=class extends sm{constructor(){super(...arguments),this.numberType=Du}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();gm(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Nl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Yt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function vm(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),um(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),um(t,l,1,s),o=!1):o=!0}t.closePath()}mm=fm([Ka()],mm);const _m=new class extends Lf{constructor(){super(...arguments),this.time=Jo.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:id(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:id(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:id(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:id(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},ym=bf;var bm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sm=function(t,e){return function(i,s){e(i,s,t)}};let Am=class extends sm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pu,this.builtinContributions=[_m,ym],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Pc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Nl(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Nl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Nl(e,E,{curveTension:b}),n=Nl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,y,r[u],[g,t.attribute],Yt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=qo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Nt(_.x-b.x),A=Nt(_.y-b.y);x=null==_.x1?qo.ROW:null==_.y1?qo.COLUMN:Number.isFinite(S+A)?S>A?qo.ROW:qo.COLUMN:qo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?qo.ROW:qo.COLUMN,Number.isFinite(c)||(o=qo.COLUMN),Number.isFinite(d)||(o=qo.ROW);const u=i*(o===qo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),gm(t,i[0]?e.top:e.bottom,l,x===qo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};Am=bm([Ka(),Sm(0,Xa(uo)),Sm(0,qa(eg)),xm("design:paramtypes",[Object])],Am);const km=Rf,Mm=bf;var Tm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cm=function(t,e){return function(i,s){e(i,s,t)}};let Em=class extends sm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[Mm,km],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Pc(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)il(t.pathShape.commandList,e,i,s,1,1,f);else{il((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Em=Tm([Ka(),Cm(0,Xa(uo)),Cm(0,qa(rg)),wm("design:paramtypes",[Object])],Em);var Bm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lm=function(t,e){return function(i,s){e(i,s,t)}};let Rm=class extends sm{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=ju,this.builtinContributions=[Xf,Kf,$f],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Pc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=$p(g,f,T,w,h),E=qp(g,v,T,w,M),B=Gp(h,c),P=Yp(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),Nf(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Rm=Bm([Ka(),Lm(0,Xa(uo)),Lm(0,qa(og)),Pm("design:paramtypes",[Object])],Rm);var Om=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Im=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dm=function(t,e){return function(i,s){e(i,s,t)}};let Fm=class extends sm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Vu,this.builtinContributions=[Jf,em,tm,Qf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Pc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Fm=Om([Ka(),Dm(0,Xa(uo)),Dm(0,qa(lg)),Im("design:paramtypes",[Object])],Fm);const zm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const jm=new class extends yf{constructor(){super(...arguments),this.time=Jo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,_,y,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:M=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:w=l.backgroundKeepAspectRatio,backgroundScale:C=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:L=l.backgroundClip,backgroundCornerRadius:R=l.backgroundCornerRadius}=t.attribute;let O,{background:I}=t.attribute;if(!I)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),O&&e.setTransformFromMatrix(O,!0,1))};let F;"richtext"===t.type&&(O=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(I)&&I.background?I:null,j=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(_=z.height)&&void 0!==_?_:e.height();if(F=zm.allocate(i,s,i+n,s+r),I=z.background,!j){const t=F.width(),e=F.height();F.set((null!==(y=z.x)&&void 0!==y?y:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,j||(F=ff(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const i=t.resources.get(I);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),j&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,L&&(e.beginPath(),R?Nf(e,F.x1,F.y1,F.width(),F.height(),R,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:M,backgroundFit:T,backgroundKeepAspectRatio:w,backgroundScale:C,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=I,R?(Nf(e,F.x1,F.y1,F.width(),F.height(),R,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&zm.free(F),D()}};var Hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nm=function(t,e){return function(i,s){e(i,s,t)}};let Um=class extends sm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Nu,this.builtinContributions=[jm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Pc(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=rd(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=tp.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),tp.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:dg(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Wm(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zm=function(t,e){return function(i,s){e(i,s,t)}};let Jm=class extends sm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[$m,Xm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Pc(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Wm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Wm(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=Gm(d,u),b=Gm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Ym(h,_,y,d,u),A=Ym(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Gm(k,M),w=Ym(h,Gm(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let B=E-C;B<0&&(C=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Jm=Km([Ka(),Zm(0,Xa(uo)),Zm(0,qa(ag)),qm("design:paramtypes",[Object])],Jm);var Qm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ev=function(t,e){return function(i,s){e(i,s,t)}};let iv=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Ou}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Hf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Pc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=$p(p,m,g,f,c),C=qp(p,v,g,f),E=Gp(c,u),B=Yp(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Nf(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Hf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Jo.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Jo.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=So.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Pc(t,null==s?void 0:s.theme).group,i=ep.allocate(),n=ep.allocate();mg(n,t,e),Zu(i,p||i,n),a.modelMatrix=i,ep.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ep.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};iv=Qm([Ka(),ev(0,Xa(uo)),ev(0,qa(sg)),tv("design:paramtypes",[Object])],iv);var sv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rv=function(t,e){return function(i,s){e(i,s,t)}};const av=["","repeat-x","repeat-y","repeat"];function ov({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=function(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?av[i]:"no-repeat"}(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const lv={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function hv(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=ov({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?function(t){return{backgroundMode:lv[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Cf(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}let cv=class extends sm{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Iu,this.builtinContributions=[qf,Zf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Pc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:_=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:M,doFill:T,doStroke:w}=A;if(!S||!t.resources)return;const C=t.resources.get(S);if("success"!==C.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Nf(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const L=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),hv(e,C.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x})))},R=()=>{w&&(o?o(e,t.attribute,l):M&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},O=function({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0,imagePosition:a="top-left"}){const{repeatMode:o,sizingMode:l}=ov({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===o&&("cover"===l||"auto"===l||1!==s||0!==n||0!==r)}({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x}),I=P||O;g?(R(),I&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),L(),I&&e.restore()):(I&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),L(),I&&e.restore(),R()),this.afterRenderStep(t,e,i,s,T,!1,k,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void Gc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Pc(t).image;this._draw(t,a,!1,i)}};cv=sv([Ka(),rv(0,Xa(uo)),rv(0,qa(ng)),nv("design:paramtypes",[Object])],cv);const dv=Symbol.for("IncrementalDrawContribution"),uv=Symbol.for("ArcRender"),pv=Symbol.for("AreaRender"),gv=Symbol.for("CircleRender"),fv=Symbol.for("GraphicRender"),mv=Symbol.for("GroupRender"),vv=Symbol.for("LineRender"),_v=Symbol.for("PathRender"),yv=Symbol.for("PolygonRender"),bv=Symbol.for("RectRender"),xv=Symbol.for("SymbolRender"),Sv=Symbol.for("TextRender"),Av=Symbol.for("RichTextRender"),kv=Symbol.for("GlyphRender"),Mv=Symbol.for("ImageRender"),Tv=Symbol.for("DrawContribution"),wv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Bu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Vt;for(;o<0;)o+=Vt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var Cv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ev=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Bv=Symbol.for("DrawItemInterceptor"),Pv=new Ve,Lv=new Ve;class Rv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Pv.copy(s.dirtyBounds),Lv.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,tp.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Pv),s.backupDirtyBounds.copy(Lv)),!0}}class Ov{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Iv=class{constructor(){this.order=1,this.interceptors=[new Rv,new Fv,new Dv,new Ov]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ep.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var zv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hv=function(t,e){return function(i,s){e(i,s,t)}};let Vv=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Vv=zv([Ka(),Hv(0,Xa(Tv)),jv("design:paramtypes",[Object])],Vv);var Nv=new Da((t=>{t(xo).to(Vv)}));const Uv=Symbol.for("PickerService"),Wv=Symbol.for("GlobalPickerService"),Gv=Symbol.for("PickItemInterceptor"),Yv=Symbol.for("PickServiceInterceptor");var Xv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $v=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};$v=Xv([Ka()],$v);let Kv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Pc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=tp.allocateByObj(a),u=new ne(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Kv=Xv([Ka()],Kv);let qv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ne(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};qv=Xv([Ka()],qv);let Zv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=wv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Zv=Xv([Ka()],Zv);var Jv=new Da(((t,e,i)=>{i(Uv)||(t(Wv).toSelf(),t(Uv).toService(Wv)),t(Zv).toSelf().inSingletonScope(),t(Gv).toService(Zv),t(Kv).toSelf().inSingletonScope(),t(Gv).toService(Kv),t(qv).toSelf().inSingletonScope(),t(Gv).toService(qv),go(t,Gv),t($v).toSelf().inSingletonScope(),t(Yv).toService($v),go(t,Yv)})),Qv=new Da((t=>{t(Uu).to(vg),t(Wu).toConstantValue(uf)}));const t_=Symbol.for("AutoEnablePlugins"),e_=Symbol.for("PluginService");var i_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},s_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},n_=function(t,e){return function(i,s){e(i,s,t)}};let r_=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&bo.isBound(t_)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};r_=i_([Ka(),n_(0,Xa(uo)),n_(0,qa(t_)),s_("design:paramtypes",[Object])],r_);var a_=new Da((t=>{t(e_).to(r_),function(t,e){t(uo).toDynamicValue((({container:t})=>new po(e,t))).whenTargetNamed(e)}(t,t_)})),o_=new Da((t=>{go(t,_o)})),l_=new Da((t=>{t(Rh).to(Oh).inSingletonScope(),go(t,Rh)})),h_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},c_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let d_=class{constructor(){this.type="static",this.offscreen=!1,this.global=So.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Fh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};d_=h_([Ka(),c_("design:paramtypes",[])],d_);var u_=new Da((t=>{t(d_).toSelf(),t(Fp).toService(d_)}));var p_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function g_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function f_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=g_(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=g_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var __=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},y_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},b_=function(t,e){return function(i,s){e(i,s,t)}};let x_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):f_(e,Ql.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new He,this.backupDirtyBounds=new He,this.global=So.global,this.layerService=So.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Ql.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Ql.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,tp.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=v_(e,i,Ql.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Se(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=zm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=tp.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),zm.free(n),tp.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||bo.get(dv);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let A_=class extends mm{constructor(){super(...arguments),this.numberType=Du}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Pc(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=Xp(u,p,c),_=Kp(u,g),y=Gp(c),b=Yp(d,f);if(!t.valid||!m)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};A_=S_([Ka()],A_);var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let M_=class extends Am{constructor(){super(...arguments),this.numberType=Pu}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Pc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Xp(u,d,c),f=Gp(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};M_=k_([Ka()],M_);var T_,w_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},C_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},E_=function(t,e){return function(i,s){e(i,s,t)}},B_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(T_||(T_={}));let P_=class extends x_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=T_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new vo([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return B_(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Ql.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Ql.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return B_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return B_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>B_(this,void 0,void 0,(function*(){if(2!==t.count)yield m_(t,Ql.zIndex,((i,s)=>{if(this.status===T_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return B_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return B_(this,void 0,void 0,(function*(){this.rendering&&(this.status=T_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=T_.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 B_(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:()=>B_(this,void 0,void 0,(function*(){yield m_(t,Ql.zIndex,(t=>B_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};P_=w_([Ka(),E_(0,$a(fv)),E_(1,Xa(A_)),E_(2,Xa(M_)),E_(3,Xa(uo)),E_(3,qa(Bv)),C_("design:paramtypes",[Array,Object,Object,Object])],P_);var L_=new Da((t=>{t(yf).toSelf().inSingletonScope(),t(Lf).toSelf().inSingletonScope(),t(Tv).to(x_),t(dv).to(P_),t(mv).to(iv).inSingletonScope(),t(fv).toService(mv),go(t,sg),t(Ef).toSelf().inSingletonScope(),go(t,cg),go(t,fv),t(Iv).toSelf().inSingletonScope(),t(Bv).toService(Iv),go(t,Bv)}));function R_(){R_.__loaded||(R_.__loaded=!0,bo.load(Wp),bo.load(Qv),bo.load(Nv),bo.load(Jv),bo.load(a_),function(t){t.load(o_),t.load(l_),t.load(u_)}(bo),function(t){t.load(L_)}(bo))}R_.__loaded=!1,R_();const O_=bo.get(yo);So.global=O_;const I_=bo.get(Ip);So.graphicUtil=I_;const D_=bo.get(Op);So.transformUtil=D_;const F_=bo.get(Uu);So.graphicService=F_;const z_=bo.get(Dp);So.layerService=z_;class j_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class H_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=So.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=So.global.getRequestAnimationFrame();this.rafId=t((()=>{So.global.devicePixelRatio!==this.dpr&&(this.dpr=So.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=So.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class V_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,So.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const N_=new Ve;class U_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()}));const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(N_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(N_,t.parent&&t.parent.globalTransMatrix)))})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let W_;function G_(){!function(){if(null==W_)try{const t=document.createElement("canvas"),e=t.getContext("2d");W_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),W_&&(W_=!!document.createElement)}catch(t){W_=!1}}();const t=So.global&&So.global.env;return t?"browser"===t:W_}let Y_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};Y_._pluginClasses={};const X_="white";class $_ extends Pp{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:X_}set background(t){this._background=t,this.syncBackgroundImage(t)}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}syncBackgroundImage(t){var e;const i=null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t;this.backgroundImg=!1,this.isImageBackgroundSource(i)&&this.loadImage(i,!0)}isImageBackgroundSource(t){if(!t)return!1;if("string"==typeof t)return t.startsWith("{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Ec,this.hooks={beforeRender:new vo(["stage"]),afterRender:new vo(["stage"]),afterClearScreen:new vo(["stage"]),afterClearRect:new vo(["stage"])},this.global=So.global,!this.global.env&&G_()&&this.global.setEnv("browser"),this.window=bo.get(fc),this.renderService=bo.get(xo),this.pluginService=bo.get(e_),this.layerService=bo.get(Dp),this.graphicService=bo.get(Uu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:X_,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&this.syncBackgroundImage(this._background),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Wc(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1);const k=Y_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=Y_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Y_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new j_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new H_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new V_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new He;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new U_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Y_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Y_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Y_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new ne(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=bo.get(fc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=bo.get(Uv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var K_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},q_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let Z_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return q_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};Z_=K_([Ka()],Z_);var J_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Q_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ty=class{constructor(){this._uid=Ia.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};ty=J_([Ka(),Q_("design:paramtypes",[])],ty);var ey=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sy=function(t,e){return function(i,s){e(i,s,t)}};let ny=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=So.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ue(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ne(e.x,e.y),a=Pc(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new ne(e.x,e.y);l.transformPoint(a,a);const o=Pc(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&ep.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),tp.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function ry(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function ay(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function uy(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),vy=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},_y=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new He;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return vy(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return vy(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);_y(n[0],s,i),_y(n[1],e-s,i)}};let yy=!1;const by=new Da((t=>{yy||(yy=!0,t(om).toSelf().inSingletonScope(),t(uv).to(om).inSingletonScope(),t(fv).toService(uv),t(tg).toService(Ef),go(t,tg))}));let xy=!1;const Sy=new Da((t=>{xy||(xy=!0,t(Rm).toSelf().inSingletonScope(),t(bv).to(Rm).inSingletonScope(),t(fv).toService(bv),t(Yf).toSelf(),t(Gf).toSelf(),t(og).toService(Yf),t(og).toService(Gf),t(og).toService(Ef),go(t,og))}));let Ay=!1;const ky=new Da((t=>{Ay||(Ay=!0,t(mm).toSelf().inSingletonScope(),t(A_).toSelf().inSingletonScope(),t(vv).to(mm).inSingletonScope(),t(fv).toService(vv))}));let My=!1;const Ty=new Da((t=>{My||(My=!0,t(Am).toSelf().inSingletonScope(),t(pv).to(Am).inSingletonScope(),t(fv).toService(pv),t(eg).toService(Ef),go(t,eg),t(M_).toSelf().inSingletonScope())}));let wy=!1;const Cy=new Da((t=>{wy||(wy=!0,t(Fm).toSelf().inSingletonScope(),t(xv).to(Fm).inSingletonScope(),t(fv).toService(xv),t(lg).toService(Ef),go(t,lg))}));let Ey=!1;const By=new Da((t=>{Ey||(Ey=!0,t(dm).toSelf().inSingletonScope(),t(gv).to(dm).inSingletonScope(),t(fv).toService(gv),t(ig).toService(Ef),go(t,ig))}));let Py=!1;const Ly=new Da((t=>{Py||(Py=!0,t(Sv).to(Um).inSingletonScope(),t(fv).toService(Sv),t(hg).toService(Ef),go(t,hg))}));let Ry=!1;const Oy=new Da((t=>{Ry||(Ry=!0,t(Em).toSelf().inSingletonScope(),t(_v).to(Em).inSingletonScope(),t(fv).toService(_v),t(rg).toService(Ef),go(t,rg))}));let Iy=!1;const Dy=new Da((t=>{Iy||(Iy=!0,t(yv).to(Jm).inSingletonScope(),t(fv).toService(yv),t(ag).toService(Ef),go(t,ag))}));var Fy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zy=class{constructor(){this.numberType=Ru}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Pc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};zy=Fy([Ka()],zy);let jy=!1;const Hy=new Da((t=>{jy||(jy=!0,t(kv).to(zy).inSingletonScope(),t(fv).toService(kv))}));var Vy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Uy=class extends sm{constructor(){super(),this.numberType=Hu,this.builtinContributions=[jm],this.init()}drawShape(t,e,i,s,n){const r=Pc(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Xp(o,l,!0),d=Xp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Pc(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Nf(e,i-t,s-n,v,_,f,!0)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Pc(t).richtext;this._draw(t,s,!1,i)}};Uy=Vy([Ka(),Ny("design:paramtypes",[])],Uy);let Wy=!1;const Gy=new Da((t=>{Wy||(Wy=!0,t(Av).to(Uy).inSingletonScope(),t(fv).toService(Av))}));let Yy=!1;const Xy=new Da((t=>{Yy||(Yy=!0,t(Mv).to(cv).inSingletonScope(),t(fv).toService(Mv),t(ng).toService(Ef),go(t,ng))}));function $y(t){const e=[];for(let i=0;i=0&&n>=0&&sat.getInstance().info(`[VChart log]: ${t}`,...e),Zy=(t,e)=>(d(Qy.warnHandler)&&Qy.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),Jy=(t,e,i)=>{if(!d(Qy.errorHandler))throw new Error(t);Qy.errorHandler.call(null,t,e)},Qy={silent:!1,warnHandler:!1,errorHandler:!1},tb=G_(),eb=tb&&globalThis?globalThis.document:void 0;function ib(t){return("desktop-browser"===t||"mobile-browser"===t)&&tb}function sb(t){return nb(t)||"mobile-browser"===t}function nb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let rb=0;function ab(){return rb>=9999999&&(rb=0),rb++}function ob(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function lb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const hb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class cb extends Pp{constructor(t,e){super(t),this._skipRenderAttributes=hb,(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},zb=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class jb extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=jc.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=jc.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||Fb(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=zb(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=jc.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=zb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Fb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=jc.now()-i>this.config.press.time&&zb(s[0],t){So.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Nb=[0,0,0];let Ub=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Xl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Kl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},ql),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this._clearMatrix=new Ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return tp.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&&(tp.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(tp.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Vt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*y),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&bp.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Ju(Nb,[t,e,i],this.modelMatrix),t=Nb[0],e=Nb[1],i=Nb[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(Ju(Nb,[t,e,i],this.modelMatrix),t=Nb[0],e=Nb[1],i=Nb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Ju(Nb,[e,i,s],this.modelMatrix),e=Nb[0],i=Nb[1],s=Nb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t,e=So.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=So.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:ql.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:ql.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Ju(Nb,[e,i,s],this.modelMatrix),e=Nb[0],i=Nb[1],s=Nb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=_h(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:vh(this,a,this.dpr),r.strokeStyle=_h(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Ie(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=Ie(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>tp.free(t))),this.stack.length=0}};Ub.env="browser",Ub=Hb([Ka(),Vb("design:paramtypes",[Object,Number])],Ub);var Wb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Yb=class extends lp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=So.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Ub(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function Xb(t,e){return new Da((i=>{i(Ih).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Dh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Yb.env="browser",Yb=Wb([Ka(),Gb("design:paramtypes",[Object])],Yb);const $b=Xb(Yb,Ub);var Kb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zb=function(t,e){return function(i,s){e(i,s,t)}};let Jb=class extends ny{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=uc.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let tx=class{constructor(){this.type="group",this.numberType=Ou}contains(t,e,i){return!1}};tx=Qb([Ka()],tx);const ex=new Da(((t,e,i,s)=>{ex.__vloaded||(ex.__vloaded=!0,t(Ib).to(tx).inSingletonScope(),t(Db).toService(Ib),go(t,Db))}));ex.__vloaded=!1;var ix=ex;const sx=new Da(((t,e,i,s)=>{i(Jb)||t(Jb).toSelf().inSingletonScope(),i(Uv)?s(Uv).toService(Jb):t(Uv).toService(Jb)}));var nx,rx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ox=nx=class extends ty{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${nx.idprefix}_${nx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=So.global,this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:nx.GenerateCanvasId(),canvasControled:!0};this.canvas=new Yb(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new Yb({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};ox.env="browser",ox.idprefix="visactor_window",ox.prefix_count=0,ox=nx=rx([Ka(),ax("design:paramtypes",[])],ox);const lx=new Da((t=>{t(ox).toSelf(),t(mc).toDynamicValue((t=>t.container.get(ox))).whenTargetNamed(ox.env)}));var hx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dx=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class ux{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function px(t,e=!1){const i=document.createElement("img");if(So.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let gx=class extends Z_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new ux(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return px(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return px(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:Ia.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return dx(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};gx=hx([Ka(),cx("design:paramtypes",[])],gx);const fx=new Da((t=>{fx.isBrowserBound||(fx.isBrowserBound=!0,t(gx).toSelf().inSingletonScope(),t(_o).toService(gx))}));function mx(t,e=!0){mx.__loaded||(mx.__loaded=!0,t.load(fx),t.load($b),t.load(lx),e&&function(t){t.load(ix),t.load(sx)}(t))}fx.isBrowserBound=!1,mx.__loaded=!1;var vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yx=function(t,e){return function(i,s){e(i,s,t)}};let bx=class extends ny{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new ap(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};bx=vx([Ka(),yx(0,Xa(uo)),yx(0,qa(db)),yx(1,Xa(uo)),yx(1,qa(Gv)),yx(2,Xa(uo)),yx(2,qa(Yv)),_x("design:paramtypes",[Object,Object,Object])],bx);const xx=new Da((t=>{xx.__vloaded||(xx.__vloaded=!0,go(t,db))}));xx.__vloaded=!1;var Sx=xx;class Ax{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:vh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tx=function(t,e){return function(i,s){e(i,s,t)}};let Cx=class extends Ax{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Eu}};Cx=kx([Ka(),Tx(0,Xa(uv)),Mx("design:paramtypes",[Object])],Cx);let Ex=!1;const Bx=new Da(((t,e,i,s)=>{Ex||(Ex=!0,t(ub).to(Cx).inSingletonScope(),t(db).toService(ub))}));var Px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rx=function(t,e){return function(i,s){e(i,s,t)}};let Ox=class extends Ax{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Pu}};Ox=Px([Ka(),Rx(0,Xa(pv)),Lx("design:paramtypes",[Object])],Ox);let Ix=!1;const Dx=new Da(((t,e,i,s)=>{Ix||(Ix=!0,t(pb).to(Ox).inSingletonScope(),t(db).toService(pb))}));var Fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jx=function(t,e){return function(i,s){e(i,s,t)}};let Hx=class extends Ax{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Lu}};Hx=Fx([Ka(),jx(0,Xa(gv)),zx("design:paramtypes",[Object])],Hx);let Vx=!1;const Nx=new Da(((t,e,i,s)=>{Vx||(Vx=!0,t(gb).to(Hx).inSingletonScope(),t(db).toService(gb))}));class Ux{constructor(){this.type="glyph",this.numberType=Ru}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var Wx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yx=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class extends Ux{constructor(t){super(),this.canvasRenderer=t}};Xx=Wx([Ka(),Yx(0,Xa(kv)),Gx("design:paramtypes",[Object])],Xx);let $x=!1;const Kx=new Da(((t,e,i,s)=>{$x||($x=!0,t(Sb).to(Xx).inSingletonScope(),t(Xx).toService(Sb))}));var qx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Zx=class{constructor(){this.type="image",this.numberType=Iu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Zx=qx([Ka()],Zx);let Jx=!1;const Qx=new Da(((t,e,i,s)=>{Jx||(Jx=!0,t(fb).to(Zx).inSingletonScope(),t(Zx).toService(fb))}));var tS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iS=function(t,e){return function(i,s){e(i,s,t)}};let sS=class extends Ax{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Du}};sS=tS([Ka(),iS(0,Xa(vv)),eS("design:paramtypes",[Object])],sS);let nS=!1;const rS=new Da(((t,e,i,s)=>{nS||(nS=!0,t(mb).to(sS).inSingletonScope(),t(db).toService(mb))}));var aS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lS=function(t,e){return function(i,s){e(i,s,t)}};let hS=class extends Ax{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zu}};hS=aS([Ka(),lS(0,Xa(yv)),oS("design:paramtypes",[Object])],hS);let cS=!1;const dS=new Da(((t,e,i,s)=>{cS||(cS=!0,t(xb).to(hS).inSingletonScope(),t(db).toService(xb))}));var uS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gS=function(t,e){return function(i,s){e(i,s,t)}};let fS=class extends Ax{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Fu}};fS=uS([Ka(),gS(0,Xa(_v)),pS("design:paramtypes",[Object])],fS);let mS=!1;const vS=new Da(((t,e,i,s)=>{mS||(mS=!0,t(vb).to(fS).inSingletonScope(),t(db).toService(vb))})),_S=new Ve;class yS{constructor(){this.type="rect",this.numberType=ju}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:vh(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;_S.setValue(i.x1,i.y1,i.x2,i.y2),_S.expand(-r/2),h=!_S.containsPoint(e)}}return s.highPerformanceRestore(),h}}var bS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SS=function(t,e){return function(i,s){e(i,s,t)}};let AS=class extends yS{constructor(t){super(),this.canvasRenderer=t}};AS=bS([Ka(),SS(0,Xa(bv)),xS("design:paramtypes",[Object])],AS);let kS=!1;const MS=new Da(((t,e,i,s)=>{kS||(kS=!0,t(_b).to(AS).inSingletonScope(),t(db).toService(_b))}));let TS=!1;const wS=new Da(((t,e,i,s)=>{TS||(TS=!0,t(fb).to(Zx).inSingletonScope(),t(Zx).toService(fb))}));var CS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ES=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BS=function(t,e){return function(i,s){e(i,s,t)}};let PS=class extends Ax{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vu}};PS=CS([Ka(),BS(0,Xa(xv)),ES("design:paramtypes",[Object])],PS);let LS=!1;const RS=new Da(((t,e,i,s)=>{LS||(LS=!0,t(yb).to(PS).inSingletonScope(),t(db).toService(yb))}));var OS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let IS=class{constructor(){this.type="text",this.numberType=Nu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};IS=OS([Ka()],IS);let DS=!1;const FS=new Da(((t,e,i,s)=>{DS||(DS=!0,t(bb).to(IS).inSingletonScope(),t(db).toService(bb))})),zS=new Da(((t,e,i,s)=>{i(bx)||t(bx).toSelf().inSingletonScope(),i(Uv)?s(Uv).toService(bx):t(Uv).toService(bx)}));var jS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let VS=class extends Ub{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};VS.env="node",VS=jS([Ka(),HS("design:paramtypes",[Object,Number])],VS);var NS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},US=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let WS=class extends lp{constructor(t){super(t)}init(){this._context=new VS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};WS.env="node",WS=NS([Ka(),US("design:paramtypes",[Object])],WS);const GS=Xb(WS,VS);var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$S=function(t,e){return function(i,s){e(i,s,t)}};let KS=class extends ty{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:Ia.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new WS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new WS({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};KS.env="node",KS=YS([Ka(),$S(0,Xa(yo)),XS("design:paramtypes",[Object])],KS);const qS=new Da((t=>{t(KS).toSelf(),t(mc).toDynamicValue((t=>t.container.get(KS))).whenTargetNamed(KS.env)}));var ZS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JS=class extends Z_{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return nd.call(t)}}getCancelAnimationFrame(){return t=>{nd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};JS=ZS([Ka()],JS);const QS=new Da((t=>{QS.isNodeBound||(QS.isNodeBound=!0,t(JS).toSelf().inSingletonScope(),t(_o).toService(JS))}));function tA(t,e=!0){tA.__loaded||(tA.__loaded=!0,t.load(QS),t.load(GS),t.load(qS))}QS.isNodeBound=!1,tA.__loaded=!1;var eA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iA=class extends Ub{draw(){}createPattern(t,e){return null}};iA.env="wx",iA=eA([Ka()],iA);var sA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let rA=class extends lp{constructor(t){super(t)}init(){this._context=new iA(this,this._dpr)}release(...t){}};rA.env="wx",rA=sA([Ka(),nA("design:paramtypes",[Object])],rA);const aA=Xb(rA,iA);var oA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hA=function(t,e){return function(i,s){e(i,s,t)}};class cA{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 dA=class extends ty{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new cA}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:Ia.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new rA(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new rA({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,s,n;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};dA.env="wx",dA=oA([Ka(),hA(0,Xa(yo)),lA("design:paramtypes",[Object])],dA);const uA=new Da((t=>{t(dA).toSelf(),t(mc).toDynamicValue((t=>t.container.get(dA))).whenTargetNamed(dA.env)}));var pA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fA=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let mA=class extends Z_{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,s,n,r,a){return fA(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let o=0;o{let a=wx.createSelectorQuery();r&&(a=a.in(r)),a.select(`#${l}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const a=r[0].node,h=r[0].width,c=r[0].height;a.width=h*t,a.height=c*t,i.set(l,a),o>=s&&n.push(a),e(null)}))})))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component,e.forceUpdate).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return nd.call(t)}}getCancelAnimationFrame(){return t=>{nd.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};mA=pA([Ka(),gA("design:paramtypes",[])],mA);const vA=new Da((t=>{vA._isWxBound||(vA._isWxBound=!0,t(mA).toSelf().inSingletonScope(),t(_o).toService(mA))}));function _A(t,e=!0){_A.__loaded||(_A.__loaded=!0,t.load(vA),t.load(aA),t.load(uA),e&&function(t){t.load(Sx),t.load(zS),t.load(Bx),t.load(Dx),t.load(Nx),t.load(Kx),t.load(Qx),t.load(rS),t.load(dS),t.load(vS),t.load(MS),t.load(wS),t.load(RS),t.load(FS)}(t))}vA._isWxBound=!1,_A.__loaded=!1;var yA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xA=function(t,e){return function(i,s){e(i,s,t)}};let SA=class extends Ax{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Eu}};SA=yA([Ka(),xA(0,Xa(uv)),bA("design:paramtypes",[Object])],SA);let AA=!1;const kA=new Da(((t,e,i,s)=>{AA||(AA=!0,t(Ab).to(SA).inSingletonScope(),t(Db).toService(Ab))}));var MA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wA=function(t,e){return function(i,s){e(i,s,t)}};let CA=class extends yS{constructor(t){super(),this.canvasRenderer=t}};CA=MA([Ka(),wA(0,Xa(bv)),TA("design:paramtypes",[Object])],CA);let EA=!1;const BA=new Da(((t,e,i,s)=>{EA||(EA=!0,t(Eb).to(CA).inSingletonScope(),t(Db).toService(Eb))}));class PA extends sm{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:vh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ep.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var LA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OA=function(t,e){return function(i,s){e(i,s,t)}};let IA=class extends PA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Du}};IA=LA([Ka(),OA(0,Xa(vv)),RA("design:paramtypes",[Object])],IA);let DA=!1;const FA=new Da(((t,e,i,s)=>{DA||(DA=!0,t(wb).to(IA).inSingletonScope(),t(Db).toService(wb))}));var zA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HA=function(t,e){return function(i,s){e(i,s,t)}};let VA=class extends Ax{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Pu}};VA=zA([Ka(),HA(0,Xa(pv)),jA("design:paramtypes",[Object])],VA);let NA=!1;const UA=new Da(((t,e,i,s)=>{NA||(NA=!0,t(kb).to(VA).inSingletonScope(),t(Db).toService(kb))}));class WA extends sm{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ep.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var GA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let $A=class extends WA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:vh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ep.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};$A=GA([Ka(),XA(0,Xa(xv)),YA("design:paramtypes",[Object])],$A);let KA=!1;const qA=new Da(((t,e,i,s)=>{KA||(KA=!0,t(Bb).to($A).inSingletonScope(),t(Db).toService(Bb))}));var ZA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},JA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},QA=function(t,e){return function(i,s){e(i,s,t)}};let tk=class extends Ax{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Lu}};tk=ZA([Ka(),QA(0,Xa(gv)),JA("design:paramtypes",[Object])],tk);let ek=!1;const ik=new Da(((t,e,i,s)=>{ek||(ek=!0,t(Mb).to(tk).inSingletonScope(),t(Db).toService(Mb))}));var sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rk=function(t,e){return function(i,s){e(i,s,t)}};let ak=class extends WA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Nu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=ug(a,u,n),v=dg(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&ep.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};ak=sk([Ka(),rk(0,Xa(Sv)),nk("design:paramtypes",[Object])],ak);let ok=!1;const lk=new Da(((t,e,i,s)=>{ok||(ok=!0,t(Pb).to(ak).inSingletonScope(),t(Db).toService(Pb))}));var hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ck=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dk=function(t,e){return function(i,s){e(i,s,t)}};let uk=class extends PA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Fu}};uk=hk([Ka(),dk(0,Xa(_v)),ck("design:paramtypes",[Object])],uk);let pk=!1;const gk=new Da(((t,e,i,s)=>{pk||(pk=!0,t(Cb).to(uk).inSingletonScope(),t(Db).toService(Cb))}));var fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vk=function(t,e){return function(i,s){e(i,s,t)}};let _k=class extends Ax{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zu}};_k=fk([Ka(),vk(0,Xa(yv)),mk("design:paramtypes",[Object])],_k);let yk=!1;const bk=new Da(((t,e,i,s)=>{yk||(yk=!0,t(Lb).to(_k).inSingletonScope(),t(Db).toService(Lb))}));var xk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ak=function(t,e){return function(i,s){e(i,s,t)}};let kk=class extends Ux{constructor(t){super(),this.canvasRenderer=t}};kk=xk([Ka(),Ak(0,Xa(kv)),Sk("design:paramtypes",[Object])],kk);let Mk=!1;const Tk=new Da(((t,e,i,s)=>{Mk||(Mk=!0,t(Ob).to(kk).inSingletonScope(),t(Db).toService(Ob))}));var wk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ck=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ek=function(t,e){return function(i,s){e(i,s,t)}};let Bk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Hu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Bk=wk([Ka(),Ek(0,Xa(Av)),Ck("design:paramtypes",[Object])],Bk);let Pk=!1;const Lk=new Da(((t,e,i,s)=>{Pk||(Pk=!0,t(Rb).to(Bk).inSingletonScope(),t(Db).toService(Rb))}));var Rk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ik=function(t,e){return function(i,s){e(i,s,t)}};let Dk=class extends Ax{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Iu}};Dk=Rk([Ka(),Ik(0,Xa(Mv)),Ok("design:paramtypes",[Object])],Dk);let Fk=!1;const zk=new Da(((t,e,i,s)=>{Fk||(Fk=!0,t(Tb).to(Dk).inSingletonScope(),t(Db).toService(Tb))})),jk=G_();function Hk(){Hk.__loaded||(Hk.__loaded=!0,uf.RegisterGraphicCreator("arc",af),bo.load(by),bo.load(jk?kA:Bx))}Hk.__loaded=!1;const Vk=Hk;function Nk(){Nk.__loaded||(Nk.__loaded=!0,uf.RegisterGraphicCreator("area",sf),bo.load(Ty),bo.load(jk?UA:Dx))}Nk.__loaded=!1;const Uk=Nk;function Wk(){Wk.__loaded||(Wk.__loaded=!0,uf.RegisterGraphicCreator("circle",xg),bo.load(By),bo.load(jk?ik:Nx))}Wk.__loaded=!1;const Gk=Wk;function Yk(){Yk.__loaded||(Yk.__loaded=!0,uf.RegisterGraphicCreator("glyph",Fg),bo.load(Hy),bo.load(jk?Tk:Kx))}Yk.__loaded=!1;const Xk=Yk;function $k(){$k.__loaded||($k.__loaded=!0,uf.RegisterGraphicCreator("group",Lp))}$k.__loaded=!1;const Kk=$k;function qk(){qk.__loaded||(qk.__loaded=!0,uf.RegisterGraphicCreator("image",Ug),bo.load(Xy),bo.load(jk?zk:Qx))}qk.__loaded=!1;const Zk=qk;function Jk(){Jk.__loaded||(Jk.__loaded=!0,uf.RegisterGraphicCreator("line",Pg),bo.load(ky),bo.load(jk?FA:rS))}Jk.__loaded=!1;const Qk=Jk;function tM(){tM.__loaded||(tM.__loaded=!0,uf.RegisterGraphicCreator("path",Qg),bo.load(Oy),bo.load(jk?gk:vS))}tM.__loaded=!1;const eM=tM;function iM(){iM.__loaded||(iM.__loaded=!0,uf.RegisterGraphicCreator("polygon",hf),bo.load(Dy),bo.load(jk?bk:dS))}iM.__loaded=!1;const sM=iM;function nM(){nM.__loaded||(nM.__loaded=!0,uf.RegisterGraphicCreator("rect",Ig),bo.load(Sy),bo.load(jk?BA:MS))}nM.__loaded=!1;const rM=nM;function aM(){aM.__loaded||(aM.__loaded=!0,uf.RegisterGraphicCreator("richtext",qg),bo.load(Gy),bo.load(jk?Lk:wS))}aM.__loaded=!1;const oM=aM;function lM(){lM.__loaded||(lM.__loaded=!0,uf.RegisterGraphicCreator("shadowRoot",df))}lM.__loaded=!1;const hM=lM;function cM(){cM.__loaded||(cM.__loaded=!0,uf.RegisterGraphicCreator("symbol",Cg),bo.load(Cy),bo.load(jk?qA:RS))}cM.__loaded=!1;const dM=cM;function uM(){uM.__loaded||(uM.__loaded=!0,uf.RegisterGraphicCreator("text",Mg),bo.load(Ly),bo.load(jk?lk:FS))}uM.__loaded=!1;const pM=uM;function gM(){Kk(),rM()}const fM=-.5*Math.PI,mM=1.5*Math.PI,vM="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var _M;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(_M||(_M={}));const yM={[_M.selectedReverse]:{},[_M.selected]:{},[_M.hover]:{},[_M.hoverReverse]:{}},bM={container:"",width:30,height:30,style:{}},xM="scrollDrag";function SM(){return"browser"===O_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const AM={debounce:xt,throttle:St};gM();let kM=class t extends cb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=SM(),a="browser"===O_.env?O_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=vt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:AM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(xM,{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",AM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===O_.env?O_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ri(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ri(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=vt(t[0],0,1),c=vt(t[1],0,1),d=vt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=SM(),e="browser"===O_.env?O_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===O_.env?O_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};kM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};var MM,TM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wM=MM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new He).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Nt(t.deltaX)>Nt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=MM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(xM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new kM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(wM)||(t(wM).toSelf(),t(t_).toService(wM))}));function EM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&EM(t,e)}))}const BM=t=>!u(t)&&!1!==t.visible;function PM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function LM(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const OM=["#ffffff","#000000"];function IM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ei(t).toHex(),o=new ei(e).toHex();return DM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...OM);for(const n of a)if(t!==n&&DM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function DM(t,e,i,s,n){if("lightness"===n){const i=ei.getColorBrightness(new ei(e));return ei.getColorBrightness(new ei(t))<.5?i>=.5:i<.5}return s?FM(t,e)>s:"largeText"===i?FM(t,e)>3:FM(t,e)>4.5}function FM(t,e){const i=zM(t),s=zM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function zM(t){const e=si(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function jM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function HM(t,e){return[t[0]*e,t[1]*e]}function VM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function NM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Jt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const UM=(t,e,i,s)=>new De(Object.assign({defaultFontParams:Object.assign({fontFamily:vM,fontSize:14},s),getTextBounds:i?void 0:ff,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function WM(t,e,i={}){if(!t)return{width:0,height:0};const s=ff({text:t,fontFamily:e.fontFamily||i.fontFamily||vM,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function GM(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function YM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function XM(t,e="type"){const i=GM(t,e);return"rich"===i?uf.richtext(YM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),uf.text(t))}function $M(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const KM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function qM(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function ZM(t,e){const{dx:i,dy:s}=qM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function JM(){Kk(),rM(),dM(),oM(),pM()}var QM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=QM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Ul)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},tT.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}tT.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const eT={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}},iT={poptip:j({},eT)};var sT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:zt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:zt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:zt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}cT.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};var dT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let uT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};j(s,cT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new cT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,iT.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};uT=dT([Ka()],uT);var pT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class gT{constructor(){this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let fT=class extends gT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};fT=pT([Ka()],fT);let mT=class extends gT{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};mT=pT([Ka()],mT);const vT=new Da(((t,e,i,s)=>{i(uT)||(t(uT).toSelf().inSingletonScope(),t(cg).toService(uT)),i(fT)||(t(fT).toSelf(),t(t_).toService(fT)),i(mT)||(t(mT).toSelf(),t(t_).toService(mT))}));class _T extends cb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}Kk(),Qk();class yT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},yT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}yT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Kk(),rM();class bT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},bT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}bT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},Kk(),Vk();class xT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},xT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=re.distancePP(t,e);this.setAttribute("radius",i)}}xT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},Kk(),Vk();class ST extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ST.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=fM,endAngle:s=mM}=this.attribute,n=s-i,r=oe(de(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}ST.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},Kk(),eM();class AT extends _T{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},AT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=he(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=re.distancePP(t,e);this.setAttribute("radius",i)}}function kT(){Kk(),Qk(),sM(),dM()}function MT(){Kk(),Qk(),Vk(),dM()}AT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},kT();class TT extends cb{getStartAngle(){return ue(this._startAngle)}getEndAngle(){return ue(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TT.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=uf.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=uf.line;Y(i)[0].cornerRadius&&(t=uf.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=uf.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}TT.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}}},MT();class wT extends TT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TT.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=uf.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var CT,ET;!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.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(CT||(CT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(ET||(ET={}));const BT={[ET.selectedReverse]:{},[ET.selected]:{},[ET.hover]:{},[ET.hoverReverse]:{}},PT={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},LT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const RT=Math.sin(Math.PI/10);function OT(t,e=RT){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function IT(t,e=RT){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function DT(t){const e={};return EM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function FT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function zT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return HM(r,(s?-1:1)*(n?-1:1)*t/VM(r))}function jT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function VT(t,e,i){var s;if(IT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>Fe(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>Fe(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>ze(n,r)}function NT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(_M.hover,!0),EM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(_M.hoverReverse,!0)})),s):i},WT=(t,e,i)=>i?(EM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(_M.hoverReverse),t.removeState(_M.hover))})),null):i,GT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(_M.selected)?(EM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(_M.selectedReverse),t.removeState(_M.selected))})),null):s.name&&!P(s.states)?(s.addState(_M.selected,!0),EM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(_M.selectedReverse,!0)})),s):i};class YT extends cb{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const XT={type:"default",duration:300,easing:"linear"};class $T extends YT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=UT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=WT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=GT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=uf.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prepare(),this._prevInnerView=this._innerView&&DT(this._innerView),this.removeAllChild(!0),this._innerView=uf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(XT)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=uf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=CT.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=uf.group({x:0,y:0,pickable:!1});t.name=CT.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=uf.group({x:0,y:0,pickable:!1});i.name=CT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=uf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=CT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=yM;else{const t=this.data[s],e=j({},yM,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=uf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=CT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=yM;else{const i=j({},yM,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=uf.group({x:0,y:0,pickable:!1});return r.name=`${CT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=XM(this._getLabelAttribute(t,e,n,i));if(a.name=CT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=yM;else{const s=j({},yM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new tT(Object.assign({},e));i.name=CT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return FT(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Nt(s[0])>Nt(s[1])?o=zt/2*(l.x>e.x?1:-1):h=zt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?j({},PT.label.style,_(t,e,i,s)):_;_=j(this.getLabelAlign(m,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return d(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},EM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const KT={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&VT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function qT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function ZT(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:KT[n]||KT.parity;if(s.length>=3&&NT(s,r)){do{s=a(s,r)}while(s.length>=3&&NT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);VT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),ZT(l,s,n,(t=>VT(t,l,r))),ZT(h,s,o,(t=>VT(t,h,r)||!(!n||t===l)&&VT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function QT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},iw(t,e.attribute.angle)),{angle:ew(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({},sw(t,e.attribute.angle)),{angle:ew(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Me({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function ew(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function iw(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=ew(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function sw(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=ew(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function nw(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=IT(h),m=OT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function rw(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class aw{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=VM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return HM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class ow{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-ow.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*ow.bounceIn(2*t):.5*ow.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Vt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Vt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Vt/e)*.5+1}}static registerFunc(t,e){ow[t]=e}}function lw(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}ow.quadIn=ow.getPowIn(2),ow.quadOut=ow.getPowOut(2),ow.quadInOut=ow.getPowInOut(2),ow.cubicIn=ow.getPowIn(3),ow.cubicOut=ow.getPowOut(3),ow.cubicInOut=ow.getPowInOut(3),ow.quartIn=ow.getPowIn(4),ow.quartOut=ow.getPowOut(4),ow.quartInOut=ow.getPowInOut(4),ow.quintIn=ow.getPowIn(5),ow.quintOut=ow.getPowOut(5),ow.quintInOut=ow.getPowInOut(5),ow.backIn=ow.getBackIn(1.7),ow.backOut=ow.getBackOut(1.7),ow.backInOut=ow.getBackInOut(1.7),ow.elasticIn=ow.getElasticIn(1,.3),ow.elasticOut=ow.getElasticOut(1,.3),ow.elasticInOut=ow.getElasticInOut(1,.3*1.5),ow.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),ow.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},ow.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)ow[`flicker${t}`]=e=>lw(e,t);for(let t=2;t<10;t++)ow[`aIn${t}`]=e=>t*e*e+(1-t)*e;function hw(t,e,i){return t+(e-t)*i}const cw=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=hw(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=hw(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=hw(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=hw(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=hw(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=hw(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=hw(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=hw(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=hw(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=up(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?gp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=up(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?gp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=hw(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=hw(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=hw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=hw(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=hw(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=hw(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=hw(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=hw(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=hw(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=hw(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=ed(e,i,s),r.addUpdateBoundTag()}}};function dw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=ow[s])&&void 0!==n?n:ow.linear:ow.linear,"wait"===t&&(this.onUpdate=uw),this.id=Ia.GenAutoIncrementId(),this.syncAttributeUpdate=uw}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=cp.Get(i,hp.Color255),r=cp.Get(s,hp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(cw["fill"===e?"fillPure":"strokePure"])}else cw[e]?t.push(cw[e]):t.push(dw)}else cw[e]?t.push(cw[e]):t.push(dw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class gw extends pw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class fw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Ia.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Oo.END?this.removeAnimate(t,!0):t.status!==Oo.RUNNING&&t.status!==Oo.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const mw=new fw;mw.isGlobal=!0;class vw{constructor(t=Ia.GenAutoIncrementId(),e=mw,i){this.id=t,this.status=Oo.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new pw(Ro.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new gw(Ro.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new pw(Ro.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Oo.RUNNING&&(this.status=Oo.PAUSED)}resume(){this.status===Oo.PAUSED&&(this.status=Oo.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Oo.END&&this.onEnd(),this.status=Oo.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Oo.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Oo.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Oo.END);this.status=Oo.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const _w=new ko;class yw{constructor(){this.released=!1}tick(t,e){_w.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class bw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Lo.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Lo.INITIAL,So.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),So.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new yw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Lo.INITIAL&&(this.status=Lo.PAUSE,!0)}resume(){return this.status!==Lo.INITIAL&&(this.status=Lo.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Lo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Lo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Lo.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Lo.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Lo.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Lo.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,So.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function Aw(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}Sw.getInstance();class kw{static registerBuiltInAnimate(t,e){kw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:kw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=Aw(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:kw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=Aw(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),O.attrOutChannel&&e.setAttributes(O.attrOutChannel),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_,y,b;if(e&&i){i=Aw(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(_=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:kw.builtInAnimateMap[r],f=t.custom?t.customType:Aw(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Oo.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}kw.builtInAnimateMap={};const Mw="appear",Tw="disappear",ww="update",Cw="highlight",Ew="unhighlight";class Bw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class Pw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=Sw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new kw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new kw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([Mw],[{name:Mw,animation:t}],e)}applyDisappearState(t,e){this.applyState([Tw],[{name:Tw,animation:t}],e)}applyUpdateState(t,e){this.applyState([ww],[{name:ww,animation:t}],e)}applyHighlightState(t,e){this.applyState([Cw],[{name:Cw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([Ew],[{name:Ew,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class Lw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new Pw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new Bw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new Lw)._getAnimationStateManager(t),t}}class Rw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new vw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:mw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new fw}createTicker(t){return new bw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new kw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function Ow(){G(Ep,Lw),G(Ep,Rw)}class Iw extends pw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Dw extends Iw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Fw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new kw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function zw(t){return new Fw(t)}class jw extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Hw=1e3,Vw="quadInOut",Nw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Uw=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=up(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Ww=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?dy(t):[],n=dy(e);i&&s&&(i.fromTransform&&uy(s,i.fromTransform.clone().getInverse()),uy(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Yw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Xw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Yw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?cp.Get(t,hp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class $w extends Iw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Ww(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Uw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Kw=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Gw(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Xw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new $w({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Hw,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Vw);return c.play(d),c};class qw extends Iw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Ww(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&Uw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Zw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Nw.includes(t))(i)||(e[i]=t[i])})),e},Jw=(t,e,i)=>{const s=Zw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=So.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Qw=(t,e,i)=>{const s=[],n=i?null:Zw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Zw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Lg(t.attribute),n=gy(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(So.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=gy(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(So.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=gy(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(So.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return fy(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return fy(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(So.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:my(i)}];const s=[];return _y(i,e,s),s})(t,e).forEach((t=>{s.push(So.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return _y(l,e,h),h})(t,e).forEach((t=>{s.push(So.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=dy(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(So.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(So.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Jw(t,s,e),s};class eC extends Iw{constructor(t,e,i,s,n){super(null,{},i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){super.onBind(),this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:Ko.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:Ko.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:Ko.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class iC extends eC{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=So.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class sC extends eC{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=So.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class nC extends Iw{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ne(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=td(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class oC extends rC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class lC extends aC{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const hC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class cC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class dC extends cC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=hC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class uC extends cC{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class pC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class gC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const fC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class mC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=fC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class vC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const _C=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class yC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>td(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class bC extends yC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:_C(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class xC extends yC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:_C(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const SC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class AC extends yC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:SC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class kC extends yC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:SC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const MC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class TC extends yC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:MC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class wC extends yC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:MC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const CC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class EC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class BC extends EC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=CC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class PC extends EC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const LC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class RC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=LC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class OC extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class IC extends Dw{onBind(){var t;const e=zw(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class DC extends Dw{onBind(){const t=zw(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function FC(){Kk(),Qk(),oM(),pM(),kw.registerBuiltInAnimate("axisEnter",IC),kw.registerBuiltInAnimate("axisUpdate",DC)}var zC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=uf.group({zIndex:999});e.name=CT.axisBreak,e.id=this._getNodeId(`${CT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},LT,s),a=null!==(e=r.size)&&void 0!==e?e:LT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=uf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=CT.axisBreakSymbol;const h=uf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=CT.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=uf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=CT.background,n.id=this._getNodeId("background"),n.states=j({},BT,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new tT(Object.assign({},t));e.name=CT.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=zC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:j({},BT,l),symbol:j({},BT,l)});const d=new TT(c);d.name=CT.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=zC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+L(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let T,w,{angle:C}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(C)&&o){C=NM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else T=this.getTextAlign(M),w=this.getTextBaseline(M,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(C!==Math.PI/2){const t=Math.abs(Math.cos(null!=C?C:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(C&&0!==C){const t=Math.abs(Math.sin(C));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:w},a),state:{text:j({},BT,c.text),shape:j({},BT,c.shape),panel:j({},BT,c.background)}});return B.angle=C,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=zC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(u(b)&&a){b=NM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return iw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return sw(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=ae(e)})),tw(i,t),!QT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=IT(a),l=OT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=rw(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Yt(c,i))}}else{if(l){const i=rw(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Yt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);nw(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&JT(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=uf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=CT.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=WM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ri(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}jC.defaultAttributes=PT,G(jC,aw);class HC{isInValidValue(t){const{startAngle:e=fM,endAngle:i=mM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=fM,endAngle:i=mM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return he(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return zT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function VC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=VC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var WC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=jT(n,l,c,e,i);h=uf.path(Object.assign(Object.assign({},a.style),{path:HT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=uf.circle(t)}h.name=CT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},BT,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=WC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:j({},BT,d.text),shape:j({},BT,d.shape),panel:j({},BT,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(pt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=VC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&NC(e,c,i)}else e.AABBBounds.width()>r&&NC(e,r,i)}else o>a.x&&h.x2>n.x2?(NC(e,n.x2-o,i),r&&UC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return pt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}GC.defaultAttributes=PT,G(GC,HC);const YC=t=>t.map(((t,e)=>({index:e,value:t}))),XC=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},$C=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ae(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=UM(a),_=t.range();let y=[];for(let i=0;i{ZC[t]=!0}));const iE=t=>-Math.log(-t),sE=t=>-Math.exp(-t),nE=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,rE=t=>10===t?nE:t===Math.E?Math.exp:e=>Math.pow(t,e),aE=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),oE=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),lE=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function hE(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 cE(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function dE(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function uE(t,e,i,s){return 1===i&&(i=0),dE(t,i,s)*(e/(1-i))}function pE(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function gE(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class mE{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=pE(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const vE=Symbol("implicit");class _E extends mE{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=qC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=vE}clone(){const t=(new _E).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==vE)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return yE(t,e,r,n)}class xE extends _E{constructor(t){super(),this.type=qC.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=uE(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[et(t[0]),et(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[et(t[0]),et(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:bE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return bE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=yt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new xE(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:SE}=ni;function AE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=ei.parseColorString(e)){const e=SE(ei.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ii?SE(t,e):e instanceof ei?SE(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):At(Number(t),Number(e))}class kE extends mE{constructor(t=eE,e=eE){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=eE,this._piecewise=cE,this._interpolate=AE}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),At)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,et);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=yt(i[0],i[r-1])),this._piecewise=r>2?gE:cE,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:eE),this.rescale(i)):this._clamp!==eE}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const ME=Math.sqrt(50),TE=Math.sqrt(10),wE=Math.sqrt(2),CE=[1,2,5,10],EE=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=RE(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?PE(0,-(e-1)/s,s):PE((e-1)/s,0,s)},BE=mt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return EE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return EE(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=PE(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=PE(t,e,l);return n&&r.reverse(),r})),RE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=CE[0];return i>=ME?s=CE[3]:i>=TE?s=CE[2]:i>=wE&&(s=CE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function OE(t,e,i){const s=(e-t)/Math.max(0,i);return RE(s)}function IE(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=OE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function FE(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const zE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),jE=mt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),HE=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=LE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?zE(t,e,n):zE(t,e,fE(n)),h=zE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),VE=mt(((t,e,i,s,n)=>IE(s(t),s(e),i).map((t=>fE(n(t))))));class NE extends kE{constructor(){super(...arguments),this.type=qC.Linear}clone(){var t;const e=new NE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return BE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=LE(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return IE(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function WE(t){return e=>-t(-e)}function GE(t=Number.EPSILON){return e=>Math.max(e,t)}class YE extends kE{constructor(){super(aE(10),rE(10)),this.type=qC.Log,this._limit=GE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new YE).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=aE(this._base),s=rE(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=WE(i),this._pows=WE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=iE,this.untransformer=sE):(this._logs=i,this._pows=s,this._limit=GE(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return eE}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return jE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return HE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return VE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return VE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(YE,UE);class XE extends NE{constructor(){super(oE(1),lE(1)),this.type=qC.Symlog,this._const=1}clone(){return(new XE).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=oE(t),this.untransformer=lE(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return jE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return HE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return VE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return VE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(XE,UE);class $E{constructor(){this.type=qC.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new $E).domain(this._domain).range(this._range).unknown(this._unknown)}}function KE(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function qE(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!JC(t.type))return YC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return YC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=KE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=KE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=KE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=KC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=KC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?JE.greedy:JE.parity;for(;l.length>=3&&NT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;VT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),qE(t,l,a,(e=>VT(e,t,i))),qE(n,l,o,(e=>VT(e,n,i)||!(!a||e===t)&&VT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return YC(m)},JE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&VT(i,t,e)||(i=t,0))))}},QE=(t,e,i,s)=>{const n=KC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},tB=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,eB=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?YC([s[s.length-1]]):YC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(g),a=$(g);if(s.length<=f/n){const i=QE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=sB(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=QE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!tB(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?eB(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=UM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=he({x:0,y:0},i,t),a=FT(r,zT(s,r,e,n));return o=a,l=zT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(pt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return YC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=nB(t,i,e),r=K(s),l=$(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=aB(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return YC(c)},aB=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&XC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},oB=new Uint32Array(33),lB=new Uint32Array(33);lB[0]=0,oB[0]=~lB[0];for(let t=1;t<=32;++t)lB[t]=lB[t-1]<<1|1,oB[t]=~lB[t];function hB(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&oB[31&o]&lB[1+(31&l)])return!0}else{if(i[h]&oB[31&o])return!0;if(i[c]&lB[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,oB[31&o]&lB[1+(31&l)]);else for(s(h,oB[31&o]),s(c,lB[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,lB[31&a]|oB[1+(31&o)]);else for(n(l,lB[31&a]),n(h,oB[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function cB(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=vt(i,-o,t.width+l),d=vt(s,-o,t.width+l),u=vt(n,-a,t.height+h),p=vt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function dB(t,e,i=!1){return i?cB(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function uB(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=dB(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=cB(t,r)),e.getRange(r)))}function pB(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return pB(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return pB(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return pB(t,e,n,s,h,c)}return!1}const fB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],mB=["top","inside-top","inside"];function vB(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const _B={mode:"same-time",duration:300,easing:"linear"};function yB(t){return 3===t||4===t}function bB(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const xB=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function SB(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}var AB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const TB=(t,e)=>Math.ceil(t)>Math.floor(e),wB=([t,e],[i,s])=>s>t&&e>i;function CB(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var EB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(_M.hover,!0),EM(this,(t=>{t===e||P(t.states)||t.addState(_M.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(EM(this,(t=>{P(t.states)||(t.removeState(_M.hoverReverse),t.removeState(_M.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void EM(this,(t=>{P(t.states)||(t.removeState(_M.selectedReverse),t.removeState(_M.selected))}));P(e.states)||(e.addState(_M.selected,!0),EM(this,(t=>{t===e||P(t.states)||t.addState(_M.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===Ko.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Ko.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Se(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[SB(g,f,c,d,a,o),SB(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=uf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Ul)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],h=o;if(!c(e)&&d(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?h.push(i):l.push(i)}))}d(r)?o=r(h,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(h).concat(l)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return XM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&TB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&TB(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(pt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(CB([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!wB([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(dB(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(dB(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(dB(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{PB[t]=e};var RB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}OB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const IB=()=>{LB("symbol",OB),LB("line-data",OB)};var DB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}FB.tag="rect-label",FB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var zB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};jB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const HB=()=>{LB("line",jB),LB("area",jB)};var VB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=ge(h.endAngle-u/2),g=he(c,h.outerRadius,o),f=he(c,a+e.line.line1MinLength,o),m=new NB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=he(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):yB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=he(t.circleCenter,v,t.middleAngle),t.labelLimit=f,gt(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=yB(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=yB(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(ft(t.pointB.x,this._line2MinLength+h)||gt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=yB(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?yB(t.quadrant)?"left":"right":yB(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(yB(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(pt(l/2,u))g=0,f=1,m=-p;else if(pt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&ft(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&ft(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function YB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=re.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function XB(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=HT(t,!!n),o=HT(r,!!n);const h=re.distancePP(s,l),c=re.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=YB(e,t,!1,!!n),o=YB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=HT(t,!!n),o=HT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}GB.defaultAttributes={pickable:!1};class $B extends cb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&DT(this._innerView),this.removeAllChild(!0),this._innerView=uf.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return FT(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=j({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${CT.grid}-sub`:`${CT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=HT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=YB(t,o,!1,!!a)}const u=uf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:$B.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=HT(o,!!a),m=Nt(o[0].x-o[1].x),v=Nt(o[0].y-o[1].y),_=uf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*zt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:$B.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!pt(a.value,0)&&!pt(l.value,0),d=!pt(a.value,1)&&!pt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}$B.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},Kk(),eM();class KB extends $B{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},$B.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=fM,endAngle:r=mM}=this.attribute;i=jT(t,s,re.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=j({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}G(KB,aw);var qB,ZB,JB,QB=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(tP,HC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(qB||(qB={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(ZB||(ZB={})),function(t){t.dataZoomChange="dataZoomChange"}(JB||(JB={}));const eP="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",iP={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:eP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:eP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},sP={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}},nP=0,rP=1,aP=2,oP=3,lP=4,hP=5,cP=5,dP=999,uP=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var pP=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:aP},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:aP},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:nP},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T;const{orient:w,middleHandlerStyle:C={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:L,end:R}=this._getState(),{position:O,width:I,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:O.x+L*I,y:O.y-t,width:(R-L)*I,height:t,zIndex:hP},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:O.x+(L+R)/2*I,y:O.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:hP},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+L*I,y:O.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},sP.horizontal),{zIndex:hP}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+R*I,y:O.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},sP.horizontal),{zIndex:hP}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+L*I-t/2,y:O.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:dP},sP.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+R*I-g/2,y:O.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:dP},sP.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===w?O.x-t:O.x+I,y:O.y+L*D,width:t,height:(R-L)*D,zIndex:hP},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===w?O.x-t/2:O.x+I+t/2,y:O.y+(L+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:hP},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+L*D,size:I,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},sP.vertical),{zIndex:hP}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+R*D,size:I,symbolType:null!==(M=B.symbolType)&&void 0!==M?M:"square",zIndex:hP},sP.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+I/2+t/2,y:O.y+L*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dP},sP.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+I/2+i/2,y:O.y+R*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dP},sP.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:oP},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:oP},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:rP},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:lP},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new He).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=pP(c,["formatMethod"]),{formatMethod:g}=d,f=pP(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:uP(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},w={textAlign:uP(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:uP(A,t,"start",this._isHorizontal)?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:uP(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:cP}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:cP}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new tT(e),s.name=i,t.add(s)),s}}const fP={debounce:xt,throttle:St};class mP extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=qB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=qB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=qB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=qB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=qB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===O_.env?O_:this.stage,s=SM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===qB.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===qB.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===qB.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===qB.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(ZB.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(ZB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(ZB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===qB.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(ZB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(ZB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:fP[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===O_.env?O_:this.stage,e=SM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===O_.env?O_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===O_.env?O_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:vt(e+t,0,1),end:vt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=qB.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}JM(),rM(),dM(),Uk(),Qk();let vP=class t extends cb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new gP(this._getRendererAttrs()),this._interaction=new mP(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(ZB.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(ZB.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(JB.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(ZB.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(JB.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var _P,yP,bP,xP;function SP(){Kk(),JM(),Ow()}vP.defaultAttributes=iP,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(_P||(_P={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(yP||(yP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(bP||(bP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(xP||(xP={}));class AP extends cb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=UT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=WT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=GT(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=uf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=uf.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=uf.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function kP(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function MP(t,e,i,s){t&&(kP(t.startSymbol,e,i,s),t.lines.forEach((t=>kP(t,e,i,s))),kP(t.line,e,i,s),kP(t.endSymbol,e,i,s))}function TP(t,e,i,s){t&&(kP(t.getTextShape(),e,i,s),kP(t.getBgRect(),e,i,s))}function wP(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function CP(t,e,i,s){t&&(wP(t.startSymbol,e,i,s),t.lines.forEach((t=>wP(t,e,i,s))),wP(t.line,e,i,s),wP(t.endSymbol,e,i,s))}function EP(t,e,i,s){t&&(wP(t.getTextShape(),e,i,s),wP(t.getBgRect(),e,i,s))}function BP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;kP(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),kP(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;kP(t.getTextShape(),e,l,n),kP(t.getBgRect(),e,l,n)}))}function PP(t,e,i,s,n){MP(t,s,i,n),Y(e).forEach((t=>{TP(t,s,i,n)}))}function LP(t,e,i,s,n){kP(t,s,i,n),Y(e).forEach((t=>{TP(t,s,i,n)}))}function RP(t,e,i,s,n){kP(t,s,i,n),Y(e).forEach((t=>{TP(t,s,i,n)}))}function OP(t,e,i,s,n,r){var a;MP(t,n,s,r),kP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?TP(i,n,s,r):kP(i,n,s,r)}function IP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;kP(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),kP(e,n+o+l,h,r),kP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(kP(i.getTextShape(),n+o+l+h+c,d,r),kP(i.getBgRect(),n+o+l+c,d,r)):kP(i,n+o+l+c,d,r)}function DP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?BP(t,e,s,r,a):"fadeIn"===i&&PP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?BP(t,e,s,n,a):"fadeIn"===i&&PP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){CP(t,s,i,n),Y(e).forEach((t=>{EP(t,s,i,n)}))}(t,e,i,s,n)}}function FP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&LP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&LP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wP(t,s,i,n),Y(e).forEach((t=>{EP(t,s,i,n)}))}(t,e,i,s,n)}}function zP(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&RP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&RP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wP(t,s,i,n),Y(e).forEach((t=>{EP(t,s,i,n)}))}(t,e,i,s,n)}}function jP(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?OP(n,r,e,i,s,o):"callIn"===t&&IP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?OP(n,r,e,i,s,a):"callIn"===t&&IP(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;CP(t,n,s,r),wP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?EP(i,n,s,r):wP(i,n,s,r)}(n,r,e,t,i,s)}}const HP={type:"clipIn",duration:500,easing:"linear",delay:0},VP={type:"fadeIn",duration:500,easing:"linear",delay:0},NP={type:"callIn",duration:500,easing:"linear",delay:0},UP={type:"fadeOut",duration:500,easing:"linear",delay:0};class WP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new tT(Object.assign(Object.assign({},h),{state:{panel:j({},yM,null!==(o=a[n])&&void 0!==o?o:X(a)),text:j({},yM,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},yM,null!==(a=r[s])&&void 0!==a?a:X(r)),text:j({},yM,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class GP extends AP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=HP,this.defaultExitAnimation=UP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;ZM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(GP,WP);const YP=.001,XP={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:_P.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]}},$P={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},KP={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:bP.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},qP={interactive:!0,label:{position:yP.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}},ZP={interactive:!0,label:{autoRotate:!0,position:bP.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},JP={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},QP={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},tL={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function eL(){iL._animate=DP}SP(),kT(),Ow();class iL extends GP{markerAnimate(t){iL._animate&&this._animationConfig&&iL._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},iL.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(PM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return LM(Math.abs(e),Math.PI/2,YP)||LM(Math.abs(e),3*Math.PI/2,YP)?RM(i,e,t):PM(e)?$P.postiveXAxis[t]:$P.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new TT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},yM,null==a?void 0:a.line),startSymbol:j({},yM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},yM,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:j({},yM,null==a?void 0:a.line),startSymbol:j({},yM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},yM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",iL.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(iL.defaultAttributes.label)}}function sL(){nL._animate=FP}iL.defaultAttributes=XP,SP(),sM(),Ow();class nL extends AP{markerAnimate(t){nL._animate&&this._animationConfig&&nL._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},nL.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=VP,this.defaultExitAnimation=UP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},QP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;ZM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=uf.polygon(Object.assign({points:e},i));n.states=j({},yM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",nL.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},yM,null==i?void 0:i.area)),this._updateMarkLabels(nL.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}nL.defaultAttributes=qP,G(nL,WP),SP(),MT(),Ow();class rL extends GP{markerAnimate(t){rL._animate&&this._animationConfig&&rL._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},rL.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case bP.arcInnerStart:l=n;case bP.arcOuterStart:l=n;break;case bP.arcInnerEnd:l=r;case bP.arcOuterEnd:l=r;break;case bP.center:case bP.arcInnerMiddle:case bP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return JP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new wT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},yM,null==o?void 0:o.line),startSymbol:j({},yM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},yM,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},yM,null==o?void 0:o.line),startSymbol:j({},yM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},yM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",rL.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(rL.defaultAttributes.label)}}rL.defaultAttributes=KP,SP(),Vk(),Ow();class aL extends AP{markerAnimate(t){aL._animate&&this._animationConfig&&aL._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},aL.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=VP,this.defaultExitAnimation=UP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case bP.center:h=(s+n)/2,c=(r+a)/2;break;case bP.arcInnerStart:h=s,c=r;break;case bP.arcOuterStart:h=n,c=r;break;case bP.arcInnerEnd:h=s,c=a;break;case bP.arcOuterEnd:h=n,c=a;break;case bP.arcInnerMiddle:h=s,c=(r+a)/2;break;case bP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},JP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;ZM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=uf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},yM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",aL.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=j({},yM,null==o?void 0:o.area)),this._updateMarkLabels(aL.defaultAttributes.label)}isValidPoints(){return!0}}function oL(){lL._animate=jP}aL.defaultAttributes=ZP,G(aL,WP),SP(),kT(),MT(),dM(),Zk(),Qk(),Ow();class lL extends AP{markerAnimate(t){lL._animate&&this._animationConfig&&lL._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lL.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=NP,this.defaultExitAnimation=UP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return LM(Math.abs(s),Math.PI/2,YP)||LM(Math.abs(s),3*Math.PI/2,YP)?RM(t,s,n):PM(s)?tL.postiveXAxis[n]:tL.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=xP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},yM,null==p?void 0:p.textBackground),text:j({},yM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},yM,null==p?void 0:p.itemContent));const v=PM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=uf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},yM,null==s?void 0:s.itemContent)):"text"===n?o=new tT(Object.assign(Object.assign({},i),{state:{panel:j({},yM,null==s?void 0:s.textBackground),text:j({},yM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=uf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},yM,null==s?void 0:s.itemContent)):"image"===n?(o=uf.image(Object.assign(Object.assign({},i),r)),o.states=j({},yM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},yM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=LM(c,0,YP)||LM(d,0,YP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=KM(e-u,t-d),o=KM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(vL.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(vL.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===vL.focus||"focus"===o){const s=a.hasState(fL.focus);a.toggleState(fL.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[fL.unSelected,fL.unSelectedHover,fL.focus],t),this._setLegendItemState(e,fL.selected,t)})):(this._setLegendItemState(a,fL.selected,t),this._removeLegendItemState(a,[fL.unSelected,fL.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[fL.selected,fL.selectedHover,fL.focus],t),this._setLegendItemState(e,fL.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(fL.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(fL.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(mL.legendItemClick,a,t);i?(this._removeLegendItemState(a,[fL.selected,fL.selectedHover],t),this._setLegendItemState(a,fL.unSelected,t)):(this._setLegendItemState(a,fL.selected,t),this._removeLegendItemState(a,[fL.unSelected,fL.unSelectedHover],t))}else this._setLegendItemState(a,fL.selected,t),this._removeLegendItemState(a,[fL.unSelected,fL.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[fL.selected,fL.selectedHover],t),this._setLegendItemState(e,fL.unSelected,t))}))}this._dispatchLegendEvent(mL.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,fL.selected),this._removeLegendItemState(e,[fL.unSelected,fL.unSelectedHover])):(this._removeLegendItemState(e,[fL.selected,fL.selectedHover]),this._setLegendItemState(e,fL.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=uL,spaceRow:l=pL,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=uf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ri(c);let w;!1===x.visible?(w=uf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,vL.item,t,w)):(w=uf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,vL.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?fL.selected:fL.unSelected);const C=uf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=uf.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,vL.itemShape,t,w,S.state),s.addState(e?fL.selected:fL.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=uf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,vL.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=XM(Object.assign(Object.assign({x:P/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,vL.itemLabel,t,w,A.state),D.addState(e?fL.selected:fL.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=XM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,vL.itemValue,t,w,k.state),r.addState(e?fL.selected:fL.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new dL(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new dL(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new kM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new kM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",St(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=uL,spaceRow:o=pL}=n,l=this._itemsContainer,{space:h=gL,defaultCurrent:c=1}=r,d=xL(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=uf.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=uL,spaceRow:a=pL}=s,o=this._itemsContainer,{space:l=gL,defaultCurrent:h=1}=n,c=xL(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=uf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=uf.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];pt(vt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),pt(vt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(fL.selected)?this._setLegendItemState(t,fL.selectedHover,e):this._setLegendItemState(t,fL.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===vL.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(mL.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(fL.unSelectedHover)||t.hasState(fL.selectedHover))&&(i=!0),t.removeState(fL.unSelectedHover),t.removeState(fL.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(fL.unSelectedHover)&&!t.hasState(fL.selectedHover)||(i=!0),t.removeState(fL.unSelectedHover),t.removeState(fL.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===vL.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(mL.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(mL.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==vL.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(mL.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==vL.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(mL.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(fL.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},SL,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(fL.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var kL;function ML(t){return y(t)?t:[t,t]}function TL(t){return t?"ew-resize":"ns-resize"}AL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:uL,spaceRow:pL,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:gL,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"}(kL||(kL={})),yL();class wL extends cb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},wL.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=SM(),n="browser"===O_.env?O_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=SM(),n="browser"===O_.env?O_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:ML(d)[0],endValue:ML(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=uf.group({x:0,y:0});f.name=kL.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=uf.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=kL.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=uf.group({x:g?v:0,y:g?0:v});f.add(_);const y=uf.group({x:0,y:0});let b;if(y.name=kL.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=uf.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=kL.endText,f.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=uf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=kL.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=ML(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":TL(p)},r));if(v.name=kL.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=kL.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":TL(p)},r));if(i.name=kL.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=kL.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=vt(h,i,s);const p=this._isHorizontal;e||(c=i);const f=uf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=kL.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":TL(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=uf.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=kL.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return uf.symbol(t)}_renderHandlerText(t,e){return uf.text(this._getHandlerTextAttributes(t,e))}_getHandlerPosition(t){return this.attribute.range&&t?"start":"end"}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":TL(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=uf.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=uf.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===O_.env?O_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=SM(),e="browser"===O_.env?O_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const n=t.name===kL.startHandler?this._startHandlerText:this._endHandlerText;if(n){const e=this._getHandlerPosition(t.name===kL.startHandler);n.setAttributes(this._getHandlerTextAttributes(i,e))}t.name===kL.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){const s=this._isHorizontal,n=this._getHandlerPosition(t.name===kL.startHandlerText);t.setAttributes(this._getHandlerTextAttributes(i,n));const r=t.name===kL.startHandlerText?this._startHandler:this._endHandler;r&&r.setAttributes({[s?"x":"y"]:e}),t.name===kL.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===O_.env?O_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}wL.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},bL(),yL();class CL extends _L{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},CL.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function EL(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}CL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},bL(),yL(),eM();class BL extends _L{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},BL.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=uf.group({x:0,y:0});this._innerView.add(x);const S=new wL({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:EL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=uf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}BL.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)"}},Kk(),pM(),oM();let PL=class t extends cb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ri(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},bM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},bM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};PL.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 LL={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"}}};Kk(),pM(),oM();let RL=class extends cb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(LL,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=XM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=WM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class OL extends wg{constructor(t){super(t)}}var IL,DL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(IL||(IL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(DL||(DL={}));class FL extends cb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FL.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"},FL.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"},FL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},FL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},FL.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new OL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new OL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new OL(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(IL.OnPlay)},this.pause=()=>{this._dispatchEvent(IL.OnPause)},this.forward=()=>{this._dispatchEvent(IL.OnForward)},this.backward=()=>{this._dispatchEvent(IL.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}FL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},FL.defaultAttributes={[DL.Start]:{},[DL.Pause]:{},[DL.Backward]:{},[DL.Forward]:{}};const zL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},jL=[200,10];var HL,VL;!function(t){t.Default="default",t.Reverse="reverse"}(HL||(HL={})),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"}(VL||(VL={}));const NL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===HL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===HL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),UL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===HL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===HL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),WL=t=>"top"===t||"bottom"===t;class GL extends cb{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},GL.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Gt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(WL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:jL[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:jL[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new wL(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=WL(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new FL(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=WL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:jL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Gt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(WL(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:WL(this._orient)?t+s:(this._size.width-r)/2,y:WL(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:WL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:WL(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:WL(this._orient)?t+s:(this._size.width-r)/2,y:WL(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function YL(){yL(),Kk(),dM()}GL.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({},zL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},zL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},zL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},zL),{key:"backward",position:"start"})}},YL();class XL extends GL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:HL.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(IL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(IL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(IL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(IL.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(VL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(NL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||UL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===HL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(VL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=O_.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(VL.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(VL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=O_.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(),O_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(VL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(VL.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(VL.change),this.dispatchCustomEvent(VL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var $L,KL=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};YL();class qL extends GL{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(IL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(IL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(IL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(IL.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(VL.change))},this.play=()=>KL(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(VL.play),this._rafId=O_.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=O_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(VL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(VL.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(VL.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(VL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}($L||($L={}));const ZL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},JL=5;const QL={debounce:xt,throttle:St};Kk(),sM();let tR=class t extends cb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=ZL.updateTrigger,endTrigger:i=ZL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:QL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($L.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=ZL.trigger,resetTrigger:e=ZL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent($L.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent($L.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=JL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent($L.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent($L.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent($L.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=JL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($L.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($L.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=ZL.updateTrigger,endTrigger:e=ZL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=uf.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Pe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};tR.defaultAttributes=ZL;const eR=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},iR=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},sR={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:vM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:vM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:vM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},nR=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];Kk(),rM(),dM(),pM(),oM();let rR=class t extends cb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ri(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",j({symbolType:"circle"},u.shape,{visible:BM(u)&&BM(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},iR(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:BM(u)&&BM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},iR(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},bM),u.value),visible:BM(u)&&BM(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=BM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=BM(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!BM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(BM(n.key)?r+n.key.spacing:0)+(BM(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&($M(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:BM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),$M(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(BM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=rd(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(BM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},iR(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},iR(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},bM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(BM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},iR(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},iR(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>nR.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&BM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=BM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=UM(d),_=UM(u);let y=0;if(BM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(BM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&hu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return eR({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return eR({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};rR.defaultAttributes=sR;const aR=pt;function oR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function lR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function hR(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function cR(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function dR(t,e){const i=cR(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function uR(t,e){const i=pR(t),s=pR(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function pR(t,e={x:0,y:0}){return re.distancePP(t,e)}function gR(t){return k(t.x)&&k(t.y)}function fR(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function mR(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const vR=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function yR(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&yR(t[i],e)}}var bR,xR,SR;function AR(t){var e,i;const{type:s}=t;return s===xR.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(bR||(bR={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(xR||(xR={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(SR||(SR={}));const kR={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},MR={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function TR(t,e){var i;if(!t)return[];const s=RR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?PR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>BR(i)?CR(t,i,e):i)).filter(p)}))):i.map((i=>BR(i)?CR(t,i,e):i)).filter(p):[]}return[]}function wR(t,e){var i,s;return PR(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function CR(t,e,i){var s;const n=RR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=kR[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=MR[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new ei(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ye(t,i,s),a=Ge(n,r,e.l),l=new ei(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const ER=(t,e)=>{if(e&&BR(t)){const i=CR(e,t);if(i)return i}return t};function BR(t){return t&&"palette"===t.type&&!!t.key}function PR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function LR(t){return y(t)?{dataScheme:t}:t}function RR(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=AR(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class OR extends _E{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(!PR(this._range))return void super.range(this._range);const t=wR(this._range,this._domain);super.range(t)}}const IR={linear:NE,band:xE,point:class extends xE{constructor(t){super(!1),this.type=qC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:_E,threshold:$E,colorOrdinal:OR};function DR(t){const e=IR[t];return e?new e:null}function FR(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function zR(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function jR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function HR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function VR(t){return!!_(t)&&(!!t.endsWith("%")&&ob(t.substring(0,t.length-1)))}function NR(t){return!!g(t)&&("percent"in t||"offset"in t)}function UR(t,e,i,s=0){var n,r;return S(t)?t:VR(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function WR(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=UR(t[s],e.size,i)}))})),o}function GR(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function YR(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||VR(t)||d(t)||NR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function XR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const $R=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},KR=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function qR(t,e){return t&&e.key in t?t[e.key]:e.default}function ZR(t){return t&&"token"===t.type&&!!t.key}const JR={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},QR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:KR,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:JR,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},tO={name:"dark",colorScheme:{default:{dataScheme:KR,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},eO=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>eO(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>eO(t[i],e[i])))),iO=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),iO(t[s],e.slice(1),i))},sO=t=>t instanceof Ba||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(t);function nO(t,e=["data"]){return I(t,sO,e)}function rO(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=LR(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}aO._charts={},aO._series={},aO._components={},aO._graphicComponents={},aO._marks={},aO._regions={},aO._animations={},aO._implements={},aO._chartPlugin={},aO._vChartPlugin={},aO._componentPlugin={},aO.transforms={fields:Yr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},aO.dataParser={csv:(t,e={},i)=>(i.type=Gr.DSV,sa(t)),dsv:(t,e={},i)=>{i.type=Gr.DSV;const s=Hr(ra,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return ia(n).parse(t)},tsv:(t,e={},i)=>(i.type=Gr.DSV,na(t))},aO._layout={},aO._grammarTransforms={},aO._stageEventPlugins={},aO.registerStageEventPlugin=(t,e)=>{aO._stageEventPlugins[t]=e},aO.getStageEventPlugin=t=>aO._stageEventPlugins[t],aO._interactionTriggers={},aO.registerInteractionTrigger=(t,e)=>{aO._interactionTriggers[t]=e},aO._composedEventMap={},aO.registerComposedEvent=(t,e)=>{aO._composedEventMap[t]=e},aO._tooltipProcessors={},aO.registerTooltipProcessor=(t,e)=>{aO._tooltipProcessors[t]=e},aO.createTooltipProcessor=(t,e)=>{const i=aO._tooltipProcessors[t];return i?new i(e):null};const hO=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},cO=hO(),dO={[QR.name]:QR},uO=QR.name,pO=new Map(Object.keys(dO).map((t=>[t,dO[t]]))),gO=new Map,fO=new Map(Object.keys(dO).map((t=>[t,t===uO]))),mO=(t,e)=>{if(!t)return;const i=bO(e);pO.set(t,i),fO.set(t,!0)},vO=(t=uO)=>(fO.has(t)&&!fO.get(t)&&mO(t,pO.get(t)),pO.get(t)),_O=t=>pO.delete(t)&&gO.delete(t)&&fO.delete(t),yO=t=>!!_(t)&&pO.has(t),bO=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:uO;return oO({},vO(i),t)};class xO{static registerInstance(t){xO.instances.set(t.id,t)}static unregisterInstance(t){xO.instances.delete(t.id)}static getInstance(t){return xO.instances.get(t)}static instanceExist(t){return xO.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return xO.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}xO.instances=new Map;class SO{static registerTheme(t,e){mO(t,e)}static getTheme(t,e=!1){return vO(t)}static removeTheme(t){return _O(t)}static themeExist(t){return yO(t)}static getDefaultTheme(){return SO.themes.get(uO)}static setCurrentTheme(t){SO.themeExist(t)&&(SO._currentThemeName=t,xO.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return SO.getTheme(SO._currentThemeName,t)}static getCurrentThemeName(){return SO._currentThemeName}}function AO(t){return _(t)?SO.themeExist(t)?SO.getTheme(t):{}:g(t)?t:{}}SO.themes=pO,SO._currentThemeName=uO;const kO=["animationThreshold","colorScheme","name","padding"];function MO(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];kO.includes(n)?s[n]=r:m(r)?BR(r)?s[n]=ER(r,e):ZR(r)?s[n]=qR(i,r):s[n]=MO(r,e,i):s[n]=r})),s}function TO(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=TO(t[s],e)}return i}return y(t)?t.map((t=>TO(t,e))):t}function wO(t,e){if(!t)return t;if(m(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=wO(t[s],e)}return i}return y(t)?t.map((t=>wO(t,e))):t}function CO(t,...e){return d(t)?t(...e):t}const EO=(t,e,i,s)=>((t,e,i)=>UM(t,e,i,{fontFamily:JR.fontFamily,fontSize:JR.fontSize}))(e,i,s).measure(t),BO="__VCHART",PO=500,LO=500,RO=`${BO}_MEASURE_CANVAS_ID`,OO=`${BO}_DEFAULT_DATA_INDEX`,IO=`${BO}_DEFAULT_DATA_KEY`,DO=`${BO}_DEFAULT_DATA_SERIES_FIELD`,FO=`${BO}_DEFAULT_SERIES_STYLE_NAME`,zO=`${BO}_STACK_KEY`,jO=`${BO}_STACK_START`,HO=`${BO}_STACK_END`,VO=`${BO}_STACK_START_PERCENT`,NO=`${BO}_STACK_END_PERCENT`,UO=`${BO}_STACK_START_OffsetSilhouette`,WO=`${BO}_STACK_END_OffsetSilhouette`,GO=`${BO}_STACK_TOTAL`,YO=`${BO}_STACK_TOTAL_PERCENT`,XO=`${BO}_STACK_TOTAL_TOP`,$O=`${BO}_STACK_TOTAL_BOTTOM`,KO=`${BO}_MOSAIC_VALUE_START_PERCENT`,qO=`${BO}_MOSAIC_VALUE_END_PERCENT`,ZO=`${BO}_MOSAIC_CAT_START_PERCENT`,JO=`${BO}_MOSAIC_CAT_END_PERCENT`,QO=`${BO}_SEGMENT_START`,tI=`${BO}_SEGMENT_END`,eI=`${BO}_KEY`,iI=`${BO}_MAP_LOOK_UP_KEY`;function sI(t,e){for(let i=0;it.key===e))}function rI(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function aI(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},dI(t,a,n[o],l,e,r))})),s?oI(n):n}function oI(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):oI(t[e].nodes);return t}function lI(t,e){if("values"in t&&t.values.length){const i=hR(t.values,e),s=lR(t.values,NO);t.values.forEach((t=>{t[GO]=i,t[YO]=s}))}else for(const i in t.nodes)lI(t.nodes[i],e)}function hI(t){if(!t.values.length)return;const e=t.values[t.values.length-1][HO]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)cI(t.nodes[r],e,i,s,n)}function dI(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[HO]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),dI(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const uI=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=gI(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function fI(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>_I(t.style(e,i,s,n)):P(t.style)||(e.style=_I(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>_I(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=_I(t.state[e]))})),e.state=i}return e}function mI(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>_I(t[i](e,s,n,r)):P(t[i])||(e[i]=_I(t[i]))})),e}function vI(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),_I(i)}function _I(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ae(t.angle)}):t}const yI=t=>"line"===t||"area"===t,bI=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return yI(i)?e:null==e?void 0:e[0]},xI=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let SI=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=aO.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(aO.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var AI;!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"}(AI||(AI={}));const kI=["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 MI,TI,wI;t.ChartEvent=void 0,(MI=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",MI.rendered="rendered",MI.renderFinished="renderFinished",MI.animationFinished="animationFinished",MI.regionSeriesDataFilterOver="regionSeriesDataFilterOver",MI.afterInitData="afterInitData",MI.afterInitEvent="afterInitEvent",MI.afterInitMark="afterInitMark",MI.rawDataUpdate="rawDataUpdate",MI.viewDataFilterOver="viewDataFilterOver",MI.viewDataUpdate="viewDataUpdate",MI.viewDataStatisticsUpdate="viewDataStatisticsUpdate",MI.markDeltaYUpdate="markDeltaYUpdate",MI.viewDataLabelUpdate="viewDataLabelUpdate",MI.scaleDomainUpdate="scaleDomainUpdate",MI.scaleRawDomainUpdate="scaleRawDomainUpdate",MI.scaleUpdate="scaleUpdate",MI.dataZoomChange="dataZoomChange",MI.drill="drill",MI.layoutStart="layoutStart",MI.layoutEnd="layoutEnd",MI.layoutRectUpdate="layoutRectUpdate",MI.playerPlay="playerPlay",MI.playerPause="playerPause",MI.playerEnd="playerEnd",MI.playerChange="playerChange",MI.playerForward="playerForward",MI.playerBackward="playerBackward",MI.scrollBarChange="scrollBarChange",MI.brushStart="brushStart",MI.brushChange="brushChange",MI.brushEnd="brushEnd",MI.brushClear="brushClear",MI.brushActive="brushActive",MI.legendSelectedDataChange="legendSelectedDataChange",MI.legendFilter="legendFilter",MI.legendItemClick="legendItemClick",MI.legendItemHover="legendItemHover",MI.legendItemUnHover="legendItemUnHover",MI.tooltipShow="tooltipShow",MI.tooltipHide="tooltipHide",MI.tooltipRelease="tooltipRelease",MI.afterResize="afterResize",MI.afterRender="afterRender",MI.afterLayout="afterLayout",MI.afterMarkLayoutEnd="afterMarkLayoutEnd",MI.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(TI||(TI={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(wI||(wI={}));const CI=[wI.mark,wI.model,wI.chart,wI.vchart];class EI{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(wI.vchart,[]),this._levelNodes.set(wI.chart,[]),this._levelNodes.set(wI.model,[]),this._levelNodes.set(wI.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const BI={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class PI{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>bI(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||TI.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||TI.chart);o.get(t)||o.set(t,new EI);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||TI.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||TI.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||TI.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||TI.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?CI.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[TI.chart,TI.window,TI.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&L(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return BI[a]&&(a=BI[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?wI.model:wI.vchart:wI.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=St(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=xt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=TI.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==wI.model&&s!==wI.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=wI.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case TI.chart:return this._viewBubbles;case TI.window:return this._windowBubbles;case TI.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case TI.chart:return this._viewListeners;case TI.window:return this._windowListeners;case TI.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return kI.includes(t)||Object.values(AI).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&aO.hasInteractionTrigger(e)}}function LI(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function RI(t,e,i){t.getParser(e)||t.registerParser(e,i)}const OI=new Map;let II;function DI(){II||(II=new Ea,RI(II,"geojson",Aa),RI(II,"topojson",Ma),LI(II,"simplify",Wr))}function FI(t,e,i={type:"geojson",centroid:!0}){OI.has(t)&&Zy(`map type of '${t}' already exists, will be overwritten.`),DI();const s=new Ba(II),n=j({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),OI.set(t,s)}function zI(t){OI.has(t)?OI.delete(t):Zy(`map type of '${t}' does not exists.`)}function jI(t,e=!1){let i=e;return t.latestData instanceof Ba&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const HI=(t,e)=>0===t.length?[]:1===t.length?jI(t[0],null==e?void 0:e.deep):t.map((t=>jI(t,null==e?void 0:e.deep)));function VI(e,i,s){LI(i=i instanceof Ea?i:e.dataSet,"copyDataView",HI);const n=new Ba(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function NI(t,e,i=[]){var s;if(t instanceof Ba)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Ba(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Zy(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Zy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Zy("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function UI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var WI,GI,YI,XI;t.TransformLevel=void 0,(WI=t.TransformLevel||(t.TransformLevel={}))[WI.copyDataView=-10]="copyDataView",WI[WI.treemapFilter=-8]="treemapFilter",WI[WI.treemapFlatten=-7]="treemapFlatten",WI[WI.dotObjFlat=-7]="dotObjFlat",WI[WI.linkDotInfo=-7]="linkDotInfo",WI[WI.sankeyLayout=-7]="sankeyLayout",WI[WI.dataZoomFilter=-6]="dataZoomFilter",WI[WI.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(GI||(GI={})),function(t){t.data="data",t.mark="mark"}(YI||(YI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(XI||(XI={}));const $I=["line","area","trail"];function KI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(eI,i?t.slice().sort(i):t.slice()),{keys:[eI],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const qI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function ZI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{ZI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function QI(t,e,i,s){const n=KI(t,(t=>i(t))),r=KI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const tD=`${BO}_BuiltIn_CallBack_Disappear`;var eD;!function(t){t.render="render",t.disappear="disappear"}(eD||(eD={}));class iD{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;O_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new $_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Lp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:sb(o))&&!1!==c&&aO.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=XI.before}_setCanvasStyle(){if(this._stage&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(O_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=O_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>ZI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>ZI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{ZI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(qy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===XI.before&&(this._layoutState=XI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=XI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),qy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=JI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=QI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=QI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=KI(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=KI(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:tD,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{ZI(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===GI.appear))?GI.appear:e.every((t=>t===GI.disappear))?GI.disappear:GI.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===TI.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:bI(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===TI.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===TI.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===TI.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===TI.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===TI.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{ZI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=JI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return ib(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return xu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{So.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{ZI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=O_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){O_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function sD(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:Jy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function nD(t){t.crosshair=Y(t.crosshair||{}).map((e=>rO({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function rD(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ai(l,i.width,i.height);a=t,o=e}else if(h&&ib(e.mode)){let t;t=_(h)?O_.getElementById(h):h;const{width:e,height:s}=ai(t,i.width,i.height);a=e,o=s}else if(nb(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function aD(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function oD(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var lD,hD,cD,dD,uD,pD;t.LayoutZIndex=void 0,(lD=t.LayoutZIndex||(t.LayoutZIndex={}))[lD.SeriesGroup=0]="SeriesGroup",lD[lD.Axis_Grid=50]="Axis_Grid",lD[lD.CrossHair_Grid=100]="CrossHair_Grid",lD[lD.Region=450]="Region",lD[lD.Mark=300]="Mark",lD[lD.Node=400]="Node",lD[lD.Axis=100]="Axis",lD[lD.MarkLine=500]="MarkLine",lD[lD.MarkArea=100]="MarkArea",lD[lD.MarkPoint=500]="MarkPoint",lD[lD.DataZoom=500]="DataZoom",lD[lD.ScrollBar=500]="ScrollBar",lD[lD.Player=500]="Player",lD[lD.Legend=500]="Legend",lD[lD.CrossHair=500]="CrossHair",lD[lD.Indicator=500]="Indicator",lD[lD.Title=500]="Title",lD[lD.Label=500]="Label",lD[lD.Brush=500]="Brush",lD[lD.CustomMark=500]="CustomMark",lD[lD.Interaction=700]="Interaction",t.LayoutLevel=void 0,(hD=t.LayoutLevel||(t.LayoutLevel={}))[hD.Indicator=10]="Indicator",hD[hD.Region=20]="Region",hD[hD.Axis=30]="Axis",hD[hD.DataZoom=40]="DataZoom",hD[hD.Player=40]="Player",hD[hD.ScrollBar=40]="ScrollBar",hD[hD.Legend=50]="Legend",hD[hD.Title=70]="Title",hD[hD.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(cD=t.AttributeLevel||(t.AttributeLevel={}))[cD.Default=0]="Default",cD[cD.Theme=1]="Theme",cD[cD.Chart=2]="Chart",cD[cD.Base_Series=3]="Base_Series",cD[cD.Series=4]="Series",cD[cD.Mark=5]="Mark",cD[cD.User_Chart=6]="User_Chart",cD[cD.User_Series=7]="User_Series",cD[cD.User_Mark=8]="User_Mark",cD[cD.User_SeriesStyle=9]="User_SeriesStyle",cD[cD.Built_In=99]="Built_In";class gD{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,j({},gD.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}gD.defaultMarkInfo={};class fD{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class mD{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>rO({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class vD extends fD{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=mD,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new gD,this._lastLayoutRect=null,this.id=ab(),this.userId=t.id,this._spec=t,this.effect={},this.event=new SI(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${BO}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=aO.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return L(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class _D{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=WR(YR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:UR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:UR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:UR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:UR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:UR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:UR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=UR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=UR(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=UR(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(GR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class yD extends vD{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new _D(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=j(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=j(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class bD extends mD{_initTheme(t,e){return{spec:t,theme:this._theme}}}class xD extends yD{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=bD,this.modelType="region",this.specKey="region",this.type=xD.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function SD(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function AD(t,e,i){e?t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function kD(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function MD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=ED(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),kD(d,!0,p,l),s&&AD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function TD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=ED(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=ED(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),kD(d,!1,p,o),s&&AD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function CD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=ED(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=ED(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=SD(t);n.length&&MD(n,e,i,!1,"left",s),r.length&&MD(r,e,i,!0,"left",s),a.length&&TD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=SD(t);n.length&&wD(n,e,i,!1,"top",s),r.length&&wD(r,e,i,!0,"top",s),a.length&&CD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=SD(t);n.length&&MD(n,e,i,!1,"right",s),r.length&&MD(r,e,i,!0,"right",s),a.length&&TD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=SD(t);n.length&&wD(n,e,i,!1,"bottom",s),r.length&&wD(r,e,i,!0,"bottom",s),a.length&&CD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=ED(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{U(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=ED(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Jy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}BD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(dD||(dD={})),t.STATE_VALUE_ENUM=void 0,(uD=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",uD.STATE_HOVER="hover",uD.STATE_HOVER_REVERSE="hover_reverse",uD.STATE_DIMENSION_HOVER="dimension_hover",uD.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",uD.STATE_SELECTED="selected",uD.STATE_SELECTED_REVERSE="selected_reverse",uD.STATE_SANKEY_EMPHASIS="selected",uD.STATE_SANKEY_EMPHASIS_REVERSE="blur",uD.STATE_HIGHLIGHT="highlight",uD.STATE_BLUR="blur",uD.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(pD||(pD={}));const PD=["linear","radial","conical"],LD={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const RD={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{RD[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class OD extends fD{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class ID extends OD{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,$I.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!RD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(BO)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(BO))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(JC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class DD extends fD{constructor(){super(...arguments),this.id=ab(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=aO.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class FD extends DD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const zD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,jD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=zD(l.delay,n,a,o),d=zD(l.duration,n,a,o),u=zD(l.oneByOne,n,a,o),p=zD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Qw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:tC)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Kw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Qw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:tC)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Gw(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Xw(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Ko.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new $w({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Hw,null!==(l=i.easing)&&void 0!==l?l:Vw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Ko.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new qw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Hw,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Vw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Kw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},HD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},VD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class ND extends DD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new FD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Lp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Ul)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==dD.enter&&t.context.diffState!==dD.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=e,this.model=i.model,this.key=i.key,this.state=new ID(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ae)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&rO(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(QC(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=DR(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):PD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):QC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=wR(TR(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},LD[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ei.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)PD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=wR(TR(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return KI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return aO.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[IO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=KI(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===GI.appear))?GI.appear:t.every((t=>t===GI.disappear))?GI.disappear:t[0];return null!=e?e:GI.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{VD(t),s.push(...t.getGraphics())})),e.forEach((t=>{VD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);jD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=HD(e,n),r=HD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===GI.exit?GI.exit:i===GI.update?GI.update:GI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===dD.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===dD.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=dD.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=dD.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=dD.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=GI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=GI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return qI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=qI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),u(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=xI(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=aO.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=aO.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===XI.before||(this._product||this._initProduct(),qy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===dD.exit&&!e.isExiting)if(e.context.animationState===dD.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:dD.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Lp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{t.clearStates()}))}}var UD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(UD||(UD={}));class WD extends ND{constructor(){super(...arguments),this.type=WD.type,this._marks=[],this._diffState=dD.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Zy("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Zy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return ZI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===dD.update){const t=this.hasAnimation(),e=xI(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=dD.update}render(){this._isCommited&&(qy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}WD.type="group";const GD={measureText:EO};class YD{static instance(){return YD.instance_||(YD.instance_=new YD),YD.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class XD{constructor(){this.id=ab(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Zy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class $D extends XD{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const KD={type:"fadeIn"};function qD(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return KD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const ZD={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},JD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},QD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},tF=()=>{aO.registerAnimation("scaleInOut",(()=>JD))},eF=()=>{aO.registerAnimation("fadeInOut",(()=>QD))},iF=(t,e)=>({appear:qD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:nC,duration:ZD.update.duration,easing:ZD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),sF=()=>{aO.registerAnimation("line",iF)},nF=()=>{kw.registerBuiltInAnimate("growPointsIn",bC),kw.registerBuiltInAnimate("growPointsOut",xC),kw.registerBuiltInAnimate("growPointsXIn",AC),kw.registerBuiltInAnimate("growPointsXOut",kC),kw.registerBuiltInAnimate("growPointsYIn",TC),kw.registerBuiltInAnimate("growPointsYOut",wC),kw.registerBuiltInAnimate("clipIn",oC),kw.registerBuiltInAnimate("clipOut",lC)},rF=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class aF{constructor(t){this._markSet=new gD,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const oF={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class lF extends aF{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},oF,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}lF.type="element-highlight",lF.defaultOptions=oF;const hF=()=>{aO.registerInteractionTrigger(lF.type,lF)},cF={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class dF extends aF{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},cF,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}dF.type="element-select",dF.defaultOptions=cF;const uF=()=>{aO.registerInteractionTrigger(dF.type,dF)};class pF extends XD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class gF{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>aO.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>aO.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>aO.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return aO.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>aO.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){aO.registerTransform(t,e)}static registerFunction(t,e){t&&e&&YD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&YD.instance().unregisterFunction(t)}static getFunction(t){return t?YD.instance().getFunction(t):null}static getFunctionList(){return YD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=aO.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=aO.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,OI.get(e);var e}static registerSVG(t,e,i){const s=aO.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=aO.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){xO.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=ab(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=eD.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=aD(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?aO.getSeriesBuiltInTheme(e):aO.getComponentBuiltInTheme(e);i=i?rO({},s,i[e]):s}s===t.length-1&&p(i)&&(i=MO({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},yR(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=ib(v);if(S?mx(bo):"node"===v&&tA(bo),S&&f&&(this._container=_(f)?O_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=SO.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new at(null!==(a=this._option.logLevel)&&void 0!==a?a:rt.Error);at.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new iD({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new PI(this,this._compiler),this._event=new SI(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),xO.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=rO({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=TO(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;gF.getFunctionList()&&gF.getFunctionList().length&&(t=wO(t,gF)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=aO.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=aO.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=aO.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=St(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return rD(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:PO,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:LO})}_initDataSet(t){this._dataSet=t instanceof Ea?t:new Ea,RI(this._dataSet,"dataview",Ta),RI(this._dataSet,"array",s),LI(this._dataSet,"copyDataView",HI);for(const t in aO.transforms)LI(this._dataSet,t,aO.transforms[t]);for(const t in aO.dataParser)RI(this._dataSet,t,aO.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(!0),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))):t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?GI.none:GI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,xO.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Ba?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=NI(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?rO({},t[n][e.index],i):i):t[n]=s?rO({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?rO({},t[n][r],i):i)}else t.id===e&&(t[n]=s?rO({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=rO({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=oO({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=AO(this._currentThemeName),this._currentTheme=o(a,l);else{const t=oO({},AO(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),AO(n),AO(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(iT.poptip,eT,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!ib(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return AO(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!SO.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield sD(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!ib(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t,e,i;null===(t=this._chart)||void 0===t||t.resetLayoutItemTag(),null===(e=this._chart)||void 0===e||e.setLayoutTag(!0,null,!1),null===(i=this._compiler)||void 0===i||i.render()}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?O_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?XR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Zy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?XR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Zy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return YD.instance().getFunction(t)}registerFunction(t,e){t&&e&&YD.instance().registerFunction(t,e)}unregisterFunction(t){t&&YD.instance().unregisterFunction(t)}getFunctionList(){return YD.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=aO.getChartPlugins();t.length>0&&(this._chartPlugin=new $D(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=aO.getVChartPlugins();e.length>0&&(this._vChartPlugin=new pF(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=eD.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;this._renderState=eD.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent()}}gF.InstanceManager=xO,gF.ThemeManager=SO,gF.globalConfig={uniqueTooltip:!0},gF.Utils=GD,gF.vglobal=O_;aO.registerRegion("region",xD),aO.registerLayout("base",BD),hM(),Kk(),aO.registerMark(WD.type,WD),aO.registerStageEventPlugin("gesture",jb),hF(),uF(),mO(tO.name,tO);const fF="monotone",mF="linear",vF="bevel";function _F(t,e){return e("component",t)}function yF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=aO.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const bF=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},xF=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))},SF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},AF=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=yF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},kF=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const MF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function TF(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=CF(AF(h,r,a,c),d,g),o.value=CF(AF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=AF(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function wF(t,e,i,s,n,r,a){if(d(e)){TF(t,e(n,a),i,s,r,a)}else e&&TF(t,e,i,s,r,a)}const CF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=fi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class EF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{wF(a,t,e,i,s,n,r)})):d(t)?wF(a,t,e,i,s,n,r):t&&TF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:AF(r.visible,t,n),value:CF(AF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:AF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=AF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&MF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const BF={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?$(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?$(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},PF=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=sI([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return LF(a,n,o)},LF=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{ob(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{ob(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=BF[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},RF=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{ob(t[e])||(t[e]=0)}))})),t},OF=`${BO}_HIERARCHY_DEPTH`,IF=`${BO}_HIERARCHY_ROOT`,DF=`${BO}_HIERARCHY_ROOT_INDEX`;function FF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function zF(t,e,i){t&&(i.needDefaultSeriesField&&(t[DO]=i.defaultSeriesField),t[OO]=e,t[IO]=i.getKey(t,e,i))}function jF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function HF(t,e,i,s=0,n,r){void 0===r&&(r=e),zF(t,e,i),t[OF]=s,t[IF]=n||t[i.categoryField],t[DF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>HF(e,s,i,t[OF]+1,t[IF],r)))}const VF={label:{name:"label",type:"text"}},NF=`${BO}_rect_x`,UF=`${BO}_rect_x1`,WF=`${BO}_rect_y`,GF=`${BO}_rect_y1`,YF={data:!0},XF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},$F=[...Object.keys(ZD),"normal"];function KF(t={},e,i){const s={};for(let n=0;n<$F.length;n++){const r=$F[n],a=e?e[r]:void 0;if(!1===a)continue;if("normal"===r){a&&(s.normal=a);continue}if("state"===r){!1!==a&&(s.state=null!=a?a:ZD.state);continue}if("update"!==r&&!a&&!t[r])continue;let o,l;(o=y(t[r])?t[r]:[Object.assign(Object.assign({},ZD[r]),t[r])],"exit"===r&&o.forEach((t=>{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return tz(n)&&delete n.type,n.oneByOne&&(n=ZF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:JF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=rO({},o[e],a);return tz(n)&&delete n.type,n.oneByOne&&(n=ZF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:JF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function qF(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),ez(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function ZF(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function JF(t,e){var i;return null!==(i=null==t?void 0:t[OO])&&void 0!==i?i:e.context.graphicIndex}function QF(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function tz(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function ez(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),ez(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),ez(t[s],e,i))}function iz(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class sz extends mD{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=AR(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=aO.getSeriesMarkMap(o)?function(t,e,i){const s=aO.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=rO({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return rO({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=rO({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>rO({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class nz extends vD{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${BO}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=sz,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=iz(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(LI(this._rawData.dataSet,"invalidTravel",RF),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=NI(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=VI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=VI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new FD(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=$(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=LF(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){LI(this._dataSet,"dimensionStatistics",PF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Ba(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&sI(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){LI(this._dataSet,"dimensionStatistics",PF);const s=new Ba(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=sI(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&sI(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Ba(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(LI(this._rawData.dataSet,"addVChartProperty",SF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:FF.bind(this),call:zF}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=KF({},qF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:sb(s)||nb(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=rO(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=rO(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=rF(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=rF(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=rF(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:DO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:FO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,FO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new EF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},YF),XF),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>XF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ba||UI(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();iz(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:DO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new OR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return TR(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:DO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,rO({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:IO}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==HO&&t!==NO&&t!==jO&&t!==VO||(t=this.getStackValueField()),null!==(e=rI(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>ob(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:DO]}}function rz(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();JC(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function az(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}nz.mark=VF,nz.transformerConstructor=sz;class oz extends nz{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);JC(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${BO}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(HO),this.setFieldX2(jO)):(this.setFieldY(HO),this.setFieldY2(jO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(NO),this.setFieldX2(VO)):(this.setFieldY(NO),this.setFieldY2(VO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(WO),this.setFieldX2(UO)):(this.setFieldY(WO),this.setFieldY2(UO))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(rz("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function lz(t){return"bottom"===t||"top"===t}function hz(t){return"left"===t||"right"===t}function cz(t){return"z"===t}function dz(t,e){return HR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function uz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function pz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?lz(t)?"linear":"band":lz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const gz=(t,e,i)=>{var s;const n=null!==(s="band"===e?_F("axisBand",i):["linear","log","symlog"].includes(e)?_F("axisLinear",i):{})&&void 0!==s?s:{},r=lz(t)?_F("axisX",i):hz(t)?_F("axisY",i):_F("axisZ",i);return rO({},_F("axis",i),n,r)};class fz{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:Jy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:Jy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>tE(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return lz(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class mz extends fz{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:TI.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const vz=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},_z=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},yz=(t,e,i,s)=>{var n;const r=e.getScale(),a=tE(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:bz(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,xz=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class Sz extends fz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!vz(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:TI.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:TI.canvas}),callback:this.onMouseOut}),sb(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:TI.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),sb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var Az;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Az||(Az={}));const kz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class Mz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(kz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:vF,curveType:mF,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===fF?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(kz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:QF(this._spec,kz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Ba(this._option.dataSet,{name:`${BO}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Az.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[kz.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(Az.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,rO({},this._spec[kz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Tz=Object.assign(Object.assign({},VF),kz),wz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>wz(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},Cz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class Ez extends ND{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return Cz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(QC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?wz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:dD.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[IO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class Bz extends Ez{constructor(){super(...arguments),this.type=Bz.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)===xR.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}Bz.type="line";const Pz=()=>{aO.registerMark(Bz.type,Bz),hM(),Qk(),HB(),IB(),nF(),aO.registerGraphicComponent("line",Pg)};class Lz extends ND{constructor(){super(...arguments),this.type=Lz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}Lz.type="symbol";const Rz=()=>{aO.registerMark(Lz.type,Lz),hM(),dM(),IB(),aO.registerGraphicComponent("symbol",Cg)};class Oz extends sz{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function Iz(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function Dz(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function Fz(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function zz(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function jz(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function Hz(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const Vz=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=se(t,e),a=Math.max(ee(i),ee(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return YC(v)};class Nz{constructor(t){this.id=ab(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Uz extends Nz{constructor(){super(Uz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!JC(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&Iz(c)&&Iz(d)))return;const u=Dz(t,c),p=Dz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!zz(u,p))return}else if(0===y&&0===b){if(!zz(p,u))return}else if(_||A)if(_&&!A){if(!Fz(u,p))return}else if(A&&!_){if(!Fz(p,u))return}else{if(f===b)return;if(f>b){if(!jz(u,p))return}else if(!jz(p,u))return}else{if(0===f&&0===y){if(!Hz(u,p))return}else if(0===b&&0===g&&!Hz(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){LI(e.getOption().dataSet,"tickAlign",Vz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Uz.pluginType="component",Uz.type="AxisSyncPlugin";const Wz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Gz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function Yz(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function Xz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const $z=t=>"band"===t||"ordinal"===t||"point"===t;function Kz(t,e){return{id:t,label:t,value:e,rawValue:t}}function qz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class Zz extends XD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const Jz=`${BO}_ARC_TRANSFORM_VALUE`,Qz=`${BO}_ARC_RATIO`,tj=`${BO}_ARC_START_ANGLE`,ej=`${BO}_ARC_END_ANGLE`,ij=`${BO}_ARC_K`,sj=`${BO}_ARC_MIDDLE_ANGLE`,nj=`${BO}_ARC_QUADRANT`,rj=`${BO}_ARC_RADIAN`,aj=-Math.PI/2,oj=3*Math.PI/2,lj=.6,hj=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return pe(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},cj=(t,e,i)=>{var s;const n=null!==(s="band"===e?_F("axisBand",i):"linear"===e?_F("axisLinear",i):{})&&void 0!==s?s:{},r=_F("angle"===t?"axisAngle":"axisRadius",i);return rO({},_F("axis",i),n,r)};function dj(t,e,i,s){switch(t){case r.cartesianBandAxis:return gz(dz(i,["z"]),"band",e);case r.cartesianLinearAxis:return gz(dz(i,["z"]),"linear",e);case r.cartesianLogAxis:return gz(dz(i,["z"]),"log",e);case r.cartesianSymlogAxis:return gz(dz(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return gz(dz(i),void 0,e);case r.polarBandAxis:return cj(i.orient,"band",e);case r.polarLinearAxis:return cj(i.orient,"linear",e);case r.polarAxis:return cj(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=_F(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>lz(t.orient)));let g;g=p(u)?rO({},$z(u.type)?a:o,l):l;const f=n.find((t=>hz(t.orient)));let m;return m=p(f)?rO({},tE(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=_F(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?rO({},$z(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?rO({},tE(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return uj(i,_F(t,e));default:return _F(t,e)}}const uj=(t,e)=>{var i;const s=rO({},e,e[uz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class pj extends mD{getTheme(t,e){return dj(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},YR(e)),{[s]:0}))}}class gj extends yD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=pj,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof zc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:TI.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new Zz(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!U(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(t.release(!0),null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var fj,mj;gj.transformerConstructor=pj,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(fj||(fj={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(mj||(mj={}));class vj extends ND{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=aO.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(AI.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}vj.type="component";const _j=()=>{aO.registerMark(vj.type,vj)},yj=t=>t;class bj extends gj{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?fj.circleAxis:fj.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?mj.circleAxisGrid:mj.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=KF(null===(h=aO.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this._specVisible&&(this.getVisible()||this._spec.forceInitTick||this._hideWhenEmpty)}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new FD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&fR(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?JC(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!JC(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return fR(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=mR(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),fR(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):fR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(fR(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=$(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=fI(s=t.domainLine)).startSymbol=fI(s.startSymbol),s.endSymbol=fI(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return _I(rO({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:_I(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>_I(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=_I(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return _I(rO({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:_I(t.tick.style)),t.tick.state&&(i.tick.state=mI(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return _I(rO({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:_I(t.subTick.style)),t.subTick.state&&(i.subTick.state=mI(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=Wz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ae(p):null,textStyle:rO({},d,_I(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:_I(h.style)}),h.state&&(i.title.state.shape=mI(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:_I(o.style)}),o.state&&(i.title.state.background=mI(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=mI(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=_I(t.background.style)),t.background.state&&(i.panel.state=mI(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:CO(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return _I(rO({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:_I(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:CO(t.subGrid.alternateColor),style:_I(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=yF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){RI(this._option.dataSet,"scale",yj);const i=this.registerTicksTransform();return new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===CT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}bj.specKey="axes";const xj=()=>{_j(),aO.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},Sj=[Uz];class Aj extends bj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),fR(this._regions,(t=>{const e=this.getOrient();lz(e)?qz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):hz(e)?qz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):cz(e)&&qz(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=rO({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(rO({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=lz(this.getOrient()),n=t=>{var e;return(s?!lz(t.getOrient()):lz(t.getOrient()))&&JC(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=dz(i,["z"]),cz(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!Xz(e))return null;const{axisType:t,componentName:s}=pz(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>hz(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!Xz(t))return;const{axisType:s,componentName:n}=pz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=aO.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return lz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):cz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(Sj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){lz(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!lz(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!cz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;hz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=UR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=UR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=lz(this.getOrient())?t.fieldX:cz(this.getOrient())?t.fieldZ:t.fieldY,JC(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:JC(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(AI.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(lz(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=lz(this._orient)?{x:$(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return fR(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:lz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:cz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();fR(this._regions,(e=>{lz(t)?qz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):hz(t)?qz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):cz(t)&&qz(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=lz(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=lz(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=rO(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new He).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=lz(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?vt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):vt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return Kz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:JC(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}Aj.type=r.cartesianAxis,Aj.specKey="axes";const kj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Mj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,wj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function Cj(t,e,i="count"){const s=wj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const Ej=Math.sqrt(50),Bj=Math.sqrt(10),Pj=Math.sqrt(2);class Lj{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=Yz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=lz(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Tj),e.sort(Tj),{domain:Mj(t,e),scope:Cj(t,e,i)}}(r,$y(t),this._spec.breaks[0].scopeType);e=$y(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=Yz(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-$(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=Ej?10:n>=Bj?5:n>=Pj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const Rj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},Oj={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},Ij={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},Dj={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}};class Fj extends Aj{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new NE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!cz(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=lz(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=VR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=$y(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return LI(this._option.dataSet,t,ZE),t}}Fj.type=r.cartesianLinearAxis,Fj.specKey="axes",Fj.builtInTheme={axis:Dj,axisLinear:Rj,axisX:Oj,axisY:Ij},G(Fj,Lj);const zj=()=>{aO.registerGraphicComponent(fj.lineAxis,((t,e)=>new jC(t,e))),aO.registerGraphicComponent(mj.lineAxisGrid,((t,e)=>new KB(t,e))),xj(),aO.registerComponent(Fj.type,Fj)};class jj{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new FD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=Kz(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>Kz(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const Hj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class Vj extends Aj{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new xE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return LI(this._option.dataSet,t,iB),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=uE(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{aO.registerGraphicComponent(fj.lineAxis,((t,e)=>new jC(t,e))),aO.registerGraphicComponent(mj.lineAxisGrid,((t,e)=>new KB(t,e))),xj(),aO.registerComponent(Vj.type,Vj,!1)};class Uj extends Fj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),fR(this._regions,(t=>{lz(this.getOrient())?qz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):qz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=rO({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new FD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=fi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>Kz(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>Kz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return LI(this._option.dataSet,t,ZE),t}transformScaleDomain(){}}Uj.type=r.cartesianTimeAxis,Uj.specKey="axes",Uj.builtInTheme={axis:Dj,axisX:Oj,axisY:Ij};class Wj extends Fj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new YE}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return LI(this._option.dataSet,t,ZE),t}transformScaleDomain(){}}Wj.type=r.cartesianLogAxis,Wj.specKey="axes",Wj.builtInTheme={axis:Dj,axisLinear:Rj,axisX:Oj,axisY:Ij},G(Wj,Lj);class Gj extends Fj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new XE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return LI(this._option.dataSet,t,ZE),t}transformScaleDomain(){}}Gj.type=r.cartesianSymlogAxis,Gj.specKey="axes",Gj.builtInTheme={axis:Dj,axisLinear:Rj,axisX:Oj,axisY:Ij},G(Gj,Lj);const Yj=`${BO}_hide_`;function Xj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const $j=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[Yj]&&(Xj(t,!0),t[Yj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[Yj]=!0,Xj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},Kj=()=>{aO.registerGrammarTransform("symbolOverlap",{transform:$j,runType:"afterEncode"})},qj={min:K,max:$,average:cR,sum:hR};function Zj(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function Jj(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function Qj(t,e,i,s){return Jj(t,e,i,"min",s)}function tH(t,e,i,s){return Jj(t,e,i,"max",s)}function eH(t,e,i,s){return Jj(t,e,i,"average",s)}function iH(t,e,i,s){return Jj(t,e,i,"sum",s)}const sH=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=Zj;if("min"===n?l=Qj:"max"===n?l=tH:"average"===n?l=eH:"sum"===n&&(l=iH),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},nH=()=>{aO.registerGrammarTransform("dataSampling",{transform:sH})};class rH extends oz{constructor(){super(...arguments),this.type=xR.line,this.transformerConstructor=Oz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(KF(null===(i=aO.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),qF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=az(this);this._symbolMark.setAnimationConfig(KF(null===(s=aO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),qF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}rH.type=xR.line,rH.mark=Tz,rH.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},rH.transformerConstructor=Oz,G(rH,Mz);class aH{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{UI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Ba)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Zy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Zy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class oH{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{lb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{sI(e,[{key:t,operations:JC(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&sI(e,[{key:i.field,operations:JC(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?DR("colorOrdinal"):DR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(lb(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(U(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),lb(s.domain)?e.reRender=!0:U(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!lb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=JC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=JC(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;JC(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(JC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=JC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));JC(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class lH{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class hH extends fD{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=ab(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:PO,height:LO},this._viewRect={width:PO,height:LO},this._viewBox={x1:0,y1:0,x2:PO,y2:LO},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=YR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new SI(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new aH(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new lH;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=aO.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(KF({},qF("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=aO.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=aO.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof vD)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof ND))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof ND)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&UI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=rD(this._spec,this._option,{width:PO,height:LO})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=TR(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new oH(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){aD(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=TR(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{aD(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,aD(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):aD(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];aD(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=WR(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(AI.AFTER_MARK_RENDER_END,e)};this._event.on(AI.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:bI;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(yI(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===Az.dimensionHover||s===Az.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>tE(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>tE(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const cH=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class dH{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):iO(t,a,c.spec),iO(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=cH(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=cH(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(aO.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(aO.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=aO.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=aO.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=aO.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):bF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=bF(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class uH extends dH{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),L(i,"trimPadding")&&rO(i,oD(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class pH extends uH{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),nD(t)}}const gH=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=aI(t,!0);for(const e in o)for(const i in o[e].nodes)cI(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)hI(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&lI(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class mH{_beforeInit(){this._dataSet&&LI(this._dataSet,"stackSplit",gH)}_initStack(){this._stack=new fH(this),this._stack.init()}}const vH={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:Az.dimensionHover};class _H extends aF{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},vH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=bI(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}_H.type="dimension-hover",_H.defaultOptions=vH;const yH=()=>{aO.registerInteractionTrigger(_H.type,_H)},bH=()=>{aO.registerComposedEvent(Az.dimensionHover,Sz),aO.registerComposedEvent(Az.dimensionClick,mz)},xH=t=>t.fieldX[0],SH=t=>t.fieldY[0],AH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},kH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},MH=(t,e)=>t?e?xH:AH:e?SH:kH,TH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=xz(t,(t=>lz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=xz(t,(t=>hz(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{tE(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=wH(t,i,MH(e,tE(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=wH(t,i,MH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},wH=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:CH(t,s,i)},CH=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=yz(e,t,"cartesian",null!=i?i:lz(t.getOrient())?xH:SH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},EH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(tE(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(JC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Gz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};PH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&BH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),BH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=yF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},PH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},LH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=RH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},RH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},OH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return EH(c,r,e),c.xField.cacheInfo?LH(c.xField):c.yField.cacheInfo?LH(c.yField):void 0},IH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],DH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&IH.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(FH(s).every((t=>{var e;return!MF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},FH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},zH={dom:`${BO}_TOOLTIP_HANDLER_DOM`,canvas:`${BO}_TOOLTIP_HANDLER_CANVAS`},jH={key:"其他",value:"..."};var HH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(HH||(HH={}));class VH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=DH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},jH),t):jH;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&MF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class NH extends VH{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!tE(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const UH=()=>{aO.registerTooltipProcessor("dimension",NH)};class WH extends VH{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,$o.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(bI(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const GH=()=>{aO.registerTooltipProcessor("mark",WH)};class YH extends VH{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const XH=()=>{aO.registerTooltipProcessor("group",YH)};class $H extends hH{constructor(){super(...arguments),this.transformerConstructor=pH,this.type="line",this.seriesType=xR.line}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=CH,this._modelOption.getRectByDimensionData=OH}}$H.type="line",$H.seriesType=xR.line,$H.transformerConstructor=pH,G($H,mH);const KH=[...Cz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class qH extends Ez{constructor(){super(...arguments),this.type=qH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return KH}_getIgnoreAttributes(){return[]}}qH.type="area";const ZH=()=>{aO.registerMark(qH.type,qH),hM(),Uk(),HB(),IB(),nF(),aO.registerGraphicComponent("area",sf)};class JH extends EF{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const QH=Object.assign(Object.assign(Object.assign({},VF),kz),{area:{name:"area",type:"area"}}),tV=()=>{aO.registerAnimation("area",iF),sF(),tF()};class eV extends Oz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=rO({},f.style,g.style),l.state=rO({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class iV extends oz{constructor(){super(...arguments),this.type=xR.area,this.transformerConstructor=eV,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(iV.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===fF?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return FR(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return FR(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[HO]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(KF(null===(e=aO.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),qF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(KF(null===(i=aO.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),qF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=az(this);this._symbolMark.setAnimationConfig(KF(null===(s=aO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),qF("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new JH(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}iV.type=xR.area,iV.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},iV.mark=QH,iV.transformerConstructor=eV,G(iV,Mz);class sV extends uH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),nD(t)}}class nV extends hH{constructor(){super(...arguments),this.transformerConstructor=sV,this.type="area",this.seriesType=xR.area}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=CH,this._modelOption.getRectByDimensionData=OH}}nV.type="area",nV.seriesType=xR.area,nV.transformerConstructor=sV,G(nV,mH);function rV(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const aV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:rV(t,e)}),oV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:rV(t,e)}),lV={type:"fadeIn"},hV={type:"growCenterIn"};function cV(t,e){if(!1===e)return{};switch(e){case"fadeIn":return lV;case"scaleIn":return hV;default:return aV(t)}}class dV extends ND{constructor(){super(...arguments),this.type=dV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}dV.type="rect";const uV=()=>{hM(),rM(),LB("rect",FB),aO.registerMark(dV.type,dV),kw.registerBuiltInAnimate("growHeightIn",mC),kw.registerBuiltInAnimate("growHeightOut",vC),kw.registerBuiltInAnimate("growWidthIn",RC),kw.registerBuiltInAnimate("growWidthOut",OC),kw.registerBuiltInAnimate("growCenterIn",pC),kw.registerBuiltInAnimate("growCenterOut",gC),aO.registerGraphicComponent("rect",Ig)},pV=Object.assign(Object.assign({},VF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function gV(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=$R(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[NF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):FR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[UF]):FR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=FR(this._dataToPosX(t),e,i),n=FR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[WF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):FR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[GF]):FR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=FR(this._dataToPosY(t),e,i),n=FR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},vV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:QF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(vV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(LI(this._option.dataSet,"addVChartProperty",SF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};LI(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Ba(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:FF.bind(this),call:zF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new FD(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=GF,s=WF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=UF,s=NF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=aI(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)gV(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=FR(this[r](t),l,i),u=FR(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!zR(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[jO],n=e[HO],r=e[VO],d=e[NO];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?WF:NF],i=e[a?GF:UF];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[jO]:s,[HO]:o}),c?{[VO]:u,[NO]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(Ig(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>FR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>FR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=$(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=az(this);this._barMark.setAnimationConfig(KF(null===(e=aO.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),qF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=$R(this._spec.barWidth,a)),l&&(c=Math.max(c,$R(this._spec.barMinWidth,a))),h&&(c=Math.min(c,$R(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=$R(null!==(l=i[r-1])&&void 0!==l?l:X(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=JC(g.type||"band");return d(e,m)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}vV.type=xR.bar,vV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},vV.mark=pV,vV.transformerConstructor=mV;const _V=()=>{nH(),uV(),aO.registerAnimation("bar",((t,e)=>({appear:cV(t,e),enter:aV(t,!1),exit:oV(t,!1),disappear:{duration:ZD.disappear.duration}}))),Nj(),zj(),aO.registerSeries(vV.type,vV)};class yV extends uH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),nD(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class bV extends hH{constructor(){super(...arguments),this.transformerConstructor=yV,this.type="bar",this.seriesType=xR.bar}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=CH,this._modelOption.getRectByDimensionData=OH}}bV.type="bar",bV.seriesType=xR.bar,bV.transformerConstructor=yV,G(bV,mH);const xV=[10,20],SV=qC.Linear,AV="circle",kV=qC.Ordinal,MV=["circle","square","triangle","diamond","star"],TV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},wV=Object.assign(Object.assign({},VF),{point:{name:"point",type:"symbol"}});class CV extends sz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class EV extends oz{constructor(){super(...arguments),this.type=xR.scatter,this.transformerConstructor=CV,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${BO}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${BO}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:SV,defaultRange:xV},"size")}getShapeAttribute(t,e){return u(e)?AV:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:kV,defaultRange:MV},"shape")}initMark(){this._symbolMark=this._createMark(EV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:QF(this._spec,EV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=az(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(KF(null===(i=aO.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),qF("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:AV},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i,s,n;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.y)}))}));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==r?void 0:r.renderInner)&&r.renderInner();const a=null===(i=null==r?void 0:r.getComponent)||void 0===i?void 0:i.call(r);(null==a?void 0:a.evaluate)&&a.evaluate(null,null);const o=null===(s=null==r?void 0:r.getProduct)||void 0===s?void 0:s.call(r);o&&(null==t?void 0:t.scale)&&(null==t?void 0:t.scaleCenter)&&((null===(n=o.attribute)||void 0===n?void 0:n.postMatrix)||o.setAttributes({postMatrix:new Ue}),o.scale(t.scale,t.scale,t.scaleCenter))}handlePan(t){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}EV.type=xR.scatter,EV.mark=wV,EV.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},EV.transformerConstructor=CV;const BV=()=>{Rz(),aO.registerAnimation("scatter",((t,e)=>Object.assign({appear:TV(0,e)},JD))),Nj(),zj(),aO.registerSeries(EV.type,EV)};class PV extends uH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class LV extends hH{constructor(){super(...arguments),this.transformerConstructor=PV,this.type="scatter",this.seriesType=xR.scatter}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=CH,this._modelOption.getRectByDimensionData=OH}}LV.type="scatter",LV.seriesType=xR.scatter,LV.transformerConstructor=PV,G(LV,mH);class RV extends nz{constructor(){super(...arguments),this.type=xR.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${BO}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const OV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[OO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[iI]=e.nameMap[n]:t[iI]=n})),t.features);class IV extends EF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class DV extends ND{constructor(){super(...arguments),this.type=DV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}DV.type="path";const FV=()=>{aO.registerMark(DV.type,DV),hM(),eM(),aO.registerGraphicComponent("path",Qg)},zV=Object.assign(Object.assign({},VF),{area:{name:"area",type:"path"}});class jV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Oa(i,e):La[i]?(Pa[i]||(Pa[i]=Oa(i,La[i])),Pa[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class HV{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class VV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function NV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:HV}:sb(e)||nb(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:VV}:null}const UV={debounce:xt,throttle:St};class WV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=sb(this._renderMode)||nb(this._renderMode),NV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return NV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!Ae({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:wI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:wI.chart,consume:!1}];l.on(...c,UV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,UV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||NV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||NV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:Ae({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:wI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:wI.chart,consume:!1}];l.on(...c,UV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,UV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){NV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||NV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:wI.chart},(t=>{if(!t.event)return;const{event:n}=t;Ae({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:wI.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||NV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:wI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||NV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:wI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:wI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:wI.chart,source:TI.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:wI.chart,source:TI.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=UV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=UV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:wI.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:wI.chart,source:TI.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:wI.chart,source:TI.chart},this._handleDragMouseUp)}))}}function GV(t,e){return`${BO}_${e}_${t}`}class YV extends gj{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:GV(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=rO(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new jV(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===xR.map||e.type===xR.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),fR(this._regions,(t=>{var e;if(t.type===xR.map||t.type===xR.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==xR.map&&e.type!==xR.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[iI],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}YV.type=r.geoCoordinate,G(YV,WV);const XV=()=>{aO.registerComponent(YV.type,YV)};class $V extends sz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class KV extends RV{constructor(){super(...arguments),this.type=xR.map,this.transformerConstructor=$V,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),OI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),LI(this._dataSet,"copyDataView",HI),LI(this._dataSet,"map",OV),LI(this._dataSet,"lookup",xF);const s=OI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Ba(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:iI,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new FD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(KV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:QF(this._spec,KV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:DO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:DO]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(KF(null===(t=aO.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),qF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new IV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[OO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[OO],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s,n;const{scale:r,scaleCenter:a}=t;if(1===r)return;const o=this.getRootMark().getProduct();o&&(o.attribute.postMatrix||o.setAttributes({postMatrix:new Ue}),o.scale(r,r,a));const l=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==l?void 0:l.renderInner)&&l.renderInner();const h=null===(i=null==l?void 0:l.getComponent)||void 0===i?void 0:i.call(l);(null==h?void 0:h.evaluate)&&h.evaluate(null,null);const c=null===(s=null==l?void 0:l.getProduct)||void 0===s?void 0:s.call(l);c&&r&&a&&((null===(n=c.attribute)||void 0===n?void 0:n.postMatrix)||c.setAttributes({postMatrix:new Ue}),c.scale(r,r,a))}handlePan(t){var e,i,s,n;const{delta:r}=t;if(0===r[0]&&0===r[1])return;const a=this.getRootMark().getProduct();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new Ue}),a.translate(r[0],r[1]));const o=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();(null==o?void 0:o.renderInner)&&o.renderInner();const l=null===(i=null==o?void 0:o.getComponent)||void 0===i?void 0:i.call(o);(null==l?void 0:l.evaluate)&&l.evaluate(null,null);const h=null===(s=null==o?void 0:o.getProduct)||void 0===s?void 0:s.call(o);h&&r&&((null===(n=h.attribute)||void 0===n?void 0:n.postMatrix)||h.setAttributes({postMatrix:new Ue}),h.translate(r[0],r[1]))}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return OO}getActiveMarks(){return[this._pathMark]}}KV.type=xR.map,KV.mark=zV,KV.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},KV.transformerConstructor=$V;const qV=`${BO}_waterfall_default_seriesField`,ZV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[XO]=!0:delete t[XO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=JV([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const f=g[0];let{start:m,end:v}=QV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>se(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ie(_,e)):(t[c]=+y,y=ie(y,e)),t[d]=ie(t[c],e),m=ie(m,e),b=se(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=JV(r,t,n,a,c,h,i,e),a.push(n)})),a};function JV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=QV(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=ie(i.positive,e)):(t[h]=+i.negative,i.negative=ie(i.negative,e)),t[c]=ie(t[h],e),i.end=ie(i.end,e)}i.isTotal=e,(u(p)||p===qV)&&(t[qV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function QV(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?Zy("total.collectCountField error"):n=e[a].start;o<0?Zy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=ie(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const tN=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ie(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},eN={type:"fadeIn"},iN={type:"growCenterIn"};function sN(t,e){switch(e){case"fadeIn":return eN;case"scaleIn":return iN;default:return aV(t,!1)}}class nN extends ND{constructor(){super(...arguments),this.type=nN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Pg(t)}}nN.type="rule";const rN=()=>{aO.registerMark(nN.type,nN),hM(),Qk(),aO.registerGraphicComponent("line",Pg)},aN=Object.assign(Object.assign({},pV),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),oN=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:lN(t.map((t=>t.latestData)).flat(),e.fields,i)}};function lN(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>lN(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class hN{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new Ba(e instanceof Ea?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),LI(e,"dimensionTree",oN),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class cN extends mV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const dN={rect:vN,symbol:fN,arc:yN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=fN(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:bN,line:xN,area:xN,rect3d:vN,arc3d:yN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function uN(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=dN[t])&&void 0!==i?i:dN.point;return e.series.type===xR.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=gN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:SN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function pN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==xR.sankey){const{formatFunc:t,args:n}=yF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function gN(t){return d(t)?e=>t(e.data):t}function fN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=gN(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:mN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function mN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function vN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=gN(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:_N(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function _N(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function yN(t){var e;const{labelSpec:i}=t,s=null!==(e=gN(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function bN(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=pN(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Mg(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function xN(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[DO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function SN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class AN extends vV{constructor(){super(...arguments),this.type=xR.waterfall,this.transformerConstructor=cN,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&lI(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new hN(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=qV)}getSeriesKeys(){return this._seriesField===qV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),LI(this._dataSet,"waterfallFillTotal",tN),LI(this._dataSet,"waterfall",ZV),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=VI(this.getViewData(),this._dataSet,{name:`${BO}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new FD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:jO,endAs:HO,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=az(this);this._barMark.setAnimationConfig(KF(null===(i=aO.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),qF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(KF(null===(s=aO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),qF("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(AN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:se(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:se(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return bN(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?FR(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):FR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&zR([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}AN.type=xR.waterfall,AN.mark=aN,AN.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},AN.transformerConstructor=cN;const kN=()=>{rN(),uV(),aO.registerAnimation("waterfall",((t,e)=>({appear:sN(t,e),enter:aV(t,!1),exit:oV(t,!1),disappear:{duration:ZD.disappear.duration}}))),eF(),Nj(),zj(),aO.registerSeries(AN.type,AN)},MN=`${BO}_BOX_PLOT_OUTLIER_VALUE`;var TN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(TN||(TN={}));const wN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[MN]:e};return n.forEach((e=>{i[e]=t[e]})),p(r)&&(i[r]=t[r]),i})))})),i};class CN extends EF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===TN.OUTLIER)return this.series.getOutliersField();if(t===TN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case TN.MIN:return this.series.getMinField();case TN.MAX:return this.series.getMaxField();case TN.MEDIAN:return this.series.getMedianField();case TN.Q1:return this.series.getQ1Field();case TN.Q3:return this.series.getQ3Field();case TN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===TN.OUTLIER)return e[MN];if(t===TN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case TN.MIN:return e[this.series.getMinField()];case TN.MAX:return e[this.series.getMaxField()];case TN.MEDIAN:return e[this.series.getMedianField()];case TN.Q1:return e[this.series.getQ1Field()];case TN.Q3:return e[this.series.getQ3Field()];case TN.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[MN])}getDefaultContentList(t){return[{key:this.getContentKey(TN.OUTLIER),value:this.getContentValue(TN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(TN.MAX),value:this.getContentValue(TN.MAX)},{key:this.getContentKey(TN.Q3),value:this.getContentValue(TN.Q3)},{key:this.getContentKey(TN.MEDIAN),value:this.getContentValue(TN.MEDIAN)},{key:this.getContentKey(TN.Q1),value:this.getContentValue(TN.Q1)},{key:this.getContentKey(TN.MIN),value:this.getContentValue(TN.MIN)},{key:this.getContentKey(TN.SERIES_FIELD),value:this.getContentValue(TN.SERIES_FIELD)}]}}class EN extends ND{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==dD.enter&&t.context.diffState!==dD.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Fg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=aO.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const BN=()=>{aO.registerGraphicComponent("glyph",Fg),hM(),Xk()},PN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],LN=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class RN extends EN{constructor(){super(...arguments),this.type=RN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=PN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=LN,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}RN.type="boxPlot";const ON=Object.assign(Object.assign({},VF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),IN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},DN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},FN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),zN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=FN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=FN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=FN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=FN(t,"box").attribute.width,i=FN(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=FN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=FN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=FN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=FN(t,"box").attribute.height,i=FN(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},jN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=FN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=FN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=FN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=FN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=FN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=FN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=FN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=FN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=FN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=FN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class HN extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return IN(zN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class VN extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return DN(zN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class NN extends HN{computeAttribute(){return IN(jN)(this.target,this.params,this.params.options)}}class UN extends VN{computeAttribute(){return DN(jN)(this.target,this.params,this.params.options)}}class WN extends sz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class GN extends oz{constructor(){super(...arguments),this.type=xR.boxPlot,this.transformerConstructor=WN,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(GN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(GN.mark.outlier,{key:OO,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return $R(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return $R(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>FR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>FR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>FR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>FR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>FR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>FR(e(this.getDatumPositionValues(t,MN),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>FR(e(this.getDatumPositionValues(t,MN),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;LI(this._dataSet,"foldOutlierData",wN),LI(this._dataSet,"addVChartProperty",SF);const t=new Ba(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${BO}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:FF.bind(this),call:zF}},!1),this._outlierData=new FD(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=$R(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,$R(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,$R(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=$R(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=JC(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=az(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=aO.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(qF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(KF(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(KF(null===(a=aO.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new CN(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}GN.type=xR.boxPlot,GN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},GN.mark=ON,GN.transformerConstructor=WN;const YN=()=>{BN(),Qk(),rM(),aO.registerGraphicComponent("line",(t=>Pg(t))),aO.registerGraphicComponent("rect",(t=>Ig(t))),aO.registerMark(RN.type,RN),Rz(),tF(),Nj(),zj(),kw.registerBuiltInAnimate("boxplotScaleIn",HN),kw.registerBuiltInAnimate("boxplotScaleOut",VN),kw.registerBuiltInAnimate("barBoxplotScaleIn",NN),kw.registerBuiltInAnimate("barBoxplotScaleOut",UN),aO.registerSeries(GN.type,GN)};class XN extends ND{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=XN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?qg(t):Mg(t)}}XN.type="text";const $N=()=>{aO.registerMark(XN.type,XN),hM(),pM(),oM(),aO.registerGraphicComponent("text",Mg),aO.registerGraphicComponent("richtext",qg)};class KN extends EF{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const qN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),ZN={type:"fadeIn"},JN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function QN(t,e){return"fadeIn"===e?ZN:qN(t)}const tU=Object.assign(Object.assign({},pV),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class eU extends mV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class iU extends vV{constructor(){super(...arguments),this.type=xR.rangeColumn,this._barMarkType="rect",this._barName=xR.bar,this.transformerConstructor=eU}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(iU.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:QF(this._spec,iU.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(iU.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(iU.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=az(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(KF(null===(i=aO.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),qF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(KF(null===(s=aO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),qF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(KF(null===(n=aO.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),qF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new KN(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}iU.type=xR.rangeColumn,iU.mark=tU,iU.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},iU.transformerConstructor=eU;const sU=()=>{uV(),$N(),aO.registerAnimation("rangeColumn",((t,e)=>({appear:QN(t,e),enter:qN(t),exit:JN(t),disappear:{duration:ZD.disappear.duration}}))),eF(),Nj(),zj(),aO.registerSeries(iU.type,iU)};var nU,rU;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(nU||(nU={})),function(t){t.middle="middle",t.start="start",t.end="end"}(rU||(rU={}));class aU extends EF{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const oU=Object.assign({},QH);class lU extends iV{constructor(){super(...arguments),this.type=xR.rangeArea}initMark(){this._areaMark=this._createMark(lU.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new aU(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}lU.type=xR.rangeArea,lU.mark=oU;class hU extends nz{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=lj,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};JC(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:[]};JC(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&rz(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function cU(t){return ob(t)?Number.parseFloat(t):0}const dU=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&uU(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ge(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[Jz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[Jz]*t;v(e,A,i),A+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},uU=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===cU(t[e])))||!i&&0===t.reduce(((t,i)=>t+cU(i[e])),0)));function pU(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const gU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:pU(t,!0,GI.appear)}),fU={type:"fadeIn"},mU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:pU(t,!0,GI.enter)}),vU=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:pU(t,!0,GI.exit)});function _U(t,e){if(!1===e)return{};switch(e){case"fadeIn":return fU;case"growRadius":return gU(Object.assign(Object.assign({},t),{growField:"radius"}));default:return gU(Object.assign(Object.assign({},t),{growField:"angle"}))}}class yU extends ND{constructor(t,e){super(t,e),this.type=bU.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>he({x:0,y:0},this.getAttribute("centerOffset",e,i),e[sj])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class bU extends yU{constructor(){super(...arguments),this.type=bU.type}}bU.type="arc";const xU=()=>{hM(),Vk(),LB("arc",UB),kw.registerBuiltInAnimate("growRadiusIn",BC),kw.registerBuiltInAnimate("growRadiusOut",PC),kw.registerBuiltInAnimate("growAngleIn",dC),kw.registerBuiltInAnimate("growAngleOut",uC),aO.registerGraphicComponent("arc",af),aO.registerMark(bU.type,bU)},SU=Object.assign(Object.assign({},VF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class AU extends sz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=rO({},this._theme,i,t);const n=(t,e)=>rO({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const kU=`${BO}_LABEL_VISIBLE`;class MU extends hU{constructor(){super(...arguments),this.transformerConstructor=AU,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:UR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:UR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=aj,this._endAngle=oj,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[sj];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return he(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?ae(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?ae(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?ae(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;LI(this._dataSet,"pie",dU),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?ae(this._spec.minAngle):0,asStartAngle:tj,asEndAngle:ej,asRatio:Qz,asMiddleAngle:sj,asRadian:rj,asQuadrant:nj,asK:ij,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Ba(this._dataSet,{name:`${BO}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new FD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},MU.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:IO,groupKey:this._seriesField,isSeriesMark:!0},{morph:QF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return _R(tj)(t)}endAngleScale(t){return _R(ej)(t)}_computeLayoutRadius(){return hj((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:jR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:jR(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:_R(kU).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[sj];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return he(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===GI.appear)return this._startAngle;if(i===GI.disappear)return this._endAngle;const r=[GI.disappear,GI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[OO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[OO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[OO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[OO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[sj]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[sj]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[sj]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[sj]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=KF(null===(i=aO.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}MU.transformerConstructor=AU,MU.mark=SU,MU.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class TU extends MU{constructor(){super(...arguments),this.type=xR.pie}}TU.type=xR.pie;const wU=()=>{xU(),aO.registerAnimation("pie",((t,e)=>({appear:_U(t,e),enter:mU(t),exit:vU(t),disappear:{duration:ZD.disappear.duration}}))),aO.registerAnimation("emptyCircle",((t,e)=>({appear:_U(t,e)}))),aO.registerSeries(TU.type,TU)};function CU(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const EU=t=>({type:CU(t.growField),options:{overall:!0}}),BU={type:"fadeIn"},PU=t=>({type:CU(t.growField)}),LU=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function RU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return BU;case"growAngle":return EU(Object.assign(Object.assign({},t),{growField:"angle"}));default:return EU(Object.assign(Object.assign({},t),{growField:"radius"}))}}class OU extends hU{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(HO),this.setInnerRadiusField(jO)}setValueFieldToPercent(){this.setRadiusField(NO),this.setInnerRadiusField(VO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const IU=Object.assign(Object.assign({},VF),{rose:{name:"rose",type:"arc"}});class DU extends sz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class FU extends bj{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=aO.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=aj,this._endAngle=oj,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),fR(this._regions,(t=>{"radius"===this.getOrient()?qz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):qz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:UR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:UR(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:Gz(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){fR(this._regions,(t=>{"radius"===this.getOrient()?qz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):qz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return JC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:JC(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return he(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return ce(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>Kz(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=re.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return hj((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=lj,e=0;const i=this.getChart().getSpec();return fR(this.getRegions(),(s=>{const n=s;if(r=n.type,[xR.rose,xR.radar,xR.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(rO({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(rO({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}FU.type=r.polarAxis,FU.specKey="axes";const zU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},jU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class HU extends FU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new NE}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return LI(this._option.dataSet,t,ZE),t}}HU.type=r.polarLinearAxis,HU.specKey="axes",HU.builtInTheme={axis:Dj,axisLinear:Rj,axisAngle:jU,axisRadius:zU},G(HU,Lj);const VU=()=>{aO.registerGraphicComponent(fj.lineAxis,((t,e)=>new jC(t,e))),aO.registerGraphicComponent(mj.lineAxisGrid,((t,e)=>new KB(t,e))),aO.registerGraphicComponent(fj.circleAxis,((t,e)=>new GC(t,e))),aO.registerGraphicComponent(mj.circleAxisGrid,((t,e)=>new tP(t,e))),xj(),aO.registerComponent(HU.type,HU)};class NU extends FU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new xE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}registerTicksTransform(){const t=`${this.type}-ticks`;return LI(this._option.dataSet,t,rB),t}transformScaleDomain(){}}NU.type=r.polarBandAxis,NU.specKey="axes",NU.builtInTheme={axis:Dj,axisBand:Hj,axisAngle:jU,axisRadius:zU},G(NU,jj);const UU=()=>{aO.registerGraphicComponent(fj.lineAxis,((t,e)=>new jC(t,e))),aO.registerGraphicComponent(mj.lineAxisGrid,((t,e)=>new KB(t,e))),aO.registerGraphicComponent(fj.circleAxis,((t,e)=>new GC(t,e))),aO.registerGraphicComponent(mj.circleAxisGrid,((t,e)=>new tP(t,e))),xj(),aO.registerComponent(NU.type,NU)};class WU extends OU{constructor(){super(...arguments),this.type=xR.rose,this.transformerConstructor=DU,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(WU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:QF(this._spec,WU.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>FR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=FR(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(KF(null===(i=aO.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),qF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}WU.type=xR.rose,WU.mark=IU,WU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},WU.transformerConstructor=DU;const GU=()=>{aO.registerSeries(WU.type,WU),xU(),aO.registerAnimation("rose",((t,e)=>({appear:RU(t,e),enter:PU(t),exit:LU(t),disappear:{duration:ZD.disappear.duration}}))),UU(),VU()};class YU extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:he(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=ce(this.from,this._prevCenter),{angle:i,radius:s}=ce(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,aR(this._fromAngle,this._toAngle)&&aR(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class XU extends nC{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!gR(t)&&!gR(e))return e;const s=ce(t,this._prevCenter),n=ce(e,this._center);let r=ue(s.angle),a=ue(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new ne(s,n,r,a);return o.defined=e.defined,o}}const $U=t=>({type:"in"===t?"fadeIn":"fadeOut"});function KU(t,e,i){return"fadeIn"===e?$U(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function qU(t,e,i){return"fadeIn"===e?$U(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const ZU=(t,e)=>({custom:iC,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),JU=Object.assign(Object.assign(Object.assign({},VF),kz),{area:{name:"area",type:"area"}});class QU extends OU{constructor(){super(...arguments),this.type=xR.radar,this.transformerConstructor=Oz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(QU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:mF,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?ae(this._spec.startAngle):aj},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(KF(null===(s=aO.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),qF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=aO.getAnimationInKey(e);t.setAnimationConfig(KF(null==i?void 0:i(n,r),qF(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}QU.type=xR.radar,QU.mark=JU,QU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},QU.transformerConstructor=Oz,G(QU,Mz);const tW=()=>{aO.registerSeries(QU.type,QU),ZH(),Pz(),Rz(),aO.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:KU(t,e,"in"),enter:KU(t,e,"in"),exit:KU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:ZD.disappear.duration},update:[{channel:["points","center"],custom:XU,customParameters:t,duration:ZD.update.duration,easing:ZD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),aO.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:qU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:ZD.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:YU,customParameters:t,duration:ZD.update.duration,easing:ZD.update.easing}]}))),aO.registerAnimation("radarGroup",((t,e)=>({appear:ZU(t,"in"),disappear:{duration:ZD.disappear.duration}}))),Vk(),UU(),VU()};class eW extends EF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>fi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const iW=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(BO)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[OO]:r,[IO]:`${s}_${e}`})),r++}))})),n},sW={fill:"#bbb",fillOpacity:.2},nW=Object.assign(Object.assign({},VF),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}});class rW extends oz{constructor(){super(...arguments),this.type=xR.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),LI(this._option.dataSet,"objFlat",iW),LI(this._option.dataSet,"copyDataView",HI),RI(this._option.dataSet,"dataview",Ta),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(rO(sW,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(rW.mark.group),this._containerMark=this._createMark(rW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(rW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(rW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(rW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(rW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(rW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(rW.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!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",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:DO}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new OR).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:DO}}initTooltip(){this._tooltipHelper=new eW(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}rW.type=xR.dot,rW.mark=nW,rW.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class aW extends EF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>fi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const oW=Object.assign(Object.assign({},VF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),lW=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class hW extends oz{constructor(){super(...arguments),this.type=xR.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),LI(this._option.dataSet,"linkDotInfo",lW),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(hW.mark.group),this._containerMark=this._createMark(hW.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(hW.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(hW.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:DO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new aW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}hW.type=xR.link,hW.mark=oW,hW.builtInTheme={link:{arrow:{style:{size:10}}}};const cW=Object.assign(Object.assign({},VF),{group:{name:"group",type:"group"}});class dW extends hU{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?jO:QO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(i.offsetAngle);let o;if(p(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?HO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?ae(n):aj;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?ae(r):oj,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=FR(this.angleAxisHelper.dataToPosition([t[jO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=FR(this.angleAxisHelper.dataToPosition([t[HO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?FR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(dW.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ae(a),o=ae(r)/2;return af(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Ig({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const fW=()=>{aO.registerAnimation("circularProgress",((t,e)=>({appear:gW(t,e),enter:{type:"growAngleIn"},disappear:{duration:ZD.disappear.duration}})))};class mW extends sz{constructor(){super(...arguments),this._supportStack=!0}}class vW extends dW{constructor(){super(...arguments),this.type=xR.circularProgress,this.transformerConstructor=mW,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(vW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:QF(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(vW.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?jO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?HO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(KF(null===(i=aO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),qF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(KF(null===(s=aO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),qF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}vW.type=xR.circularProgress,vW.mark=uW,vW.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},vW.transformerConstructor=mW;const _W=()=>{aO.registerSeries(vW.type,vW),xU(),fW(),eF(),UU(),VU()};function yW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const bW={type:"fadeIn"};function xW(t,e="grow"){return!1===e?{}:"fadeIn"===e?bW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:yW(t)}))(t)}class SW extends EF{enableByType(t){return"dimension"!==t}}const AW=Object.assign(Object.assign({},VF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class kW extends oz{constructor(){super(...arguments),this.type=xR.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(kW.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return FR(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return FR(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?FR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return FR(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return FR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?FR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(kW.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return FR(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return FR(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(KF(null===(i=aO.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),qF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(KF(null===(s=aO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),qF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new SW(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}kW.type=xR.linearProgress,kW.mark=AW,kW.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const MW=()=>{uV(),aO.registerAnimation("linearProgress",((t,e)=>({appear:xW(t,e),enter:xW(t),disappear:{duration:ZD.disappear.duration}}))),eF(),aO.registerSeries(kW.type,kW)},TW=[0],wW=[20,40],CW=[200,500],EW={shrink:!1,enlarge:!1,fontSizeLimitMin:0},BW=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class PW{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const LW=`${BO}_WORD_CLOUD_TEXT`,RW=Object.assign(Object.assign({},VF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),OW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class IW extends nz{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=wW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:CW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:TW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?LW:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:EW},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||ib(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:TW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!BW.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new PW(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(IW.mark.word,{key:IO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(IW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(KF(aO.getAnimationInKey("wordCloud")(n,s),qF("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new OR).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:DO])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new NE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new NE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[OO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:IO,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:O_.createCanvas.bind(O_),getTextBounds:ff}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Ug,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}IW.mark=RW,IW.builtInTheme={wordCloud:OW};function DW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||ZD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=FW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Mt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Mt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},zW=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=zW(t.children,e,t,n))})),s},jW=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=jW(t.children,e,t,n)),n=e(t,s,i,n)})),n},HW=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):HW(t.children,e,i)))})),e};function VW(t,e){let i,s;if(WW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function WW(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function $W(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function KW(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function qW(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function ZW(t){return{_:t,next:null,prev:null}}function JW(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];$W(n,s,r);let a,o,l,h,c,d,u,p=ZW(s),g=ZW(n),f=ZW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=FW(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:iG.defaultOpionts.nodeSort;zW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)zW([o],QW(h)),jW([o],tG(this._getPadding,.5,a)),zW([o],eG(1,this._maxDepth));else{const t=Math.min(s.width,s.height);zW([o],QW(iG.defaultOpionts.setRadius)),jW([o],tG(Lt,1,a)),c&&jW([o],tG(this._getPadding,o.radius/t,a)),zW([o],eG(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}iG.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const sG=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=sG(t.children):t.value=0),e+=Math.abs(t.value)})),e};function nG(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){sG(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Mt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Mt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function rG(t){return t.depth}function aG(t,e){return e-1-t.endDepth}const oG=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),lG=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},hG={left:rG,right:aG,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:rG,end:aG},cG=yt(0,1);class dG{constructor(t){this._ascendingSourceBreadth=(t,e)=>oG(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>oG(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},dG.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):hG[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return nG(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[lG(s[t.source]),lG(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Mt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Mt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*cG(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(oG),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(oG),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];uG(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),pG);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},gG.defaultOpionts,t):Object.assign({},gG.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Pt(this.options.center[0],t.width),s=t.y0+Pt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>Pt(t,n))):Pt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Pt(t,n))):Pt(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Pt(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=FW(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=he({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function fG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:uG,slice:fG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?fG:uG)(t,e,i,s,n)}};class _G{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},_G.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Bt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?mG(this.options.aspectRatio):null!==(e=vG[this.options.splitType])&&void 0!==e?e:vG.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=FW(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function yG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+hi?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return at.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=yG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=wi(o.map(wi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rTt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=bG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&at.getInstance().error("Area "+r+" not represented on screen")}return i}function wG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Bi((function(i){return-1*CG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},BG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||SG,s=e.lossFunction||xG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];ci(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rre.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:EG(f),arcs:f})}))},PG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:LG,triangle:LG,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 LG(){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 RG(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const OG=t=>PG[t]?PG[t]():PG.circle(),IG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function DG(t){return d(t)?t:function(){return t}}class FG{constructor(t){var e,i;switch(this.options=j({},FG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=OG(this.options.shape),this.getText=null!==(e=DG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=DG(this.options.fontWeight),this.getTextFontSize=DG(this.options.fontSize),this.getTextFontStyle=DG(this.options.fontStyle),this.getTextFontFamily=DG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>IG(10,50);break;case"random-light":this.getTextColor=()=>IG(50,90);break;default:this.getTextColor=DG(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return ae(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():Tt(e);return ae(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class jG extends FG{constructor(t){var e;super(j({},jG.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<=jG.defaultOptions.minFontSize&&(this.options.minFontSize=jG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=zG[this.options.spiral])&&void 0!==e?e:zG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=DG(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=RG(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(UG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(NG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}UG(p,this._size)&&(p=WG(p,this._size))}else if(UG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||VG(p,i))&&(!i||!HG(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function HG(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function VG(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,UG=(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 WG(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},YG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>he(t,e,i+r*n)))},XG=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},$G=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=RG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=OG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return he(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)XG(n,YG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)XG(n,YG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)XG(n,YG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)XG(n,YG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)XG(n,YG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=YG({x:l,y:h},o,-Math.PI/2,5),e=YG({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);XG(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var C=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var M=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const w=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)};const B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=M(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function U(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=U(t),n=U(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=it){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var yt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function _(t){return o=void 0,u&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Ct(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const wt=4294967296;const Et=t=>e=>R(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(_(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Rt=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,Ot=t=>0,It=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Lt(f.min,f);for(let r=0;r=1?jt:t<=-1?-jt:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ae{static distancePP(t,e){return $t(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return $t(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return $t(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Nt;)t+=Nt;else if(t>0)for(;t>Nt;)t-=Nt;return t};function ce(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=pe(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(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 me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function _e(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Ce(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?oe(t.angle):t.angle,s=Me(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+jt;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+jt;u>Ut&&(u-=Ut),g>Ut&&(g-=Ut);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Ce(n,i)+Ce(n,s))/2>Ce(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Ie(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Fe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}},He=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ne(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ue{}class We extends Ue{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class Ge{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ge,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ge;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ge(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=le(r.rotateDeg),r}}class Ye{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Xe(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Ke(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const $e=/^#([0-9a-f]{3,8})$/,qe={transparent:4294967040},Ze={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Je(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Qe(t){return S(t)?new ni(t>>16,t>>8&255,255&t,1):_(t)?new ni(t[0],t[1],t[2]):new ni(255,255,255)}function ti(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ei(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ii=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ni((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Qe(t):8===e?new ni(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class si{static Brighter(t,e=1){return 1===e?t:new si(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new si(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof si?t:new si(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(qe[t]))return function(t){return S(t)?new ni(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ni(t[0],t[1],t[2],t[3]):new ni(255,255,255,1)}(qe[t]);if(p(Ze[t]))return Qe(Ze[t]);const e=`${t}`.trim().toLowerCase(),i=ii(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ni(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Xe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ni(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=si.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ni(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Ke(this.color.r,this.color.g,this.color.b),r=Xe(u(t)?n.h:yt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ni(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ii(e,!0);return null!=i?i:this}setColorName(t){const e=Ze[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new si(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ei(t.color.r),this.color.g=ei(t.color.g),this.color.b=ei(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ni{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Je(this.r)+Je(this.g)+Je(this.b)+(1===this.opacity?"":Je(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Ke(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ri(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new ni(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Ke});function oi(t){if(k(t))return[t,t,t,t];if(_(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function li(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const hi=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function ci(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function di(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const ui=1e-10;function pi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ui)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=vi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=gi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ui,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function gi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function fi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return gi(t,t-(i*i-e*e+t*t)/(2*i))+gi(e,s)}function mi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function vi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let bi;function xi(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class Si{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ai=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ki(t){let e;if(e=Ai.exec(t))return new Si({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});ot.getInstance().error("invalid format: "+t)}const Ci=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ti{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return Ti.instance||(Ti.instance=new Ti),Ti.instance}newFormat(t){const e=ki(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Mi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:y,group:_,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?m:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?Ci[8+bi/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?y+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=_(k,1/0));let C=S.length+k.length+A.length,T=C>1)+S+k+A+T.slice(C);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=ki(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=_i(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ci[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>xi(100*t,e),r:xi,s:function(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(bi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+_i(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function wi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Ri(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ri(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Pi(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},is=Math.sqrt,ss=Math.tan;function ns(t){return t>1?0:t<-1?Ni:Math.acos(t)}function rs(t){return t>1?Ui:t<-1?-Ui:Math.asin(t)}function as(){}function os(t,e){t&&hs.hasOwnProperty(t.type)&&hs[t.type](t,e)}var ls={Feature:function(t,e){os(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sNi?t+Math.round(-t/Wi)*Wi:t,e]}function Ss(t,e,i){return(t%=Wi)?e||i?bs(ks(t),Cs(e,i)):ks(t):e||i?Cs(e,i):xs}function As(t){return function(e,i){return[(e+=t)>Ni?e-Wi:e<-Ni?e+Wi:e,i]}}function ks(t){var e=As(t);return e.invert=As(-t),e}function Cs(t,e){var i=qi(t),s=ts(t),n=qi(e),r=ts(e);function a(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*i+o*s;return[$i(l*n-c*r,o*i-h*s),rs(c*n+l*r)]}return a.invert=function(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*n-l*r;return[$i(l*n+h*r,o*i+c*s),rs(c*i-o*s)]},a}function Ts(t,e){(e=gs(e))[0]-=t,_s(e);var i=ns(-e[1]);return((-e[2]<0?-i:i)+Wi-ji)%Wi}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:as,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ws(t,e){return Xi(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function Ps(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Fs(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function zs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Fs(a);var t=function(t,e){var i=Ls(e),s=e[1],n=ts(s),r=[ts(i),-qi(i),0],a=0,o=0;Is.reset(),1===n?s=Ui+ji:-1===n&&(s=-Ui-ji);for(var l=0,h=t.length;l=0?1:-1,C=k*A,T=C>Ni,M=f*x;if(Is.add($i(M*k*ts(C),m*S+M*qi(C))),a+=T?A+k*Wi:A,T^p>=i^_>=i){var w=ms(gs(u),gs(y));_s(w);var E=ms(r,w);_s(E);var B=(T^A>=0?-1:1)*rs(E[2]);(s>B||s===B&&(w[0]||w[1]))&&(o+=T^A>=0?1:-1)}}return(a<-ji||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Hs))}return u}}function Hs(t){return t.length>1}function js(t,e){return((t=t.x)[0]<0?t[1]-Ui-ji:Ui-t[1])-((e=e.x)[0]<0?e[1]-Ui-ji:Ui-e[1])}1===(Rs=Ds).length&&(Os=Rs,Rs=function(t,e){return Ds(Os(t),e)});var Ns=zs((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Ni:-Ni,l=Xi(r-i);Xi(l-Ni)0?Ui:-Ui),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ni&&(Xi(i-n)ji?Ki((ts(e)*(r=qi(s))*ts(i)-ts(s)*(n=qi(e))*ts(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*Ui,s.point(-Ni,n),s.point(0,n),s.point(Ni,n),s.point(Ni,0),s.point(Ni,-n),s.point(0,-n),s.point(-Ni,-n),s.point(-Ni,0),s.point(-Ni,n);else if(Xi(t[0]-e[0])>ji){var r=t[0]0,n=Xi(e)>ji;function r(t,i){return qi(t)*qi(i)>e}function a(t,i,s){var n=[1,0,0],r=ms(gs(t),gs(i)),a=fs(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ms(n,r),u=ys(n,h);vs(u,ys(r,c));var p=d,g=fs(u,p),f=fs(p,p),m=g*g-f*(fs(u,u)-1);if(!(m<0)){var v=is(m),y=ys(p,(-g-v)/f);if(vs(y,u),y=ps(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Xi(y[0]-b)Ni^(b<=y[0]&&y[0]<=x)){var T=ys(p,(-g+v)/f);return vs(T,u),[y,ps(T)]}}}function o(e,i){var n=s?t:Ni-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return zs(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Ni:-Ni),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ws(e,p)||ws(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&ws(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=qi(e),o=ts(e),l=s*i;null==n?(n=e+s*Wi,r=e-l/2):(n=Ts(a,n),r=Ts(a,r),(s>0?nr)&&(n+=s*Wi));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Xi(s[0]-t)0?0:3:Xi(s[0]-i)0?2:1:Xi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,y,_=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&_.lineEnd()},polygonStart:function(){_=b,l=[],h=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=y&&e,n=(l=Fs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Bs(l,o,e,r,a),a.polygonEnd());_=a,l=h=c=null}};function S(t,e){n(t,e)&&_.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(_.lineStart(),_.point(r,a));else if(o&&m)_.point(r,a);else{var l=[g=Math.max(Ws,Math.min(Vs,g)),f=Math.max(Ws,Math.min(Vs,f))],b=[r=Math.max(Ws,Math.min(Vs,r)),a=Math.max(Ws,Math.min(Vs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(_.lineStart(),_.point(r,a),y=!1):(m||(_.lineStart(),_.point(l[0],l[1])),_.point(b[0],b[1]),o||_.lineEnd(),y=!1)}g=r,f=a,m=o}return x}}function Ys(t){return t}var Xs,Ks,$s,qs,Zs=Di(),Js=Di(),Qs={point:as,lineStart:as,lineEnd:as,polygonStart:function(){Qs.lineStart=tn,Qs.lineEnd=nn},polygonEnd:function(){Qs.lineStart=Qs.lineEnd=Qs.point=as,Zs.add(Xi(Js)),Js.reset()},result:function(){var t=Zs/2;return Zs.reset(),t}};function tn(){Qs.point=en}function en(t,e){Qs.point=sn,Xs=$s=t,Ks=qs=e}function sn(t,e){Js.add(qs*t-$s*e),$s=t,qs=e}function nn(){sn(Xs,Ks)}var rn=Qs,an=1/0,on=an,ln=-an,hn=ln;var cn,dn,un,pn,gn={point:function(t,e){tln&&(ln=t);ehn&&(hn=e)},lineStart:as,lineEnd:as,polygonStart:as,polygonEnd:as,result:function(){var t=[[an,on],[ln,hn]];return ln=hn=-(on=an=1/0),t}},fn=0,mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn={point:Cn,lineStart:Tn,lineEnd:En,polygonStart:function(){kn.lineStart=Bn,kn.lineEnd=Pn},polygonEnd:function(){kn.point=Cn,kn.lineStart=Tn,kn.lineEnd=En},result:function(){var t=An?[xn/An,Sn/An]:bn?[yn/bn,_n/bn]:vn?[fn/vn,mn/vn]:[NaN,NaN];return fn=mn=vn=yn=_n=bn=xn=Sn=An=0,t}};function Cn(t,e){fn+=t,mn+=e,++vn}function Tn(){kn.point=Mn}function Mn(t,e){kn.point=wn,Cn(un=t,pn=e)}function wn(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,Cn(un=t,pn=e)}function En(){kn.point=Cn}function Bn(){kn.point=Rn}function Pn(){On(cn,dn)}function Rn(t,e){kn.point=On,Cn(cn=un=t,dn=pn=e)}function On(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,xn+=(n=pn*t-un*e)*(un+t),Sn+=n*(pn+e),An+=3*n,Cn(un=t,pn=e)}var In=kn;function Ln(t){this._context=t}Ln.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Wi)}},result:as};var Dn,Fn,zn,Hn,jn,Nn=Di(),Un={point:as,lineStart:function(){Un.point=Vn},lineEnd:function(){Dn&&Wn(Fn,zn),Un.point=as},polygonStart:function(){Dn=!0},polygonEnd:function(){Dn=null},result:function(){var t=+Nn;return Nn.reset(),t}};function Vn(t,e){Un.point=Wn,Fn=Hn=t,zn=jn=e}function Wn(t,e){Hn-=t,jn-=e,Nn.add(is(Hn*Hn+jn*jn)),Hn=t,jn=e}var Gn=Un;function Yn(){this._string=[]}function Xn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Kn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),us(t,i(s))),s.result()}return r.area=function(t){return us(t,i(rn)),rn.result()},r.measure=function(t){return us(t,i(Gn)),Gn.result()},r.bounds=function(t){return us(t,i(gn)),gn.result()},r.centroid=function(t){return us(t,i(In)),In.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ys):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Yn):new Ln(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function $n(t){return function(e){var i=new qn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function qn(){}function Zn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),us(i,t.stream(gn)),e(gn.result()),null!=s&&t.clipExtent(s),t}function Jn(t,e,i){return Zn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Qn(t,e,i){return Jn(t,[[0,0],e],i)}function tr(t,e,i){return Zn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function er(t,e,i){return Zn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Yn.prototype={_radius:4.5,_circle:Xn(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=Xn(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}},qn.prototype={constructor:qn,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 ir=16,sr=qi(30*Yi);function nr(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,y=c-n,_=v*v+y*y;if(_>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=is(b*b+x*x+S*S),k=rs(S/=A),C=Xi(Xi(S)-1)e||Xi((v*E+y*B)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Yi:0,E()):[m*Gi,v*Gi,y*Gi]},M.angle=function(t){return arguments.length?(_=t%360*Yi,E()):_*Gi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},M.precision=function(t){return arguments.length?(a=nr(o,T=t*t),B()):is(T)},M.fitExtent=function(t,e){return Jn(M,t,e)},M.fitSize=function(t,e){return Qn(M,t,e)},M.fitWidth=function(t,e){return tr(M,t,e)},M.fitHeight=function(t,e){return er(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&w,E()}}function cr(t){var e=0,i=Ni/3,s=hr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Yi,i=t[1]*Yi):[e*Gi,i*Gi]},n}function dr(t,e){var i=ts(t),s=(i+ts(e))/2;if(Xi(s)2?t[2]*Yi:0),e.invert=function(e){return(e=t.invert(e[0]*Yi,e[1]*Yi))[0]*=Gi,e[1]*=Gi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===yr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function br(t){return ss((Ui+t)/2)}function xr(t,e){var i=qi(t),s=t===e?ts(t):Ji(i/qi(e))/Ji(br(e)/br(t)),n=i*Qi(br(t),s)/s;if(!s)return yr;function r(t,e){n>0?e<-Ui+ji&&(e=-Ui+ji):e>Ui-ji&&(e=Ui-ji);var i=n/Qi(br(e),s);return[i*ts(s*t),n-i*qi(s*t)]}return r.invert=function(t,e){var i=n-e,r=es(s)*is(t*t+i*i),a=$i(t,Xi(i))*es(i);return i*s<0&&(a-=Ni*es(t)*es(i)),[a/s,2*Ki(Qi(n/r,1/s))-Ui]},r}function Sr(t,e){return[t,e]}function Ar(t,e){var i=qi(t),s=t===e?ts(t):(i-qi(e))/(e-t),n=i/s+t;if(Xi(s)ji&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Rr.invert=fr(rs),Or.invert=fr((function(t){return 2*Ki(t)})),Ir.invert=function(t,e){return[-e,2*Ki(Zi(t))-Ui]};var Fr={exports:{}},zr=function(t,e){this.p1=t,this.p2=e};zr.prototype.rise=function(){return this.p2[1]-this.p1[1]},zr.prototype.run=function(){return this.p2[0]-this.p1[0]},zr.prototype.slope=function(){return this.rise()/this.run()},zr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},zr.prototype.isVertical=function(){return!isFinite(this.slope())},zr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},zr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},zr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},zr.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)},zr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Hr=zr,jr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Hr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=jr(t.slice(0,s),e),o=jr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Nr=jr;!function(t){var e=Nr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Vr(Yr,e),{tolerance:s}=i;return Ur(t,s)};var Kr;!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"}(Kr||(Kr={}));const $r=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),_(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let C=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/C:0,T.push(y[t])}return T},Zr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],w=M.length?M:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:w});if(!T.length)return qr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...M,...T];return qr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},Jr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",w=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",R=null!==(p=k.min)&&void 0!==p?p:"min",O=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(y=k.values)&&void 0!==y?y:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),_(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}_(S)&&(S=[yt(Math.min.apply(null,S),0,1),yt(Math.max.apply(null,S),0,1)]);const U=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[M]=o,f[w]=l,f[E]=h,f[B]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,A&&(f[F]=H.get(t)||[]),U.push(f)}return U};var Qr={},ta={};function ea(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ia(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function sa(t,e){var i=t+"",s=i.length;return s9999?"+"+sa(e,6):sa(e,4))+"-"+sa(t.getUTCMonth()+1,2)+"-"+sa(t.getUTCDate(),2)+(r?"T"+sa(i,2)+":"+sa(s,2)+":"+sa(n,2)+"."+sa(r,3)+"Z":n?"T"+sa(i,2)+":"+sa(s,2)+":"+sa(n,2)+"Z":s||i?"T"+sa(i,2)+":"+sa(s,2)+"Z":"")}function ra(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return ta;if(h)return h=!1,Qr;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a0}function ma(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=ha(t));var r=[];switch(t.type){case"GeometryCollection":return va(t,(function(t){_a(t,s)})),t;case"FeatureCollection":return ma(t,(function(t){ma(_a(t,s),(function(t){r.push(t)}))})),di(r)}return _a(t,s)}function _a(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return va(t,(function(t){_a(t,e)})),t;case"LineString":return ba(ga(t),e),t;case"Polygon":return xa(ga(t),e),t;case"MultiLineString":return ga(t).forEach((function(t){ba(t,e)})),t;case"MultiPolygon":return ga(t).forEach((function(t){xa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ba(t,e){fa(t)===e&&t.reverse()}function xa(t,e){fa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Sa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Ta=(t,e={},i)=>{i.type=Kr.GEO;const s=Vr(ka,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ca(t))})):e.push(Ca(t))})),e})(t);let l=t.features;return o&&(l=ya(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=Aa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=Aa.bounds(t);t.bbox=e}})),t.features=l,t},Ma={},wa=(t,e,i)=>{i.type=Kr.GEO;const s=Vr(ka,Ma,e),{object:n}=s;if(!y(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Dr(a,t)}))}:Dr(a,o));var a,o;return Ta(r,s,i)},Ea=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!_(t))throw new TypeError("Invalid data: must be DataView array!");return _(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Ba=0;function Pa(t="dataset"){return Ba>1e8&&(Ba=0),t+"_"+Ba++}class Ra{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:Pa("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Oa{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Pa("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Oa||!0!==(null==e?void 0:e.clone)||(i=!0),i?L(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?H({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",$r),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Kn();const Ia={},La={albers:pr,albersusa:function(){var t,e,i,s,n,r,a=pr(),o=ur().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=ur().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}},Da=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Fa(t,e){return function i(){const s=e();return s.type=t,s.path=Kn().projection(s),s.copy=s.copy||function(){const t=i();return Da.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class za{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class Ha extends za{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}class ja{static GenAutoIncrementId(){return ja.auto_increment_id++}}ja.auto_increment_id=0;class Na{}const Ua=new Na;let Va=0;class Wa{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Ua.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Va,t),this.tryRunAnimationFrameNextFrame(),Va}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class Ga{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Ya=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Xa extends Ga{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=ja.GenAutoIncrementId(),this.hooks={onSetEnv:new Ha(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Wa);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Wa),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Ya(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}var Ka=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class $a extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=ja.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Ka(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(io(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=io(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=io(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=io(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=eo.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(io(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(io(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,io(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Ja))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):io(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof Qa))return void ot.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=eo.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new so(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Ja,this.rootWheelEvent=new Qa,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&y(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const oo=Nt-1e-8;class lo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>oo)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Nt)<0&&(s+=Nt),(n%=Nt)<0&&(n+=Nt),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const co=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,uo={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},po={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let go,fo,mo,vo,yo,_o;function bo(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;t_o){let t,e=mo;for(let s=1,r=i.length;s1&&(g=Math.sqrt(g),i*=g,s*=g);const f=d/i,m=c/i,v=-c/s,y=d/s,_=f*o+m*l,b=v*o+y*l,x=f*t+m*e,S=v*t+y*e;let A=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const C=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),M=Math.atan2(b-T,_-C);let w=Math.atan2(S-T,x-C)-M;w<0&&1===r?w+=Nt:w>0&&0===r&&(w-=Nt);const E=Math.ceil(Math.abs(w/(jt+.001))),B=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Ro(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=No(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Vo(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new Wo(i,n),new Wo(n,s)]}class Wo extends Oo{constructor(t,e){super(),this.type=Co.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===ko.ROW?Vt(this.p0.x-this.p1.x):t===ko.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class Go{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new Uo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new Wo(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===ko.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===ko.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Yo extends Go{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Xo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Ko(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?ko.ROW:ko.COLUMN;return"monotoneY"===t?new Yo(t,s):new Go(t,s)}class $o{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 qo(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ko("linear",i,t);return Zo(new $o(n,s),t),n}function Zo(t,e){return Xo(t,e,1)}function Jo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Qo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Jo(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:Jo(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 tl(t,e){return Xo(t,e,2)}function el(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return qo(t,e);const n=Ko("basis",i,t);return tl(new Qo(n,s),t),n}function il(t){return t<0?-1:1}function sl(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(il(r)+il(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function nl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function rl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class al{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:rl(this,this._t0,nl(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,rl(this,nl(this,e=sl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:rl(this,this._t0,e=sl(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class ol extends al{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ll(t,e){return Xo(t,e,2)}function hl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return qo(t,e);const n=Ko("monotoneX",i,t);return ll(new al(n,s),t),n}function cl(t,e){return Xo(t,e,2)}function dl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return qo(t,e);const n=Ko("monotoneY",i,t);return cl(new ol(n,s),t),n}let ul=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class pl extends ul{lineEnd(){this.context.closePath()}}function gl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Go("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?ko.ROW:ko.COLUMN);return fl(new ul(r,e,n),t),r}function fl(t,e){return Xo(t,e,1)}function ml(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Go("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?ko.ROW:ko.COLUMN);return fl(new pl(r,e,n),t),r}class vl extends $o{lineEnd(){this.context.closePath()}}function yl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ko("linear",i,t);return _l(new vl(n,s),t),n}function _l(t,e){return Xo(t,e,1)}function bl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function xl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return qo(i,n);const o=Ko(t,r,i);return Xo(new e(o,s,a),i,2),o}}const Sl=xl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:bl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Al=xl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:bl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class kl extends Oo{constructor(t,e,i){super(),this.type=Co.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Ho(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?jo(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===ko.ROW?Vt(this.p0.x-this.p2.x):t===ko.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=Xt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Ho(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new kl(i,a,r),new kl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Cl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Wo(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new kl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new Uo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Tl(t,e,i){var s,n;switch(e){case"linear":default:return qo(t,i);case"basis":return el(t,i);case"monotoneX":return hl(t,i);case"monotoneY":return dl(t,i);case"step":return gl(t,.5,i);case"stepClosed":return ml(t,.5,i);case"stepBefore":return gl(t,0,i);case"stepAfter":return gl(t,1,i);case"catmullRom":return Sl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Al(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return yl(t,i)}}class Ml extends ho{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new lo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([po.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([po.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([po.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([po.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([po.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([po.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([po.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([po.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([po.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Cl(this);Ro(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[po.M]=t=>`M${t[1]} ${t[2]}`,t[po.L]=t=>`L${t[1]} ${t[2]}`,t[po.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[po.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[po.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];Bo(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[po.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=bo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=Tl(e,i);"x"===s?this.direction=ko.ROW:"y"===s?this.direction=ko.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[po.M]=this.moveToTransform,t[po.L]=this.lineToTransform,t[po.Q]=this.quadraticCurveToTransform,t[po.C]=this.bezierCurveToTransform,t[po.AT]=this.arcToTransform,t[po.E]=this.ellipseTransform,t[po.R]=this.rectTransform,t[po.A]=this.arcTransform,t[po.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Ro(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===ko.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===ko.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),Ql=Object.assign(Object.assign({},Gl),{points:[],cornerRadius:0,closePath:!0}),th=Object.assign(Object.assign({},Gl),{width:100,height:100,spikes:5,thickness:.5}),eh=Object.assign(Object.assign({},Gl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),ih=Object.assign(Object.assign({},Gl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),sh=Object.assign(Object.assign({},Gl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),nh=Object.assign(Object.assign(Object.assign({},Gl),jl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),rh=Object.assign(Object.assign(Object.assign({},Gl),jl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ah=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Gl),{fill:!0,cornerRadius:0,cornerType:"round"}),oh=Object.assign(Object.assign({},ah),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});class lh{static GetImage(t,e){var i;const s=lh.cache.get(t);s?"fail"===s.loadState?Ua.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):lh.loadImage(t,e)}static GetSvg(t,e){var i;let s=lh.cache.get(t);s?"fail"===s.loadState?Ua.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},lh.cache.set(t,s),s.dataPromise=Ua.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=lh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},lh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ua.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ua.global.loadBlob(t):"json"===e&&(i.dataPromise=Ua.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!lh.isLoading&&lh.toLoadAueue.length){lh.isLoading=!0;const t=lh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(lh.cache.set(i,n),n.dataPromise=Ua.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()})).catch((t=>{console.error(t),lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()}))}}),0)}static loadImage(t,e){const i=hh(t,lh.toLoadAueue);if(-1!==i)return lh.toLoadAueue[i].marks.push(e),void lh.loading();lh.toLoadAueue.push({url:t,marks:[e]}),lh.loading()}static improveImageLoading(t){const e=hh(t,lh.toLoadAueue);if(-1!==e){const t=lh.toLoadAueue.splice(e,1);lh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function hh(t,e){for(let i=0;i{var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)dh[s]=t,i&&(i=!(null!==(e=dh[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)dh[e]=!!t[e],i&&(i=!!dh[e]);else dh[0]=!1,dh[1]=!1,dh[2]=!1,dh[3]=!1;return{isFullStroke:i,stroke:dh}},ph=[0,0,0,0],gh=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ph[0]=t[0],ph[2]=t[0],ph[1]=t[1],ph[3]=t[1],ph):t:t:0,fh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],mh=[1,2,3,0,1,2,3,0];function vh(t,e,i,s){for(;t>=Ut;)t-=Ut;for(;t<0;)t+=Ut;for(;t>e;)e+=Ut;fh[0].x=i,fh[1].y=i,fh[2].x=-i,fh[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Gt(t)*i,Kt(t)*i),s.add(Gt(e)*i,Kt(e)*i),n!==r||e-t>Ht){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Sh.TimeOut=1e3/60;const Ah=new Sh,kh=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,Ch=(t,e)=>{const i=kh(t,e);return isNaN(i)?i:Math.max(e,i)};class Th{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Mh(t,e,i,s,n){return n?t.arc(i,s,e,0,Nt,!1,n):t.arc(i,s,e,0,Nt),!1}var wh=new class extends Th{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return Mh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Mh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Eh=new class extends Th{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Ph=new class extends Th{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Rh(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Th{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2+n,i,s)}};function Ih(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Lh extends Th{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Ih(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ih(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Lh;var Fh=new class extends Lh{constructor(){super(...arguments),this.type="triangle"}};const zh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Hh=Math.sin(Nt/10)*zh,jh=-Math.cos(Nt/10)*zh;function Nh(t,e,i,s){const n=Hh*e,r=jh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Nt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Uh=new class extends Th{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Nh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Nh(t,this.parseSize(e)/2+n,i,s)}};const Vh=$t(3);function Wh(t,e,i,s){const n=e,r=n/Vh,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Gh=new class extends Th{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Yh(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Xh=new class extends Th{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Yh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Yh(t,this.parseSize(e)/2+n,i,s)}};function Kh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var $h=new class extends Th{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Kh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Kh(t,this.parseSize(e)/2+n,i,s)}};const qh=-.5,Zh=$t(3)/2,Jh=1/$t(12);function Qh(t,e,i,s){const n=e/2,r=e*Jh,a=n,o=e*Jh+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(qh*n-Zh*r+i,Zh*n+qh*r+s),t.lineTo(qh*a-Zh*o+i,Zh*a+qh*o+s),t.lineTo(qh*l-Zh*h+i,Zh*l+qh*h+s),t.lineTo(qh*n+Zh*r+i,qh*r-Zh*n+s),t.lineTo(qh*a+Zh*o+i,qh*o-Zh*a+s),t.lineTo(qh*l+Zh*h+i,qh*h-Zh*l+s),t.closePath(),!1}var tc=new class extends Th{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Qh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qh(t,this.parseSize(e)/2+n,i,s)}};function ec(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ic=new class extends Th{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return ec(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return ec(t,this.parseSize(e)/2,i,s,n)}};function sc(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var nc=new class extends Th{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return sc(t,this.parseSize(e)/2,i,s,n)}};function rc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var ac=new class extends Th{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return rc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return rc(t,this.parseSize(e)/2,i,s,n)}};const oc=$t(3);function lc(t,e,i,s){const n=e*oc;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var hc=new class extends Th{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return lc(t,this.parseSize(e)/2/oc,i,s)}drawOffset(t,e,i,s,n){return lc(t,this.parseSize(e)/2/oc+n,i,s)}};function cc(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var dc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return cc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return cc(t,this.parseSize(e)/4+n,i,s)}};function uc(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var pc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return uc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return uc(t,this.parseSize(e)/4+n,i,s)}};function gc(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var fc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return gc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return gc(t,this.parseSize(e)/4+n,i,s)}};function mc(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var vc=new class extends Th{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return mc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return mc(t,this.parseSize(e)/4+n,i,s)}};function yc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var _c=new class extends Th{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return yc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function bc(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var xc=new class extends Th{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return bc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return bc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Sc(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var Ac=new class extends Th{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return Sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Sc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function kc(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Cc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Tc=new class extends Th{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?Cc(t,e,i,s):kc(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Cc(t,e+2*n,i,s):kc(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Mc=new Ve;class wc{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Ro(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Ro(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Mc.x1=i.bounds.x1*t,Mc.y1=i.bounds.y1*t,Mc.x2=i.bounds.x2*t,Mc.y2=i.bounds.y2*t,e.union(Mc)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const Ec=[wh,Eh,Ph,Oh,hc,Fh,Uh,Gh,Xh,$h,tc,ic,nc,Dh,ac,dc,pc,fc,vc,Tc,_c,xc,Ac],Bc={};Ec.forEach((t=>{Bc[t.type]=t}));const Pc={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Rc{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ic(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ic(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ic(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Rc(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Rc(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function Fc(t,e){return zc(t)}function zc(t,e){const i={};for(let e=0;e{Ua.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)}))}function Yc(t,e,i,s=0){return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let Xc=0;function Kc(){return Xc++}var $c;function qc(t){const e=[];let i=0,s="";for(let n=0;nZc.set(t,!0)));const Jc=new Map;function Qc(t){if(Zc.has(t))return!0;if(Jc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function td(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Jc.set(t,!0)));const ed=Kc(),id=Kc(),sd=Kc(),nd=Kc(),rd=Kc(),ad=Kc(),od=Kc(),ld=Kc(),hd=Kc(),cd=Kc(),dd=Kc(),ud=Kc(),pd=Kc(),gd=Kc(),fd=Kc(),md=Kc(),vd=Kc(),yd=Symbol.for("GraphicService"),_d=Symbol.for("GraphicCreator"),bd={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},xd=Object.keys(bd),Sd={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Ad=Object.keys(Sd),kd={duration:200,easing:"cubicOut"},Cd=Symbol.for("CanvasFactory"),Td=Symbol.for("Context2dFactory");function Md(t){return function(){var t,e;const i=null===(t=Ua.global)||void 0===t?void 0:t.env,s=i?null===(e=Ua.canvasFactory)||void 0===e?void 0:e.call(Ua,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const wd=1e-4,Ed=Math.sqrt(3),Bd=1/3;function Pd(t){return t>-Gd&&tGd||t<-Gd}function Od(t){return"number"==typeof t&&Number.isFinite(t)}const Id=[0,0],Ld=[0,0],Dd=[0,0];function Fd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function zd(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Hd(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function jd(t){return(t%=Ut)<0&&(t+=Ut),t}function Nd(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Ut);let d=Math.atan2(l,o);return d<0&&(d+=Ut),d>=s&&d<=n||d+Ut>=s&&d+Ut<=n}function Wd(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(Pd(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Xd=[-1,-1,-1],Kd=[-1,-1];function $d(){const t=Kd[0];Kd[0]=Kd[1],Kd[1]=t}function qd(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Pd(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Bd):Math.pow(i,Bd),s=s<0?-Math.pow(-s,Bd):Math.pow(s,Bd);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+Ed*Math.sin(e)))/(3*a),h=(-o+i*(s-Ed*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Xd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&$d(),p=Hd(e,s,r,o,Kd[0]),u>1&&(g=Hd(e,s,r,o,Kd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Pd(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Xd);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=zd(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Xd[0]=-l,Xd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ut-1e-4){s=0,n=Ut;const e=r?1:-1;return a>=Xd[0]+t&&a<=Xd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ut,n+=Ut);let c=0;for(let e=0;e<2;e++){const i=Xd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ut+t),(t>=s&&t<=n||t+Ut>=s&&t+Ut<=n)&&(t>Ht/2&&t<1.5*Ht&&(e=-e),c+=e)}}return c}function Qd(t){return Math.round(t/Ht*1e8)/1e8%2*Ht}function tu(t,e){let i=Qd(t[0]);i<0&&(i+=Ut);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ut?n=i+Ut:e&&i-n>=Ut?n=i-Ut:!e&&i>n?n=i+(Ut-Qd(i-n)):e&&i1&&(i||(h+=Oe(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,A=b;eu[0]=S,eu[1]=A,tu(eu,Boolean(a[6])),S=eu[0],A=eu[1];const k=S,C=A-S,T=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case po.M:u=m,p=v,c=u,d=p;break;case po.L:if(i){if(Wd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case po.C:if(i){if(Ud(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=qd(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(Nd(c,d,m,v,y,_,e,s,n))return!0}else h+=Zd(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case po.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Vd(m,v,y,k,k+C,T,e,M,n))return!0}else h+=Jd(m,v,y,k,k+C,T,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case po.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Wd(u,p,o,p,e,s,n)||Wd(o,p,o,l,e,s,n)||Wd(o,l,u,l,e,s,n)||Wd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case po.Z:if(i){if(Wd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class nu{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(nu.IsGradientStr(t))try{const e=su(t)[0];if(e){if("linear"===e.type)return nu.ParseLinear(e);if("radial"===e.type)return nu.ParseRadial(e);if("conic"===e.type)return nu.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2,n=parseFloat(e.value)/180*Ht-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ut,stops:nu.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:nu.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2;let n="angular"===e.type?parseFloat(e.value)/180*Ht:0;for(;n<0;)n+=Ut;for(;n>=Ut;)n-=Ut;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function ou(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function lu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s,t}function hu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n,t}function cu(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s,t}function du(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function uu(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function pu(t,e,i){const s=i[0],n=i[1],r=i[2];return t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function gu(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function fu(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],v=s[0],y=s[1],_=s[2],b=i[0],x=i[1],S=i[2];return Math.abs(g-b)0&&(Au.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Au.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Tu),function(t,e,i){return iu(t,0,!1,e,i)}(this.path.commandList,Tu.x,Tu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Tu);const i=ru(this,this.lineWidth,this.dpr);return function(t,e,i,s){return iu(t,e,!0,i,s)}(this.path.commandList,i,Tu.x,Tu.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(Cu,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Au.free(t))),this.stack.length=0}}const wu={WIDTH:500,HEIGHT:500,DPR:1};class Eu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=wu.WIDTH,height:n=wu.HEIGHT,dpr:r=wu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Bu;Eu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Bu||(Bu={}));class Pu{static Get(t,e=Bu.Color1,i=[0,0,0,1]){if(e===Bu.Color1){const e=Pu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=si.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Pu.store1[t]=e,Pu.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Pu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=si.parseColorString(t);return n&&(Pu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Pu.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Bu.Color1){if(Pu.store1[t])return;Pu.store1[t]=i,Pu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Pu.store255[t])return;Pu.store255[t]=i,Pu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Ru(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Ou(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Iu(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Iu(t,e,i,s,n)}function Iu(t,e,i,s,n){if(!t||!e)return t&&Ru(t)||e&&Ru(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Pu.Get(t,Bu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Pu.Get(e,Bu.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:Ru(a)})))});return o?Ou(r,l,i,s,n):Ou(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return Lu(s,n,i);if("radial"===s.gradient)return Du(s,n,i);if("conical"===s.gradient)return Fu(s,n,i)}return!1}return n&&n(r,a),Ru(zu(r,a,i),s)}function Lu(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Uu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Uu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Fu(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Uu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function zu(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]}function Hu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Pu.store255={},Pu.store1={};const ju=[0,0,0,0],Nu=[0,0,0,0];function Uu(t,e,i){return Pu.Get(t,Bu.Color255,ju),Pu.Get(e,Bu.Color255,Nu),`rgba(${Math.round(ju[0]+(Nu[0]-ju[0])*i)},${Math.round(ju[1]+(Nu[1]-ju[1])*i)},${Math.round(ju[2]+(Nu[2]-ju[2])*i)},${ju[3]+(Nu[3]-ju[3])*i})`}class Vu{static GetCanvas(){try{return Vu.canvas||(Vu.canvas=Ua.global.createCanvas({})),Vu.canvas}catch(t){return null}}static GetCtx(){if(!Vu.ctx){const t=Vu.GetCanvas();Vu.ctx=t.getContext("2d")}return Vu.ctx}}class Wu extends Ye{static getInstance(){return Wu._instance||(Wu._instance=new Wu),Wu._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Vu.GetCanvas(),s=Vu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Wu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Gu{static GetSize(t){for(let e=0;e=t)return Gu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Gu.GenKey(t,e,i,s,n),l=Gu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=Gu.GenKey(t,e,i,s,n);Gu.cache[l]?Gu.cache[l].push({width:a,height:o,pattern:r}):Gu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Yu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Ut;for(;i>Ut;)i-=Ut;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),Ou(o.color,l.color,h,!1)}function Xu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Vu.GetCanvas(),d=Vu.GetCtx();if(!d)return null;const u=Gu.GetSize(o),p=Gu.GetSize(l);let g=Gu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Wu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);t++){const e=y.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Gu.Set(e,i,s,r,a,g,u,p),g}Gu.cache={},Gu.ImageSize=[20,40,80,160,320,640,1280,2560];const Ku=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function $u(t){return null==t?void 0:t}class qu{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:$u(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Ku.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:$u(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function Zu(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Ju(t){if(!Zu(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Ju(t[i])})),e}function Qu(t,e){var i;const s=null!==(i=Ju(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];Zu(n)&&Zu(i)?s[t]=Qu(n,i):s[t]=Ju(i)})),s}class tp{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Ju(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];Zu(r)&&Zu(n)?t[i]=Qu(r,n):!Zu(r)&&Zu(a)&&Zu(n)?t[i]=Qu(a,n):t[i]=Ju(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?ep.PAINT|ep.BOUNDS|ep.PICK:ep.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?ep.PAINT|ep.BOUNDS:ep.PAINT}};class np{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:kd;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:Ao.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:Ao.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:Ao.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const rp=new qu;function ap(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,op(t),!0)}function op(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=rp.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function lp(t){if(t)return t.parentScope&&lp(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&op(t),t}function hp(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function cp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function dp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,cp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),hp(null!=e?e:t.ownerStage))}const up=new Ve,pp=new Ge,gp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],fp=["x","y"],mp=["scaleX","scaleY"],vp=["angle"],yp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),_p=new re,bp=[],xp=ep.PAINT|ep.SHAPE|ep.BOUNDS|ep.TRANSFORM|ep.LAYOUT;function Sp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Ap(t){if(!Sp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=Sp(s)?Ap(s):s})),i}function kp(t,e){return t===e||!!(Sp(t)||Sp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function Cp(t,e){var i;const s=null!==(i=Ap(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];Sp(n)&&Sp(i)?s[t]=Cp(n,i):s[t]=Ap(i)})),s}const Tp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Mp extends $a{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,cp(this.stage,this),hp(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&lp(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Ao.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(lp(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new qu).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Ap(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&Sp(n)&&Sp(s)?e[t]=Cp(n,s):e[t]=Ap(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:Ap(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e){const i=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((s=>{const n=Object.prototype.hasOwnProperty.call(e,s),r=t[s];if(!n)return void(Object.prototype.hasOwnProperty.call(t,s)&&(i.set(s,{prev:r,next:void 0}),delete t[s]));const a=e[s];kp(r,a)||(i.set(s,{prev:r,next:a}),t[s]=Ap(a))})),i}_syncAttribute(){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const t=this.buildStaticAttributeSnapshot(),e=this.syncObjectToSnapshot(this.attribute,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,e}_syncFinalAttributeFromStaticTruth(){const t=this.finalAttribute;if(!t)return;const e=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(t,e)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=sp[t];return n?n(e,i):null!==(s=ip[t])&&void 0!==s?s:ep.PAINT}(e,i,s):null!==(n=ip[e])&&void 0!==n?n:ep.PAINT;return r&ep.PICK&&(r|=ep.BOUNDS),r===ep.PAINT&&this.needUpdateTag(e)&&(r=ep.SHAPE|ep.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&xp)!==xp?(t&ep.SHAPE?this.addUpdateShapeAndBoundsTag():t&ep.BOUNDS&&this.addUpdateBoundTag(),t&ep.PAINT&&this.addUpdatePaintTag(),t&ep.TRANSFORM&&this.addUpdatePositionTag(),t&ep.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=ep.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!Sp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=Sp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&xo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Mp.userSymbolMap[t],e)return e;if(!0===Nc(t=Pc[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=_(i.path)?i.path:[i.path];up.clear();const n=[];s.forEach((t=>{const e=(new Ml).fromString(t.d),i={};Ad.forEach((e=>{t[e]&&(i[Sd[e]]=t[e])})),n.push({path:e,attribute:i}),up.union(e.bounds)}));const r=up.width(),a=up.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new wc(t,n,!0);return Mp.userSymbolMap[t]=l,l}const i=(new Ml).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Yt(s,n);i.transform(0,0,r,r);const a=new wc(t,i);return Mp.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=gh(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new lo(t);return Ro(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ge),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&xo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&xo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&xo.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&xo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=xo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===So.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===Ao.STATE||null!=i&&i>=Ao.ANIMATE_BIND&&i<=Ao.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===Ao.STATE||null!=o&&o>=Ao.ANIMATE_BIND&&o<=Ao.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!kp(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:bp,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Ao.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:Ao.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:kd}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:bp,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Ap(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Ao.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:Ao.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:bp,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:bp,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Ao.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:Ao.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Ao.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Dl.x,y:e=Dl.y,scaleX:i=Dl.scaleX,scaleY:s=Dl.scaleY,angle:n=Dl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Gt(a),f=Kt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const y=m-i,_=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*y-S*_,t.f=p+h*m+d*v-x*y-A*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),Ua.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Dl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=pp.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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:Ua.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:Ao.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:Ao.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=Ua.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Ml).fromString(t):this.pathProxy=new Ml,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:Ua.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new to(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):$a.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:Ao.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:Ao.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Ua.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Mu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}function wp(t){return!!t&&("string"==typeof t?!yp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Op=Pp();class Ip{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Bp.forEach((t=>{this._defaultTheme[t]=Object.create(Op[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Bp.forEach((s=>{const n=Object.create(Op[s]);t&&t[s]&&Rp(n,t[s]),i[s]&&Rp(n,i[s]),e[s]&&Rp(n,e[s]),this.combinedTheme[s]=n})),e.common&&Bp.forEach((t=>{Rp(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Lp=new Ip;function Dp(t,e){return t.glyphHost?Dp(t.glyphHost):e?(t.isContainer,e):Fp(t)||t.attachedThemeGraphic&&Dp(t.attachedThemeGraphic)||Lp.getTheme()}function Fp(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)):Lp.getTheme()}return null}const zp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},Hp=["radius","startAngle","endAngle",...gp];class jp extends Mp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=nd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Dp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ua.graphicService.updateTempAABBBounds(i);return zp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ut-zt?i.set(-r,-r,r,r):vh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Hp)}needUpdateTag(t){return super.needUpdateTag(t,Hp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Ml,s.arc(0,0,r,a,o),s}clone(){return new jp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return jp.NOWORK_ANIMATE_ATTR}}function Np(t){return new jp(t)}function Up(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Vp(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Wp(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[hi(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=hi(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}jp.NOWORK_ANIMATE_ATTR=Tp;class Gp{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Bl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=vd}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Dp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Xp({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Ua.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Yc(n,o/Math.abs(r+a),!0,l),i.union(n)}return Ua.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ua.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ne(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=Ua.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Gp(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=Ua.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new Gp(a,T,C),w=_(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=Up(y,a),e=this.cache.verticalList.length*v,i=Vp(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>qc(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===$c.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const S=Up(y,a),A=x.verticalList.length*v,k=Vp(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Ch(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Yp){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Yp){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Xp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xp.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Xp.baselineMapAlign}getAlignMapBaseline(){return Xp.alignMapBaseline}}function Kp(t){return new Xp(t)}Xp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Tp),Xp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Xp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const $p=["heightLimit","lineClamp"];class qp extends Xp{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=Ch(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=Ua.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new Gp(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),T=[],M=[0,0];let w=1/0;if(y>0&&(w=Math.max(Math.floor(y/x),1)),b&&(w=Math.min(w,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Yc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Jp)}needUpdateTag(t){return super.needUpdateTag(t,Jp)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Ml).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Ml).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function tg(t){return new Qp(t)}Qp.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Tp);const eg=["segments","points","curveType","curveTension",...gp];let ig=class t extends Mp{constructor(t={}){super(t),this.type="line",this.numberType=ld}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}getGraphicTheme(){return Dp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Ua.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,eg)}needUpdateTag(t){return super.needUpdateTag(t,eg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Ml;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function sg(t){return new ig(t)}ig.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const ng=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},rg=["width","x1","y1","height","cornerRadius",...gp];class ag extends Mp{constructor(t){super(t),this.type="rect",this.numberType=ud}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Dp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);return zp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,rg)}needUpdateTag(t){return super.needUpdateTag(t,rg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=ng(e);return t=new Ml,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new ag(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ag.NOWORK_ANIMATE_ATTR}}function og(t){return new ag(t)}ag.NOWORK_ANIMATE_ATTR=Tp;const lg=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class hg extends ag{constructor(t){super(t),this.type="rect3d",this.numberType=pd}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Xt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;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,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Dp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new dg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return dg.NOWORK_ANIMATE_ATTR}}function ug(t){return new dg(t)}dg.NOWORK_ANIMATE_ATTR=Tp;const pg=Symbol.for("EnvContribution"),gg=Symbol.for("VGlobal"),fg="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",mg={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"}},vg=!0,yg=!1,_g=/\w|\(|\)|-/,bg=/[.?!,;:/,。?!、;:]/,xg=/\S/,Sg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Ag(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Ua.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=kg(t,a)),a}function kg(t,e,i=!1){let s=e;for(;_g.test(t[s-1])&&_g.test(t[s])||bg.test(t[s]);)if(s--,s<=0)return i?Cg(t,e):e;return s}function Cg(t,e){let i=e;for(;_g.test(t[i+1])&&_g.test(t[i])||bg.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Tg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Ua.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Mg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=mg[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function wg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Eg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Ch(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Tg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Tg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ag(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Tg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=wg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ag(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Tg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=wg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Ag(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Tg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Bg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...gp];class Pg extends Mp{constructor(t){super(t),this.type="image",this.numberType=od,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Dp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);return zp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ah[t]}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}clone(){return new Pg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Pg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Tp);class Og extends Pg{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=gh(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=gh(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=ah.width,height:e=ah.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Ig{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Og?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=mg[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Eg){const e=xg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Og)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Tg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||yg;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Sg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||vg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?au(t,s,{AABBBounds:i}):s,Sg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Og)break;const{width:n}=Tg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Og?t.width:t.getWidthWithEllips(this.direction)})),i}}class Lg{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=mg[this.direction]}store(t){if(t instanceof Og){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 Ig(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Og?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Ag(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Eg(i,t.newLine,t.character,t.ascentDescentMode),new Eg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Dg=!1;try{Dg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Dg=!1}const Fg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...gp];class zg extends Mp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=gd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:rh.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:rh.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:rh.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:rh.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:rh.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:rh.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:rh.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:rh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Dp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&zg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&zg.splitText(t.text).length>1)))}static splitText(t){if(Dg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=zg.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Ua.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ua.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!zg.AllSingleCharacter(y)&&(y=zg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Mg(0,0,(k?n:x?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Lg(T);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&T.lines[T.lines.length-1].paragraphs.push(s)):M.deal(s,!0),T.lines.length!==t&&(t=T.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,T.lines[T.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===T.layoutDirection?k:C)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:s)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new zg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return zg.NOWORK_ANIMATE_ATTR}}function Hg(t){return new zg(t)}zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Tp);const jg=["path","customPath",...gp];class Ng extends Mp{constructor(t){super(t),this.type="path",this.numberType=hd}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Ml?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Ml?this.cache:t.path)}getGraphicTheme(){return Dp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);zp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Ml).fromString(t.path):t.customPath&&(this.cache=new Ml,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,jg)}needUpdateTag(t){return super.needUpdateTag(t,jg)}toCustomPath(){return(new Ml).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Ng(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ng.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Ng(t)}Ng.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Tp);const Vg=["segments","points","curveType","curveTension",...gp];class Wg extends Mp{constructor(t){super(t),this.type="area",this.numberType=sd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Dp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Ua.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Ml;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Wg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wg.NOWORK_ANIMATE_ATTR}}function Gg(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const Yg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...gp];class Xg extends Mp{constructor(t){super(t),this.type="arc",this.numberType=ed}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=he(e),i=e+a,s&&Vt(a)>zt&&Vt(a)zt&&o>zt)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=$t(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Kt(g)),n=Zt(Number(l)/a*Kt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Dp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ua.graphicService.updateTempAABBBounds(i);zp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Ut-zt?i.set(-s,-s,s,s):(vh(l,o,s,i),vh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Yg)}needUpdateTag(t){return super.needUpdateTag(t,Yg)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ut-zt)n.moveTo(0+h*Gt(a),0+h*Kt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Kt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Kt(a),i=l*Gt(o),s=l*Kt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function Kg(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Tp);const $g=["width","height","spikes","thickness",...gp];class qg extends Mp{constructor(t){super(t),this.type="star",this._cachedPoints=[],this.numberType=fd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e,spikes:i}=this.attribute;return(null==t||t>0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return Dp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=Ua.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Ml,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Tp;class Jg extends Xg{constructor(t){super(t),this.type="arc3d",this.numberType=id}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),Ua.graphicService.updateTempAABBBounds(i),Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return Jg.NOWORK_ANIMATE_ATTR}}function Qg(t){return new Jg(t)}var tf;Jg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Tp),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(tf||(tf={}));let ef=class t extends Mp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=ad,this._childUpdateTag=xo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(ap(this.sharedStateScope,t),dp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Ip),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Ip)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===So.GLOBAL){const i=new re(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&xo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Dl.x,y:e=Dl.y,dx:i=Dl.dx,dy:s=Dl.dy,scaleX:n=Dl.scaleX,scaleY:r=Dl.scaleY,angle:a=Dl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Dp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Ua.graphicService.updateTempAABBBounds(i),Ua.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=xo.CLEAR_BOUNDS,this._childUpdateTag&=xo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&xo.UPDATE_BOUNDS||(this._childUpdateTag|=xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:Ua.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&xo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Ua.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&ap(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return op({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function sf(t){return new ef(t)}ef.NOWORK_ANIMATE_ATTR=Tp;const nf=["points","cornerRadius",...gp];class rf extends Mp{constructor(t){super(t),this.type="polygon",this.numberType=cd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Dp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Ua.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ua.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,nf)}needUpdateTag(t){return super.needUpdateTag(t,nf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Ml,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new rf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rf.NOWORK_ANIMATE_ATTR}}function af(t){return new rf(t)}rf.NOWORK_ANIMATE_ATTR=Tp;class of extends rf{constructor(t){super(t),this.type="pyramid3d",this.numberType=dd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),Ua.graphicService.updateTempAABBBounds(i),Ua.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,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}getNoWorkAnimateAttr(){return of.NOWORK_ANIMATE_ATTR}}function lf(t){return new of(t)}of.NOWORK_ANIMATE_ATTR=Tp;class hf extends ef{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function cf(t){return new hf(t)}class df{constructor(){this.registry=new Map}create(t,e){const i=this.registry.get(t);if(!i)throw new Error(`GraphicFactory has no creator registered for type "${t}"`);return new i(e)}register(t,e){if(!t)throw new Error("GraphicFactory requires a non-empty graphic type");this.registry.set(t,e)}}const uf=new df;const pf=new class{constructor(){this.store=new Map}registerStore(t,e){this.store.set(t,e),this[t]=e}RegisterGraphicCreator(t,e){gf(t,e)}CreateGraphic(t,e){return this.store.has(t)?ff(t,e):null}};function gf(t,e){if(!t)throw new Error("Graphic registration requires a non-empty graphic type");pf.registerStore(t,e),uf.register(t,function(t){return class{constructor(e){try{return new t(e)}catch(i){return t(e)}}}}(e))}function ff(t,e){return uf.create(t,e)}function mf(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=m[1];y[2]=null!==(s=m[2])&&void 0!==s?s:0}if(ou(t),du(t,t,[n+o,r+l,a+h]),du(t,t,[y[0],y[1],y[2]]),lu(t,t,g),hu(t,t,p),du(t,t,[-y[0],-y[1],y[2]]),pu(t,t,[c,d,u]),f){const i=ku.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}du(i,i,[s[0],s[1],0]),cu(i,i,f),du(i,i,[-s[0],-s[1],0]),gu(t,t,i)}}function vf(t){const{alpha:e,beta:i}=t.attribute;return e||i}class yf{constructor(t=pf){this.creator=t,this.hooks={onAttributeUpdate:new Ha(["graphic"]),onSetStage:new Ha(["graphic","stage"]),onRemove:new Ha(["graphic"]),onRelease:new Ha(["graphic"]),onAddIncremental:new Ha(["graphic","group","stage"]),onClearIncremental:new Ha(["graphic","group","stage"]),beforeUpdateAABBBounds:new Ha(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Ha(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new Ha(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Vp(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Up(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Yc(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Yc(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Ne(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}let _f,bf;function xf(t){return _f||(_f=ff("text",{})),_f.initAttributes(t),_f.AABBBounds}function Sf(t){return bf||(bf=ff("richtext",{})),bf.setAttributes(t),bf.AABBBounds}const Af=Symbol.for("TransformUtil"),kf=Symbol.for("GraphicUtil"),Cf=Symbol.for("LayerService"),Tf=Symbol.for("StaticLayerHandlerContribution"),Mf=Symbol.for("DynamicLayerHandlerContribution"),wf=Symbol.for("VirtualLayerHandlerContribution"),Ef=Symbol.for("RenderService"),Bf=Symbol.for("BeforeRenderConstribution"),Pf=Symbol.for("AutoEnablePlugins"),Rf=Symbol.for("PluginService"),Of=Symbol.for("GraphicPicker"),If=Symbol.for("PickerService"),Lf=Symbol.for("BoundsPicker"),Df=Symbol.for("GlobalPickerService"),Ff=Symbol.for("PickItemInterceptor"),zf=Symbol.for("PickServiceInterceptor"),Hf=Symbol.for("IncrementalDrawContribution"),jf=Symbol.for("ArcRender"),Nf=Symbol.for("Arc3dRender"),Uf=Symbol.for("AreaRender"),Vf=Symbol.for("CircleRender"),Wf=Symbol.for("GraphicRender"),Gf=Symbol.for("GroupRender"),Yf=Symbol.for("LineRender"),Xf=Symbol.for("PathRender"),Kf=Symbol.for("PolygonRender"),$f=Symbol.for("RectRender"),qf=Symbol.for("Rect3DRender"),Zf=Symbol.for("SymbolRender"),Jf=Symbol.for("TextRender"),Qf=Symbol.for("RichTextRender"),tm=Symbol.for("Pyramid3dRender"),em=Symbol.for("GlyphRender"),im=Symbol.for("ImageRender"),sm=Symbol.for("RenderSelector"),nm=Symbol.for("DrawContribution"),rm=Symbol.for("StarRender"),am=Symbol.for("VWindow"),om=Symbol.for("WindowHandlerContribution");function lm(t){const e=Ua.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class hm extends Ga{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=Ua.global,e=lm){super(),this.handlerFactory=e,this.hooks={onChange:new Ha(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=ja.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&>(this.width,t.width())&>(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class cm{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Md(Object.assign({nativeCanvas:Ua.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Md(Object.assign({nativeCanvas:Ua.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const dm=new cm;class um{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Ua.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=dm.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:jl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:jl.fontFamily,fontSize:jl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=Ua.windowFactory)||void 0===s?void 0:s.call(Ua))&&void 0!==n?n:new hm(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var pm;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(pm||(pm={}));const gm=new Ge;class fm{constructor(){this.matrix=new Ge}init(t){return this.mode=pm.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=pm.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(gm.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(gm.a,gm.b,gm.c,gm.d,gm.e,gm.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(gm.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(gm.a,gm.b,gm.c,gm.d,gm.e,gm.f),this}scale(t,e,i){return this.mode===pm.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===pm.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return gm.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(gm.a,gm.b,gm.c,gm.d,gm.e,gm.f),this}translate(t,e){return this.mode===pm.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===pm.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}class mm{constructor(){this.global=Ua.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ge(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new re(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var vm=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function ym(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function _m(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=ym(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=ym(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Sm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Am{constructor(){this.time=To.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(Tm(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Dp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){Im(t,e,i,s)}}const km=new Am,Cm=new Set(["top","center","bottom"]);function Tm(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Mm({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const wm={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Em({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=wm[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Mm({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Bm(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Pm(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:Cm.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Bm(s,e,"left","center","right"),y:Bm(n,i,"top","center","bottom")}}function Rm(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Om(t){if(!t)return null;const e=Rm(t.naturalWidth,t.videoWidth,t.width),i=Rm(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Im(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Om(e),{backgroundRepeatMode:m,backgroundSizing:v}=Em({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Pm(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=dm.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),dm.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class Lm{constructor(t){this.subRenderContribitions=t,this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}}class Dm{constructor(){this.time=To.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const Fm=new Dm;class zm{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Hm=new zm,jm={getContributions:()=>[]};class Nm{constructor(t=[],e=jm,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):_m(e,Gl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ue,this.backupDirtyBounds=new Ue,this.global=null!==(s=i.global)&&void 0!==s?s:Ua.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:Ua.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:jm,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Gl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Gl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Au.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=xm(e,i,Gl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Sm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Au.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Sm.free(n),Au.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||function(){const t=Ua.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class Vm{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class Wm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Gm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Ym{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const Xm={getContributions:()=>[]};class Km{constructor(t=Xm,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new Gm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class $m{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class qm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Ua.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Ua.global.getRequestAnimationFrame();this.rafId=t((()=>{Ua.global.devicePixelRatio!==this.dpr&&(this.dpr=Ua.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Ua.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class Zm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ua.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Jm=new Ve;class Qm{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&xo.UPDATE_PAINT)||s._updateTag&xo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(Jm.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(Jm,t.parent&&t.parent.globalTransMatrix)))})),t.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let tv;function ev(){if(null==tv)try{const t=document.createElement("canvas"),e=t.getContext("2d");tv=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),tv&&(tv=!!document.createElement)}catch(t){tv=!1}}function iv(){ev();const t=Ua.global&&Ua.global.env;return t?"browser"===t:tv}const sv="white";class nv extends ef{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:sv}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Ip,this.hooks={beforeRender:new Ha(["stage"]),afterRender:new Ha(["stage"]),afterClearScreen:new Ha(["stage"]),afterClearRect:new Ha(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:Ua.global,!this.global.env&&iv()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:Ua.windowFactory)&&void 0!==n?n:()=>new hm(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=Ua.pickerServiceFactory)&&void 0!==a?a:()=>new mm,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=Ua.renderServiceFactory)||void 0===h?void 0:h.call(Ua))&&void 0!==c?c:Ua.renderService)&&void 0!==d?d:new Um,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=Ua.pluginServiceFactory)||void 0===p?void 0:p.call(Ua))&&void 0!==g?g:Ua.pluginService)&&void 0!==f?f:new Km,this.layerService=null!==(v=null!==(m=e.layerService)&&void 0!==m?m:Ua.layerService)&&void 0!==v?v:new cv(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:Ua.graphicService)&&void 0!==b?b:new yf,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:sv,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,op(s)),dp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new ao(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[y,_,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,A=Math.cos(d)*Math.cos(u)*1);const k=lv.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=lv.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=lv.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new $m))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new qm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new Zm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ue;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Qm,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=lv.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=lv.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=lv.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return op({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class rv{constructor(t=nv,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class av extends ef{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Ip,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Ua.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Ua.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}class ov{constructor(t=av){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let lv=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function hv(t){const e=Ua.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}lv._pluginClasses={};class cv{static GenerateLayerId(){return`${cv.idprefix}_${cv.prefix_count++}`}constructor(t=Ua.global,e=new ov,i=hv){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:cv.GenerateLayerId(),layerHandler:n})}),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}}cv.idprefix="visactor_layer",cv.prefix_count=0;const dv=Symbol("ContributionProvider");class uv{constructor(t,e){this.serviceIdentifier=t,this.container=e,mv.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function pv(t,e){return new uv(t,e)}function gv(t,e){t(dv).toDynamicValue((({container:t})=>pv(e,t))).inSingletonScope().whenTargetNamed(e)}function fv(t,e){t(dv).toDynamicValue((({container:t})=>pv(e,t))).whenTargetNamed(e)}class mv{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}mv.store=new Map;class vv{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=nh.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=kg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=kg(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}}const yv=Symbol.for("TextMeasureContribution");class _v extends vv{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function bv({bind:t}){t(gg).toDynamicValue((({container:t})=>new Xa(pv(pg,t)))).inSingletonScope(),t(am).to(hm),t(kf).toDynamicValue((({container:t})=>new um(pv(yv,t)))).inSingletonScope(),t(Af).to(fm).inSingletonScope(),t(Cf).to(cv).inSingletonScope()}function xv({bind:t}){t(Ef).to(Um)}const Sv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===id,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Ut;for(;o<0;)o+=Ut;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};class Av{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class kv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Dp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Au.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class Cv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class Tv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=Sv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function Mv({bind:t,isBound:e}){e(If)||(t(Df).toSelf(),t(If).toService(Df)),t(Tv).toSelf().inSingletonScope(),t(Ff).toService(Tv),t(kv).toSelf().inSingletonScope(),t(Ff).toService(kv),t(Cv).toSelf().inSingletonScope(),t(Ff).toService(Cv),gv(t,Ff),t(Av).toSelf().inSingletonScope(),t(zf).toService(Av),gv(t,zf)}function wv({bind:t}){t(yd).to(yf),t(_d).toConstantValue(pf)}class Ev{constructor(){this.type="static",this.offscreen=!1,this.global=Ua.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Md({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}}function Bv(t){(function({bind:t}){gv(t,pg)})({bind:t.bind}),function({bind:t}){t(yv).to(_v).inSingletonScope(),gv(t,yv)}({bind:t.bind}),function({bind:t}){t(Ev).toSelf(),t(Tf).toService(Ev)}({bind:t.bind})}const Pv=Ht/2;function Rv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Pv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Pv,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Pv,Ht,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ht,Ht+Pv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function Ov(t,e){return!(!t&&!e)}function Iv(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Lv(t,e,i){return i&&t*e>0}function Dv(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Fv(t,e){return t*e>0}function zv(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Hv(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uB*B+P*P&&(k=T,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Nv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*Gt(c),k=n*Kt(c),C=s*Gt(u),T=s*Kt(u);let M,w,E,B;if((b>zt||y>zt)&&(M=n*Gt(d),w=n*Kt(d),E=s*Gt(p),B=s*Kt(p),r1?0:P<-1?Ht:Math.acos(P))/2),l=$t(t[0]*t[0]+t[1]*t[1]);S=Xt(b,(s-l)/(o-1)),x=Xt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:M,yore:w,xire:C,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Uv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ut-zt)e.moveTo(i+n*Gt(o),s+n*Kt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Kt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:T,innerDeltaAngle:M,innerEndAngle:w,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Nv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=Xt(v,m),r=Xt(y,m),o=jv(g,f,u,p,n,t,Number(c)),l=jv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Gt(Wt(l.y01,l.x01)),s+o.cy+m*Kt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Kt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Kt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Gt(C),s+n*Kt(C));if(!(r>zt)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=Xt(B,T),n=Xt(P,T),o=jv(S,A,b,x,r,-n,Number(c)),l=jv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Kt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,w,E,c):e.moveTo(i+r*Gt(E),s+r*Kt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Kt(o)):e.closePath(),d}const Vv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Wv{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=dm.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),dm.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Ut),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=dm.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=tg({}));const C=h.columns?v/h.columns:b,T=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,T-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:Vv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=dm.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),dm.free(l),c}dm.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const Gv=new Wv;class Yv{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{innerPadding:m=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,T-=m;const w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:ru(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:T-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Uv(t,e,i,s,M+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&w(u,"outerBorder"),f&&w(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:T,startAngle:y,endAngle:_})}}const Xv=new Yv,Kv=Gv,$v=km;class qv{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:ru(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Zv=new qv,Jv=Gv,Qv=km;class ty extends Am{constructor(){super(...arguments),this.time=To.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Tm(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const ey=new ty;class iy{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:k-i)||0,w=(null!=w?w:C-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:ru(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,w-o*g)):(e.beginPath(),Rv(e,u,p,M-o*g,w-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}class sy{constructor(){this.time=To.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}}class ny{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Rv(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ry=new iy,ay=Gv,oy=km;class ly extends iy{constructor(){super(...arguments),this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}}const hy=new ly,cy=km;class dy{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:ru(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class uy{constructor(){this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const py=new dy,gy=new uy,fy=Gv,my=km,vy=Gv,yy=km;class _y extends Wv{constructor(){super(...arguments),this.time=To.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:xh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:xh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:xh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:xh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class by{constructor(t){this.groupRenderContribitions=t,this.numberType=ad}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ey)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Dp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:T=l.y}=t.attribute,M=Dv(p,m,g,f,c),w=zv(p,v,g,f),E=Ov(c,u),B=Iv(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(M||w||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Rv(e,i,s,g,f,y,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ey));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===To.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,T-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,C-i,T-s,l),e.stroke()))};A?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===To.afterFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Ua.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Dp(t,null==s?void 0:s.theme).group,i=ku.allocate(),n=ku.allocate();mf(n,t,e),gu(i,p||i,n),a.modelMatrix=i,ku.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ku.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var xy,Sy=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(xy||(xy={}));class Ay extends Nm{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=xy.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Ha([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Sy(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Gl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Gl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return Sy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Sy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Sy(this,void 0,void 0,(function*(){if(2!==t.count)yield bm(t,Gl.zIndex,((i,s)=>{if(this.status===xy.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Sy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Sy(this,void 0,void 0,(function*(){this.rendering&&(this.status=xy.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=xy.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 Sy(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:()=>Sy(this,void 0,void 0,(function*(){yield bm(t,Gl.zIndex,(t=>Sy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const ky=Symbol.for("DrawItemInterceptor"),Cy=new Ve,Ty=new Ve;class My{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Cy.copy(s.dirtyBounds),Ty.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Au.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Cy),s.backupDirtyBounds.copy(Ty)),!0}}class wy{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}class Ey{constructor(){this.order=1,this.interceptors=[new My,new Py,new By,new wy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ku.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const Ry=Symbol.for("ArcRenderContribution"),Oy=Symbol.for("AreaRenderContribution"),Iy=Symbol.for("CircleRenderContribution"),Ly=Symbol.for("GroupRenderContribution"),Dy=Symbol.for("ImageRenderContribution"),Fy=Symbol.for("PathRenderContribution"),zy=Symbol.for("PolygonRenderContribution"),Hy=Symbol.for("RectRenderContribution"),jy=Symbol.for("SymbolRenderContribution"),Ny=Symbol.for("TextRenderContribution"),Uy=Symbol.for("StarRenderContribution"),Vy=Symbol.for("CommonRenderContribution"),Wy=Symbol.for("InteractiveSubRenderContribution");function Gy(t){!function({bind:t}){t(Am).toSelf().inSingletonScope(),t(Wv).toSelf().inSingletonScope(),t(nm).to(Nm),t(Hf).to(Ay),t(Gf).toDynamicValue((({container:t})=>new by(pv(Ly,t)))).inSingletonScope(),t(Wf).toService(Gf),gv(t,Ly),gv(t,Wy),t(Lm).toDynamicValue((({container:t})=>new Lm(pv(Wy,t)))).inSingletonScope(),gv(t,Wf),t(Ey).toSelf().inSingletonScope(),t(ky).toService(Ey),gv(t,ky)}({bind:t.bind})}class Yy{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class Xy{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new Yy(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function Ky(){return new Xy}const $y=Ky();function qy(){qy.__loaded||(qy.__loaded=!0,bv({bind:$y.bind}),wv({bind:$y.bind}),xv({bind:$y.bind}),Mv({bind:$y.bind,isBound:$y.isBound}),function({bind:t}){t(Rf).to(Km),fv(t,Pf)}({bind:$y.bind}),Bv($y),Gy($y))}function Zy(){return $y}function Jy(t){qy();const[e]=$y.getAll(t);return e}function Qy(t,e){return qy(),$y.getNamed(t,e)}function t_(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}qy.__loaded=!1;const e_=t_((()=>Jy(gg)));Ua.global=e_;const i_=Zy(),s_=t_((()=>Jy(kf))),n_=t_((()=>Jy(Af))),r_=t_((()=>Jy(yd))),a_=t_((()=>Jy(Cf)));function o_(){Ua.global=e_,Ua.graphicUtil=s_,Ua.transformUtil=n_,Ua.graphicService=r_,Ua.layerService=a_,Ua.canvasFactory=t=>Qy(Cd,t),Ua.context2dFactory=t=>Qy(Td,t),Ua.windowFactory=()=>new hm(Ua.global),Ua.windowHandlerFactory=t=>function(t){const e=Qy(om,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),Ua.renderServiceFactory=()=>Jy(Ef),Ua.renderService=t_((()=>Jy(Ef))),Ua.pluginServiceFactory=()=>Jy(Rf),Ua.pluginService=t_((()=>Jy(Rf))),Ua.pickerServiceFactory=()=>Jy(If),Ua.layerHandlerFactory=t=>Jy("static"===t?Tf:"dynamic"===t?Mf:wf),Ua.incrementalDrawContributionFactory=()=>Jy(Hf)}o_();const l_={x:0,y:0,z:0,lastModelMatrix:null};class h_{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(Fm),e(Hm),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===To.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===To.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Dp(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,y=Lv(d,u,h),_=Fv(d,g),b=Ov(h),x=Iv(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Ro(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Lv(o,l,n),p=Fv(o,c),g=Ov(n,r),f=Iv(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;l_.x=n,l_.y=r,l_.z=a,l_.lastModelMatrix=d;const p=u&&(s||vf(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=ku.allocate(),n=ku.allocate();mf(n,t,e),gu(s,d||s,n),l_.x=0,l_.y=0,l_.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ku.free(n)}if(g&&!d){const s=t.getOffsetXY(e);l_.x+=s.x,l_.y+=s.y,l_.z=a,i.setTransformForCurrent()}else if(p)l_.x=0,l_.y=0,l_.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);l_.x+=s.x,l_.y+=s.y,this.transformWithoutTranslate(i,l_.x,l_.y,l_.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),l_.x=0,l_.y=0,l_.z=0;return l_}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,f,m,v,y,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ku.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class c_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ed,this.builtinContributions=[Xv,$v,Kv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nzt){const t=Xt(b,_),r=Xt(x,_),a=jv(v,y,f,m,n,t,Number(u)),o=jv(A,k,C,T,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||w<.001)e.lineTo(i+C,s+T),p=!0;else if(M>zt){const t=Xt(B,M),n=Xt(P,M),a=jv(C,T,A,k,r,-n,Number(u)),o=jv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Kt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Dp(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let T=0;const M=(c(S)&&S||S[0])&&"conical"===h.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Ut-zt){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),w||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Yu(0,0,h,n);a||Lv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}class d_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=nd,this.builtinContributions=[Zv,Qv,Jv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}function u_(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=No(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function p_(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function g_(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=p_(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),u_(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=ko.ROW:"y"===s?u=ko.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function m_(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}class v_ extends h_{constructor(){super(...arguments),this.numberType=ld}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();g_(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Tl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Xt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}function y_(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?ko.ROW:ko.COLUMN,Number.isFinite(c)||(o=ko.COLUMN),Number.isFinite(d)||(o=ko.ROW);const u=i*(o===ko.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),u_(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),u_(t,l,1,s),o=!1):o=!0}t.closePath()}const b_=new _y,x_=km;class S_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=sd,this.builtinContributions=[b_,x_],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Dp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:T,points:M,segments:w}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===C&&!w&&!M.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,_,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(w&&w.length){let e,i;const s=w.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Tl(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Tl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Tl(e,E,{curveTension:b}),n=Tl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Xt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=ko.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),A=Vt(y.y-b.y);x=null==y.x1?ko.ROW:null==y.y1?ko.COLUMN:Number.isFinite(S+A)?S>A?ko.ROW:ko.COLUMN:ko.ROW,y_(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),g_(t,i[0]?e.top:e.bottom,l,x===ko.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const A_=Gv,k_=km;class C_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=hd,this.builtinContributions=[k_,A_],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Dp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)Ro(t.pathShape.commandList,e,i,s,1,1,f);else{Ro((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}class T_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=ud,this.builtinContributions=[ry,oy,ay],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Dp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:M}=t.attribute;T=(null!=T?T:b-S)||0,M=(null!=M?M:x-A)||0;const w=Dv(g,f,T,M,h),E=zv(g,v,T,M,C),B=Ov(h,c),P=Iv(d,m);if(!t.valid||!y)return;if(!B&&!P)return;if(!(w||E||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,M)):(e.beginPath(),Rv(e,i,s,T,M,u,"bevel"!==p));const R={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,w,E,l,n,a,o,R),k?(this._runStroke(t,e,i,s,l,R,E,S,A,o),this._runFill(t,e,i,s,l,R,w,S,A,a)):(this._runFill(t,e,i,s,l,R,w,S,A,a),this._runStroke(t,e,i,s,l,R,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,w,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}class M_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=md,this.builtinContributions=[py,my,fy,gy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Dp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,M=s,w=C;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,C);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,M=t.y,w=void 0}!1===A.draw(e,c,T,M,w,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,A,a)):(this._runFill(t,e,i,s,l,x,y,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const w_=new class extends Am{constructor(){super(...arguments),this.time=To.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:w=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:R=l.backgroundClip,backgroundCornerRadius:O=l.backgroundCornerRadius}=t.attribute;let I,{background:L}=t.attribute;if(!L)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(L)&&L.background?L:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Sm.allocate(i,s,i+n,s+r),L=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=xf(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const i=t.resources.get(L);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,R&&(e.beginPath(),O?Rv(e,F.x1,F.y1,F.width(),F.height(),O,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:T,backgroundKeepAspectRatio:M,backgroundScale:w,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=L,O?(Rv(e,F.x1,F.y1,F.width(),F.height(),O,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Sm.free(F),D()}};class E_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=vd,this.builtinContributions=[w_],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Dp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=Ch(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:T}=S,M=!f,w=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,T,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,w,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Au.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Au.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,w))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,w))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,w),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,w)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,w),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,w,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,w,e),this.afterRenderStep(t,e,i,s,C,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!u(c),_=y?c.width:i.clipedWidth,b=y?0:Up(d,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}function B_(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?B_(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void B_(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,y=v/m;const _=P_(d,u),b=P_(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=R_(h,y,_,d,u),A=R_(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,T=P_(k,C),M=R_(h,P_(y,v),T,k,C);let w=Math.atan2(S.y-M.y,S.x-M.x);const E=Math.atan2(A.y-M.y,A.x-M.x);let B=E-w;B<0&&(w=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const D_=["","repeat-x","repeat-y","repeat"];function F_(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?D_[i]:"no-repeat"}function z_({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=F_(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const H_={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function j_(t){return{backgroundMode:H_[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function N_({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=z_({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function U_(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=z_({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?j_(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Im(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class V_ extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=od,this.builtinContributions=[hy,cy],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:T,doStroke:M}=A;if(!S||!t.resources)return;const w=t.resources.get(S);if("success"!==w.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Rv(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),U_(e,w.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},O=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=N_({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),L=P||I;g?(O(),L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore()):(L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore(),O()),this.afterRenderStep(t,e,i,s,T,!1,k,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&y(s))return void lh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Dp(t).image;this._draw(t,a,!1,i)}}var W_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class G_{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return W_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class Y_{constructor(){this._uid=ja.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class X_{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Pu.Get(e,Bu.Color1),this.ambient=i;const s=$t(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Xt(Yt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=y(e)?Pu.Get(e,Bu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const K_=()=>{lv.registerPlugin("DirectionalLight",X_)};class $_{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=ku.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=ku.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return fu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=ku.allocate()),this._vp=gu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=ku.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=ku.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return mu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=ku.allocate()),this._vp=gu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return vu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;vu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const q_=()=>{lv.registerPlugin("OrthoCamera",$_)},Z_={getContributions:()=>[]},J_={getContributions:()=>[]};class Q_{constructor(t=Z_,e=J_,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:Ua.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:Z_,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:J_,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ge(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=Dp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new re(e.x,e.y);l.transformPoint(a,a);const o=Dp(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&ku.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Au.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class tb{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new Vm,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new Wm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new Ym,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new Gm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new rv(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new ov,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new df}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new Um(new Nm([],(t=this.registry.contribution,e=ky,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class eb{constructor(t={}){this.context=new tb(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function ib(t={}){return new eb(t)}class sb extends eb{}class nb extends eb{}class rb extends S_{constructor(){super(...arguments),this.numberType=sd}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Dp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Lv(u,d,c),f=Ov(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=Dp(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=Lv(u,p,c),y=Fv(u,g),_=Ov(c),b=Iv(d,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||a||o))return;const{context:x}=n;for(let n=e;n{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function fb(t,e){let i=cb.get(t);i||(i=new Map,cb.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function mb(t,e,i){const s=fb(t,e);i&&s.forEach((t=>i(t))),s.clear()}function vb(){return ub(),ob}function yb(){mv.refreshAllContributions()}function _b(){return ub(),null!=lb||(lb=new Xa(pv(pg,ob))),lb}function bb(t){const e=vb(),i=_b();Ua.global=i,Ua.canvasFactory=t=>e.getNamed(Cd,t),Ua.context2dFactory=t=>e.getNamed(Td,t),Ua.windowHandlerFactory=t=>pb(om,t),Ua.windowFactory=()=>new hm(i,(t=>pb(om,t))),Ua.pluginServiceFactory=()=>new Km(pv(Pf,e),{pluginRegistry:t.context.registry.plugin}),Ua.incrementalDrawContributionFactory=()=>new Ay([],new ab,new rb(pv(Oy,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,ky))}function xb(t){var e;const i=vb();yb();const s=i.getAll(Wf),n=fb(t.registry.renderer,"vrender:runtime-renderer");mb(t.registry.renderer,"vrender:runtime-renderer",null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),gb(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,"vrender:runtime-renderer")}function Sb(t){var e;const i=vb();yb();const s=i.getAll(ky),n=null!==(e=db.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,ky,e)})),n.clear(),db.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(ky));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(ky,e),r.add(e)),n.add(e)}))}function Ab(t,e){var i;const s=vb();yb();const n=s.getAll(e),r=fb(t.registry.picker,"vrender:runtime-picker");mb(t.registry.picker,"vrender:runtime-picker",null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),gb(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,"vrender:runtime-picker")}function kb(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function Cb(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function Tb(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function Mb(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function Lb(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=ng(t.attribute),n=Fb(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=Fb(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=Fb(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;n{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return Xb(l,e,h),h},Vb=(t,e)=>{const i=t.attribute,s=i.points;if(s)return Nb(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return Nb(t,e)}return[]};const Wb=t=>t.map((t=>({x:t.x,y:t.y}))),Gb=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},Yb=t=>{const e=new Ue;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return Gb(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return Gb(t,{x:e.x1,y:n},{x:e.x2,y:n})},Xb=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=Yb(t);Xb(n[0],s,i),Xb(n[1],e-s,i)}},Kb=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:Wb(i)}];const s=[];return Xb(i,e,s),s},$b=(t,e)=>{const i=Ib(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;rObject.assign({},t))):[]}function Zb(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:qb(t.touches),configurable:!0},changedTouches:{value:qb(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function Jb(t,e){try{return t[e]}catch(t){return}}function Qb(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Zb(t),l=Jb(t,"target"),h=Jb(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var tx=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function sx(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class nx{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:ix(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},ex(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},ex(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=tx(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=ix(i,this.selectionStartCursorIdx),a=ix(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=ex(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=sx(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),Ua.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),Ua.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class rx{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=ix(i,Math.ceil(t)),n=ix(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=ix(i.attribute.textConfig,a),h=ix(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(ax,[this.formatTextCommandCb]),this.commandCbs.set(ox,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):g(t)&&e.forEach((e=>H(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new nx,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),Ua.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(Ua.global.isMacOS()&&t.metaKey&&"c"===t.key||!Ua.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return Ua.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(Ua.global.isMacOS()&&t.metaKey&&"a"===t.key||!Ua.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},ex(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=Hg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:Sf(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||og({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},ex(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),Ua.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=sf({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,lx.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=sg({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=sf({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=Sf(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=Sf(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(og({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(og({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(og({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=Sf(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=Sf(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:Sf(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Mx=new Tx;function Ex(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Bx=new WeakSet;function Px({bind:t}){Ex(Bx,t)||(t(c_).toDynamicValue((({container:t})=>new c_(pv(Ry,t)))).inSingletonScope(),t(jf).toService(c_),t(Wf).toService(jf),t(Ry).toService(Lm),gv(t,Ry))}const Rx=Px,Ox=new WeakSet;function Ix({bind:t}){Ex(Ox,t)||(t(T_).toDynamicValue((({container:t})=>new T_(pv(Hy,t)))).inSingletonScope(),t($f).toService(T_),t(Wf).toService($f),t(ny).toSelf(),t(sy).toSelf(),t(Hy).toService(ny),t(Hy).toService(sy),t(Hy).toService(Lm),gv(t,Hy))}const Lx=Ix,Dx=new WeakSet;function Fx({bind:t}){Ex(Dx,t)||(t(v_).toDynamicValue((()=>new v_)).inSingletonScope(),t(Yf).toService(v_),t(Wf).toService(Yf))}const zx=Fx,Hx=new WeakSet;function jx({bind:t}){Ex(Hx,t)||(t(S_).toDynamicValue((({container:t})=>new S_(pv(Oy,t)))).inSingletonScope(),t(Uf).toService(S_),t(Wf).toService(Uf),t(Oy).toService(Lm),gv(t,Oy))}const Nx=jx,Ux=new WeakSet;function Vx({bind:t}){Ex(Ux,t)||(t(M_).toDynamicValue((({container:t})=>new M_(pv(jy,t)))).inSingletonScope(),t(Zf).toService(M_),t(Wf).toService(Zf),t(jy).toService(Lm),gv(t,jy))}const Wx=Vx,Gx=new WeakSet;function Yx({bind:t}){Ex(Gx,t)||(t(d_).toDynamicValue((({container:t})=>new d_(pv(Iy,t)))).inSingletonScope(),t(Vf).toService(d_),t(Wf).toService(Vf),t(Iy).toService(Lm),gv(t,Iy))}const Xx=Yx,Kx=new WeakSet;function $x({bind:t}){Ex(Kx,t)||(t(Jf).toDynamicValue((({container:t})=>new E_(pv(Ny,t)))).inSingletonScope(),t(Wf).toService(Jf),t(Ny).toService(Lm),gv(t,Ny))}const qx=$x,Zx=new WeakSet;function Jx({bind:t}){Ex(Zx,t)||(t(C_).toDynamicValue((({container:t})=>new C_(pv(Fy,t)))).inSingletonScope(),t(Xf).toService(C_),t(Wf).toService(Xf),t(Fy).toService(Lm),gv(t,Fy))}const Qx=Jx,tS=new WeakSet;function eS({bind:t}){Ex(tS,t)||(t(Kf).toDynamicValue((({container:t})=>new L_(pv(zy,t)))).inSingletonScope(),t(Wf).toService(Kf),t(zy).toService(Lm),gv(t,zy))}const iS=eS;class sS extends h_{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[yy,vy],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const nS=new WeakSet;function rS({bind:t}){Ex(nS,t)||(t(sS).toDynamicValue((({container:t})=>new sS(pv(Uy,t)))).inSingletonScope(),t(rm).toService(sS),t(Wf).toService(rm),gv(t,Uy))}const aS=rS;class oS{constructor(){this.numberType=rd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Dp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const lS=new WeakSet;function hS({bind:t}){Ex(lS,t)||(t(oS).toDynamicValue((()=>new oS)).inSingletonScope(),t(em).toService(oS),t(Wf).toService(em))}const cS=hS;class dS extends h_{constructor(){super(),this.numberType=gd,this.builtinContributions=[w_],this.init()}drawShape(t,e,i,s,n){const r=Dp(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Lv(o,l,!0),d=Lv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Dp(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,y)):(e.beginPath(),Rv(e,i-t,s-n,v,y,f,!0)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,s,o,l))}draw(t,e,i){const s=Dp(t).richtext;this._draw(t,s,!1,i)}}const uS=new WeakSet;function pS({bind:t}){Ex(uS,t)||(t(dS).toDynamicValue((()=>new dS)).inSingletonScope(),t(Qf).toService(dS),t(Wf).toService(Qf))}const gS=pS,fS=new WeakSet;function mS({bind:t}){Ex(fS,t)||(t(im).toDynamicValue((({container:t})=>new V_(pv(Dy,t)))).inSingletonScope(),t(Wf).toService(im),t(Dy).toService(Lm),gv(t,Dy))}const vS=mS;class yS extends h_{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Pu.Get(r,Bu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[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+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class _S extends yS{constructor(){super(...arguments),this.type="rect3d",this.numberType=pd}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=Dp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,T=Dv(v,y,A,k,d),M=zv(v,b,A,k,S),w=Ov(d),E=Iv(u,_);if(!t.valid||!x)return;if(!w&&!E)return;if(!(T||M||a||o))return;const{light:B}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,B,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=Dp(t).rect;this._draw(t,s,!1,i)}}const bS=new WeakSet;function xS({bind:t}){Ex(bS,t)||(t(_S).toDynamicValue((()=>new _S)).inSingletonScope(),t(qf).toService(_S),t(Wf).toService(qf))}const SS=xS;class AS extends h_{constructor(){super(...arguments),this.numberType=id}drawShape(t,e,i,s,n,r,a,o){var l;const h=Dp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Pu.Get(c,Bu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},T={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Ut-zt)e.moveTo(i+r*Gt(o),s+r*Kt(o),n),e.arc(i,s,r,o,l,!c,n),a>zt&&(e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Gt(p),y=r*Kt(p),_=a*Gt(f),b=a*Kt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>zt)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Ut,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=zt)e.moveTo(i,s,n);else if(c>=Ut-zt)e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Gt(h),s+a*Kt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Gt(c),f=a*Kt(c),m=a*Gt(p),v=a*Kt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=Dp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const kS=new WeakSet;function CS({bind:t}){Ex(kS,t)||(t(AS).toDynamicValue((()=>new AS)).inSingletonScope(),t(Nf).toService(AS),t(Wf).toService(Nf))}const TS=CS;class MS extends yS{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=dd}drawShape(t,e,i,s,n,r,a,o){var l;const h=Dp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=Dp(t).polygon;this._draw(t,s,!1,i)}}const wS=new WeakSet;function ES({bind:t}){Ex(wS,t)||(t(MS).toDynamicValue((()=>new MS)).inSingletonScope(),t(tm).toService(MS),t(Wf).toService(tm))}const BS=ES;function PS(){gf("arc",Kg)}function RS(){gf("arc3d",Qg)}function OS(){gf("area",Gg)}function IS(){gf("circle",Np)}function LS(){gf("glyph",ug)}function DS(){gf("group",sf)}function FS(){gf("image",Rg)}function zS(){gf("line",sg)}function HS(){gf("path",Ug)}function jS(){gf("polygon",af)}function NS(){gf("star",Zg)}function US(){gf("pyramid3d",lf)}function VS(){gf("rect",og)}function WS(){gf("rect3d",cg)}function GS(){gf("richtext",Hg)}function YS(){gf("symbol",tg)}function XS(){gf("text",Kp)}function KS(){gf("shadowRoot",cf)}function $S(){gf("wrapText",Zp)}class qS{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?Ua.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Ua.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Wp("text"===t.type&&t.attribute?t.attribute:Dp(t).text)}getTransformOfText(t){const e=Dp(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let p=n.anchorType;if(u(p)&&(p="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===p&&(p="top-left"),"position"===p||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=ze(c,p);l=t.x,h=t.y}const f=Ua.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),v=e.viewBox,_=l+m.left-f.left+v.x1,b=h+m.top-f.top+v.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===p&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:b,left:_,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else g(n.style)?o=Object.assign(Object.assign({},o),n.style):y(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));Ua.global.updateDom(i,{width:n.width,height:n.height,style:o})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===Ua.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Gl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Gl.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&Ua.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===Ua.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const ZS=()=>{lv.registerPlugin("HtmlAttributePlugin",qS)};class JS extends qS{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?Ua.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&Ua.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const QS=()=>{lv.registerPlugin("ReactAttributePlugin",JS)};class tA{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/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,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}const eA=()=>{lv.registerPlugin("ViewTransform3dPlugin",tA)},iA=new Ve;class sA{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=ja.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Dp(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},f=g.main,m=g.cross;"column"!==r&&"column-reverse"!==r||(f.len=d,m.len=c,f.field="y",m.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,y=0;const _=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===f.field?e.width():e.height(),s="x"===m.field?e.width():e.height();_.push({mainLen:i,crossLen:s}),v+=i,y=Math.max(y,s)}));const b=[];if(v>f.len&&"wrap"===a){let t=0,e=0;_.forEach((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),b.push({idx:_.length-1,mainLen:t,crossLen:e})}else b.push({idx:_.length-1,mainLen:v,crossLen:y});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,f,_,x,t),x=t.idx+1})),y=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":m.len,center:m.len/2};this.layoutCross(p,o,m,t,_,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(m.len-y)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",m,s,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(m.len-y)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(m.len-y)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&iA.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(iA.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const nA=()=>{lv.registerPlugin("FlexLayoutPlugin",sA)};var rA=Object.freeze({__proto__:null,ARC3D_NUMBER_TYPE:id,ARC_NUMBER_TYPE:ed,AREA_NUMBER_TYPE:sd,AbstractGraphicRender:class{},get AnimateMode(){return Pl},get AnimateStatus(){return Il},get AnimateStepType(){return Ol},AppContext:tb,Application:Na,Arc:Xg,Arc3d:Jg,Arc3dRender:Nf,ArcRender:jf,ArcRenderContribution:Ry,Area:Wg,AreaRender:Uf,AreaRenderContribution:Oy,get AttributeUpdateType(){return Ao},AutoEnablePlugins:Pf,BaseCanvas:Eu,BaseEnvContribution:G_,BaseRender:h_,get BaseRenderContributionTime(){return To},BaseWindowHandlerContribution:Y_,Basis:Qo,BeforeRenderConstribution:Bf,BoundsContext:lo,BoundsPicker:Lf,BrowserEntry:eb,CIRCLE_NUMBER_TYPE:nd,Canvas3DDrawItemInterceptor:Py,Canvas3DPickItemInterceptor:Tv,CanvasFactory:Cd,CanvasTextLayout:Gp,Circle:jp,CircleRender:Vf,CircleRenderContribution:Iy,ColorInterpolate:Wu,ColorStore:Pu,get ColorType(){return Bu},CommonDrawItemInterceptorContribution:Ey,CommonRenderContribution:Vy,Context2dFactory:Td,ContributionProvider:dv,ContributionRegistry:Ym,ContributionStore:mv,CubicBezierCurve:Uo,CurveContext:Cl,get CurveTypeEnum(){return Co},CustomEvent:to,CustomPath2D:Ml,CustomSymbolClass:wc,DEFAULT_TEXT_FONT_FAMILY:fg,DebugDrawItemInterceptorContribution:wy,DefaultArcAllocate:ux,DefaultArcAttribute:Yl,DefaultArcRenderContribution:Yv,DefaultAreaAllocate:gx,DefaultAreaAttribute:Xl,DefaultAreaTextureRenderContribution:_y,DefaultAttribute:Gl,DefaultBaseBackgroundRenderContribution:Am,DefaultBaseClipRenderAfterContribution:zm,DefaultBaseClipRenderBeforeContribution:Dm,DefaultBaseInteractiveRenderContribution:Lm,DefaultBaseTextureRenderContribution:Wv,DefaultCanvasAllocate:cm,DefaultCanvasArcRender:c_,DefaultCanvasAreaRender:S_,DefaultCanvasCircleRender:d_,DefaultCanvasGroupRender:by,DefaultCanvasImageRender:V_,DefaultCanvasLineRender:v_,DefaultCanvasPathRender:C_,DefaultCanvasPolygonRender:L_,DefaultCanvasRectRender:T_,DefaultCanvasSymbolRender:M_,DefaultCanvasTextRender:E_,DefaultCircleAllocate:mx,DefaultCircleAttribute:Kl,DefaultCircleRenderContribution:qv,DefaultConnectAttribute:Vl,DefaultDebugAttribute:Wl,DefaultFillStyle:Fl,DefaultGlobal:Xa,DefaultGlobalPickerService:mm,DefaultGlyphAttribute:ql,DefaultGraphicAllocate:hx,DefaultGraphicMemoryManager:Tx,DefaultGraphicService:yf,DefaultGraphicUtil:um,DefaultGroupAttribute:$l,DefaultGroupBackgroundRenderContribution:ty,DefaultImageAttribute:ah,DefaultImageRenderContribution:ly,DefaultLayerService:cv,DefaultLayout:Ll,DefaultLineAllocate:yx,DefaultLineAttribute:Zl,DefaultMat4Allocate:Su,DefaultMatrixAllocate:xu,DefaultPathAllocate:bx,DefaultPathAttribute:Jl,DefaultPickService:Q_,DefaultPickStyle:Nl,DefaultPolygonAttribute:Ql,DefaultRect3dAttribute:ih,DefaultRectAllocate:cx,DefaultRectAttribute:eh,DefaultRectRenderContribution:iy,DefaultRenderService:Um,DefaultRichTextAttribute:rh,DefaultRichTextIconAttribute:oh,DefaultStarAttribute:th,DefaultStrokeStyle:Hl,DefaultStyle:Ul,DefaultSymbolAllocate:Sx,DefaultSymbolAttribute:sh,DefaultSymbolClipRangeStrokeRenderContribution:uy,DefaultSymbolRenderContribution:dy,DefaultTextAllocate:kx,DefaultTextAttribute:nh,DefaultTextMeasureContribution:_v,DefaultTextStyle:jl,DefaultTransform:Dl,DefaultTransformUtil:fm,DefaultWindow:hm,get Direction(){return ko},DirectionalLight:X_,DrawContribution:nm,DrawItemInterceptor:ky,DynamicLayerHandlerContribution:Mf,get Edge(){return ch},EditModule:nx,EmptyContext2d:Mu,EnvContribution:pg,EventManager:so,EventSystem:ao,EventTarget:no,FORMAT_ALL_TEXT_COMMAND:ox,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:ax,Factory:lv,FederatedEvent:qa,FederatedMouseEvent:Za,FederatedPointerEvent:Ja,FederatedWheelEvent:Qa,FlexLayoutPlugin:sA,GLYPH_NUMBER_TYPE:rd,GRAPHIC_UPDATE_TAG_KEY:gp,GROUP_NUMBER_TYPE:ad,Generator:ja,GlobalPickerService:Df,Glyph:dg,GlyphRender:em,GradientParser:nu,Graphic:Mp,GraphicCreator:_d,GraphicFactory:df,GraphicPicker:Of,GraphicRender:Wf,GraphicService:yd,GraphicUtil:kf,Group:ef,GroupRender:Gf,GroupRenderContribution:Ly,get GroupUpdateAABBBoundsMode(){return tf},HtmlAttributePlugin:qS,get IContainPointMode(){return So},IMAGE_NUMBER_TYPE:od,Image:Pg,ImageRender:im,ImageRenderContribution:Dy,IncrementalDrawContribution:Hf,InteractiveDrawItemInterceptorContribution:By,InteractivePickItemInterceptorContribution:Cv,InteractiveSubRenderContribution:Wy,LINE_NUMBER_TYPE:ld,Layer:av,LayerFactory:ov,LayerService:Cf,Line:ig,LineRender:Yf,Linear:$o,LinearClosed:vl,Mat4Allocate:_u,MatrixAllocate:yu,get MeasureModeEnum(){return Bl},MiniappEntry:nb,MonotoneX:al,MonotoneY:ol,NOWORK_ANIMATE_ATTR:Tp,Node:$a,NodeEntry:sb,OrthoCamera:$_,PATH_NUMBER_TYPE:hd,POLYGON_NUMBER_TYPE:cd,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:dd,Path:Ng,PathRender:Xf,PathRenderContribution:Fy,PerformanceRAF:Wa,PickItemInterceptor:Ff,PickServiceInterceptor:zf,PickerRegistry:Wm,PickerService:If,PluginRegistry:Gm,PluginService:Rf,Polygon:rf,PolygonRender:Kf,PolygonRenderContribution:zy,Pyramid3d:of,Pyramid3dRender:tm,RECT3D_NUMBER_TYPE:pd,RECT_NUMBER_TYPE:ud,RICHTEXT_NUMBER_TYPE:gd,RafBasedSTO:Sh,ReactAttributePlugin:JS,Rect:ag,Rect3DRender:qf,Rect3d:hg,RectRender:$f,RectRenderContribution:Hy,ReflectSegContext:Yo,RenderSelector:sm,RenderService:Ef,RendererRegistry:Vm,ResourceLoader:lh,RichText:zg,RichTextEditPlugin:lx,RichTextRender:Qf,STAR_NUMBER_TYPE:fd,get STATUS(){return Rl},SVG_ATTRIBUTE_MAP:bd,SVG_ATTRIBUTE_MAP_KEYS:xd,SVG_PARSE_ATTRIBUTE_MAP:Sd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Ad,SYMBOL_NUMBER_TYPE:md,SegContext:Go,ShadowPickServiceInterceptorContribution:Av,ShadowRoot:hf,ShadowRootDrawItemInterceptorContribution:My,ShadowRootPickItemInterceptorContribution:kv,SplitRectAfterRenderContribution:ny,SplitRectBeforeRenderContribution:sy,Stage:nv,StageFactory:rv,Star:qg,StarRender:rm,StarRenderContribution:Uy,StateDefinitionCompiler:qu,StateEngine:tp,StaticLayerHandlerContribution:Tf,Step:ul,StepClosed:pl,Symbol:Qp,SymbolRender:Zf,SymbolRenderContribution:jy,TEXT_NUMBER_TYPE:vd,Text:Xp,get TextDirection(){return $c},TextMeasureContribution:yv,TextRender:Jf,TextRenderContribution:Ny,Theme:Ip,TransformUtil:Af,get UpdateTag(){return xo},VGlobal:gg,VWindow:am,ViewTransform3dPlugin:tA,VirtualLayerHandlerContribution:wf,WILDCARD:"*",WindowHandlerContribution:om,WrapText:qp,XMLParser:Vc,_calculateLineHeight:kh,_interpolateColor:Iu,addArcToBezierPath:Bo,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:Ob,alignSubpath:Mb,application:Ua,applyTransformOnBezierCurves:Lb,arc3dModule:TS,arcModule:Rx,areaModule:Nx,bezier:wo,bezierCurversToPath:Db,binarySplitPolygon:Yb,bindArc3dRenderModule:CS,bindArcRenderModule:Px,bindAreaRenderModule:jx,bindCircleRenderModule:Yx,bindContributionProvider:gv,bindContributionProviderNoSingletonScope:fv,bindGlyphRenderModule:hS,bindImageRenderModule:mS,bindLineRenderModule:Fx,bindPathRenderModule:Jx,bindPolygonRenderModule:eS,bindPyramid3dRenderModule:ES,bindRect3dRenderModule:xS,bindRectRenderModule:Ix,bindRichtextRenderModule:pS,bindStarRenderModule:rS,bindSymbolRenderModule:Vx,bindTextRenderModule:$x,boundStroke:Yc,builtInSymbolStrMap:Pc,builtinSymbols:Ec,builtinSymbolsMap:Bc,calcLineCache:Tl,calculateArcCornerRadius:Nv,calculateLineHeight:Ch,canvasAllocate:dm,centroidOfSubpath:Bb,circleBounds:vh,circleModule:Xx,clock:eo,colorEqual:function(t,e){const i=si.parseColorString(t),s=si.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:Uu,configureRuntimeApplicationForApp:bb,container:i_,cornerTangents:jv,createApp:ib,createArc:Kg,createArc3d:Qg,createArea:Gg,createBrowserApp:ib,createCanvasEventTransformer:function(t,e,i,s){return Qb(t.parentElement,e,i,s)},createCircle:Np,createColor:au,createConicalGradient:Xu,createContributionProvider:pv,createEventTransformer:Qb,createGlyph:ug,createGraphic:ff,createGroup:sf,createImage:Rg,createLine:sg,createMat4:bu,createMiniappApp:function(t={}){return new nb(t)},createNodeApp:function(t={}){return new sb(t)},createPath:Ug,createPolygon:af,createPyramid3d:lf,createRect:og,createRect3d:cg,createRectPath:Rv,createRichText:Hg,createShadowRoot:cf,createStage:function(t){return o_(),(new rv).create(t)},createStar:Zg,createSymbol:tg,createText:Kp,createWrapText:Zp,cubicCalc:Do,cubicLength:Lo,cubicPointAt:Fo,cubicSubdivide:Tb,defaultArcAllocate:px,defaultArcBackgroundRenderContribution:$v,defaultArcRenderContribution:Xv,defaultArcTextureRenderContribution:Kv,defaultAreaAllocate:fx,defaultBaseBackgroundRenderContribution:km,defaultBaseClipRenderAfterContribution:Hm,defaultBaseClipRenderBeforeContribution:Fm,defaultBaseTextureRenderContribution:Gv,defaultCircleAllocate:vx,defaultCircleBackgroundRenderContribution:Qv,defaultCircleRenderContribution:Zv,defaultCircleTextureRenderContribution:Jv,defaultGraphicMemoryManager:Mx,defaultGroupBackgroundRenderContribution:ey,defaultImageBackgroundRenderContribution:cy,defaultImageRenderContribution:hy,defaultLineAllocate:_x,defaultPathAllocate:xx,defaultRectAllocate:dx,defaultRectBackgroundRenderContribution:oy,defaultRectRenderContribution:ry,defaultRectTextureRenderContribution:ay,defaultStarBackgroundRenderContribution:yy,defaultStarTextureRenderContribution:vy,defaultSymbolAllocate:Ax,defaultSymbolBackgroundRenderContribution:my,defaultSymbolClipRangeStrokeRenderContribution:gy,defaultSymbolRenderContribution:py,defaultSymbolTextureRenderContribution:fy,defaultTextAllocate:Cx,diff:Cb,divideCubic:No,drawArc:Eo,drawArcPath:Uv,drawAreaSegments:y_,drawBackgroundImage:Im,drawImageWithLayout:U_,drawIncrementalAreaSegments:m_,drawIncrementalSegments:f_,drawSegments:g_,enumCommandMap:po,fillVisible:Lv,findBestMorphingRotation:Rb,findConfigIndexByCursorIdx:ix,findCursorIdxByConfigIndex:sx,findNextGraphic:xm,flatten_simplify:kb,foreach:_m,foreachAsync:bm,genBasisSegments:el,genBasisTypeSegments:tl,genLinearClosedSegments:yl,genLinearClosedTypeSegments:_l,genLinearSegments:qo,genLinearTypeSegments:Zo,genMonotoneXSegments:hl,genMonotoneXTypeSegments:ll,genMonotoneYSegments:dl,genMonotoneYTypeSegments:cl,genNumberType:Kc,genStepClosedSegments:ml,genStepSegments:gl,genStepTypeSegments:fl,getAttributeFromDefaultAttrList:xh,getBackgroundImage:Tm,getConicGradientAt:Yu,getCurrentEnv:function(){return iv()?"browser":"node"},getDefaultCharacterConfig:ex,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Up(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=ku.allocate();return du(o,o,[a[0],a[1],0]),n&&lu(o,o,n),s&&hu(o,o,s),du(o,o,[-a[0],-a[1],0]),o},getLegacyBindingContext:Zy,getModelMatrix:mf,getRichTextBounds:Sf,getRuntimeInstallerBindingContext:vb,getRuntimeInstallerGlobal:_b,getScaledStroke:ru,getTextBounds:xf,getTheme:Dp,getThemeFromGroup:Fp,globalTheme:Lp,glyphModule:cS,graphicCreator:pf,graphicService:r_,graphicUtil:s_,identityMat4:ou,imageModule:vS,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeDrawContributionsToApp:Sb,installRuntimeGraphicRenderersToApp:xb,installRuntimePickersToApp:Ab,interpolateColor:Ou,interpolateGradientConicalColor:Fu,interpolateGradientLinearColor:Lu,interpolateGradientRadialColor:Du,interpolatePureColorArray:zu,interpolatePureColorArrayToStr:Hu,intersect:Hv,isBrowserEnv:iv,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){ev();const t=Ua.global&&Ua.global.env;return t?"node"===t:!tv},isSvg:Nc,isXML:Uc,layerService:a_,lineModule:zx,lookAt:fu,mapToCanvasPointForCanvas:function(t){var e;if(Od(t._canvasX)&&Od(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:uu,mat4Allocate:ku,matrixAllocate:Au,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i.c,b=i.d,x=0,S=0,t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=0,b=0,x=1,S=0,t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i.e,b=i.f,x=0,S=1,t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t},multiplyMat4Mat4:gu,newThemeObj:Pp,ortho:mu,parsePadding:gh,parseStroke:uh,parseSvgPath:bo,pathModule:Qx,pathToBezierCurves:Ib,point:Jo,pointEqual:yh,pointInterpolation:_h,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Jt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Jt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>yh(t,e[i]))):!Number.isNaN(t.x+t.y)&&yh(t,e))},pointsInterpolation:bh,polygonModule:iS,preLoadAllModule:qy,pyramid3dModule:BS,quadCalc:zo,quadLength:jo,quadPointAt:Ho,rafBasedSto:Ah,rect3dModule:SS,rectFillVisible:Dv,rectModule:Lx,rectStrokeVisible:zv,recursiveCallBinarySplit:Xb,refreshRuntimeInstallerContributions:yb,registerArc3dGraphic:RS,registerArcGraphic:PS,registerAreaGraphic:OS,registerCircleGraphic:IS,registerDirectionalLight:K_,registerFlexLayoutPlugin:nA,registerGlobalEventTransformer:function(t,e,i,s,n){const r=Qb(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:LS,registerGraphic:gf,registerGroupGraphic:DS,registerHtmlAttributePlugin:ZS,registerImageGraphic:FS,registerLineGraphic:zS,registerOrthoCamera:q_,registerPathGraphic:HS,registerPolygonGraphic:jS,registerPyramid3dGraphic:US,registerReactAttributePlugin:QS,registerRect3dGraphic:WS,registerRectGraphic:VS,registerRichtextGraphic:GS,registerShadowRootGraphic:KS,registerStarGraphic:NS,registerSymbolGraphic:YS,registerTextGraphic:XS,registerViewTransform3dPlugin:eA,registerWindowEventTransformer:function(t,e,i,s,n){const r=Qb(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:$S,renderCommandList:Ro,resolveBackgroundDrawMode:Em,resolveBackgroundParamsByImageSizing:j_,resolveBackgroundPosition:Pm,resolveBackgroundSizing:Mm,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:z_,resolveImageRepeatMode:F_,resolveRenderableImageSize:Om,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:gS,rotateX:lu,rotateY:hu,rotateZ:cu,runFill:Ov,runStroke:Iv,scaleMat4:pu,segments:Mo,shouldClipImageByLayout:N_,shouldUseMat4:vf,snapLength:Io,splitArc:Hb,splitArea:Ub,splitCircle:jb,splitLine:Vb,splitPath:$b,splitPolygon:Kb,splitRect:zb,splitToGrids:Fb,starModule:aS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Fv,symbolModule:Wx,textAttributesToStyle:Wp,textDrawOffsetX:Up,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Vp,textModule:qx,transformMat4:vu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:n_,translate:du,verticalLayout:qc,vglobal:e_,waitForAllSubLayers:Gc,wrapCanvas:Md,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=Ua.global)||void 0===t?void 0:t.env,s=i?null===(e=Ua.context2dFactory)||void 0===e?void 0:e.call(Ua,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=_(t)?t[0]:t,i=[];if(!e)return i;if(!0===Uc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};td(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};td(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});function aA(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),hA=(t,e)=>(d(dA.warnHandler)&&dA.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),cA=(t,e,i)=>{if(!d(dA.errorHandler))throw new Error(t);dA.errorHandler.call(null,t,e)},dA={silent:!1,warnHandler:!1,errorHandler:!1},uA=iv(),pA=uA&&globalThis?globalThis.document:void 0;function gA(t){return("desktop-browser"===t||"mobile-browser"===t)&&uA}function fA(t){return mA(t)||"mobile-browser"===t}function mA(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let vA=0;function yA(){return vA>=9999999&&(vA=0),vA++}function _A(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function bA(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}function xA(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&xA(t,e)}))}const SA=t=>!u(t)&&!1!==t.visible;function AA(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function kA(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const TA=["#ffffff","#000000"];function MA(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new si(t).toHex(),o=new si(e).toHex();return wA(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...TA);for(const n of a)if(t!==n&&wA(n,e,i,s,r))return n}(a,o,i,s,n,r)}function wA(t,e,i,s,n){if("lightness"===n){const i=si.getColorBrightness(new si(e));return si.getColorBrightness(new si(t))<.5?i>=.5:i<.5}return s?EA(t,e)>s:"largeText"===i?EA(t,e)>3:EA(t,e)>4.5}function EA(t,e){const i=BA(t),s=BA(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function BA(t){const e=ri(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function PA(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function RA(t,e){return[t[0]*e,t[1]*e]}function OA(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function IA(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const LA=ff,DA={arc:t=>LA("arc",t),circle:t=>LA("circle",t),group:t=>LA("group",t),image:t=>LA("image",t),line:t=>LA("line",t),path:t=>LA("path",t),polygon:t=>LA("polygon",t),rect:t=>LA("rect",t),richtext:t=>LA("richtext",t),symbol:t=>LA("symbol",t),text:t=>LA("text",t)},FA=-.5*Math.PI,zA=1.5*Math.PI,HA="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var jA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(jA||(jA={}));const NA={[jA.selectedReverse]:{},[jA.selected]:{},[jA.hover]:{},[jA.hoverReverse]:{}},UA={container:"",width:30,height:30,style:{}},VA="scrollDrag",WA=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:HA,fontSize:14},s),getTextBounds:i?void 0:xf,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function GA(t,e,i={}){if(!t)return{width:0,height:0};const s=xf({text:t,fontFamily:e.fontFamily||i.fontFamily||HA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function YA(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function XA(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function KA(t,e="type"){const i=YA(t,e);return"rich"===i?DA.richtext(XA(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),DA.text(t))}function $A(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const qA=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function ZA(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function JA(t,e){const{dx:i,dy:s}=ZA(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const QA={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},tk={size:8,stroke:"#000",lineWidth:1,zIndex:1};const ek=Math.sin(Math.PI/10);function ik(t,e=ek){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function sk(t,e=ek){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function nk(t){const e={};return xA(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function rk(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function ak(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return RA(r,(s?-1:1)*(n?-1:1)*t/OA(r))}function ok(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function hk(t,e,i){var s;if(sk(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>He(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>He(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function ck(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function pk(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function gk(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function fk(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function mk(t,e){const i=fk(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function vk(t,e){const i=yk(t),s=yk(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function yk(t,e={x:0,y:0}){return ae.distancePP(t,e)}function _k(t){return k(t.x)&&k(t.y)}function bk(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function xk(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const Sk=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function kk(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&kk(t[i],e)}}var Ck;!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"}(Ck||(Ck={}));const Tk={};function Mk(t){switch(t){case Ck.Linear:case Ck.Log:case Ck.Pow:case Ck.Sqrt:case Ck.Symlog:case Ck.Time:return!0;default:return!1}}function wk(t){return!!Tk[t]}function Ek(t){switch(t){case Ck.Ordinal:case Ck.Point:case Ck.Band:return!0;default:return!1}}function Bk(t){return t}Object.values(Ck).forEach((t=>{Tk[t]=!0}));const Pk=t=>-Math.log(-t),Rk=t=>-Math.exp(-t),Ok=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Ik=t=>10===t?Ok:t===Math.E?Math.exp:e=>Math.pow(t,e),Lk=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Dk=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Fk=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function zk(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 Hk(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function jk(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Nk(t,e,i,s){return 1===i&&(i=0),jk(t,i,s)*(e/(1-i))}function Uk(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Vk(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class Gk{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=Uk(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=yt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Yk=Symbol("implicit");class Xk extends Gk{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=Ck.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Yk}clone(){const t=(new Xk).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==Yk)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return Kk(t,e,r,n)}class qk extends Xk{constructor(t){super(),this.type=Ck.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=Nk(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:$k(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return $k(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new qk(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:Zk}=ai;function Jk(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=si.parseColorString(e)){const e=Zk(si.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof ni?Zk(t,e):e instanceof si?Zk(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class Qk extends Gk{constructor(t=Bk,e=Bk){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Bk,this._piecewise=Hk,this._interpolate=Jk}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Ct,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=bt(i[0],i[r-1])),this._piecewise=r>2?Vk:Hk,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Bk),this.rescale(i)):this._clamp!==Bk}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const tC=Math.sqrt(50),eC=Math.sqrt(10),iC=Math.sqrt(2),sC=[1,2,5,10],nC=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=lC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?aC(0,-(e-1)/s,s):aC((e-1)/s,0,s)},rC=vt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return nC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return nC(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=aC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=aC(t,e,l);return n&&r.reverse(),r})),lC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=sC[0];return i>=tC?s=sC[3]:i>=eC?s=sC[2]:i>=iC&&(s=sC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function hC(t,e,i){const s=(e-t)/Math.max(0,i);return lC(s)}function cC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=hC(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function uC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const pC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),gC=vt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),fC=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=oC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?pC(t,e,n):pC(t,e,Wk(n)),h=pC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),mC=vt(((t,e,i,s,n)=>cC(s(t),s(e),i).map((t=>Wk(n(t))))));class vC extends Qk{constructor(){super(...arguments),this.type=Ck.Linear}clone(){var t;const e=new vC;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return rC(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=oC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return cC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function _C(t){return e=>-t(-e)}function bC(t=Number.EPSILON){return e=>Math.max(e,t)}class xC extends Qk{constructor(){super(Lk(10),Ik(10)),this.type=Ck.Log,this._limit=bC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new xC).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=Lk(this._base),s=Ik(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=_C(i),this._pows=_C(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Pk,this.untransformer=Rk):(this._logs=i,this._pows=s,this._limit=bC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Bk}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return gC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return fC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(xC,yC);class SC extends vC{constructor(){super(Dk(1),Fk(1)),this.type=Ck.Symlog,this._const=1}clone(){return(new SC).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=Dk(t),this.untransformer=Fk(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return gC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return fC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(SC,yC);class AC{constructor(){this.type=Ck.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[lt(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 AC).domain(this._domain).range(this._range).unknown(this._unknown)}}var kC,CC,TC;function MC(t){var e,i;const{type:s}=t;return s===CC.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(kC||(kC={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(CC||(CC={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(TC||(TC={}));const wC={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},EC={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function BC(t,e){var i;if(!t)return[];const s=FC(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?LC(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>IC(i)?RC(t,i,e):i)).filter(p)}))):i.map((i=>IC(i)?RC(t,i,e):i)).filter(p):[]}return[]}function PC(t,e){var i,s;return LC(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function RC(t,e,i){var s;const n=FC(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=wC[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=EC[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!y(r))return r;let o=new si(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ke(t,i,s),a=Xe(n,r,e.l),l=new si(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const OC=(t,e)=>{if(e&&IC(t)){const i=RC(e,t);if(i)return i}return t};function IC(t){return t&&"palette"===t.type&&!!t.key}function LC(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function DC(t){return _(t)?{dataScheme:t}:t}function FC(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=MC(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class zC extends Xk{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!LC(this._range))return void super.range(this._range);const t=PC(this._range,this._domain);super.range(t)}}const HC={linear:vC,band:qk,point:class extends qk{constructor(t){super(!1),this.type=Ck.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:Xk,threshold:AC,colorOrdinal:zC};function jC(t){const e=HC[t];return e?new e:null}function NC(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function UC(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function VC(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function WC(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function GC(t){return!!y(t)&&(!!t.endsWith("%")&&_A(t.substring(0,t.length-1)))}function YC(t){return!!g(t)&&("percent"in t||"offset"in t)}function XC(t,e,i,s=0){var n,r;return S(t)?t:GC(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function KC(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=XC(t[s],e.size,i)}))})),o}function $C(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function qC(t){let e={};return _(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||GC(t)||d(t)||YC(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function ZC(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const JC=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},QC=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function tT(t,e){return t&&e.key in t?t[e.key]:e.default}function eT(t){return t&&"token"===t.type&&!!t.key}const iT={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},sT={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:QC,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:iT,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},nT={name:"dark",colorScheme:{default:{dataScheme:QC,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},rT=(t,e)=>t===e||!d(t)&&!d(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>rT(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>rT(t[i],e[i])))),aT=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),aT(t[s],e.slice(1),i))},oT=t=>t instanceof Oa||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(t);function lT(t,e=["data"]){return L(t,oT,e)}function hT(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=DC(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}cT._charts={},cT._series={},cT._components={},cT._graphicComponents={},cT._marks={},cT._regions={},cT._animations={},cT._implements={},cT._chartPlugin={},cT._vChartPlugin={},cT._componentPlugin={},cT.transforms={fields:$r,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},cT.dataParser={csv:(t,e={},i)=>(i.type=Kr.DSV,aa(t)),dsv:(t,e={},i)=>{i.type=Kr.DSV;const s=Vr(la,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return ra(n).parse(t)},tsv:(t,e={},i)=>(i.type=Kr.DSV,oa(t))},cT._layout={},cT._grammarTransforms={},cT._stageEventPlugins={},cT.registerStageEventPlugin=(t,e)=>{cT._stageEventPlugins[t]=e},cT.getStageEventPlugin=t=>cT._stageEventPlugins[t],cT._interactionTriggers={},cT.registerInteractionTrigger=(t,e)=>{cT._interactionTriggers[t]=e},cT._composedEventMap={},cT.registerComposedEvent=(t,e)=>{cT._composedEventMap[t]=e},cT._tooltipProcessors={},cT.registerTooltipProcessor=(t,e)=>{cT._tooltipProcessors[t]=e},cT.createTooltipProcessor=(t,e)=>{const i=cT._tooltipProcessors[t];return i?new i(e):null};const pT=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},gT=pT(),fT={[sT.name]:sT},mT=sT.name,vT=new Map(Object.keys(fT).map((t=>[t,fT[t]]))),yT=new Map,_T=new Map(Object.keys(fT).map((t=>[t,t===mT]))),bT=(t,e)=>{if(!t)return;const i=kT(e);vT.set(t,i),_T.set(t,!0)},xT=(t=mT)=>(_T.has(t)&&!_T.get(t)&&bT(t,vT.get(t)),vT.get(t)),ST=t=>vT.delete(t)&&yT.delete(t)&&_T.delete(t),AT=t=>!!y(t)&&vT.has(t),kT=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:mT;return dT({},xT(i),t)};class CT{static registerInstance(t){CT.instances.set(t.id,t)}static unregisterInstance(t){CT.instances.delete(t.id)}static getInstance(t){return CT.instances.get(t)}static instanceExist(t){return CT.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return CT.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}CT.instances=new Map;class TT{static registerTheme(t,e){bT(t,e)}static getTheme(t,e=!1){return xT(t)}static removeTheme(t){return ST(t)}static themeExist(t){return AT(t)}static getDefaultTheme(){return TT.themes.get(mT)}static setCurrentTheme(t){TT.themeExist(t)&&(TT._currentThemeName=t,CT.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return TT.getTheme(TT._currentThemeName,t)}static getCurrentThemeName(){return TT._currentThemeName}}function MT(t){return y(t)?TT.themeExist(t)?TT.getTheme(t):{}:g(t)?t:{}}TT.themes=vT,TT._currentThemeName=mT;const wT=["animationThreshold","colorScheme","name","padding"];function ET(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];wT.includes(n)?s[n]=r:m(r)?IC(r)?s[n]=OC(r,e):eT(r)?s[n]=tT(i,r):s[n]=ET(r,e,i):s[n]=r})),s}function BT(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=BT(t[s],e)}return i}return _(t)?t.map((t=>BT(t,e))):t}function PT(t,e){if(!t)return t;if(m(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(y(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=PT(t[s],e)}return i}return _(t)?t.map((t=>PT(t,e))):t}function RT(t,...e){return d(t)?t(...e):t}const OT=(t,e,i,s)=>((t,e,i)=>WA(t,e,i,{fontFamily:iT.fontFamily,fontSize:iT.fontSize}))(e,i,s).measure(t),IT="__VCHART",LT=500,DT=500,FT=`${IT}_MEASURE_CANVAS_ID`,zT=`${IT}_DEFAULT_DATA_INDEX`,HT=`${IT}_DEFAULT_DATA_KEY`,jT=`${IT}_DEFAULT_DATA_SERIES_FIELD`,NT=`${IT}_DEFAULT_SERIES_STYLE_NAME`,UT=`${IT}_STACK_KEY`,VT=`${IT}_STACK_START`,WT=`${IT}_STACK_END`,GT=`${IT}_STACK_START_PERCENT`,YT=`${IT}_STACK_END_PERCENT`,XT=`${IT}_STACK_START_OffsetSilhouette`,KT=`${IT}_STACK_END_OffsetSilhouette`,$T=`${IT}_STACK_TOTAL`,qT=`${IT}_STACK_TOTAL_PERCENT`,ZT=`${IT}_STACK_TOTAL_TOP`,JT=`${IT}_STACK_TOTAL_BOTTOM`,QT=`${IT}_MOSAIC_VALUE_START_PERCENT`,tM=`${IT}_MOSAIC_VALUE_END_PERCENT`,eM=`${IT}_MOSAIC_CAT_START_PERCENT`,iM=`${IT}_MOSAIC_CAT_END_PERCENT`,sM=`${IT}_SEGMENT_START`,nM=`${IT}_SEGMENT_END`,rM=`${IT}_KEY`,aM=`${IT}_MAP_LOOK_UP_KEY`;function oM(t,e){for(let i=0;it.key===e))}function hM(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function cM(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},fM(t,a,n[o],l,e,r))})),s?dM(n):n}function dM(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):dM(t[e].nodes);return t}function uM(t,e){if("values"in t&&t.values.length){const i=gk(t.values,e),s=pk(t.values,YT);t.values.forEach((t=>{t[$T]=i,t[qT]=s}))}else for(const i in t.nodes)uM(t.nodes[i],e)}function pM(t){if(!t.values.length)return;const e=t.values[t.values.length-1][WT]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)gM(t.nodes[r],e,i,s,n)}function fM(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[WT]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),fM(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const mM=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=yM(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function _M(t){return!d(t)&&!P(t)&&Object.keys(t).some((e=>d(t[e])))}function bM(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(d(t))return kM(t(r,i,s,n));if(_M(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{d(e[t])&&(e[t]=e[t](r,i,s,n))})),kM(e)}return kM(t)}function xM(t={}){const e=Object.assign({},t);if(d(t.style)||_M(t.style)?e.style=(e,i,s,n)=>bM(t.style,e,i,s,n):P(t.style)||(e.style=kM(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])||_M(t.state[e])?i[e]=(i,s,n,r)=>bM(t.state[e],i,s,n,r):P(t.state[e])||(i[e]=kM(t.state[e]))})),e.state=i}return e}function SM(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>kM(t[i](e,s,n,r)):P(t[i])||(e[i]=kM(t[i]))})),e}function AM(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),kM(i)}function kM(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const CM=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},TM=t=>"line"===t||"area"===t,MM=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return TM(i)?e:null==e?void 0:e[0]},wM=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let EM=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=cT.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(cT.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var BM;!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"}(BM||(BM={}));const PM=["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 RM,OM,IM;t.ChartEvent=void 0,(RM=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",RM.rendered="rendered",RM.renderFinished="renderFinished",RM.animationFinished="animationFinished",RM.regionSeriesDataFilterOver="regionSeriesDataFilterOver",RM.afterInitData="afterInitData",RM.afterInitEvent="afterInitEvent",RM.afterInitMark="afterInitMark",RM.rawDataUpdate="rawDataUpdate",RM.viewDataFilterOver="viewDataFilterOver",RM.viewDataUpdate="viewDataUpdate",RM.viewDataStatisticsUpdate="viewDataStatisticsUpdate",RM.markDeltaYUpdate="markDeltaYUpdate",RM.viewDataLabelUpdate="viewDataLabelUpdate",RM.scaleDomainUpdate="scaleDomainUpdate",RM.scaleRawDomainUpdate="scaleRawDomainUpdate",RM.scaleUpdate="scaleUpdate",RM.dataZoomChange="dataZoomChange",RM.drill="drill",RM.layoutStart="layoutStart",RM.layoutEnd="layoutEnd",RM.layoutRectUpdate="layoutRectUpdate",RM.playerPlay="playerPlay",RM.playerPause="playerPause",RM.playerEnd="playerEnd",RM.playerChange="playerChange",RM.playerForward="playerForward",RM.playerBackward="playerBackward",RM.scrollBarChange="scrollBarChange",RM.brushStart="brushStart",RM.brushChange="brushChange",RM.brushEnd="brushEnd",RM.brushClear="brushClear",RM.brushActive="brushActive",RM.legendSelectedDataChange="legendSelectedDataChange",RM.legendFilter="legendFilter",RM.legendItemClick="legendItemClick",RM.legendItemHover="legendItemHover",RM.legendItemUnHover="legendItemUnHover",RM.tooltipShow="tooltipShow",RM.tooltipHide="tooltipHide",RM.tooltipRelease="tooltipRelease",RM.afterResize="afterResize",RM.afterRender="afterRender",RM.afterLayout="afterLayout",RM.afterMarkLayoutEnd="afterMarkLayoutEnd",RM.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(OM||(OM={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(IM||(IM={}));const LM=[IM.mark,IM.model,IM.chart,IM.vchart];class DM{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(IM.vchart,[]),this._levelNodes.set(IM.chart,[]),this._levelNodes.set(IM.model,[]),this._levelNodes.set(IM.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const FM={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class zM{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>MM(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||OM.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||OM.chart);o.get(t)||o.set(t,new DM);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||OM.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||OM.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||OM.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||OM.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?LM.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[OM.chart,OM.window,OM.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return FM[a]&&(a=FM[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?IM.model:IM.vchart:IM.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=OM.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==IM.model&&s!==IM.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=IM.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case OM.chart:return this._viewBubbles;case OM.window:return this._windowBubbles;case OM.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case OM.chart:return this._viewListeners;case OM.window:return this._windowListeners;case OM.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return PM.includes(t)||Object.values(BM).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&cT.hasInteractionTrigger(e)}}function HM(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function jM(t,e,i){t.getParser(e)||t.registerParser(e,i)}const NM=new Map;let UM;function VM(){UM||(UM=new Ra,jM(UM,"geojson",Ta),jM(UM,"topojson",wa),HM(UM,"simplify",Xr))}function WM(t,e,i={type:"geojson",centroid:!0}){NM.has(t)&&hA(`map type of '${t}' already exists, will be overwritten.`),VM();const s=new Oa(UM),n=H({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),NM.set(t,s)}function GM(t){NM.has(t)?NM.delete(t):hA(`map type of '${t}' does not exists.`)}function YM(t,e=!1){let i=e;return t.latestData instanceof Oa&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const XM=(t,e)=>0===t.length?[]:1===t.length?YM(t[0],null==e?void 0:e.deep):t.map((t=>YM(t,null==e?void 0:e.deep)));function KM(e,i,s){HM(i=i instanceof Ra?i:e.dataSet,"copyDataView",XM);const n=new Oa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function $M(t,e,i=[]){var s;if(t instanceof Oa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Oa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return hA(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return hA(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),hA("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function qM(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var ZM,JM,QM,tw;t.TransformLevel=void 0,(ZM=t.TransformLevel||(t.TransformLevel={}))[ZM.copyDataView=-10]="copyDataView",ZM[ZM.treemapFilter=-8]="treemapFilter",ZM[ZM.treemapFlatten=-7]="treemapFlatten",ZM[ZM.dotObjFlat=-7]="dotObjFlat",ZM[ZM.linkDotInfo=-7]="linkDotInfo",ZM[ZM.sankeyLayout=-7]="sankeyLayout",ZM[ZM.dataZoomFilter=-6]="dataZoomFilter",ZM[ZM.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(JM||(JM={})),function(t){t.data="data",t.mark="mark"}(QM||(QM={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(tw||(tw={}));const ew=["line","area","trail"];function iw(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(rM,i?t.slice().sort(i):t.slice()),{keys:[rM],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const sw=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function nw(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{nw(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function aw(t,e,i,s){const n=iw(t,(t=>i(t))),r=iw(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const ow=`${IT}_BuiltIn_CallBack_Disappear`;var lw;!function(t){t.render="render",t.disappear="disappear"}(lw||(lw={}));const hw=[0,0,0];class cw{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Fl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Hl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},jl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ge(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ge(1,0,0,1,0,0),this._clearMatrix=new Ge(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ge(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Au.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&&(Au.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Au.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Ut;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=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:jl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:jl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(vu(hw,[e,i,s],this.modelMatrix),e=hw[0],i=hw[1],s=hw[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=au(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:ru(this,a,this.dpr),r.strokeStyle=au(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Au.free(t))),this.stack.length=0}}cw.env="browser";class dw extends Eu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ua.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new cw(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}}function uw(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,Cd,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Td,e.env));r||i.bind(Cd).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(Td).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}dw.env="browser";const pw=uw(dw,cw);class gw extends cw{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}gw.env="feishu";class fw extends Eu{constructor(t){super(t)}init(){this._context=new gw(this,this._dpr)}release(...t){}}fw.env="feishu";const mw=uw(fw,gw);class vw extends cw{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:ru(this,l,this.dpr),r.strokeStyle=au(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=Ua.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Ua.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}vw.env="harmony";class yw extends Eu{constructor(t){super(t)}init(){this._context=new vw(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}yw.env="harmony";const _w=uw(yw,vw);class bw extends cw{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:ru(this,l,this.dpr),r.strokeStyle=au(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=Ua.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Ua.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}bw.env="lynx";class xw extends Eu{constructor(t){super(t)}init(){this._context=new bw(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}xw.env="lynx";const Sw=uw(xw,bw);class Aw extends cw{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}Aw.env="node";class kw extends Eu{constructor(t){super(t)}init(){this._context=new Aw(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}}kw.env="node";const Cw=uw(kw,Aw);class Tw extends cw{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,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(au(this,l,t,i,s)))}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:ru(this,l,this.dpr)),r.setStrokeStyle(au(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}Tw.env="taro";class Mw extends Eu{constructor(t){super(t)}init(){this._context=new Tw(this,this._dpr)}release(...t){}}Mw.env="taro";const ww=uw(Mw,Tw);class Ew extends gw{}Ew.env="tt";class Bw extends Eu{constructor(t){super(t)}init(){this._context=new Ew(this,this._dpr)}release(...t){}}Bw.env="tt";const Pw=uw(Bw,Ew);class Rw extends cw{draw(){}createPattern(t,e){return null}}Rw.env="wx";class Ow extends Eu{constructor(t){super(t)}init(){this._context=new Rw(this,this._dpr)}release(...t){}}Ow.env="wx";const Iw=uw(Ow,Rw);function Lw(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function Dw(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}class Fw extends Q_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=dm.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:ru(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class bE extends _E{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ed}}let xE=!1;function SE(t){xE||(xE=!0,t.bind(Zw).toDynamicValue((()=>new bE(Lw(t,jf)))).inSingletonScope(),t.bind(mE).toService(Zw))}class AE extends h_{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ku.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class kE extends AE{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=id,this.themeType="arc"}}let CE=!1;function TE(t){var e;CE||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Nf))&&(CE=!0,t.bind(Jw).toDynamicValue((()=>new kE(Lw(t,Nf)))).inSingletonScope(),t.bind(mE).toService(Jw))}class ME extends _E{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=sd}}let wE=!1;function EE(t){wE||(wE=!0,t.bind(Qw).toDynamicValue((()=>new ME(Lw(t,Uf)))).inSingletonScope(),t.bind(mE).toService(Qw))}class BE extends _E{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=nd}}let PE=!1;function RE(t){PE||(PE=!0,t.bind(tE).toDynamicValue((()=>new BE(Lw(t,Vf)))).inSingletonScope(),t.bind(mE).toService(tE))}class OE{constructor(){this.type="glyph",this.numberType=rd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}class IE extends OE{constructor(t){super(),this.canvasRenderer=t}}let LE=!1;function DE(t){LE||(LE=!0,t.bind(pE).toDynamicValue((()=>new IE(Lw(t,em)))).inSingletonScope(),t.bind(mE).toService(pE))}class FE extends _E{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=od}}let zE=!1;function HE(t){zE||(zE=!0,t.bind(eE).toDynamicValue((()=>new FE(Lw(t,im)))).inSingletonScope(),t.bind(mE).toService(eE))}class jE extends h_{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:ru(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ku.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class NE extends jE{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ld}}let UE=!1;function VE(t){UE||(UE=!0,t.bind(sE).toDynamicValue((()=>new NE(Lw(t,Yf)))).inSingletonScope(),t.bind(mE).toService(sE))}const WE=new Ve;class GE{constructor(){this.type="rect",this.numberType=ud}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:ru(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;WE.setValue(i.x1,i.y1,i.x2,i.y2),WE.expand(-r/2),h=!WE.containsPoint(e)}}return s.highPerformanceRestore(),h}}class YE extends GE{constructor(t){super(),this.canvasRenderer=t}}let XE=!1;class KE extends jE{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=hd}}let $E=!1;function qE(t){$E||($E=!0,t.bind(rE).toDynamicValue((()=>new KE(Lw(t,Xf)))).inSingletonScope(),t.bind(mE).toService(rE))}class ZE extends _E{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=cd}}let JE=!1;function QE(t){JE||(JE=!0,t.bind(cE).toDynamicValue((()=>new ZE(Lw(t,Kf)))).inSingletonScope(),t.bind(mE).toService(cE))}class tB extends AE{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=dd,this.themeType="polygon"}}let eB=!1;function iB(t){var e;eB||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,tm))&&(eB=!0,t.bind(dE).toDynamicValue((()=>new tB(Lw(t,tm)))).inSingletonScope(),t.bind(mE).toService(dE))}class sB extends GE{constructor(t){super(),this.canvasRenderer=t}}let nB=!1;function rB(t){nB||(nB=!0,t.bind(aE).toDynamicValue((()=>new sB(Lw(t,$f)))).inSingletonScope(),t.bind(mE).toService(aE))}class aB extends AE{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=pd,this.themeType="rect"}}let oB=!1;function lB(t){var e;oB||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,qf))&&(oB=!0,t.bind(oE).toDynamicValue((()=>new aB(Lw(t,qf)))).inSingletonScope(),t.bind(mE).toService(oE))}class hB{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=gd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let cB=!1;function dB(t){cB||(cB=!0,t.bind(uE).toDynamicValue((()=>new hB(Lw(t,Qf)))).inSingletonScope(),t.bind(mE).toService(uE))}class uB extends _E{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=fd}}let pB=!1;function gB(t){var e;pB||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,rm))&&(pB=!0,t.bind(fE).toDynamicValue((()=>new uB(Lw(t,rm)))).inSingletonScope(),t.bind(mE).toService(fE))}class fB extends AE{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=md}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:ru(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ku.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let mB=!1;function vB(t){mB||(mB=!0,t.bind(lE).toDynamicValue((()=>new fB(Lw(t,Zf)))).inSingletonScope(),t.bind(mE).toService(lE))}class yB extends AE{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=vd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Vp(a,u,n),v=Up(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&ku.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let _B=!1;function bB(t){_B||(_B=!0,t.bind(hE).toDynamicValue((()=>new yB(Lw(t,Jf)))).inSingletonScope(),t.bind(mE).toService(hE))}const xB=Kc();Kc();class SB{constructor(){this.type="gif-image",this.numberType=xB}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let AB=!1;function kB(t){AB||(AB=!0,t.bind(iE).toDynamicValue((()=>new SB)).inSingletonScope(),t.bind(mE).toService(iE))}function CB(t){t.isBound(Fw)||t.bind(Fw).toDynamicValue((()=>new Fw(Dw(mE,t),Lw(t,nm),Dw(Ff,t),Dw(zf,t)))).inSingletonScope(),t.isBound(If)?t.rebind(If).toService(Fw):t.bind(If).toService(Fw)}function TB(t){(function(t){yE||(yE=!0,t.bind(gE).toDynamicValue((()=>new vE)).inSingletonScope(),t.bind(mE).toService(gE),gv(t.bind.bind(t),mE))})(t),SE(t),TE(t),EE(t),RE(t),DE(t),HE(t),VE(t),function(t){XE||(XE=!0,t.bind(nE).toDynamicValue((()=>new YE(Lw(t,$f)))).inSingletonScope(),t.bind(mE).toService(nE))}(t),qE(t),QE(t),iB(t),rB(t),lB(t),dB(t),gB(t),vB(t),bB(t),kB(t),CB(t)}class MB extends Y_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${MB.idprefix}_${MB.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ua.global,this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:MB.GenerateCanvasId(),canvasControled:!0};this.canvas=new dw(s)}createWindowByCanvas(t){var e,i;let s;if("string"==typeof t.canvas){if(s=this.global.getElementById(t.canvas),s||"undefined"==typeof document||(s=document.getElementById(t.canvas)),!s)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else s=t.canvas;if(!s)throw new Error("发生错误,传入的canvas不正确");let n=t.width,r=t.height;if(null==n||null==r||!t.canvasControled){const t=s.getBoundingClientRect();n=t.width,r=t.height}let a=t.dpr;null==a&&(a=null!==(e=s.getContext("2d").pixelRatio)&&void 0!==e?e:s.width/n),this.canvas=new dw({width:n,height:r,dpr:a,nativeCanvas:s,canvasControled:null!==(i=t.canvasControled)&&void 0!==i&&i})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}}function wB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,MB))||t.bind(MB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,MB.env))||t.bind(om).toService(MB).whenTargetNamed(MB.env)}MB.env="browser",MB.idprefix="visactor_window",MB.prefix_count=0;var EB=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class BB{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function PB(t,e=!1){const i=document.createElement("img");if(Ua.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class RB extends G_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new BB(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return PB(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return PB(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ja.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return EB(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function OB(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,RB))||(t.bind(RB).toSelf().inSingletonScope(),t.bind(pg).toService(RB))}function IB(t=Zy(),e=!0){IB.__loaded||(IB.__loaded=!0,OB(t),pw(t),wB(t),e&&TB(t))}IB.__loaded=!1;class LB extends Y_{get container(){return null}constructor(t=Ua.global){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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new fw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new fw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function DB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,LB))||t.bind(LB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,LB.env))||t.bind(om).toService(LB).whenTargetNamed(LB.env)}LB.env="feishu";class FB extends Q_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Mu(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}}let zB=!1;class HB extends _E{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ed}}let jB=!1;function NB(t){jB||(jB=!0,t.bind(Hw).toDynamicValue((()=>new HB(Lw(t,jf)))).inSingletonScope(),t.bind(zw).toService(Hw))}class UB extends _E{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=sd}}let VB=!1;function WB(t){VB||(VB=!0,t.bind(jw).toDynamicValue((()=>new UB(Lw(t,Uf)))).inSingletonScope(),t.bind(zw).toService(jw))}class GB extends _E{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=nd}}let YB=!1;function XB(t){YB||(YB=!0,t.bind(Nw).toDynamicValue((()=>new GB(Lw(t,Vf)))).inSingletonScope(),t.bind(zw).toService(Nw))}class KB extends OE{constructor(t){super(),this.canvasRenderer=t}}let $B=!1;function qB(t){$B||($B=!0,t.bind($w).toDynamicValue((()=>new KB(Lw(t,em)))).inSingletonScope(),t.bind(zw).toService($w))}class ZB{constructor(){this.type="image",this.numberType=od}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let JB=!1;function QB(t){JB||(JB=!0,t.bind(Uw).toDynamicValue((()=>new ZB)).inSingletonScope(),t.bind(zw).toService(Uw))}class tP extends _E{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ld}}let eP=!1;function iP(t){eP||(eP=!0,t.bind(Vw).toDynamicValue((()=>new tP(Lw(t,Yf)))).inSingletonScope(),t.bind(zw).toService(Vw))}class sP extends _E{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=cd}}let nP=!1;function rP(t){nP||(nP=!0,t.bind(Kw).toDynamicValue((()=>new sP(Lw(t,Kf)))).inSingletonScope(),t.bind(zw).toService(Kw))}class aP extends _E{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=hd}}let oP=!1;function lP(t){oP||(oP=!0,t.bind(Ww).toDynamicValue((()=>new aP(Lw(t,Xf)))).inSingletonScope(),t.bind(zw).toService(Ww))}class hP extends GE{constructor(t){super(),this.canvasRenderer=t}}let cP=!1;function dP(t){cP||(cP=!0,t.bind(Gw).toDynamicValue((()=>new hP(Lw(t,$f)))).inSingletonScope(),t.bind(zw).toService(Gw))}class uP{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=gd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let pP=!1;function gP(t){pP||(pP=!0,t.bind(qw).toDynamicValue((()=>new uP(Lw(t,Qf)))).inSingletonScope(),t.bind(zw).toService(qw))}class fP extends _E{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=md}}let mP=!1;function vP(t){mP||(mP=!0,t.bind(Yw).toDynamicValue((()=>new fP(Lw(t,Zf)))).inSingletonScope(),t.bind(zw).toService(Yw))}class yP{constructor(){this.type="text",this.numberType=vd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let _P=!1;function bP(t){_P||(_P=!0,t.bind(Xw).toDynamicValue((()=>new yP)).inSingletonScope(),t.bind(zw).toService(Xw))}function xP(t){(function(t){zB||(zB=!0,gv(t.bind.bind(t),zw))})(t),function(t){t.isBound(FB)||t.bind(FB).toDynamicValue((()=>new FB(Dw(zw,t),Dw(Ff,t),Dw(zf,t)))).inSingletonScope(),t.isBound(If)?t.rebind(If).toService(FB):t.bind(If).toService(FB)}(t),NB(t),WB(t),XB(t),qB(t),QB(t),iP(t),rP(t),lP(t),dP(t),gP(t),vP(t),bP(t)}class SP{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class AP{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function kP(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function CP(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new SP(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function TP(t,e,i,s){const n=kP(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new AP(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function MP(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function wP(t,e=MP(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class EP extends G_{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},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 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=MP(i),n=null!==(e=t.dpr)&&void 0!==e?e:wP(i,s),r=TP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=kP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=CP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wP(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function BP(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,EP))||(t.bind(EP).toSelf().inSingletonScope(),t.bind(pg).toService(EP))}function PP(t=Zy(),e=!0){PP.__loaded||(PP.__loaded=!0,BP(t),mw(t),DB(t),e&&xP(t))}PP.__loaded=!1;function RP(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function OP(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new yw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new yw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return RP(t,"target",s),RP(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=OP(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=OP(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&IP(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),IP(t,"x",_),IP(t,"y",b),IP(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),IP(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),IP(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),IP(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),IP(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),IP(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function DP(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,LP))||t.bind(LP).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,LP.env))||t.bind(om).toService(LP).whenTargetNamed(LP.env)}LP.env="harmony";const FP="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function zP(t){return"number"==typeof t&&Number.isFinite(t)}function HP(...t){for(let e=0;e({width:i,height:s})),new AP(t,l,n,i,s,e)}function WP(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=UP(e*s,i*s);if(t)return t}throw new Error(FP)}class GP extends G_{constructor(){super(),this.type="harmony",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,this.rafSTO=new Sh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=jP(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=jP(s),r=null!==(i=t.dpr)&&void 0!==i?i:NP(s),a=function(t,e){if(!zP(t)||!zP(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=VP(WP(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=VP(WP(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return NP(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=HP(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=HP(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function YP(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,GP))||(t.bind(GP).toSelf().inSingletonScope(),t.bind(pg).toService(GP))}function XP(t=Zy(),e=!0){XP.__loaded||(XP.__loaded=!0,YP(t),_w(t),DP(t),e&&xP(t))}XP.__loaded=!1;function KP(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function $P(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new xw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new xw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return KP(t,"target",s),KP(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=$P(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=$P(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&qP(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),qP(t,"x",_),qP(t,"y",b),qP(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),qP(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),qP(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),qP(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),qP(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),qP(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function JP(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,ZP))||t.bind(ZP).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,ZP.env))||t.bind(om).toService(ZP).whenTargetNamed(ZP.env)}ZP.env="lynx";function QP(t){return"number"==typeof t&&Number.isFinite(t)}function tR(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=iR(r),o=null!==(i=t.dpr)&&void 0!==i?i:sR(r,a),l=rR(t.width,t.height),h=aR(oR(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=iR(a),l=null!==(n=t.dpr)&&void 0!==n?n:sR(a,o),h=rR(t.width,t.height),c=Math.random().toString(),d=aR(oR(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return sR(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=tR(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=tR(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function hR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,lR))||(t.bind(lR).toSelf().inSingletonScope(),t.bind(pg).toService(lR))}function cR(t=Zy(),e=!0){cR.__loaded||(cR.__loaded=!0,hR(t),Sw(t),JP(t),e&&xP(t))}cR.__loaded=!1;class dR extends Y_{get container(){return null}constructor(t=Ua.global){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:ja.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new kw(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new kw({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function uR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,dR))||t.bind(dR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,dR.env))||t.bind(om).toService(dR).whenTargetNamed(dR.env)}dR.env="node";class pR extends G_{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function gR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,pR))||(t.bind(pR).toSelf().inSingletonScope(),t.bind(pg).toService(pR))}function fR(t=Zy(),e=!0){fR.__loaded||(fR.__loaded=!0,gR(t),Cw(t),uR(t))}fR.__loaded=!1;class mR extends Y_{get container(){return null}constructor(t=Ua.global){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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Mw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Mw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.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){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function vR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,mR))||t.bind(mR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,mR.env))||t.bind(om).toService(mR).whenTargetNamed(mR.env)}mR.env="taro";class yR extends G_{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},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 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=TP(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=kP(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=CP(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}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(...t){}}function _R(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,yR))||(t.bind(yR).toSelf().inSingletonScope(),t.bind(pg).toService(yR))}function bR(t=Zy(),e=!0){bR.__loaded||(bR.__loaded=!0,_R(t),ww(t),vR(t),e&&xP(t))}bR.__loaded=!1;class xR extends Y_{get container(){return null}constructor(t=Ua.global){super(),this.global=t,this.type="tt",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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Bw(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Bw({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function SR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,xR))||t.bind(xR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,xR.env))||t.bind(om).toService(xR).whenTargetNamed(xR.env)}xR.env="tt";function AR(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function kR(t,e=AR(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class CR extends G_{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=AR(i),n=null!==(e=t.dpr)&&void 0!==e?e:kR(i,s),r=TP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=kP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=CP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return kR(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function TR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,CR))||(t.bind(CR).toSelf().inSingletonScope(),t.bind(pg).toService(CR))}function MR(t=Zy(),e=!0){MR.__loaded||(MR.__loaded=!0,TR(t),Pw(t),SR(t),e&&xP(t))}MR.__loaded=!1;class wR{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={}}}function ER(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class BR extends Y_{get container(){return null}constructor(t=Ua.global){super(),this.global=t,this.type="wx",this.eventManager=new wR}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:ja.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Ow(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Ow({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,s,n,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return ER(t,"target",o),ER(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s: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!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function PR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,BR))||t.bind(BR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,om,BR.env))||t.bind(om).toService(BR).whenTargetNamed(BR.env)}BR.env="wx";function RR(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function OR(t,e=RR(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class IR extends G_{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=RR(i),n=null!==(e=t.dpr)&&void 0!==e?e:OR(i,s),r=TP(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=kP(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=CP(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return OR(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function LR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,IR))||(t.bind(IR).toSelf().inSingletonScope(),t.bind(pg).toService(IR))}function DR(t=Zy(),e=!0){DR.__loaded||(DR.__loaded=!0,LR(t),Iw(t),PR(t),e&&xP(t))}DR.__loaded=!1;var FR={},zR={},HR={};Object.defineProperty(HR,"__esModule",{value:!0}),HR.loop=HR.conditional=HR.parse=void 0;HR.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};HR.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};HR.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var jR={};Object.defineProperty(jR,"__esModule",{value:!0}),jR.readBits=jR.readArray=jR.readUnsigned=jR.readString=jR.peekBytes=jR.readBytes=jR.peekByte=jR.readByte=jR.buildStream=void 0;jR.buildStream=function(t){return{data:t,pos:0}};var NR=function(){return function(t){return t.data[t.pos++]}};jR.readByte=NR;jR.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var UR=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};jR.readBytes=UR;jR.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};jR.readString=function(t){return function(e){return Array.from(UR(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};jR.readUnsigned=function(t){return function(e){var i=UR(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};jR.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=UR(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=JR(t),i=YR(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=JR(this.attribute.gifImage),e=YR(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=Ua.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=Ua.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function eO(t){return new tO(t)}class iO extends V_{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=xB,this._renderContribitions=void 0,this.builtinContributions=[sO],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Dp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=Dp(t).image;this._draw(t,n,!1,i)}}const sO=new class extends iy{constructor(){super(...arguments),this.time=To.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let nO=!1;function rO(t){nO||(nO=!0,t.bind(iO).toDynamicValue((()=>new iO(Dw(Dy,t)))).inSingletonScope(),t.bind(Wf).toService(iO))}function aO(){pf.RegisterGraphicCreator("gif",eO)}function oO(){if(oO.__loaded)return;oO.__loaded=!0;const t=Zy();aO(),rO(t),kB(t)}oO.__loaded=!1;const lO=oO,hO=[{register:PS,bindModule:Rx},{register:RS,bindModule:TS},{register:OS,bindModule:Nx},{register:IS,bindModule:Xx},{register:LS,bindModule:cS},{register:DS},{register:FS,bindModule:vS},{register:zS,bindModule:zx},{register:HS,bindModule:Qx},{register:jS,bindModule:iS},{register:US,bindModule:BS},{register:VS,bindModule:Lx},{register:WS,bindModule:SS},{register:GS,bindModule:gS},{register:KS},{register:NS,bindModule:aS},{register:YS,bindModule:Wx},{register:XS,bindModule:qx},{register:$S},{register:aO}];let cO=!1;const dO=[SE,TE,EE,RE,DE,HE,VE,qE,QE,iB,rB,lB,dB,gB,vB,bB,kB];function uO(t){return{getContributions:t}}function pO(t,{envParams:e,force:i=!1}={}){_b().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function gO(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){bb(t);const a=vb();i(a),s(a),n(a),yb(),pO(e,{envParams:r,force:!0})}function fO(t,e){gO(t,"browser",{bindEnv:OB,bindCanvasModules:pw,bindWindowContribution:wB},e)}function mO(t,e){gO(t,"node",{bindEnv:gR,bindCanvasModules:Cw,bindWindowContribution:uR},e)}function vO(t){bb(t),function(){if(cO)return;const t=vb();cO=!0,hO.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),rO(t),yb()}(),Sb(t),xb(t)}function yO(t){bb(t);const e=vb();dO.forEach((t=>t(e))),CB(e),Ab(t,mE),function(t){const e=vb(),i=uO((()=>t.registry.picker.getAll())),s=uO((()=>e.isBound(Ff)?e.getAll(Ff):[])),n=uO((()=>e.isBound(zf)?e.getAll(zf):[])),r=_b();Ua.pickerServiceFactory=()=>new Fw(i,{},s,n),Ua.global=r}(t)}function _O(t){bb(t);xP(vb()),Ab(t,zw),function(t){const e=vb(),i=uO((()=>t.registry.picker.getAll())),s=uO((()=>e.isBound(Ff)?e.getAll(Ff):[])),n=uO((()=>e.isBound(zf)?e.getAll(zf):[]));Ua.pickerServiceFactory=()=>new FB(i,s,n)}(t)}const bO=iv();function xO(){if(xO.__loaded)return;xO.__loaded=!0;const t=Zy();PS(),Rx({bind:t.bind}),bO?SE(t):NB(t)}xO.__loaded=!1;const SO=xO;function AO(){if(AO.__loaded)return;AO.__loaded=!0;const t=Zy();RS(),K_(),q_(),TS({bind:t.bind}),TE(t)}AO.__loaded=!1;const kO=AO;function CO(){if(CO.__loaded)return;CO.__loaded=!0;const t=Zy();OS(),Nx({bind:t.bind}),bO?EE(t):WB(t)}CO.__loaded=!1;const TO=CO;function MO(){if(MO.__loaded)return;MO.__loaded=!0;const t=Zy();IS(),Xx({bind:t.bind}),bO?RE(t):XB(t)}MO.__loaded=!1;const wO=MO;function EO(){if(EO.__loaded)return;EO.__loaded=!0;const t=Zy();LS(),cS({bind:t.bind}),bO?DE(t):qB(t)}EO.__loaded=!1;const BO=EO;function PO(){PO.__loaded||(PO.__loaded=!0,DS())}PO.__loaded=!1;const RO=PO;function OO(){if(OO.__loaded)return;OO.__loaded=!0;const t=Zy();FS(),vS({bind:t.bind}),bO?HE(t):QB(t)}OO.__loaded=!1;const IO=OO;function LO(){if(LO.__loaded)return;LO.__loaded=!0;const t=Zy();zS(),zx({bind:t.bind}),bO?VE(t):iP(t)}LO.__loaded=!1;const DO=LO;function FO(){if(FO.__loaded)return;FO.__loaded=!0;const t=Zy();HS(),Qx({bind:t.bind}),bO?qE(t):lP(t)}FO.__loaded=!1;const zO=FO;function HO(){if(HO.__loaded)return;HO.__loaded=!0;const t=Zy();jS(),iS({bind:t.bind}),bO?QE(t):rP(t)}HO.__loaded=!1;const jO=HO;function NO(){if(NO.__loaded)return;NO.__loaded=!0;const t=Zy();US(),K_(),q_(),BS({bind:t.bind}),iB(t)}NO.__loaded=!1;const UO=NO;function VO(){if(VO.__loaded)return;VO.__loaded=!0;const t=Zy();VS(),Lx({bind:t.bind}),bO?rB(t):dP(t)}VO.__loaded=!1;const WO=VO;function GO(){if(GO.__loaded)return;GO.__loaded=!0;const t=Zy();WS(),SS({bind:t.bind}),lB(t)}GO.__loaded=!1;const YO=GO;function XO(){if(XO.__loaded)return;XO.__loaded=!0;const t=Zy();GS(),gS({bind:t.bind}),bO?dB(t):gP(t)}XO.__loaded=!1;const KO=XO;function $O(){$O.__loaded||($O.__loaded=!0,KS())}$O.__loaded=!1;const qO=$O;function ZO(){if(ZO.__loaded)return;ZO.__loaded=!0;const t=Zy();NS(),aS({bind:t.bind}),gB(t)}ZO.__loaded=!1;const JO=ZO;function QO(){if(QO.__loaded)return;QO.__loaded=!0;const t=Zy();YS(),Wx({bind:t.bind}),bO?vB(t):vP(t)}QO.__loaded=!1;const tI=QO;function eI(){if(eI.__loaded)return;eI.__loaded=!0;const t=Zy();XS(),qx({bind:t.bind}),bO?bB(t):bP(t)}eI.__loaded=!1;const iI=eI;function sI(){sI.__loaded||(sI.__loaded=!0,$S())}sI.__loaded=!1;const nI=sI;function rI(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}class aI{static registerBuiltInAnimate(t,e){aI.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._activeConfigList=null,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:aI.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=rI(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:aI.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=rI(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:T,customType:M,controlOptions:w}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),E.startAt(b);const O=i*x+B;O>0&&E.wait(O);let I=null,L=t.to,D=t.from;const F=this.shouldCommitAttrOutChannel(p);L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(E,T,M,D,L,_,m,f,w,C,p,e);let z=0;x&&(z=x*(s-i-1));const H=d(y)?y(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&E.wait(z),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,y,_,b;if(e&&i){i=rI(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:aI.builtInAnimateMap[r],m=t.custom?t.customType:rI(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Il.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}aI.builtInAnimateMap={};class oI{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-oI.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*oI.bounceIn(2*t):.5*oI.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ut/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ut*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ut/e)*.5+1}}static registerFunc(t,e){oI[t]=e}}function lI(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}oI.quadIn=oI.getPowIn(2),oI.quadOut=oI.getPowOut(2),oI.quadInOut=oI.getPowInOut(2),oI.cubicIn=oI.getPowIn(3),oI.cubicOut=oI.getPowOut(3),oI.cubicInOut=oI.getPowInOut(3),oI.quartIn=oI.getPowIn(4),oI.quartOut=oI.getPowOut(4),oI.quartInOut=oI.getPowInOut(4),oI.quintIn=oI.getPowIn(5),oI.quintOut=oI.getPowOut(5),oI.quintInOut=oI.getPowInOut(5),oI.backIn=oI.getBackIn(1.7),oI.backOut=oI.getBackOut(1.7),oI.backInOut=oI.getBackInOut(1.7),oI.elasticIn=oI.getElasticIn(1,.3),oI.elasticOut=oI.getElasticOut(1,.3),oI.elasticInOut=oI.getElasticInOut(1,.3*1.5),oI.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),oI.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},oI.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)oI[`flicker${t}`]=e=>lI(e,t);for(let t=2;t<10;t++)oI[`aIn${t}`]=e=>t*e*e+(1-t)*e;function hI(t,e,i){return t+(e-t)*i}const cI=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=hI(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=hI(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=hI(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=hI(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=hI(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=hI(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=hI(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=hI(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=hI(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Ou(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?Hu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Ou(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?Hu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=hI(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=hI(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=hI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=hI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=hI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=hI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=hI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=hI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=hI(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=hI(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=hI(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=hI(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=hI(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=hI(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=hI(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=hI(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=bh(e,i,s),r.addUpdateBoundTag()}}};function dI(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:Ao.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=oI[s])&&void 0!==n?n:oI.linear:oI.linear,"wait"===t&&(this.onUpdate=xI),this.id=ja.GenAutoIncrementId(),this.syncAttributeUpdate=xI}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Pu.Get(i,Bu.Color255),r=Pu.Get(s,Bu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(cI["fill"===e?"fillPure":"strokePure"])}else cI[e]?t.push(cI[e]):t.push(dI)}else cI[e]?t.push(cI[e]):t.push(dI)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class kI extends AI{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();_I(this.target,t,Ao.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class CI extends AI{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class TI extends CI{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class MI extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Il.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class wI extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&bI(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),vI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class EI extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,_I(this.target,i,Ao.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),vI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class BI extends wI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class PI extends EI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class RI extends wI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class OI extends EI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}class II extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){_I(this.target,this.from,Ao.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const LI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class DI extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){vI(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){vI(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class FI extends DI{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=LI(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&bI(this.target,r),this.determineUpdateFunction()}}class zI extends DI{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class HI extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&bI(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),vI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class jI extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),vI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const NI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class UI extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=NI(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&bI(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){yI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class VI extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){yI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const WI=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class GI extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(vI(this.target,{points:r.map(((t,i)=>_h(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class YI extends GI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:WI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&bI(this.target,e)}else this.valid=!1}}class XI extends GI{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:WI(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const KI=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class $I extends GI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:KI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&bI(this.target,e)}else this.valid=!1}}class qI extends GI{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:KI(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const ZI=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class JI extends GI{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:ZI(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&bI(this.target,e)}else this.valid=!1}}class QI extends GI{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:ZI(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const tL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class eL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),vI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class iL extends eL{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&bI(this.target,r)}}class sL extends eL{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const nL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class rL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=nL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&bI(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){yI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){yI(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class oL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),vI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lL extends oL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?y:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&bI(this.target,e)}}class hL extends oL{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,y=v&&k(v.x)?v.x:f,_=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class cL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,_I(this.target,{text:n})}}class dL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),vI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class uL extends dL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&bI(this.target,e)}}class pL extends dL{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class gL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),T=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,w=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,E=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,B=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(w){case"x":A={scaleX:null!==(g=null!=E?E:T.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=B?B:T.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=E?E:T.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=B?B:T.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&bI(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),vI(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class fL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),vI(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class mL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function vL(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;tyL[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&vL(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(vI(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class xL{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new aI(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function SL(t){return new xL(t)}class AL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;_I(this.target,{text:o})}}class kL extends TI{onBind(){super.onBind();const t=SL(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(bI(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),bI(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),bI(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),bI(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;bI(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:AL});const i=s._titleBottom.attribute.text;bI(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:AL})}else bI(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),bI(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;bI(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());bI(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class CL extends TI{onBind(){super.onBind();const t=SL(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class TL extends TI{onBind(){super.onBind();const t=SL(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if(bI(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:AL}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:AL}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class ML extends TI{onBind(){super.onBind();const t=SL(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class wL extends MI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=e_.createCanvas({width:t.width,height:t.height,dpr:e_.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=e_.createCanvas({width:t.width,height:t.height,dpr:e_.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==wL.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class EL extends wL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class BL extends wL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==BL.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==BL.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class PL{static createTempCanvas(t,e,i){return e_.createCanvas({width:t,height:e,dpr:i||e_.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=PL.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(PL.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(PL.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(PL.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(PL.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(PL.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(PL.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(PL.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class IL extends BL{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class zL extends BL{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=PL.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class HL extends wL{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=e_.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=e_.createCanvas({width:i,height:s,dpr:e_.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class jL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}_I(this.target,{textConfig:o})}}class NL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),_I(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),_I(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class UL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),_I(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),_I(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function YL(t,e){vI(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class XL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,bI(this.target,m)}onUpdate(t,e,i){YL(this.target,GL(this.propKeys,this.from,this.to,e))}}class KL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,bI(this.target,d)}onUpdate(t,e,i){YL(this.target,GL(this.propKeys,this.from,this.to,e))}}class $L extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,bI(this.target,p)}onUpdate(t,e,i){YL(this.target,GL(this.propKeys,this.from,this.to,e))}}class qL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,bI(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),_I(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class ZL extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,bI(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),_I(this.target,n)}}class JL extends CI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new aI(this.target);a.execute({type:"custom",custom:XL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:KL,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class QL extends CI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new aI(this.target);a.execute({type:"custom",custom:XL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:$L,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class tD extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){YL(this.target,GL(this.propKeys,this.from,this.to,e))}}class eD extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){YL(this.target,GL(this.propKeys,this.from,this.to,e))}}class iD extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){YL(this.target,GL(this.propKeys,this.from,this.to,e))}}class sD extends CI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new aI(this.target);n.execute({type:"custom",custom:eD,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:tD,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class nD extends CI{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new aI(this.target);n.execute({type:"custom",custom:iD,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:tD,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class rD extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),vI(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Ou(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Ou(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class aD extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Ua.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Ml,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Ua.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Ao.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Ao.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=No(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=No(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}oD.getInstance();const lD="appear",hD="disappear",cD="update",dD="highlight",uD="unhighlight";class pD{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class gD{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new aI(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new aI(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([lD],[{name:lD,animation:t}],e)}applyDisappearState(t,e){this.applyState([hD],[{name:hD,animation:t}],e)}applyUpdateState(t,e){this.applyState([cD],[{name:cD,animation:t}],e)}applyHighlightState(t,e){this.applyState([dD],[{name:dD,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([uD],[{name:uD,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class fD{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new gD(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new pD(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class mD extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=ja.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Il.END?this.removeAnimate(t,!0):t.status!==Il.RUNNING&&t.status!==Il.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const vD=new mD;function yD(t,e){for(let i=0;i{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new AI(Ol.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new kI(Ol.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new II(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Il.RUNNING&&(this.status=Il.PAUSED)}resume(){this.status===Il.PAUSED&&(this.status=Il.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Il.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Il.END,this.target.restoreStaticAttribute(),void(this.__skipRestoreStaticAttributeOnRemove=!0);this.status=Il.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&_I(this.target,this._startProps,Ao.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const xD=new Wa;class SD{constructor(){this.released=!1}tick(t,e){xD.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class AD extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Rl.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Rl.INITIAL,Ua.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Ua.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new SD;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Rl.INITIAL&&(this.status=Rl.PAUSE,!0)}resume(){return this.status!==Rl.INITIAL&&(this.status=Rl.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Rl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Rl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Rl.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Rl.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Rl.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Rl.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Ua.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function CD(){G(Mp,fD),G(Mp,kD)}const TD=Symbol.for("vrender.bootstrap.state"),MD=new WeakMap;function wD(t,e){var i;const s=null!==(i=t[TD])&&void 0!==i?i:new Set;return t[TD]=s,!s.has(e)&&(s.add(e),!0)}function ED(t,e){var i,s,n,r;const a=null!==(i=null==t?void 0:t.type)&&void 0!==i?i:"unknown",o=null!==(s=null==t?void 0:t.numberType)&&void 0!==s?s:"unknown",l=null!==(r=null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)&&void 0!==r?r:"anonymous";return`${e}:${String(o)}:${String(a)}:${l}`}function BD(t,e){let i=MD.get(t);i||(i=new Map,MD.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function PD(t,e,i){const s=BD(t,e);i&&s.forEach((t=>i(t))),s.clear()}function RD(t){var e,i;const s=null!==(e=Zy().getAll(Wf))&&void 0!==e?e:[],n=BD(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;PD(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=ED(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function OD(t,e){var i,s;const n=null!==(i=Zy().getAll(e))&&void 0!==i?i:[],r=BD(t.registry.picker,"vrender:legacy-picker"),a=new Set;PD(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=ED(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const ID=fO,LD=mO,DD={taro:{installEnv:function(t,e){gO(t,"taro",{bindEnv:_R,bindCanvasModules:ww,bindWindowContribution:vR},e)},loadEnv:bR},feishu:{installEnv:function(t,e){gO(t,"feishu",{bindEnv:BP,bindCanvasModules:mw,bindWindowContribution:DB},e)},loadEnv:PP},tt:{installEnv:function(t,e){gO(t,"tt",{bindEnv:TR,bindCanvasModules:Pw,bindWindowContribution:SR},e)},loadEnv:MR},wx:{installEnv:function(t,e){gO(t,"wx",{bindEnv:LR,bindCanvasModules:Iw,bindWindowContribution:PR},e)},loadEnv:DR},lynx:{installEnv:function(t,e){gO(t,"lynx",{bindEnv:hR,bindCanvasModules:Sw,bindWindowContribution:JP},e)},loadEnv:cR},harmony:{installEnv:function(t,e){gO(t,"harmony",{bindEnv:YP,bindCanvasModules:_w,bindWindowContribution:DP},e)},loadEnv:XP}},FD=[nA,eA,ZS,QS,K_,q_],zD=[()=>{aI.registerBuiltInAnimate("increaseCount",cL),aI.registerBuiltInAnimate("fromTo",II),aI.registerBuiltInAnimate("scaleIn",gL),aI.registerBuiltInAnimate("scaleOut",fL),aI.registerBuiltInAnimate("growHeightIn",UI),aI.registerBuiltInAnimate("growHeightOut",VI),aI.registerBuiltInAnimate("growWidthIn",rL),aI.registerBuiltInAnimate("growWidthOut",aL),aI.registerBuiltInAnimate("growCenterIn",HI),aI.registerBuiltInAnimate("growCenterOut",jI),aI.registerBuiltInAnimate("clipIn",BI),aI.registerBuiltInAnimate("clipOut",PI),aI.registerBuiltInAnimate("fadeIn",RI),aI.registerBuiltInAnimate("fadeOut",OI),aI.registerBuiltInAnimate("growPointsIn",YI),aI.registerBuiltInAnimate("growPointsOut",XI),aI.registerBuiltInAnimate("growPointsXIn",$I),aI.registerBuiltInAnimate("growPointsXOut",qI),aI.registerBuiltInAnimate("growPointsYIn",JI),aI.registerBuiltInAnimate("growPointsYOut",QI),aI.registerBuiltInAnimate("growAngleIn",FI),aI.registerBuiltInAnimate("growAngleOut",zI),aI.registerBuiltInAnimate("growRadiusIn",iL),aI.registerBuiltInAnimate("growRadiusOut",sL),aI.registerBuiltInAnimate("moveIn",lL),aI.registerBuiltInAnimate("moveOut",hL),aI.registerBuiltInAnimate("rotateIn",uL),aI.registerBuiltInAnimate("rotateOut",pL),aI.registerBuiltInAnimate("update",bL),aI.registerBuiltInAnimate("state",mL),aI.registerBuiltInAnimate("labelItemAppear",kL),aI.registerBuiltInAnimate("labelItemDisappear",CL),aI.registerBuiltInAnimate("poptipAppear",TL),aI.registerBuiltInAnimate("poptipDisappear",ML),aI.registerBuiltInAnimate("inputText",AL),aI.registerBuiltInAnimate("inputRichText",jL),aI.registerBuiltInAnimate("outputRichText",NL),aI.registerBuiltInAnimate("slideRichText",VL),aI.registerBuiltInAnimate("slideOutRichText",UL),aI.registerBuiltInAnimate("slideIn",XL),aI.registerBuiltInAnimate("growIn",KL),aI.registerBuiltInAnimate("spinIn",$L),aI.registerBuiltInAnimate("moveScaleIn",JL),aI.registerBuiltInAnimate("moveRotateIn",QL),aI.registerBuiltInAnimate("strokeIn",qL),aI.registerBuiltInAnimate("slideOut",tD),aI.registerBuiltInAnimate("growOut",eD),aI.registerBuiltInAnimate("spinOut",iD),aI.registerBuiltInAnimate("moveScaleOut",sD),aI.registerBuiltInAnimate("moveRotateOut",nD),aI.registerBuiltInAnimate("strokeOut",ZL),aI.registerBuiltInAnimate("pulse",rD),aI.registerBuiltInAnimate("MotionPath",WL),aI.registerBuiltInAnimate("streamLight",aD),aI.registerBuiltInAnimate("dissolve",OL),aI.registerBuiltInAnimate("grayscale",FL),aI.registerBuiltInAnimate("distortion",IL),aI.registerBuiltInAnimate("particle",zL),aI.registerBuiltInAnimate("glitch",DL),aI.registerBuiltInAnimate("gaussianBlur",LL),aI.registerBuiltInAnimate("pixelation",HL)},CD],HD=[SO,kO,TO,wO,BO,lO,RO,IO,DO,zO,jO,UO,WO,YO,KO,qO,tI,iI,nI,JO];function jD(){FD.forEach((t=>t())),zD.forEach((t=>t()))}function ND(t,e){if(!wD(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==e_?void 0:e_.env)?e_.envParams:void 0}(e);return void 0===i?mO(t):LD(t,i),vO(t),_O(t),fR(),HD.forEach((t=>t())),RD(t),OD(t,zw),jD(),t}function UD(t,e,i){if(!wD(t,e))return t;const s=DD[e];return s.installEnv(t,i),vO(t),function(t){_O(t)}(t),s.loadEnv(),HD.forEach((t=>t())),RD(t),OD(t,zw),jD(),t}var VD=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt())),RD(t),OD(t,mE),jD(),t):t}(ib(VD(t,["envParams"])),e)}var GD=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nQD(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=JD(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&QD(t,i,s))}}}(t,s,r,o)}function eF(t){const{env:e}=t,i=Object.assign({},t);return delete i.env,delete i.key,"browser"===e?WD(i):"node"===e?function(t={}){const{envParams:e}=t,i=KD(t,["envParams"]);return ND($D(i),e)}(i):"taro"===e?function(t={}){return XD("taro",t)}(i):"feishu"===e?function(t={}){return XD("feishu",t)}(i):"tt"===e?function(t={}){return XD("tt",t)}(i):"wx"===e?function(t={}){return XD("wx",t)}(i):"lynx"===e?function(t={}){return XD("lynx",t)}(i):function(t={}){return XD("harmony",t)}(i)}const iF=e=>{switch(e){case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony";case t.RenderModeEnum.lynx:return"lynx";default:return"browser"}},sF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},nF=(t,e)=>{const i=iF(t),s=sF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},rF=(t,e)=>{const i=tF((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,eF,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}};class aF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option,m=nF(o,l);e_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=m?m:{});const v=this._option.stage;if(this._isExternalStage=!!v,this._releaseVRenderAppRef=void 0,this._stage=v,!this._stage){const t=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=iF(i.mode),n=nF(i.mode,i.modeParams);return rF(s,n)})({app:this._option.app,mode:o,modeParams:l});this._releaseVRenderAppRef=t.releaseAppRef;try{this._stage=(y=t.app,_=Object.assign({background:f,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(s=this._option.renderHooks)&&void 0!==s?s:{}),y.createStage(_))}catch(t){throw null===(n=this._releaseVRenderAppRef)||void 0===n||n.call(this),this._releaseVRenderAppRef=void 0,t}}var y,_;this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const b=sf({x:0,y:0,width:this._width,height:this._height});b.name="root",this._stage.defaultLayer.appendChild(b),this._rootGroup=b;const x=(p(h)?h:fA(o))&&!1!==c&&cT.getStageEventPlugin("gesture");x&&(this._gestureController=new x(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=tw.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!_(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!gA(this._option.mode))return!1;return!1===(p(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:e_.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(e_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=e_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>nw(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>nw(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{nw(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===tw.before;(e||i)&&(lA(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=tw.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=tw.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),lA(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=rw(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=aw(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=aw(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=iw(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=iw(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:ow,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{nw(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===JM.appear))?JM.appear:e.every((t=>t===JM.disappear))?JM.disappear:JM.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===OM.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=CM(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=CM(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:MM(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===OM.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===OM.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===OM.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===OM.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===OM.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{nw(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=rw(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return gA(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&Gc(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{nw(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=e_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){e_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function oF(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:cA)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const lF={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}},hF={poptip:H({},lF)};function cF(t){t.crosshair=Y(t.crosshair||{}).map((e=>hT({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function dF(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=li(l,i.width,i.height);a=t,o=e}else if(h&&gA(e.mode)){let t;t=y(h)?e_.getElementById(h):h;const{width:e,height:s}=li(t,i.width,i.height);a=e,o=s}else if(mA(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}const uF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function pF(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function gF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function fF(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;uF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function mF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var vF,yF,_F,bF,xF,SF;t.LayoutZIndex=void 0,(vF=t.LayoutZIndex||(t.LayoutZIndex={}))[vF.SeriesGroup=0]="SeriesGroup",vF[vF.Axis_Grid=50]="Axis_Grid",vF[vF.CrossHair_Grid=100]="CrossHair_Grid",vF[vF.Region=450]="Region",vF[vF.Mark=300]="Mark",vF[vF.Node=400]="Node",vF[vF.Axis=100]="Axis",vF[vF.MarkLine=500]="MarkLine",vF[vF.MarkArea=100]="MarkArea",vF[vF.MarkPoint=500]="MarkPoint",vF[vF.DataZoom=500]="DataZoom",vF[vF.ScrollBar=500]="ScrollBar",vF[vF.Player=500]="Player",vF[vF.Legend=500]="Legend",vF[vF.CrossHair=500]="CrossHair",vF[vF.Indicator=500]="Indicator",vF[vF.Title=500]="Title",vF[vF.Label=500]="Label",vF[vF.Brush=500]="Brush",vF[vF.CustomMark=500]="CustomMark",vF[vF.Interaction=700]="Interaction",t.LayoutLevel=void 0,(yF=t.LayoutLevel||(t.LayoutLevel={}))[yF.Indicator=10]="Indicator",yF[yF.Region=20]="Region",yF[yF.Axis=30]="Axis",yF[yF.DataZoom=40]="DataZoom",yF[yF.Player=40]="Player",yF[yF.ScrollBar=40]="ScrollBar",yF[yF.Legend=50]="Legend",yF[yF.Title=70]="Title",yF[yF.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(_F=t.AttributeLevel||(t.AttributeLevel={}))[_F.Default=0]="Default",_F[_F.Theme=1]="Theme",_F[_F.Chart=2]="Chart",_F[_F.Base_Series=3]="Base_Series",_F[_F.Series=4]="Series",_F[_F.Mark=5]="Mark",_F[_F.User_Chart=6]="User_Chart",_F[_F.User_Series=7]="User_Series",_F[_F.User_Mark=8]="User_Mark",_F[_F.User_SeriesStyle=9]="User_SeriesStyle",_F[_F.Built_In=99]="Built_In";class AF{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,H({},AF.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}AF.defaultMarkInfo={};class kF{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class CF{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>hT({},i,s,t);return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class TF extends kF{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=CF,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new AF,this._lastLayoutRect=null,this.id=yA(),this.userId=t.id,this._spec=t,this.effect={},this.event=new EM(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${IT}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=cT.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class MF{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=KC(qC(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:XC(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:XC(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:XC(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:XC(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:XC(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:XC(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=XC(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=XC(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=XC(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec($C(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class wF extends TF{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new MF(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=H(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=H(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class EF extends CF{_initTheme(t,e){return{spec:t,theme:this._theme}}}class BF extends wF{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=EF,this.modelType="region",this.specKey="region",this.type=BF.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function PF(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function RF(t,e,i){e?t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=X(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function OF(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function IF(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=zF(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),OF(d,!0,p,l),s&&RF(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function LF(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=zF(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=zF(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),OF(d,!1,p,o),s&&RF(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function FF(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=zF(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=zF(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=PF(t);n.length&&IF(n,e,i,!1,"left",s),r.length&&IF(r,e,i,!0,"left",s),a.length&&LF(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=PF(t);n.length&&DF(n,e,i,!1,"top",s),r.length&&DF(r,e,i,!0,"top",s),a.length&&FF(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=PF(t);n.length&&IF(n,e,i,!1,"right",s),r.length&&IF(r,e,i,!0,"right",s),a.length&&LF(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=PF(t);n.length&&DF(n,e,i,!1,"bottom",s),r.length&&DF(r,e,i,!0,"bottom",s),a.length&&FF(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=zF(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=zF(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:cA)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}HF.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(bF||(bF={})),t.STATE_VALUE_ENUM=void 0,(xF=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",xF.STATE_HOVER="hover",xF.STATE_HOVER_REVERSE="hover_reverse",xF.STATE_DIMENSION_HOVER="dimension_hover",xF.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",xF.STATE_SELECTED="selected",xF.STATE_SELECTED_REVERSE="selected_reverse",xF.STATE_SANKEY_EMPHASIS="selected",xF.STATE_SANKEY_EMPHASIS_REVERSE="blur",xF.STATE_HIGHLIGHT="highlight",xF.STATE_BLUR="blur",xF.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(SF||(SF={}));const jF=["linear","radial","conical"],NF={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const UF={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{UF[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class VF extends kF{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(H(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class WF extends VF{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,ew.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!UF[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(IT)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(IT))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(Mk(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class GF extends kF{constructor(){super(...arguments),this.id=yA(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=cT.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class YF extends GF{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const XF=1e3,KF="quadInOut",$F=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],qF=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=Ou(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},ZF=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Ib(t):[],n=Ib(e);i&&s&&(i.fromTransform&&Lb(s,i.fromTransform.clone().getInverse()),Lb(s,i.toTransfrom));const[r,a]=Ob(s,n);return t?Rb(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},QF=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],tz=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!QF.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Pu.Get(t,Bu.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class ez extends CI{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;ZF(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&qF(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):_I(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const iz=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=JF(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=tz(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new ez({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:XF,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:KF);return c.play(d),c};class sz extends CI{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;ZF(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&qF(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const nz=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>$F.includes(t))(i)||(e[i]=t[i])})),e},rz=(t,e,i)=>{const s=nz(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=Ua.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},az=(t,e,i)=>{const s=[],n=i?null:nz(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:nz(t.attribute);if("rect"===t.type)zb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)Hb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)jb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=Vb(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ua.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?Kb(t,e).forEach((t=>{s.push(Ua.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?Ub(t,e).forEach((t=>{s.push(Ua.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&$b(t,e).forEach((t=>{"path"in t?s.push(Ua.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ua.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&rz(t,s,e),s},lz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,hz=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=lz(l.delay,n,a,o),d=lz(l.duration,n,a,o),u=lz(l.oneByOne,n,a,o),p=lz(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?az:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:oz)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);iz(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?az:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:oz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>JF(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>tz(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Ao.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new ez({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:XF,null!==(l=i.easing)&&void 0!==l?l:KF))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Ao.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new sz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:XF,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:KF))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):iz(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},cz=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},dz=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},uz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},pz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];uz(t,a,s)},gz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));uz(t,r,i)},fz=Symbol("statesClearedBeforeReInit");class mz extends GF{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new YF(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=sf("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Ml)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===bF.enter||t.context.diffState===bF.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&uz(t,r,e)},this.name=e,this.model=i.model,this.key=i.key,this.state=new WF(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&hT(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(wk(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return y(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=jC(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):jF.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):wk(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=PC(BC(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},NF[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=si.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)jF.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=PC(BC(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return iw(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return cT.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[HT],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=iw(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===JM.appear))?JM.appear:t.every((t=>t===JM.disappear))?JM.disappear:t[0];return null!=e?e:JM.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{dz(t),s.push(...t.getGraphics())})),e.forEach((t=>{dz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);hz([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=cz(e,n),r=cz(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===JM.exit?JM.exit:i===JM.update?JM.update:JM.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===bF.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===bF.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=bF.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=bF.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=bF.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=JM.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=JM.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return sw(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=sw(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||d(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!d(r)&&(!jF.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!wk(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);u(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,wM(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=cT.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=cT.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===tw.before||(this._product||this._initProduct(),lA(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[fz],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?pz(i,t,!0,a):gz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[fz]=e:delete s[fz]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===bF.exit&&!e.isExiting)if(e.context.animationState===bF.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===bF.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:bF.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=sf({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[fz]=t.currentStates.slice())}))}}var vz;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(vz||(vz={}));class yz extends mz{constructor(){super(...arguments),this.type=yz.type,this._marks=[],this._diffState=bF.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(hA("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?(hA("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return nw(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===bF.update){const t=this.hasAnimation(),e=wM(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=bF.update}render(){this._isCommited&&(lA(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}yz.type="group";const _z={measureText:OT};class bz{static instance(){return bz.instance_||(bz.instance_=new bz),bz.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class xz{constructor(){this.id=yA(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?hA("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class Sz extends xz{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const Az=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},kz=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class Cz extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=eo.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=eo.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||Az(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=kz(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=eo.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=kz(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Az(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=eo.now()-i>this.config.press.time&&kz(s[0],t){Ua.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:Ao.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Mz extends Tz{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},y=null!==(o=v.width)&&void 0!==o?o:0,_=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const C=Ua.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:y/2,y:null!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:_/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(y+_)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,M;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},M={startAngle:x}):(T={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?T:M,"in"===b?M:T,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class wz extends Tz{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",y=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",_=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Ua.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===y?0:f,height:"in"===v&&"y"===y?0:m,fill:!0});let x={},S={};"y"===y?"negative"===_?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===_?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Ez extends CI{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=yt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&vL(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(vI(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=_h(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));_I(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const Bz={type:"fadeIn"};function Pz(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return Bz;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const Rz={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},Oz={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},Iz={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},Lz=()=>{cT.registerAnimation("scaleInOut",(()=>Oz))},Dz=()=>{cT.registerAnimation("fadeInOut",(()=>Iz))},Fz=(t,e)=>({appear:Pz(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Ez,duration:Rz.update.duration,easing:Rz.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),zz=()=>{cT.registerAnimation("line",Fz)},Hz=()=>{aI.registerBuiltInAnimate("growPointsIn",YI),aI.registerBuiltInAnimate("growPointsOut",XI),aI.registerBuiltInAnimate("growPointsXIn",$I),aI.registerBuiltInAnimate("growPointsXOut",qI),aI.registerBuiltInAnimate("growPointsYIn",JI),aI.registerBuiltInAnimate("growPointsYOut",QI),aI.registerBuiltInAnimate("clipIn",BI),aI.registerBuiltInAnimate("clipOut",PI)},jz=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class Nz{constructor(t){this._markSet=new AF,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const Uz={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class Vz extends Nz{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},Uz,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&gz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}Vz.type="element-highlight",Vz.defaultOptions=Uz;const Wz=()=>{cT.registerInteractionTrigger(Vz.type,Vz)},Gz={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class Yz extends Nz{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},Gz,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),pz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&gz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}Yz.type="element-select",Yz.defaultOptions=Gz;const Xz=()=>{cT.registerInteractionTrigger(Yz.type,Yz)};class Kz extends xz{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const $z=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},qz=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...qz(t))})),s},Zz=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||($z(t,r),!1)};class Jz{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>cT.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>cT.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>cT.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return cT.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>cT.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){cT.registerTransform(t,e)}static registerFunction(t,e){t&&e&&bz.instance().registerFunction(t,e)}static unregisterFunction(t){t&&bz.instance().unregisterFunction(t)}static getFunction(t){return t?bz.instance().getFunction(t):null}static getFunctionList(){return bz.instance().getFunctionNameList()}static registerMap(t,e,i){const s=cT.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=cT.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,NM.get(e);var e}static registerSVG(t,e,i){const s=cT.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=cT.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){CT.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=yA(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=lw.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=fF(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?cT.getSeriesBuiltInTheme(e):cT.getComponentBuiltInTheme(e);i=i?hT({},s,i[e]):s}s===t.length-1&&p(i)&&(i=ET({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},kk(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=gA(v);if(S?IB(i_):"node"===v&&fR(i_),S&&f&&(this._container=y(f)?e_.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=TT.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new aF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new zM(this,this._compiler),this._event=new EM(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),CT.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=hT({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=BT(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;Jz.getFunctionList()&&Jz.getFunctionList().length&&(t=PT(t,Jz)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=cT.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=cT.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=cT.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return dF(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:LT,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:DT})}_initDataSet(t){this._dataSet=t instanceof Ra?t:new Ra,jM(this._dataSet,"dataview",Ea),jM(this._dataSet,"array",s),HM(this._dataSet,"copyDataView",XM);for(const t in cT.transforms)HM(this._dataSet,t,cT.transforms[t]);for(const t in cT.dataParser)jM(this._dataSet,t,cT.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),pF(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?JM.none:JM.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,CT.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{$z(t)})),this._exitingVRenderComponents.clear())}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Oa?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=$M(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?hT({},t[n][e.index],i):i):t[n]=s?hT({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?hT({},t[n][r],i):i)}else t.id===e&&(t[n]=s?hT({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=hT({},t.getSpec(),e));const r=t.updateSpec(e),a=pF(r),o=gF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=dT({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=MT(this._currentThemeName),this._currentTheme=o(a,l);else{const t=dT({},MT(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),MT(n),MT(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),H(hF.poptip,lF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!gA(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return MT(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!TT.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield oF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!gA(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=y(this._canvas)?e_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?ZC(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return hA("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?ZC(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(hA("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return bz.instance().getFunction(t)}registerFunction(t,e){t&&e&&bz.instance().registerFunction(t,e)}unregisterFunction(t){t&&bz.instance().unregisterFunction(t)}getFunctionList(){return bz.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=cT.getChartPlugins();t.length>0&&(this._chartPlugin=new Sz(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=cT.getVChartPlugins();e.length>0&&(this._vChartPlugin=new Kz(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=lw.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;this._renderState=lw.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent()}}Jz.InstanceManager=CT,Jz.ThemeManager=TT,Jz.globalConfig={uniqueTooltip:!0},Jz.Utils=_z,Jz.vglobal=e_;cT.registerRegion("region",BF),cT.registerLayout("base",HF),qO(),RO(),cT.registerMark(yz.type,yz),cT.registerStageEventPlugin("gesture",Cz),Wz(),Xz(),bT(nT.name,nT);const Qz="monotone",tH="linear",eH="bevel";t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));class iH{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}function sH(t,e){return e("component",t)}function nH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=cT.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const rH=(t,e,i,s)=>{if(u(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},aH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,d(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],c=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(d(e.set))g=function(t){const i=c.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=c.get(`${e[a]}`);if(u(i))for(let i=0;i(g(t),t)))},oH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},lH=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=nH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},hH=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const cH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function dH(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=pH(lH(h,r,a,c),d,g),o.value=pH(lH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=lH(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function uH(t,e,i,s,n,r,a){if(d(e)){dH(t,e(n,a),i,s,r,a)}else e&&dH(t,e,i,s,r,a)}const pH=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=yi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class gH{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{uH(a,t,e,i,s,n,r)})):d(t)?uH(a,t,e,i,s,n,r):t&&dH(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:lH(r.visible,t,n),value:pH(lH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:lH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=lH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&cH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const fH={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?K(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?K(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},mH=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=oM([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return vH(a,n,o)},vH=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{_A(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{_A(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=fH[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},yH=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{_A(t[e])||(t[e]=0)}))})),t},_H=`${IT}_HIERARCHY_DEPTH`,bH=`${IT}_HIERARCHY_ROOT`,xH=`${IT}_HIERARCHY_ROOT_INDEX`;function SH(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function AH(t,e,i){t&&(i.needDefaultSeriesField&&(t[jT]=i.defaultSeriesField),t[zT]=e,t[HT]=i.getKey(t,e,i))}function kH(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function CH(t,e,i,s=0,n,r){void 0===r&&(r=e),AH(t,e,i),t[_H]=s,t[bH]=n||t[i.categoryField],t[xH]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>CH(e,s,i,t[_H]+1,t[bH],r)))}const TH={label:{name:"label",type:"text"}},MH=`${IT}_rect_x`,wH=`${IT}_rect_x1`,EH=`${IT}_rect_y`,BH=`${IT}_rect_y1`,PH={data:!0},RH={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},OH=[...Object.keys(Rz),"normal"];function IH(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var s;let n=t;return HH(n)&&delete n.type,n.oneByOne&&(n=DH(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:FH,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=hT({},o[e],a);return HH(n)&&delete n.type,n.oneByOne&&(n=DH(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:FH,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function LH(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=L(t,null,i),jH(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function DH(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function FH(t,e){var i;return null!==(i=null==t?void 0:t[zT])&&void 0!==i?i:e.context.graphicIndex}function zH(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function HH(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function jH(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),jH(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),jH(t[s],e,i))}function NH(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class UH extends CF{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=MC(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=cT.getSeriesMarkMap(o)?function(t,e,i){const s=cT.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=hT({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return hT({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=hT({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>hT({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const VH=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(RH[e]||(t[e]=!0),t)),{}),WH={compileOnlyKeys:RH,dataRelatedKeys:VH,seriesOnlyKeys:{tooltip:!0}},GH={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},YH=t=>(t=>g(t)&&!_(t)&&!d(t))(t)?t:u(t)?{}:null,XH=(t,e,i)=>{const s=YH(t),n=YH(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function KH(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class $H extends TF{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${IT}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=UH,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=NH(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(HM(this._rawData.dataSet,"invalidTravel",yH),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=$M(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=KM(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=KM(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new YF(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=K(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=vH(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=H(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){HM(this._dataSet,"dimensionStatistics",mH);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Oa(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&oM(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){HM(this._dataSet,"dimensionStatistics",mH);const s=new Oa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=oM(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&oM(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Oa(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:y(t)?e=>e[t]:_(t)&&t.every((t=>y(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(HM(this._rawData.dataSet,"addVChartProperty",oH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:SH.bind(this),call:AH}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:y(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=IH({},LH(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:fA(s)||mA(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=hT(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=hT(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=jz(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=jz(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=jz(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:jT;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:NT,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,NT,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(cT.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new gH(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,KH(i))}_getSpecUpdatePolicy(){return WH}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},PH),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),l),!l.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>XH(t[i],e[i],GH)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&XH(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?KH(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&KH(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Oa||qM(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();NH(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:jT,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new zC).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return BC(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:jT}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),u(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),u(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,p=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${p}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,hT({},d,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:HT}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${u(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==WT&&t!==YT&&t!==VT&&t!==GT||(t=this.getStackValueField()),null!==(e=hM(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>_A(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:jT]}}function qH(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Mk(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function ZH(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}$H.mark=TH,$H.transformerConstructor=UH;class JH extends $H{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);Mk(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${IT}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(WT),this.setFieldX2(VT)):(this.setFieldY(WT),this.setFieldY2(VT))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(YT),this.setFieldX2(GT)):(this.setFieldY(YT),this.setFieldY2(GT))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(KT),this.setFieldX2(XT)):(this.setFieldY(KT),this.setFieldY2(XT))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(qH("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function QH(t){return"bottom"===t||"top"===t}function tj(t){return"left"===t||"right"===t}function ej(t){return"z"===t}function ij(t,e){return WC(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function sj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function nj(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?QH(t)?"linear":"band":QH(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const rj=(t,e,i)=>{var s;const n=null!==(s="band"===e?sH("axisBand",i):["linear","log","symlog"].includes(e)?sH("axisLinear",i):{})&&void 0!==s?s:{},r=QH(t)?sH("axisX",i):tj(t)?sH("axisY",i):sH("axisZ",i);return hT({},sH("axis",i),n,r)};class aj{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:cA)("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:cA)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>Ek(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return QH(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class oj extends aj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:OM.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const lj=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},hj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},cj=(t,e,i,s)=>{var n;const r=e.getScale(),a=Ek(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:dj(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,uj=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class pj extends aj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!lj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:OM.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:OM.canvas}),callback:this.onMouseOut}),fA(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:OM.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),fA(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var gj;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(gj||(gj={}));const fj={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},mj={sampling:!0,samplingFactor:!0};class vj{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(fj.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:eH,curveType:tH,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===Qz?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(fj.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:zH(this._spec,fj.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Oa(this._option.dataSet,{name:`${IT}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(gj.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[fj.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(gj.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,hT({},this._spec[fj.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const yj=Object.assign(Object.assign({},TH),fj),_j=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>_j(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},bj=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class xj extends mz{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return bj}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(wk(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?_j(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:bF.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[HT]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const Sj=new Uint32Array(33),Aj=new Uint32Array(33);Aj[0]=0,Sj[0]=~Aj[0];for(let t=1;t<=32;++t)Aj[t]=Aj[t-1]<<1|1,Sj[t]=~Aj[t];function kj(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&Sj[31&o]&Aj[1+(31&l)])return!0}else{if(i[h]&Sj[31&o])return!0;if(i[c]&Aj[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,Sj[31&o]&Aj[1+(31&l)]);else for(s(h,Sj[31&o]),s(c,Aj[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,Aj[31&a]|Sj[1+(31&o)]);else for(n(l,Aj[31&a]),n(h,Sj[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function Cj(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=yt(i,-o,t.width+l),d=yt(s,-o,t.width+l),u=yt(n,-a,t.height+h),p=yt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function Tj(t,e,i=!1){return i?Cj(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function Mj(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=Tj(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=Cj(t,r)),e.getRange(r)))}function wj(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return wj(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return wj(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return wj(t,e,n,s,h,c)}return!1}const Bj=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],Pj=["top","inside-top","inside"];function Rj(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const Oj={mode:"same-time",duration:300,easing:"linear"};function Ij(t){return 3===t||4===t}function Lj(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const Dj=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function Fj(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}class zj extends TI{onBind(){const t=SL(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class Hj extends TI{onBind(){const t=SL(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const jj=(t,e)=>Math.ceil(t)>Math.floor(e),Nj=([t,e],[i,s])=>s>t&&e>i;function Uj(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const Vj=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Wj extends ef{constructor(t,e){super(t),this._skipRenderAttributes=Vj,(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?H(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{Xj(t,e,i)})),e}function Kj(t,e){e&&(null==t||t.onComplete.push(e))}function $j(t){t.forEach((t=>{t()}))}function qj(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var Zj=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(jA.hover,!0),xA(this,(t=>{t===e||P(t.states)||t.addState(jA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(xA(this,(t=>{P(t.states)||(t.removeState(jA.hoverReverse),t.removeState(jA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void xA(this,(t=>{P(t.states)||(t.removeState(jA.selectedReverse),t.removeState(jA.selected))}));P(e.states)||(e.addState(jA.selected,!0),xA(this,(t=>{t===e||P(t.states)||t.addState(jA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===Ao.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Ao.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[Fj(g,f,c,d,a,o),Fj(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=DA.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Ml)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),$j(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Kj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(Oj),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=Xj(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=Xj(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},qj(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(d(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(a);const o=[],l=a;if(!c(t)&&d(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}d(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return KA(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&jj(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&jj(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(Uj([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!Nj([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(Tj(i,e,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(Tj(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(Tj(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;Yj(i,null==n?void 0:n.attribute),Yj(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{Qj[t]=e};var eN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};iN.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const sN=()=>{tN("line",iN),tN("area",iN)};var nN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}rN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const aN=()=>{tN("symbol",rN),tN("line-data",rN)};class oN extends xj{constructor(){super(...arguments),this.type=oN.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)===CC.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}oN.type="line";const lN=()=>{cT.registerMark(oN.type,oN),qO(),DO(),sN(),aN(),Hz(),cT.registerGraphicComponent("line",sg)};class hN extends mz{constructor(){super(...arguments),this.type=hN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}hN.type="symbol";const cN=()=>{cT.registerMark(hN.type,hN),qO(),tI(),aN(),cT.registerGraphicComponent("symbol",tg)};class dN extends UH{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function uN(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function pN(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function gN(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function fN(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function mN(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function vN(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const yN=t=>t.map(((t,e)=>({index:e,value:t}))),_N=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},bN=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=WA(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return yN(v)};class AN{constructor(t){this.id=yA(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class kN extends AN{constructor(){super(kN.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Mk(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&uN(c)&&uN(d)))return;const u=pN(t,c),p=pN(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=u,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!fN(u,p))return}else if(0===_&&0===b){if(!fN(p,u))return}else if(y||A)if(y&&!A){if(!gN(u,p))return}else if(A&&!y){if(!gN(p,u))return}else{if(f===b)return;if(f>b){if(!mN(u,p))return}else if(!mN(p,u))return}else{if(0===f&&0===_){if(!vN(u,p))return}else if(0===b&&0===g&&!vN(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){HM(e.getOption().dataSet,"tickAlign",SN);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}kN.pluginType="component",kN.type="AxisSyncPlugin";const CN={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function TN(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function MN(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function wN(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const EN=t=>"band"===t||"ordinal"===t||"point"===t;function BN(t,e){return{id:t,label:t,value:e,rawValue:t}}function PN(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class RN extends xz{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const ON=`${IT}_ARC_TRANSFORM_VALUE`,IN=`${IT}_ARC_RATIO`,LN=`${IT}_ARC_START_ANGLE`,DN=`${IT}_ARC_END_ANGLE`,FN=`${IT}_ARC_K`,zN=`${IT}_ARC_MIDDLE_ANGLE`,HN=`${IT}_ARC_QUADRANT`,jN=`${IT}_ARC_RADIAN`,NN=-Math.PI/2,UN=3*Math.PI/2,VN=.6,WN=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},GN=(t,e,i)=>{var s;const n=null!==(s="band"===e?sH("axisBand",i):"linear"===e?sH("axisLinear",i):{})&&void 0!==s?s:{},r=sH("angle"===t?"axisAngle":"axisRadius",i);return hT({},sH("axis",i),n,r)};function YN(t,e,i,s){switch(t){case r.cartesianBandAxis:return rj(ij(i,["z"]),"band",e);case r.cartesianLinearAxis:return rj(ij(i,["z"]),"linear",e);case r.cartesianLogAxis:return rj(ij(i,["z"]),"log",e);case r.cartesianSymlogAxis:return rj(ij(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return rj(ij(i),void 0,e);case r.polarBandAxis:return GN(i.orient,"band",e);case r.polarLinearAxis:return GN(i.orient,"linear",e);case r.polarAxis:return GN(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=sH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>QH(t.orient)));let g;g=p(u)?hT({},EN(u.type)?a:o,l):l;const f=n.find((t=>tj(t.orient)));let m;return m=p(f)?hT({},Ek(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=sH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?hT({},EN(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?hT({},Ek(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return XN(i,sH(t,e));default:return sH(t,e)}}const XN=(t,e)=>{var i;const s=hT({},e,e[sj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class KN extends CF{getTheme(t,e){return YN(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},qC(e)),{[s]:0}))}}class $N extends wF{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=KN,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof to||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:OM.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new RN(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;$z(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=qz(t),s=Zz(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}$z(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var qN,ZN;$N.transformerConstructor=KN,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(qN||(qN={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(ZN||(ZN={}));class JN extends mz{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=Zz(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?$z(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&($z(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=cT.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(BM.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}JN.type="component";const QN=()=>{cT.registerMark(JN.type,JN)};var tU,eU;!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.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(tU||(tU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(eU||(eU={}));const iU={[eU.selectedReverse]:{},[eU.selected]:{},[eU.hover]:{},[eU.hoverReverse]:{}},sU=t=>t,nU={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class rU extends $N{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?qN.circleAxis:qN.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?ZN.circleAxisGrid:ZN.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=IH(null===(h=cT.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new YF(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&bk(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?Mk(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!Mk(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return bk(this._regions,(e=>{var i;_(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=xk(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),bk(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):bk(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(bk(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=K(t.map((t=>t.fields.length)));for(let t=1;tV(null==e?void 0:e[i],null==t?void 0:t[i])||nU[i]))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=xM(s=t.domainLine)).startSymbol=xM(s.startSymbol),s.endSymbol=xM(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=j(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return kM(hT({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:kM(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>kM(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=kM(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return kM(hT({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:kM(t.tick.style)),t.tick.state&&(i.tick.state=SM(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return kM(hT({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:kM(t.subTick.style)),t.subTick.state&&(i.subTick.state=SM(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=CN[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:hT({},d,kM(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:kM(h.style)}),h.state&&(i.title.state.shape=SM(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:kM(o.style)}),o.state&&(i.title.state.background=SM(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=SM(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=kM(t.background.style)),t.background.state&&(i.panel.state=SM(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:RT(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return kM(hT({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:kM(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:RT(t.subGrid.alternateColor),style:kM(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=nH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){jM(this._option.dataSet,"scale",sU);const i=this.registerTicksTransform();return new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===tU.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}rU.specKey="axes";const aU=()=>{QN(),cT.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},oU=[kN];class lU extends rU{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),bk(this._regions,(t=>{const e=this.getOrient();QH(e)?PN(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):tj(e)?PN(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):ej(e)&&PN(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=hT({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(hT({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=QH(this.getOrient()),n=t=>{var e;return(s?!QH(t.getOrient()):QH(t.getOrient()))&&Mk(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=ij(i,["z"]),ej(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!wN(e))return null;const{axisType:t,componentName:s}=nj(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>tj(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!wN(t))return;const{axisType:s,componentName:n}=nj(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=cT.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return QH(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):ej(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(oU.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){QH(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!QH(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!ej(this.getOrient())&&this._spec.innerOffset){const t=this._spec;tj(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=XC(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=XC(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=QH(this.getOrient())?t.fieldX:ej(this.getOrient())?t.fieldZ:t.fieldY,Mk(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:Mk(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(BM.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(QH(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=QH(this._orient)?{x:K(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return bk(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:QH(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:ej(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();bk(this._regions,(e=>{QH(t)?PN(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):tj(t)?PN(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):ej(t)&&PN(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=QH(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&_(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=QH(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=hT(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ue).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=QH(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?yt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):yt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return BN(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:Mk(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}lU.type=r.cartesianAxis,lU.specKey="axes";class hU{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new YF(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=BN(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>BN(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const cU=(t,e,i,s)=>{const n=xN(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},dU=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,uU=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?yN([s[s.length-1]]):yN([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(g),a=K(g);if(s.length<=f/n){const i=cU(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=gU(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=cU(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!dU(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?uU(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function mU(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=lk(t,!!n),o=lk(r,!!n);const h=ae.distancePP(s,l),c=ae.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=fU(e,t,!1,!!n),o=fU(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=lk(t,!!n),o=lk(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class vU extends Wj{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&nk(this._innerView),this.removeAllChild(!0),this._innerView=DA.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return rk(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=H({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${tU.grid}-sub`:`${tU.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=lk(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=fU(t,o,!1,!!a)}const u=DA.path(Object.assign({path:c,z:l},d(r)?H({},this.skipDefault?null:vU.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=lk(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=DA.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ht/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?H({},this.skipDefault?null:vU.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}vU.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class yU{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=OA(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return RA([n[1],-1*n[0]],t*(e?1:-1)*s)}}class _U extends TI{onBind(){var t;const e=SL(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;Yj(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class bU extends TI{onBind(){const t=SL(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;Yj(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function xU(){RO(),DO(),KO(),iI(),aI.registerBuiltInAnimate("axisEnter",_U),aI.registerBuiltInAnimate("axisUpdate",bU)}RO(),zO();class SU extends vU{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},vU.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=FA,endAngle:r=zA}=this.attribute;i=ok(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=H({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function AU(){RO(),DO(),jO(),tI()}function kU(){RO(),DO(),SO(),tI()}G(SU,yU),AU();class CU extends Wj{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},CU.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=DA.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=DA.line;Y(i)[0].cornerRadius&&(t=DA.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=DA.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}CU.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}}},kU();class TU extends CU{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},CU.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=DA.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function MU(){RO(),WO(),tI(),KO(),iI()}var wU=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-E)):j>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-E/2));const N="right"===_||"end"===_,U="left"===_||"start"===_,V=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:Y(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=T-b[1]-b[3],e=I+E,i=1===j?(t-e)/2+E+I/2:b[0]+E-(T/2+e/2-E)+I/2;if(V(i,"center"),A){const t=i-I/2-E+F/2;A.setAttributes({x:t})}}if(U&&1!==j){const t=T-b[1]-b[3],e=0===j?-t/2+E/2:-T+b[3]+b[1]+E;if(V(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=T-b[1]-b[3],e=0===j?t/2+E/2:t;if(V(e,"right"),A){const t=e-I-E+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===H&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(O.states=m.text);const{visible:W}=a,G=wU(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:M,x:k,y:C}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Ml)}this._bgRect=t}this._textShape=O,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:H({},EU.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}EU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const BU=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(jA.hover,!0),xA(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(jA.hoverReverse,!0)})),s):i},PU=(t,e,i)=>i?(xA(e,(t=>{t.name&&!P(t.states)&&(t.removeState(jA.hoverReverse),t.removeState(jA.hover))})),null):i,RU=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(jA.selected)?(xA(e,(t=>{t.name&&!P(t.states)&&(t.removeState(jA.selectedReverse),t.removeState(jA.selected))})),null):s.name&&!P(s.states)?(s.addState(jA.selected,!0),xA(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(jA.selectedReverse,!0)})),s):i},OU={type:"default",duration:300,easing:"linear"};class IU extends Gj{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=BU(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=PU(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=RU(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=DA.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),$j(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Kj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(xA(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=Xj(this),{delay:a=0,duration:o=OU.duration,easing:l=OU.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};Yj(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=Xj(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},qj(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&nk(this._innerView),this.removeAllChild(!0),this._innerView=DA.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(OU)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=DA.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=tU.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=DA.group({x:0,y:0,pickable:!1});t.name=tU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=DA.group({x:0,y:0,pickable:!1});i.name=tU.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=DA.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=tU.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=NA;else{const t=this.data[s],e=H({},NA,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=DA.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=tU.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=NA;else{const i=H({},NA,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=DA.group({x:0,y:0,pickable:!1});return r.name=`${tU.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=KA(this._getLabelAttribute(t,e,n,i));if(a.name=tU.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=NA;else{const s=H({},NA,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new EU(Object.assign({},e));i.name=tU.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return rk(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=Ht/2*(l.x>e.x?1:-1):h=Ht/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=d(y)?H({},QA.label.style,y(t,e,i,s)):y;y=H(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return d(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},xA(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=L(r.attribute),a=L(e.attribute),o=Cb(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},Yj(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const LU={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&hk(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function DU(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function FU(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:LU[n]||LU.parity;if(s.length>=3&&ck(s,r)){do{s=a(s,r)}while(s.length>=3&&ck(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);hk(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),FU(l,s,n,(t=>hk(t,l,r))),FU(h,s,o,(t=>hk(t,h,r)||!(!n||t===l)&&hk(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function HU(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},UU(t,e.attribute.angle)),{angle:NU(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({},VU(t,e.attribute.angle)),{angle:NU(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function NU(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function UU(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=NU(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function VU(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=NU(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function WU(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=sk(h),m=ik(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function GU(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var YU=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=DA.group({zIndex:999});e.name=tU.axisBreak,e.id=this._getNodeId(`${tU.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=H({},tk,s),a=null!==(e=r.size)&&void 0!==e?e:tk.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=DA.symbol(Object.assign({x:s.x,y:s.y},o));l.name=tU.axisBreakSymbol;const h=DA.symbol(Object.assign({x:n.x,y:n.y},o));h.name=tU.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=DA.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=tU.background,n.id=this._getNodeId("background"),n.states=H({},iU,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new EU(Object.assign({},t));e.name=tU.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=YU(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:H({},iU,l),symbol:H({},iU,l)});const d=new CU(c);d.name=tU.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=YU(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let T,M,{angle:w}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=IA(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else T=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(w&&0!==w){const t=Math.abs(Math.sin(w));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:M},a),state:{text:H({},iU,c.text),shape:H({},iU,c.shape),panel:H({},iU,c.background)}});return B.angle=w,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=YU(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(u(b)&&a){b=IA(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return UU(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return VU(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),jU(i,t),!HU(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=sk(a),l=ik(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=GU(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Xt(c,i))}}else{if(l){const i=GU(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Xt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);WU(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&zU(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=DA.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=tU.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=GA(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=oi(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}XU.defaultAttributes=QA,G(XU,yU);const KU={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},$U={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},qU={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},ZU={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}};class JU extends lU{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new qk}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return HM(this._option.dataSet,t,pU),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Nk(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{cT.registerGraphicComponent(qN.lineAxis,((t,e)=>new XU(t,e))),cT.registerGraphicComponent(ZN.lineAxisGrid,((t,e)=>new SU(t,e))),aU(),cT.registerComponent(JU.type,JU,!1)},tV=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function eV(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,sV=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function nV(t,e,i="count"){const s=sV(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const rV=Math.sqrt(50),aV=Math.sqrt(10),oV=Math.sqrt(2);class lV{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=MN(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=QH(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!d(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(X(e)-e[0]);i<=1||k(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(iV),e.sort(iV),{domain:eV(t,e),scope:nV(t,e,i)}}(r,aA(t),this._spec.breaks[0].scopeType);e=aA(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=MN(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-K(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=rV?10:n>=aV?5:n>=oV?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function hV(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function cV(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!Mk(t.type))return yN(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return yN([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=hV(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=hV(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=hV(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=xN(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=xN(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?uV.greedy:uV.parity;for(;l.length>=3&&ck(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;hk(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),cV(t,l,a,(e=>hk(e,t,i))),cV(n,l,o,(e=>hk(e,n,i)||!(!a||e===t)&&hk(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return yN(m)},uV={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&hk(i,t,e)||(i=t,0))))}},pV={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class gV extends lU{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new vC}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!ej(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=QH(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=GC(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=aA(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return HM(this._option.dataSet,t,dV),t}}gV.type=r.cartesianLinearAxis,gV.specKey="axes",gV.builtInTheme={axis:$U,axisLinear:pV,axisX:qU,axisY:ZU},G(gV,lV);const fV=()=>{cT.registerGraphicComponent(qN.lineAxis,((t,e)=>new XU(t,e))),cT.registerGraphicComponent(ZN.lineAxisGrid,((t,e)=>new SU(t,e))),aU(),cT.registerComponent(gV.type,gV)},mV=`${IT}_hide_`;function vV(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const yV=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[mV]&&(vV(t,!0),t[mV]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[mV]=!0,vV(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},_V=()=>{cT.registerGrammarTransform("symbolOverlap",{transform:yV,runType:"afterEncode"})},bV={min:$,max:K,average:fk,sum:gk};function xV(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function SV(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function AV(t,e,i,s){return SV(t,e,i,"min",s)}function kV(t,e,i,s){return SV(t,e,i,"max",s)}function CV(t,e,i,s){return SV(t,e,i,"average",s)}function TV(t,e,i,s){return SV(t,e,i,"sum",s)}const MV=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=xV;if("min"===n?l=AV:"max"===n?l=kV:"average"===n?l=CV:"sum"===n&&(l=TV),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},wV=()=>{cT.registerGrammarTransform("dataSampling",{transform:MV})};class EV extends JH{constructor(){super(...arguments),this.type=CC.line,this.transformerConstructor=dN,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),mj)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(IH(null===(i=cT.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),LH("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=ZH(this);this._symbolMark.setAnimationConfig(IH(null===(s=cT.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),LH("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}EV.type=CC.line,EV.mark=yj,EV.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},EV.transformerConstructor=dN,G(EV,vj);class BV{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{qM(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Oa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];hA(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];hA(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class PV{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{bA(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{oM(e,[{key:t,operations:Mk(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&oM(e,[{key:i.field,operations:Mk(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?jC("colorOrdinal"):jC(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(bA(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),bA(s.domain)?e.reRender=!0:V(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!bA(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Mk(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Mk(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;Mk(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(Mk(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Mk(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Mk(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class RV{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");pz(t,s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");gz(t,s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");gz(t,s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");pz(t,s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&pz(t,i,!0,l):a&&pz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&pz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{gz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&gz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const OV={[r.markPoint]:!0,[r.markLine]:!0,[r.markArea]:!0},IV={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class LV extends kF{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=yA(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:LT,height:DT},this._viewRect={width:LT,height:DT},this._viewBox={x1:0,y1:0,x2:LT,y2:DT},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(IV).some((t=>!u(e[t])))},this._paddingSpec=qC(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new EM(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new BV(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new RV;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=cT.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(IH({},LH("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=j(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=cT.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=cT.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof TF)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof mz))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof mz)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&qM(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=dF(this._spec,this._option,{width:LT,height:DT})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=BC(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new PV(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){fF(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=BC(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=qC(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{fF(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},n={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===r.label||l.type===r.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));n[l.type]&&(n[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(_(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);gF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),fF(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);gF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),fF(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(n).forEach((e=>{if(n[e]){const i=this._spec[e];(_(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(OV[t]&&_(e)&&_(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return OV[t]&&_(e)&&e.length>0&&_(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!OV[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;OV[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];fF(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=KC(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(BM.AFTER_MARK_RENDER_END,e)};this._event.on(BM.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:MM;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(TM(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===gj.dimensionHover||s===gj.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>Ek(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>Ek(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const DV=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)},FV={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class zV{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},FV),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):aT(t,a,c.spec),aT(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=DV(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=DV(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(cT.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(cT.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=cT.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=cT.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=cT.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):rH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=rH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class HV extends zV{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&hT(i,mF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class jV extends HV{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),cF(t)}}const NV=(t,e)=>{const i={nodes:{}},{fields:s}=d(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=cM(t,!0);for(const e in o)for(const i in o[e].nodes)gM(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)pM(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&uM(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class VV{_beforeInit(){this._dataSet&&HM(this._dataSet,"stackSplit",NV)}_initStack(){this._stack=new UV(this),this._stack.init()}}const WV={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:gj.dimensionHover};class GV extends Nz{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},WV,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=MM(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}GV.type="dimension-hover",GV.defaultOptions=WV;const YV=()=>{cT.registerInteractionTrigger(GV.type,GV)},XV=()=>{cT.registerComposedEvent(gj.dimensionHover,pj),cT.registerComposedEvent(gj.dimensionClick,oj)},KV=t=>t.fieldX[0],$V=t=>t.fieldY[0],qV=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},ZV=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},JV=(t,e)=>t?e?KV:qV:e?$V:ZV,QV=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=uj(t,(t=>QH(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=uj(t,(t=>tj(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Ek(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=tW(t,i,JV(e,Ek(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=tW(t,i,JV(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},tW=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:eW(t,s,i)},eW=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=cj(e,t,"cartesian",null!=i?i:QH(t.getOrient())?KV:$V);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},iW=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(Ek(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(Mk(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=TN(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};nW(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&sW(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),sW=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=nH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},nW=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},rW=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=aW(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},aW=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},oW=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return iW(c,r,e),c.xField.cacheInfo?rW(c.xField):c.yField.cacheInfo?rW(c.yField):void 0},lW=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],hW=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&lW.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(cW(s).every((t=>{var e;return!cH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},cW=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},dW={dom:`${IT}_TOOLTIP_HANDLER_DOM`,canvas:`${IT}_TOOLTIP_HANDLER_CANVAS`},uW={key:"其他",value:"..."};var pW;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(pW||(pW={}));class gW{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=hW(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},uW),t):uW;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&cH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class fW extends gW{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Ek(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const mW=()=>{cT.registerTooltipProcessor("dimension",fW)};class vW extends gW{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,So.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(MM(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const yW=()=>{cT.registerTooltipProcessor("mark",vW)};class _W extends gW{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const bW=()=>{cT.registerTooltipProcessor("group",_W)};class xW extends LV{constructor(){super(...arguments),this.transformerConstructor=jV,this.type="line",this.seriesType=CC.line}_setModelOption(){this._modelOption.getDimensionInfo=QV,this._modelOption.getDimensionInfoByValue=eW,this._modelOption.getRectByDimensionData=oW}}xW.type="line",xW.seriesType=CC.line,xW.transformerConstructor=jV,G(xW,VV);const SW=[...bj,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class AW extends xj{constructor(){super(...arguments),this.type=AW.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return SW}_getIgnoreAttributes(){return[]}}AW.type="area";const kW=()=>{cT.registerMark(AW.type,AW),qO(),TO(),sN(),aN(),Hz(),cT.registerGraphicComponent("area",Gg)};class CW extends gH{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const TW=Object.assign(Object.assign(Object.assign({},TH),fj),{area:{name:"area",type:"area"}}),MW=()=>{cT.registerAnimation("area",Fz),zz(),Lz()};class wW extends dN{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=hT({},f.style,g.style),l.state=hT({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function EW(){RO(),WO()}function BW(){return"browser"===e_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const PW={debounce:St,throttle:At};EW();let RW=class t extends Wj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=yt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=yt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=BW(),a="browser"===e_.env?e_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=yt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:PW[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(VA,{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",PW[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===e_.env?e_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:oi(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=oi(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=yt(t[0],0,1),c=yt(t[1],0,1),d=yt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=BW(),e="browser"===e_.env?e_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===e_.env?e_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};RW.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class OW{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ue).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=OW.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(VA,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new RW(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Xt(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Xt(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ht/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ht/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ht,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}UW.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class VW{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};H(s,UW.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new UW(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,H(e,hF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class WW{constructor(){this.activeEvent="onRegister",this._uid=ja.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class GW extends WW{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class YW extends WW{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function XW(t){t.isBound(VW)||(t.bind(VW).toSelf().inSingletonScope(),t.bind(Wy).toService(VW)),t.isBound(GW)||(t.bind(GW).toSelf(),t.bind(Pf).toService(GW)),t.isBound(YW)||(t.bind(YW).toSelf(),t.bind(Pf).toService(YW))}class KW extends Wj{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}RO(),DO();class $W extends KW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},$W.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}$W.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},RO(),WO();class qW extends KW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},qW.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}qW.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},RO(),SO();class ZW extends KW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},ZW.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}ZW.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},RO(),SO();class JW extends KW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},JW.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=FA,endAngle:s=zA}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}JW.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},RO(),zO();class QW extends KW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},QW.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ce(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}QW.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class tG{isInValidValue(t){const{startAngle:e=FA,endAngle:i=zA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=FA,endAngle:i=zA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return ak(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function eG(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=eG(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var nG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=ok(n,l,c,e,i);h=DA.path(Object.assign(Object.assign({},a.style),{path:lk(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=DA.circle(t)}h.name=tU.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=H({},iU,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=nG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;u(_)&&(_=0===r?"end":"middle"),"start"===_?(y="bottom",g={x:s.x,y:s.y-v}):"end"===_&&(y="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:y,textAlign:"center"},l),state:{text:H({},iU,d.text),shape:H({},iU,d.shape),panel:H({},iU,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=eG(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&iG(e,c,i)}else e.AABBBounds.width()>r&&iG(e,r,i)}else o>a.x&&h.x2>n.x2?(iG(e,n.x2-o,i),r&&sG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}rG.defaultAttributes=QA,G(rG,tG);const aG=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=WA(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=rk(r,ak(s,r,e,n));return o=a,l=ak(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(gt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return yN(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=aG(t,i,e),r=$(s),l=K(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=lG(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return yN(c)},lG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&_N(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var hG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new uG(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):Ij(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=Ij(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=Ij(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=Ij(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?Ij(t.quadrant)?"left":"right":Ij(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(Ij(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),$j(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Kj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}fG.defaultAttributes={pickable:!1};var mG,vG,yG,_G=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(bG,tG),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(mG||(mG={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(vG||(vG={})),function(t){t.dataZoomChange="dataZoomChange"}(yG||(yG={}));const xG="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",SG={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:xG,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:xG,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},AG={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}},kG=0,CG=1,TG=2,MG=3,wG=4,EG=5,BG=5,PG=999,RG=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var OG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:TG},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:TG},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:kG},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,T;const{orient:M,middleHandlerStyle:w={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(w.visible){const t=(null===(i=w.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t,zIndex:EG},null===(s=w.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=w.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=w.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:EG},w.icon),{pickable:!P&&(null===(h=w.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},AG.horizontal),{zIndex:EG}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},AG.horizontal),{zIndex:EG}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:PG},AG.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:PG},AG.horizontal),{pickable:!P}),"rect")}else{if(w.visible){const t=(null===(g=w.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D,zIndex:EG},null===(f=w.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=w.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=w.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:EG},w.icon),{pickable:!P&&(null===(S=null===(x=w.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},AG.vertical),{zIndex:EG}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(C=B.symbolType)&&void 0!==C?C:"square",zIndex:EG},AG.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:PG},AG.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:PG},AG.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:MG},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:MG},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:CG},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:wG},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return kb(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ue).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=OG(c,["formatMethod"]),{formatMethod:g}=d,f=OG(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,T,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},T={textAlign:RG(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:RG(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:RG(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:RG(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),H({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:BG}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),H({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:BG}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new EU(e),s.name=i,t.add(s)),s}}const LG={debounce:St,throttle:At};class DG extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=mG.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=mG.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=mG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=mG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=mG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===e_.env?e_:this.stage,s=BW();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===mG.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===mG.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===mG.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===mG.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(vG.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(vG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(vG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===mG.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(vG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(vG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:LG[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===e_.env?e_:this.stage,e=BW();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===e_.env?e_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===e_.env?e_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:yt(e+t,0,1),end:yt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=mG.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}MU(),WO(),tI(),TO(),DO();let FG=class t extends Wj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,y;h.visible?this._isHorizontal?(m=p,v=g-f,y={x:a.x,y:a.y+f}):(m=p-f,v=g,y={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,y=a);const _=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(_+b)/2,y={x:y.x+_/2,y:y.y}):(v-=(_+b)/2,y={x:y.x,y:y.y+_/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new IG(this._getRendererAttrs()),this._interaction=new DG(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(vG.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(vG.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(yG.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(vG.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(yG.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var zG,HG,jG,NG;function UG(){RO(),MU(),CD()}FG.defaultAttributes=SG,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(zG||(zG={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(HG||(HG={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(jG||(jG={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(NG||(NG={}));class VG extends Wj{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=BU(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=PU(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=RU(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:H({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:H({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:H({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=DA.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=DA.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=DA.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),$j(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,Kj(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=Xj(this);this.markerAnimate("exit");const n=Xj(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},qj(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function WG(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function GG(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;Yj(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function YG(t,e,i,s){t&&(GG(t.startSymbol,e,i,s),WG(t).forEach((t=>GG(t,e,i,s))),GG(t.endSymbol,e,i,s))}function XG(t,e,i,s){t&&(GG(t.getTextShape(),e,i,s),GG(t.getBgRect(),e,i,s))}function KG(t,e,i,s){var n,r,a,o;t&&(Yj(t,{fillOpacity:0,strokeOpacity:0},{fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function $G(t,e,i,s){t&&(KG(t.startSymbol,e,i,s),WG(t).forEach((t=>KG(t,e,i,s))),KG(t.endSymbol,e,i,s))}function qG(t,e,i,s){t&&(KG(t.getTextShape(),e,i,s),KG(t.getBgRect(),e,i,s))}function ZG(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;GG(t.startSymbol,s,r,n);const h=WG(t);h.forEach((t=>Yj(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),GG(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;GG(t.getTextShape(),e,l,n),GG(t.getBgRect(),e,l,n)}))}function JG(t,e,i,s,n){YG(t,s,i,n),Y(e).forEach((t=>{XG(t,s,i,n)}))}function QG(t,e,i,s,n){GG(t,s,i,n),Y(e).forEach((t=>{XG(t,s,i,n)}))}function tY(t,e,i,s,n){GG(t,s,i,n),Y(e).forEach((t=>{XG(t,s,i,n)}))}function eY(t,e,i,s,n,r){var a;YG(t,n,s,r),GG(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?XG(i,n,s,r):GG(i,n,s,r)}function iY(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;GG(t.startSymbol,n,o,r);const u=WG(t);u.forEach((t=>Yj(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),GG(e,n+o+l,h,r),GG(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(GG(i.getTextShape(),n+o+l+h+c,d,r),GG(i.getBgRect(),n+o+l+c,d,r)):GG(i,n+o+l+c,d,r)}function sY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?ZG(t,e,s,r,a):"fadeIn"===i&&JG(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?ZG(t,e,s,n,a):"fadeIn"===i&&JG(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){$G(t,s,i,n),Y(e).forEach((t=>{qG(t,s,i,n)}))}(t,e,i,s,n)}}function nY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&QG(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&QG(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){KG(t,s,i,n),Y(e).forEach((t=>{qG(t,s,i,n)}))}(t,e,i,s,n)}}function rY(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&tY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&tY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){KG(t,s,i,n),Y(e).forEach((t=>{qG(t,s,i,n)}))}(t,e,i,s,n)}}function aY(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?eY(n,r,e,i,s,o):"callIn"===t&&iY(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?eY(n,r,e,i,s,a):"callIn"===t&&iY(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;$G(t,n,s,r),KG(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?qG(i,n,s,r):KG(i,n,s,r)}(n,r,e,t,i,s)}}const oY={type:"clipIn",duration:500,easing:"linear",delay:0},lY={type:"fadeIn",duration:500,easing:"linear",delay:0},hY={type:"callIn",duration:500,easing:"linear",delay:0},cY={type:"fadeOut",duration:500,easing:"linear",delay:0};class dY{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=H({},i,s),c=new EU(Object.assign(Object.assign({},h),{state:{panel:H({},NA,null!==(o=a[n])&&void 0!==o?o:X(a)),text:H({},NA,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=H({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:H({},NA,null!==(a=r[s])&&void 0!==a?a:X(r)),text:H({},NA,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class uY extends VG{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=oY,this.defaultExitAnimation=cY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;JA(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(uY,dY);const pY=.001,gY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:zG.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]}},fY={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},mY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:jG.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},vY={interactive:!0,label:{position:HG.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}},yY={interactive:!0,label:{autoRotate:!0,position:jG.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},_Y={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},bY={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},xY={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function SY(){AY._animate=sY}UG(),AU(),CD();class AY extends uY{markerAnimate(t){AY._animate&&this._animationConfig&&AY._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},AY.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(AA(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return kA(Math.abs(e),Math.PI/2,pY)||kA(Math.abs(e),3*Math.PI/2,pY)?CA(i,e,t):AA(e)?fY.postiveXAxis[t]:fY.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new CU({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:H({},NA,null==a?void 0:a.line),startSymbol:H({},NA,null==a?void 0:a.lineStartSymbol),endSymbol:H({},NA,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:H({},NA,null==a?void 0:a.line),startSymbol:H({},NA,null==a?void 0:a.lineStartSymbol),endSymbol:H({},NA,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",AY.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(AY.defaultAttributes.label)}}function kY(){CY._animate=nY}AY.defaultAttributes=gY,UG(),jO(),CD();class CY extends VG{markerAnimate(t){CY._animate&&this._animationConfig&&CY._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},CY.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=lY,this.defaultExitAnimation=cY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},bY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;JA(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=DA.polygon(Object.assign({points:e},i));n.states=H({},NA,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",CY.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=H({},NA,null==i?void 0:i.area)),this._updateMarkLabels(CY.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}CY.defaultAttributes=vY,G(CY,dY),UG(),kU(),CD();class TY extends uY{markerAnimate(t){TY._animate&&this._animationConfig&&TY._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},TY.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case jG.arcInnerStart:l=n;case jG.arcOuterStart:l=n;break;case jG.arcInnerEnd:l=r;case jG.arcOuterEnd:l=r;break;case jG.center:case jG.arcInnerMiddle:case jG.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return _Y[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new TU({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},NA,null==o?void 0:o.line),startSymbol:H({},NA,null==o?void 0:o.lineStartSymbol),endSymbol:H({},NA,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},NA,null==o?void 0:o.line),startSymbol:H({},NA,null==o?void 0:o.lineStartSymbol),endSymbol:H({},NA,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",TY.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(TY.defaultAttributes.label)}}TY.defaultAttributes=mY,UG(),SO(),CD();class MY extends VG{markerAnimate(t){MY._animate&&this._animationConfig&&MY._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},MY.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=lY,this.defaultExitAnimation=cY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case jG.center:h=(s+n)/2,c=(r+a)/2;break;case jG.arcInnerStart:h=s,c=r;break;case jG.arcOuterStart:h=n,c=r;break;case jG.arcInnerEnd:h=s,c=a;break;case jG.arcOuterEnd:h=n,c=a;break;case jG.arcInnerMiddle:h=s,c=(r+a)/2;break;case jG.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},_Y[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;JA(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=DA.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=H({},NA,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",MY.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=H({},NA,null==o?void 0:o.area)),this._updateMarkLabels(MY.defaultAttributes.label)}isValidPoints(){return!0}}function wY(){EY._animate=aY}MY.defaultAttributes=yY,G(MY,dY),UG(),AU(),kU(),tI(),IO(),DO(),CD();class EY extends VG{markerAnimate(t){EY._animate&&this._animationConfig&&EY._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},EY.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=hY,this.defaultExitAnimation=cY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return kA(Math.abs(s),Math.PI/2,pY)||kA(Math.abs(s),3*Math.PI/2,pY)?CA(t,s,n):AA(s)?xY.postiveXAxis[n]:xY.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=NG.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:H({},NA,null==p?void 0:p.textBackground),text:H({},NA,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=H({},NA,null==p?void 0:p.itemContent));const v=AA(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=DA.symbol(Object.assign(Object.assign({},i),r)),o.states=H({},NA,null==s?void 0:s.itemContent)):"text"===n?o=new EU(Object.assign(Object.assign({},i),{state:{panel:H({},NA,null==s?void 0:s.textBackground),text:H({},NA,null==s?void 0:s.itemContent)}})):"richText"===n?(o=DA.richtext(Object.assign(Object.assign({},i),r)),o.states=H({},NA,null==s?void 0:s.itemContent)):"image"===n?(o=DA.image(Object.assign(Object.assign({},i),r)),o.states=H({},NA,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=H({},NA,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=kA(c,0,pY)||kA(d,0,pY),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=qA(e-u,t-d),o=qA(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(zY.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(zY.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===zY.focus||"focus"===o){const s=a.hasState(DY.focus);a.toggleState(DY.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[DY.unSelected,DY.unSelectedHover,DY.focus],t),this._setLegendItemState(e,DY.selected,t)})):(this._setLegendItemState(a,DY.selected,t),this._removeLegendItemState(a,[DY.unSelected,DY.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[DY.selected,DY.selectedHover,DY.focus],t),this._setLegendItemState(e,DY.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(DY.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(DY.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(FY.legendItemClick,a,t);i?(this._removeLegendItemState(a,[DY.selected,DY.selectedHover],t),this._setLegendItemState(a,DY.unSelected,t)):(this._setLegendItemState(a,DY.selected,t),this._removeLegendItemState(a,[DY.unSelected,DY.unSelectedHover],t))}else this._setLegendItemState(a,DY.selected,t),this._removeLegendItemState(a,[DY.unSelected,DY.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[DY.selected,DY.selectedHover],t),this._setLegendItemState(e,DY.unSelected,t))}))}this._dispatchLegendEvent(FY.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,DY.selected),this._removeLegendItemState(e,[DY.unSelected,DY.unSelectedHover])):(this._removeLegendItemState(e,[DY.selected,DY.selectedHover]),this._setLegendItemState(e,DY.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=OY,spaceRow:l=IY,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,T=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),M.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=DA.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(y,t,e,i,s),k=this._handleStyle(b,t,e,i,s),C=this._handleStyle(x,t,e,i,s),T=oi(c);let M;!1===x.visible?(M=DA.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,zY.item,t,M)):(M=DA.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,zY.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?DY.selected:DY.unSelected);const w=DA.group({x:0,y:0,pickable:!1});M.add(w);let E,B=0,P=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);P=_(i)?i[0]||0:i,O=R(v,"space",8);const s=DA.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,zY.itemShape,t,M,S.state),s.addState(e?DY.selected:DY.unSelected),w.add(s)}let I=0;if(d){const e=R(g,"size",10);E=DA.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,zY.focus,t,M),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=KA(Object.assign(Object.assign({x:P/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,zY.itemLabel,t,M,A.state),D.addState(e?DY.selected:DY.unSelected),w.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=KA(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,zY.itemValue,t,M,k.state),r.addState(e?DY.selected:DY.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),w.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-O-I),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),w.add(E));const z=w.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;w.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const j=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:H+T[1]+T[3],U=this._itemHeightByUser||j+T[0]+T[2];return M.setAttributes({width:N,height:U}),E&&E.setAttribute("visible",!1),w.translateTo(-z.x1+T[3],-z.y1+T[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new RY(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},H({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new RY(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new RW(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new RW(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=OY,spaceRow:o=IY}=n,l=this._itemsContainer,{space:h=LY,defaultCurrent:c=1}=r,d=UY(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=DA.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=OY,spaceRow:a=IY}=s,o=this._itemsContainer,{space:l=LY,defaultCurrent:h=1}=n,c=UY(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=DA.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=DA.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(yt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(yt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(DY.selected)?this._setLegendItemState(t,DY.selectedHover,e):this._setLegendItemState(t,DY.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===zY.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(FY.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(DY.unSelectedHover)||t.hasState(DY.selectedHover))&&(i=!0),t.removeState(DY.unSelectedHover),t.removeState(DY.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(DY.unSelectedHover)&&!t.hasState(DY.selectedHover)||(i=!0),t.removeState(DY.unSelectedHover),t.removeState(DY.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===zY.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(FY.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(FY.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==zY.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(FY.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==zY.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(FY.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(DY.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=H({},VY,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(DY.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var GY;function YY(t){return _(t)?t:[t,t]}function XY(t){return t?"ew-resize":"ns-resize"}WY.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:OY,spaceRow:IY,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:LY,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"}(GY||(GY={})),jY();class KY extends Wj{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},KY.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=yt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=BW(),n="browser"===e_.env?e_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=yt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=BW(),n="browser"===e_.env?e_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?yt(t+p,h,c):yt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?yt(t+p,0,c-h):yt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:YY(d)[0],endValue:YY(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=DA.group({x:0,y:0});f.name=GY.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=DA.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=GY.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=DA.group({x:g?v:0,y:g?0:v});f.add(y);const _=DA.group({x:0,y:0});let b;if(_.name=GY.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=DA.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=GY.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=DA.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=GY.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=YY(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":XY(p)},r));if(v.name=GY.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=GY.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":XY(p)},r));if(i.name=GY.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=GY.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=yt(h,i,s);const p=this._isHorizontal;e||(c=i);const f=DA.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=GY.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":XY(p);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(d,e?"end":"start"),b=DA.rect(Object.assign({x:p?Math.min(y,_):0,y:p?0:Math.min(y,_),width:p?Math.abs(_-y):r,height:p?n:Math.abs(_-y),cursor:v},a));b.name=GY.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return DA.symbol(t)}_renderHandlerText(t,e){return DA.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":XY(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=DA.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=DA.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===e_.env?e_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=BW(),e="browser"===e_.env?e_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===GY.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===GY.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===GY.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===GY.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===e_.env?e_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}KY.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},NY(),jY();class $Y extends HY{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},$Y.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip:y,inverse:_,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function qY(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}$Y.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},NY(),jY(),zO();class ZY extends HY{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},ZY.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,sizeBackground:y,disableTriggerEvent:_,inverse:b}=this.attribute,x=DA.group({x:0,y:0});this._innerView.add(x);const S=new KY({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:qY(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:_,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const C=DA.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);const T=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}ZY.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)"}},RO(),iI(),KO();let JY=class t extends Wj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:T,subtextStyle:M={},width:w,height:E,minWidth:B,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=oi(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||p(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:w)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},UA),C),x:h,y:c,width:null!==(s=null!=t?t:w)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:w,heightLimit:null!==(a=C.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,O-j);if("rich"===k||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:T},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},UA),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(T)?T:[T],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const U=this._subTitle?this._subTitle.AABBBounds.height():0,V=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,V),G=j+(null!==(f=M.height)&&void 0!==f?f:U);if(p(w)&&(W=w),p(E)&&(G=E),p(B)&&WP&&(W=P),p(R)&&GO&&(G=O),z.setAttributes({width:W,height:G,boundsPadding:F}),this._mainTitle){if(p(I)||p(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:L,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(I)||p(M.align)){const t=M.align?M.align:I,e=null!==(y=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==y?y:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=this._mainTitle?p(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};JY.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 QY={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"}}};RO(),iI(),KO();let tX=class extends Wj{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=H({},R(QY,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=KA(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=GA(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;k(_)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class eX extends Qp{constructor(t){super(t)}}var iX,sX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(iX||(iX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(sX||(sX={}));class nX extends Wj{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},nX.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"},nX.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"},nX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},nX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},nX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new eX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new eX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new eX(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(iX.OnPlay)},this.pause=()=>{this._dispatchEvent(iX.OnPause)},this.forward=()=>{this._dispatchEvent(iX.OnForward)},this.backward=()=>{this._dispatchEvent(iX.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}nX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},nX.defaultAttributes={[sX.Start]:{},[sX.Pause]:{},[sX.Backward]:{},[sX.Forward]:{}};const rX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},aX=[200,10];var oX,lX;!function(t){t.Default="default",t.Reverse="reverse"}(oX||(oX={})),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"}(lX||(lX={}));const hX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===oX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===oX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),cX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===oX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===oX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),dX=t=>"top"===t||"bottom"===t;class uX extends Wj{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},uX.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Yt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(dX(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:aX[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:aX[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new KY(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=dX(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new nX(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=dX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:aX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(dX(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:dX(this._orient)?t+s:(this._size.width-r)/2,y:dX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:dX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:dX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:dX(this._orient)?t+s:(this._size.width-r)/2,y:dX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function pX(){jY(),RO(),tI()}uX.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({},rX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},rX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},rX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},rX),{key:"backward",position:"start"})}},pX();class gX extends uX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:oX.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(iX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(iX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(iX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(iX.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(lX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(hX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||cX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===oX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(lX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=e_.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(lX.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(lX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=e_.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(),e_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(lX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,e_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(lX.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(lX.change),this.dispatchCustomEvent(lX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var fX,mX=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};pX();class vX extends uX{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(iX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(iX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(iX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(iX.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(lX.change))},this.play=()=>mX(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(lX.play),this._rafId=e_.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=e_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,e_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(lX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,e_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(lX.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(lX.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(lX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}(fX||(fX={}));const yX={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},_X=5;const bX={debounce:St,throttle:At};RO(),jO();let xX=class t extends Wj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=yX.updateTrigger,endTrigger:i=yX.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(Y(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:bX[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(fX.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=yX.trigger,resetTrigger:i=yX.resetTrigger}=this.attribute;Y(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),Y(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(fX.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(fX.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=_X}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(fX.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(fX.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent(fX.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=_X}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(fX.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(fX.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),Y(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=yX.updateTrigger,endTrigger:s=yX.endTrigger}=this.attribute;Y(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),Y(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=DA.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Re(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};xX.defaultAttributes=yX;const SX=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return H(t,...e,{shape:i.every(u)?void 0:H({},...i),key:s.every(u)?void 0:H({},...s),value:n.every(u)?void 0:H({},...n)})},AX=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},kX={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:HA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:HA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:HA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},CX=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];RO(),WO(),tI(),iI(),KO();let TX=class t extends Wj{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=oi(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",H({symbolType:"circle"},u.shape,{visible:SA(u)&&SA(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:SA(u)&&SA(u.value)},AX(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:SA(u)&&SA(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:SA(u)&&SA(u.value)},AX(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},UA),u.value),visible:SA(u)&&SA(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=SA(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=SA(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!SA(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(SA(n.key)?r+n.key.spacing:0)+(SA(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&($A(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:SA(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),$A(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(SA(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Ch(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(SA(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},AX(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},AX(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},UA),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(SA(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},AX(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},AX(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>CX.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&SA(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=SA(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=WA(d),y=WA(u);let _=0;if(SA(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(SA(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return SX({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return SX({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};TX.defaultAttributes=kX;class MX extends gV{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),bk(this._regions,(t=>{QH(this.getOrient())?PN(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):PN(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=hT({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new YF(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=yi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>BN(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>BN(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return HM(this._option.dataSet,t,dV),t}transformScaleDomain(){}}MX.type=r.cartesianTimeAxis,MX.specKey="axes",MX.builtInTheme={axis:$U,axisX:qU,axisY:ZU};class wX extends gV{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new xC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return HM(this._option.dataSet,t,dV),t}transformScaleDomain(){}}wX.type=r.cartesianLogAxis,wX.specKey="axes",wX.builtInTheme={axis:$U,axisLinear:pV,axisX:qU,axisY:ZU},G(wX,lV);class EX extends gV{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new SC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return HM(this._option.dataSet,t,dV),t}transformScaleDomain(){}}EX.type=r.cartesianSymlogAxis,EX.specKey="axes",EX.builtInTheme={axis:$U,axisLinear:pV,axisX:qU,axisY:ZU},G(EX,lV);class BX extends JH{constructor(){super(...arguments),this.type=CC.area,this.transformerConstructor=wW,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),mj)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(BX.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===Qz?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return NC(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return NC(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[WT]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(IH(null===(e=cT.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),LH("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(IH(null===(i=cT.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),LH("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=ZH(this);this._symbolMark.setAnimationConfig(IH(null===(s=cT.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),LH("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new CW(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}BX.type=CC.area,BX.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},BX.mark=TW,BX.transformerConstructor=wW,G(BX,vj);class PX extends HV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),cF(t)}}class RX extends LV{constructor(){super(...arguments),this.transformerConstructor=PX,this.type="area",this.seriesType=CC.area}_setModelOption(){this._modelOption.getDimensionInfo=QV,this._modelOption.getDimensionInfoByValue=eW,this._modelOption.getRectByDimensionData=oW}}RX.type="area",RX.seriesType=CC.area,RX.transformerConstructor=PX,G(RX,VV);function OX(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const IX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:OX(t,e)}),LX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:OX(t,e)}),DX={type:"fadeIn"},FX={type:"growCenterIn"};function zX(t,e){if(!1===e)return{};switch(e){case"fadeIn":return DX;case"scaleIn":return FX;default:return IX(t)}}class HX extends mz{constructor(){super(...arguments),this.type=HX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}HX.type="rect";const jX=()=>{qO(),WO(),tN("rect",cG),cT.registerMark(HX.type,HX),aI.registerBuiltInAnimate("growHeightIn",UI),aI.registerBuiltInAnimate("growHeightOut",VI),aI.registerBuiltInAnimate("growWidthIn",rL),aI.registerBuiltInAnimate("growWidthOut",aL),aI.registerBuiltInAnimate("growCenterIn",HI),aI.registerBuiltInAnimate("growCenterOut",jI),cT.registerGraphicComponent("rect",og)},NX=Object.assign(Object.assign({},TH),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function UX(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=JC(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[MH]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):NC(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[wH]):NC(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=NC(this._dataToPosX(t),e,i),n=NC(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[EH]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):NC(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[BH]):NC(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=NC(this._dataToPosY(t),e,i),n=NC(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),GX)})}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},YX.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:zH(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(YX.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(HM(this._option.dataSet,"addVChartProperty",oH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};HM(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Oa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:SH.bind(this),call:AH}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new YF(this._option,n)}init(t){super.init(t),this.initRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=BH,s=EH,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=wH,s=MH,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=cM(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)UX(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=NC(this[r](t),l,i),u=NC(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!UC(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&u(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[VT],n=e[WT],r=e[GT],d=e[YT];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?EH:MH],i=e[a?BH:wH];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[VT]:s,[WT]:o}),c?{[GT]:u,[YT]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(og(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>NC(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>NC(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=K(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=ZH(this);this._barMark.setAnimationConfig(IH(null===(e=cT.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),LH(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=JC(this._spec.barWidth,a)),l&&(c=Math.max(c,JC(this._spec.barMinWidth,a))),h&&(c=Math.min(c,JC(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=JC(null!==(l=i[r-1])&&void 0!==l?l:X(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*y+(u-1)*p,n+=g*(y+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const _=Mk(g.type||"band");return d(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}YX.type=CC.bar,YX.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},YX.mark=NX,YX.transformerConstructor=WX;const XX=()=>{wV(),jX(),cT.registerAnimation("bar",((t,e)=>({appear:zX(t,e),enter:IX(t,!1),exit:LX(t,!1),disappear:{duration:Rz.disappear.duration}}))),QU(),fV(),cT.registerSeries(YX.type,YX)};class KX extends HV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),cF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class $X extends LV{constructor(){super(...arguments),this.transformerConstructor=KX,this.type="bar",this.seriesType=CC.bar}_setModelOption(){this._modelOption.getDimensionInfo=QV,this._modelOption.getDimensionInfoByValue=eW,this._modelOption.getRectByDimensionData=oW}}$X.type="bar",$X.seriesType=CC.bar,$X.transformerConstructor=KX,G($X,VV);const qX=[10,20],ZX=Ck.Linear,JX="circle",QX=Ck.Ordinal,tK=["circle","square","triangle","diamond","star"],eK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},iK=Object.assign(Object.assign({},TH),{point:{name:"point",type:"symbol"}});class sK extends UH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const nK={sizeField:!0};class rK extends JH{constructor(){super(...arguments),this.type=CC.scatter,this.transformerConstructor=sK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),nK)})}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(_(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${IT}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${IT}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:y(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:ZX,defaultRange:qX},"size")}getShapeAttribute(t,e){return u(e)?JX:y(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:QX,defaultRange:tK},"shape")}initMark(){this._symbolMark=this._createMark(rK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:zH(this._spec,rK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=ZH(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(IH(null===(i=cT.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),LH("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:y(this._shape)||d(this._shape)?this._shape:JX},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ge});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}rK.type=CC.scatter,rK.mark=iK,rK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},rK.transformerConstructor=sK;const aK=()=>{cN(),cT.registerAnimation("scatter",((t,e)=>Object.assign({appear:eK(0,e)},Oz))),QU(),fV(),cT.registerSeries(rK.type,rK)};class oK extends HV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class lK extends LV{constructor(){super(...arguments),this.transformerConstructor=oK,this.type="scatter",this.seriesType=CC.scatter}_setModelOption(){this._modelOption.getDimensionInfo=QV,this._modelOption.getDimensionInfoByValue=eW,this._modelOption.getRectByDimensionData=oW}}lK.type="scatter",lK.seriesType=CC.scatter,lK.transformerConstructor=oK,G(lK,VV);class hK extends $H{constructor(){super(...arguments),this.type=CC.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${IT}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const cK=(t,e)=>{const i=d(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[zT]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[aM]=a||r})),s};class dK extends gH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class uK extends mz{constructor(){super(...arguments),this.type=uK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}uK.type="path";const pK=()=>{cT.registerMark(uK.type,uK),qO(),zO(),cT.registerGraphicComponent("path",Ug)},gK=Object.assign(Object.assign({},TH),{area:{name:"area",type:"path"}});class fK{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Fa(i,e):La[i]?(Ia[i]||(Ia[i]=Fa(i,La[i])),Ia[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class mK{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class vK{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function yK(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:mK}:fA(e)||mA(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:vK}:null}const _K={debounce:St,throttle:At};class bK{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=fA(this._renderMode)||mA(this._renderMode),yK(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return yK(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:IM.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:IM.chart,consume:!1}];l.on(...c,_K[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,_K[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||yK(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||yK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:IM.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:IM.chart,consume:!1}];l.on(...c,_K[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,_K[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){yK(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||yK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:IM.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:IM.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||yK(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:IM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||yK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:IM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:IM.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:IM.chart,source:OM.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:IM.chart,source:OM.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=_K[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=_K[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:IM.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:IM.chart,source:OM.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:IM.chart,source:OM.chart},this._handleDragMouseUp)}))}}class xK extends $N{constructor(){var e,i;super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:(e=this.type,i=this.id,`${IT}_${i}_${e}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=hT(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new fK(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===CC.map||e.type===CC.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),bk(this._regions,(t=>{var e;if(t.type===CC.map||t.type===CC.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==CC.map&&e.type!==CC.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[aM],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}xK.type=r.geoCoordinate,G(xK,bK);const SK=()=>{cT.registerComponent(xK.type,xK)};class AK extends UH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class kK extends hK{constructor(){super(...arguments),this.type=CC.map,this.transformerConstructor=AK,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),NM.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),HM(this._dataSet,"copyDataView",XM),HM(this._dataSet,"map",cK),HM(this._dataSet,"lookup",aH);const s=NM.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Oa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:()=>({nameMap:this._nameMap,nameProperty:this._nameProperty})}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:aM,fields:()=>this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new YF(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(kK.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:zH(this._spec,kK.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:jT])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:jT]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(IH(null===(t=cT.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),LH("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new dK(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[zT]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[zT],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ge}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ge}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return zT}getActiveMarks(){return[this._pathMark]}}kK.type=CC.map,kK.mark=gK,kK.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},kK.transformerConstructor=AK;const CK=`${IT}_waterfall_default_seriesField`,TK=(t,e)=>{if(!t||0===t.length)return t;const i=d(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let c=Array.from(l[s]);"decrease"===a&&(c=c.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return c.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[ZT]=!0:delete t[ZT]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===c.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=MK([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const f=g[0];let{start:m,end:v}=wK(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=se(y,e)):(t[c]=+_,_=se(_,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,c,e,i,a),void o.push(s)}u=MK(r,t,s,o,u,c,e,i),o.push(s)})),o};function MK(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=wK(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===CK)&&(t[CK]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function wK(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?hA("total.collectCountField error"):n=e[a].start;o<0?hA("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=se(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const EK=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=d(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},BK={type:"fadeIn"},PK={type:"growCenterIn"};function RK(t,e){switch(e){case"fadeIn":return BK;case"scaleIn":return PK;default:return IX(t,!1)}}class OK extends mz{constructor(){super(...arguments),this.type=OK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return sg(t)}}OK.type="rule";const IK=()=>{cT.registerMark(OK.type,OK),qO(),DO(),cT.registerGraphicComponent("line",sg)},LK=Object.assign(Object.assign({},NX),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),DK=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:FK(t.map((t=>t.latestData)).flat(),e.fields,i)}};function FK(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>FK(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class zK{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new Oa(e instanceof Ra?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),HM(e,"dimensionTree",DK),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class HK extends WX{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const jK={rect:YK,symbol:WK,arc:KK,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=WK(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:$K,line:qK,area:qK,rect3d:YK,arc3d:KK,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function NK(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=jK[t])&&void 0!==i?i:jK.point;return e.series.type===CC.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=VK(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:ZK(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function UK(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==CC.sankey){const{formatFunc:t,args:n}=nH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function VK(t){return d(t)?e=>t(e.data):t}function WK(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=VK(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:GK(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function GK(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function YK(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=VK(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:XK(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function XK(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function KK(t){var e;const{labelSpec:i}=t,s=null!==(e=VK(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:y(s)&&s.includes("inside"),{position:n,smartInvert:r}}function $K(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=UK(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Kp(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function qK(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[jT]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function ZK(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const JK={calculationMode:!0};class QK extends YX{constructor(){super(...arguments),this.type=CC.waterfall,this.transformerConstructor=HK,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&uM(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),JK)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new zK(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=CK)}getSeriesKeys(){return this._seriesField===CK?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),HM(this._dataSet,"waterfallFillTotal",EK),HM(this._dataSet,"waterfall",TK),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=KM(this.getViewData(),this._dataSet,{name:`${IT}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new YF(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:VT,endAs:WT,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=ZH(this);this._barMark.setAnimationConfig(IH(null===(i=cT.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),LH("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(IH(null===(s=cT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),LH("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(QK.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return $K(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?NC(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):NC(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,y1:t=>this.totalPositionY(t,"index",this._getLeaderLineCategoryPos(!1,e))},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,x1:t=>this.totalPositionX(t,"index",this._getLeaderLineCategoryPos(!1,e)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&UC([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}QK.type=CC.waterfall,QK.mark=LK,QK.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},QK.transformerConstructor=HK;const t$=()=>{IK(),jX(),cT.registerAnimation("waterfall",((t,e)=>({appear:RK(t,e),enter:IX(t,!1),exit:LX(t,!1),disappear:{duration:Rz.disappear.duration}}))),Dz(),QU(),fV(),cT.registerSeries(QK.type,QK)},e$=`${IT}_BOX_PLOT_OUTLIER_VALUE`;var i$;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(i$||(i$={}));const s$=(t,e)=>{const i=[],s=d(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=_(e)?e:[e];i.push(...s.map((e=>{const i={[e$]:e};return r.forEach((e=>{i[e]=t[e]})),p(a)&&(i[a]=t[a]),i})))})),i};class n$ extends gH{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===i$.OUTLIER)return this.series.getOutliersField();if(t===i$.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case i$.MIN:return this.series.getMinField();case i$.MAX:return this.series.getMaxField();case i$.MEDIAN:return this.series.getMedianField();case i$.Q1:return this.series.getQ1Field();case i$.Q3:return this.series.getQ3Field();case i$.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===i$.OUTLIER)return e[e$];if(t===i$.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case i$.MIN:return e[this.series.getMinField()];case i$.MAX:return e[this.series.getMaxField()];case i$.MEDIAN:return e[this.series.getMedianField()];case i$.Q1:return e[this.series.getQ1Field()];case i$.Q3:return e[this.series.getQ3Field()];case i$.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[e$])}getDefaultContentList(t){return[{key:this.getContentKey(i$.OUTLIER),value:this.getContentValue(i$.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(i$.MAX),value:this.getContentValue(i$.MAX)},{key:this.getContentKey(i$.Q3),value:this.getContentValue(i$.Q3)},{key:this.getContentKey(i$.MEDIAN),value:this.getContentValue(i$.MEDIAN)},{key:this.getContentKey(i$.Q1),value:this.getContentValue(i$.Q1)},{key:this.getContentKey(i$.MIN),value:this.getContentValue(i$.MIN)},{key:this.getContentKey(i$.SERIES_FIELD),value:this.getContentValue(i$.SERIES_FIELD)}]}}const r$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class a$ extends mz{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.context.diffState!==bF.enter&&t.context.diffState!==bF.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{r$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?H(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?H(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=ug(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e),e.addEventListener("afterAttributeUpdate",(t=>{var i;2===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.type)&&this._syncInheritedStyleAttrs(e,e.attribute)}));const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=cT.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const o$=()=>{cT.registerGraphicComponent("glyph",ug),qO(),BO()},l$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],h$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class c$ extends a${constructor(){super(...arguments),this.type=c$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=l$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=h$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}c$.type="boxPlot";const d$=Object.assign(Object.assign({},TH),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),u$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},p$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},g$=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),f$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,C;if(i&&k(i.center))return i.center;let T,M,w,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=g$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=g$(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,w=null===(p=null===(u=null===(d=null===(c=g$(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=g$(t,"box").attribute.width,i=g$(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=g$(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=g$(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,w=null===(C=null===(A=null===(S=null===(x=g$(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===C?void 0:C.y;const e=g$(t,"box").attribute.height,i=g$(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(M)&&k(w)?(M+w)/2:k(w)?w:k(M)?M:NaN},m$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=g$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=g$(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=g$(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=g$(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=g$(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=g$(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=g$(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=g$(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=g$(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=g$(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(y)&&k(_)?(y+_)/2:k(_)?_:k(y)?y:NaN};class v$ extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return u$(f$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class y$ extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return p$(f$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class _$ extends v${computeAttribute(){return u$(m$)(this.target,this.params,this.params.options)}}class b$ extends y${computeAttribute(){return p$(m$)(this.target,this.params,this.params.options)}}class x$ extends UH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const S$={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class A$ extends JH{constructor(){super(...arguments),this.type=CC.boxPlot,this.transformerConstructor=x$,this._bandPosition=0}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}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),S$)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(A$.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(A$.mark.outlier,{key:zT,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return JC(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return JC(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.initBoxPlotMarkStyle()}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>NC(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>NC(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>NC(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>NC(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>NC(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>NC(e(this.getDatumPositionValues(t,e$),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>NC(e(this.getDatumPositionValues(t,e$),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;HM(this._dataSet,"foldOutlierData",s$),HM(this._dataSet,"addVChartProperty",oH);const t=new Oa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${IT}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:SH.bind(this),call:AH}},!1),this._outlierData=new YF(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=JC(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,JC(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,JC(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=JC(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=Mk(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=H({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=ZH(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=cT.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(LH("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(IH(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(IH(null===(a=cT.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new n$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}A$.type=CC.boxPlot,A$.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},A$.mark=d$,A$.transformerConstructor=x$;const k$=()=>{o$(),DO(),WO(),cT.registerGraphicComponent("line",(t=>sg(t))),cT.registerGraphicComponent("rect",(t=>og(t))),cT.registerMark(c$.type,c$),cN(),Lz(),QU(),fV(),aI.registerBuiltInAnimate("boxplotScaleIn",v$),aI.registerBuiltInAnimate("boxplotScaleOut",y$),aI.registerBuiltInAnimate("barBoxplotScaleIn",_$),aI.registerBuiltInAnimate("barBoxplotScaleOut",b$),cT.registerSeries(A$.type,A$)};class C$ extends mz{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=C$.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Hg(t):Kp(t)}}C$.type="text";const T$=()=>{cT.registerMark(C$.type,C$),qO(),iI(),KO(),cT.registerGraphicComponent("text",Kp),cT.registerGraphicComponent("richtext",Hg)};class M$ extends gH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const w$=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),E$={type:"fadeIn"},B$=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function P$(t,e){return"fadeIn"===e?E$:w$(t)}const R$=Object.assign(Object.assign({},NX),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class O$ extends WX{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class I$ extends YX{constructor(){super(...arguments),this.type=CC.rangeColumn,this._barMarkType="rect",this._barName=CC.bar,this.transformerConstructor=O$}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(I$.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:zH(this._spec,I$.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(I$.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(I$.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=ZH(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(IH(null===(i=cT.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),LH("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(IH(null===(s=cT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),LH("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(IH(null===(n=cT.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),LH("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new M$(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}I$.type=CC.rangeColumn,I$.mark=R$,I$.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},I$.transformerConstructor=O$;const L$=()=>{jX(),T$(),cT.registerAnimation("rangeColumn",((t,e)=>({appear:P$(t,e),enter:w$(t),exit:B$(t),disappear:{duration:Rz.disappear.duration}}))),Dz(),QU(),fV(),cT.registerSeries(I$.type,I$)};var D$,F$;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(D$||(D$={})),function(t){t.middle="middle",t.start="start",t.end="end"}(F$||(F$={}));class z$ extends gH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const H$=Object.assign({},TW);class j$ extends BX{constructor(){super(...arguments),this.type=CC.rangeArea}initMark(){this._areaMark=this._createMark(j$.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new z$(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}j$.type=CC.rangeArea,j$.mark=H$;class N$ extends $H{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=VN,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Mk(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:[]};Mk(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&qH(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function U$(t){return _A(t)?Number.parseFloat(t):0}const V$=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&W$(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[ON],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[ON]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},W$=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===U$(t[e])))||!i&&0===t.reduce(((t,i)=>t+U$(i[e])),0)));function G$(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const Y$=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:G$(t,!0,JM.appear)}),X$={type:"fadeIn"},K$=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:G$(t,!0,JM.enter)}),$$=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:G$(t,!0,JM.exit)});function q$(t,e){if(!1===e)return{};switch(e){case"fadeIn":return X$;case"growRadius":return Y$(Object.assign(Object.assign({},t),{growField:"radius"}));default:return Y$(Object.assign(Object.assign({},t),{growField:"angle"}))}}class Z$ extends mz{constructor(t,e){super(t,e),this.type=J$.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[zN])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class J$ extends Z${constructor(){super(...arguments),this.type=J$.type}}J$.type="arc";const Q$=()=>{qO(),SO(),tN("arc",pG),aI.registerBuiltInAnimate("growRadiusIn",iL),aI.registerBuiltInAnimate("growRadiusOut",sL),aI.registerBuiltInAnimate("growAngleIn",FI),aI.registerBuiltInAnimate("growAngleOut",zI),cT.registerGraphicComponent("arc",Kg),cT.registerMark(J$.type,J$)},tq=Object.assign(Object.assign({},TH),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class eq extends UH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=hT({},this._theme,i,t);const n=(t,e)=>hT({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const iq=`${IT}_LABEL_VISIBLE`,sq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},nq={outerRadius:!0};class rq extends N${constructor(){super(...arguments),this.transformerConstructor=eq,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:XC(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:XC(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=NN,this._endAngle=UN,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[zN];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;HM(this._dataSet,"pie",V$),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:LN,asEndAngle:DN,asRatio:IN,asMiddleAngle:zN,asRadian:jN,asQuadrant:HN,asK:FN,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Oa(this._dataSet,{name:`${IT}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new YF(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},rq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:HT,groupKey:this._seriesField,isSeriesMark:!0},{morph:zH(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Ak(LN)(t)}endAngleScale(t){return Ak(DN)(t)}_computeLayoutRadius(){return WN((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:VC(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:VC(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Ak(iq).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),nq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),sq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[zN];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===JM.appear)return this._startAngle;if(i===JM.disappear)return this._endAngle;const r=[JM.disappear,JM.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[zT];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[zT]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[zT])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[zT])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[zN]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[zN]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[zN]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[zN]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=IH(null===(i=cT.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}rq.transformerConstructor=eq,rq.mark=tq,rq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class aq extends rq{constructor(){super(...arguments),this.type=CC.pie}}aq.type=CC.pie;const oq=()=>{Q$(),cT.registerAnimation("pie",((t,e)=>({appear:q$(t,e),enter:K$(t),exit:$$(t),disappear:{duration:Rz.disappear.duration}}))),cT.registerAnimation("emptyCircle",((t,e)=>({appear:q$(t,e)}))),cT.registerSeries(aq.type,aq)};function lq(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const hq=t=>({type:lq(t.growField),options:{overall:!0}}),cq={type:"fadeIn"},dq=t=>({type:lq(t.growField)}),uq=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function pq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return cq;case"growAngle":return hq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return hq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const gq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class fq extends N${_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),gq)})}getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(WT),this.setInnerRadiusField(VT)}setValueFieldToPercent(){this.setRadiusField(YT),this.setInnerRadiusField(GT)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const mq=Object.assign(Object.assign({},TH),{rose:{name:"rose",type:"arc"}});class vq extends UH{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class yq extends rU{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=cT.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=NN,this._endAngle=UN,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),bk(this._regions,(t=>{"radius"===this.getOrient()?PN(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):PN(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:XC(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:XC(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:TN(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){bk(this._regions,(t=>{"radius"===this.getOrient()?PN(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):PN(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Mk(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Mk(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>BN(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ae.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return WN((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=VN,e=0;const i=this.getChart().getSpec();return bk(this.getRegions(),(s=>{const n=s;if(r=n.type,[CC.rose,CC.radar,CC.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(hT({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(hT({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}yq.type=r.polarAxis,yq.specKey="axes";const _q={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},bq={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class xq extends yq{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new vC}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return HM(this._option.dataSet,t,dV),t}}xq.type=r.polarLinearAxis,xq.specKey="axes",xq.builtInTheme={axis:$U,axisLinear:pV,axisAngle:bq,axisRadius:_q},G(xq,lV);const Sq=()=>{cT.registerGraphicComponent(qN.lineAxis,((t,e)=>new XU(t,e))),cT.registerGraphicComponent(ZN.lineAxisGrid,((t,e)=>new SU(t,e))),cT.registerGraphicComponent(qN.circleAxis,((t,e)=>new rG(t,e))),cT.registerGraphicComponent(ZN.circleAxisGrid,((t,e)=>new bG(t,e))),aU(),cT.registerComponent(xq.type,xq)};class Aq extends yq{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new qk}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return HM(this._option.dataSet,t,oG),t}transformScaleDomain(){}}Aq.type=r.polarBandAxis,Aq.specKey="axes",Aq.builtInTheme={axis:$U,axisBand:KU,axisAngle:bq,axisRadius:_q},G(Aq,hU);const kq=()=>{cT.registerGraphicComponent(qN.lineAxis,((t,e)=>new XU(t,e))),cT.registerGraphicComponent(ZN.lineAxisGrid,((t,e)=>new SU(t,e))),cT.registerGraphicComponent(qN.circleAxis,((t,e)=>new rG(t,e))),cT.registerGraphicComponent(ZN.circleAxisGrid,((t,e)=>new bG(t,e))),aU(),cT.registerComponent(Aq.type,Aq)};class Cq extends fq{constructor(){super(...arguments),this.type=CC.rose,this.transformerConstructor=vq,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(Cq.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:zH(this._spec,Cq.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>NC(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=NC(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(IH(null===(i=cT.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),LH("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}Cq.type=CC.rose,Cq.mark=mq,Cq.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},Cq.transformerConstructor=vq;const Tq=()=>{cT.registerSeries(Cq.type,Cq),Q$(),cT.registerAnimation("rose",((t,e)=>({appear:pq(t,e),enter:dq(t),exit:uq(t),disappear:{duration:Rz.disappear.duration}}))),kq(),Sq()};class Mq extends CI{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,dk(this._fromAngle,this._toAngle)&&dk(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class wq extends Ez{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!_k(t)&&!_k(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const Eq=t=>({type:"in"===t?"fadeIn":"fadeOut"});function Bq(t,e,i){return"fadeIn"===e?Eq(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function Pq(t,e,i){return"fadeIn"===e?Eq(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const Rq=(t,e)=>({custom:Mz,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),Oq=Object.assign(Object.assign(Object.assign({},TH),fj),{area:{name:"area",type:"area"}});class Iq extends fq{constructor(){super(...arguments),this.type=CC.radar,this.transformerConstructor=dN,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(Iq.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:tH,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?oe(this._spec.startAngle):NN},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(IH(null===(s=cT.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),LH("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=cT.getAnimationInKey(e);t.setAnimationConfig(IH(null==i?void 0:i(n,r),LH(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&_(a)?a[0]:a}}}Iq.type=CC.radar,Iq.mark=Oq,Iq.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Iq.transformerConstructor=dN,G(Iq,vj);const Lq=()=>{cT.registerSeries(Iq.type,Iq),kW(),lN(),cN(),cT.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:Bq(t,e,"in"),enter:Bq(t,e,"in"),exit:Bq(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:Rz.disappear.duration},update:[{channel:["points","center"],custom:wq,customParameters:t,duration:Rz.update.duration,easing:Rz.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),cT.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:Pq(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:Rz.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:Mq,customParameters:t,duration:Rz.update.duration,easing:Rz.update.easing}]}))),cT.registerAnimation("radarGroup",((t,e)=>({appear:Rq(t,"in"),disappear:{duration:Rz.disappear.duration}}))),SO(),kq(),Sq()};class Dq extends gH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>yi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const Fq=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(IT)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[zT]:r,[HT]:`${s}_${e}`})),r++}))})),n},zq={fill:"#bbb",fillOpacity:.2},Hq=Object.assign(Object.assign({},TH),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),jq={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},Nq={grid:{background:!0}};class Uq extends JH{constructor(){super(...arguments),this.type=CC.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),jq),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),Nq)})}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),HM(this._option.dataSet,"objFlat",Fq),HM(this._option.dataSet,"copyDataView",XM),jM(this._option.dataSet,"dataview",Ea),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(hT(zq,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(Uq.mark.group),this._containerMark=this._createMark(Uq.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(Uq.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(Uq.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(Uq.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(Uq.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(Uq.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(Uq.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!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",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:jT}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new zC).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:jT}}initTooltip(){this._tooltipHelper=new Dq(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}Uq.type=CC.dot,Uq.mark=Hq,Uq.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class Vq extends gH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>yi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const Wq=Object.assign(Object.assign({},TH),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),Gq=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class Yq extends JH{constructor(){super(...arguments),this.type=CC.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),HM(this._option.dataSet,"linkDotInfo",Gq),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(Yq.mark.group),this._containerMark=this._createMark(Yq.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(Yq.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(Yq.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:jT}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new Vq(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}Yq.type=CC.link,Yq.mark=Wq,Yq.builtInTheme={link:{arrow:{style:{size:10}}}};const Xq=Object.assign(Object.assign({},TH),{group:{name:"group",type:"group"}}),Kq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class $q extends N${constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?VT:sM],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?WT:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Kq)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?oe(n):NN;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):UN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=NC(this.angleAxisHelper.dataToPosition([t[VT]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=NC(this.angleAxisHelper.dataToPosition([t[WT]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?NC(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark($q.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return Kg(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[og({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const Qq=()=>{cT.registerAnimation("circularProgress",((t,e)=>({appear:Jq(t,e),enter:{type:"growAngleIn"},disappear:{duration:Rz.disappear.duration}})))};class tZ extends UH{constructor(){super(...arguments),this._supportStack=!0}}const eZ={cornerRadius:!0,roundCap:!0};class iZ extends $q{constructor(){super(...arguments),this.type=CC.circularProgress,this.transformerConstructor=tZ,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),eZ)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(iZ.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:zH(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(iZ.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?VT:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?WT:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(IH(null===(i=cT.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),LH("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(IH(null===(s=cT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),LH("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}iZ.type=CC.circularProgress,iZ.mark=qq,iZ.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},iZ.transformerConstructor=tZ;const sZ=()=>{cT.registerSeries(iZ.type,iZ),Q$(),Qq(),Dz(),kq(),Sq()};function nZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const rZ={type:"fadeIn"};function aZ(t,e="grow"){return!1===e?{}:"fadeIn"===e?rZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:nZ(t)}))(t)}class oZ extends gH{enableByType(t){return"dimension"!==t}}const lZ=Object.assign(Object.assign({},TH),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),hZ={bandWidth:!0,cornerRadius:!0,clamp:!0},cZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class dZ extends JH{constructor(){super(...arguments),this.type=CC.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),hZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),cZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(dZ.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return NC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return NC(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?NC(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return NC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return NC(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?NC(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(dZ.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return NC(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return NC(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(IH(null===(i=cT.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),LH("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(IH(null===(s=cT.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),LH("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new oZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}dZ.type=CC.linearProgress,dZ.mark=lZ,dZ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const uZ=()=>{jX(),cT.registerAnimation("linearProgress",((t,e)=>({appear:aZ(t,e),enter:aZ(t),disappear:{duration:Rz.disappear.duration}}))),Dz(),cT.registerSeries(dZ.type,dZ)},pZ=[0],gZ=[20,40],fZ=[200,500],mZ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},vZ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class yZ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const _Z=`${IT}_WORD_CLOUD_TEXT`,bZ=Object.assign(Object.assign({},TH),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),xZ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class SZ extends $H{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=gZ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:fZ,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:pZ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?_Z:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:mZ},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||gA(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:pZ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!vZ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new yZ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(SZ.mark.word,{key:HT,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(SZ.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(IH(cT.getAnimationInKey("wordCloud")(n,s),LH("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new zC).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:jT])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new vC).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new vC).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[zT])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:HT,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:e_.createCanvas.bind(e_),getTextBounds:xf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Rg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}SZ.mark=bZ,SZ.builtInTheme={wordCloud:xZ};function AZ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||Rz.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=kZ(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},CZ=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=CZ(t.children,e,t,n))})),s},TZ=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=TZ(t.children,e,t,n)),n=e(t,s,i,n)})),n},MZ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):MZ(t.children,e,i)))})),e};function wZ(t,e){let i,s;if(PZ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function PZ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*T*w))/(2*T):w/M);return{x:s+S+A*E,y:n+k+C*E,radius:E}}function LZ(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function DZ(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function FZ(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function zZ(t){return{_:t,next:null,prev:null}}function HZ(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];LZ(n,s,r);let a,o,l,h,c,d,u,p=zZ(s),g=zZ(n),f=zZ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=kZ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:VZ.defaultOpionts.nodeSort;CZ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)CZ([o],jZ(h)),TZ([o],NZ(this._getPadding,.5,a)),CZ([o],UZ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);CZ([o],jZ(VZ.defaultOpionts.setRadius)),TZ([o],NZ(Ot,1,a)),c&&TZ([o],NZ(this._getPadding,o.radius/t,a)),CZ([o],UZ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}VZ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const WZ=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=WZ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function GZ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){WZ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function YZ(t){return t.depth}function XZ(t,e){return e-1-t.endDepth}const KZ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),$Z=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},qZ={left:YZ,right:XZ,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:YZ,end:XZ},ZZ=bt(0,1);class JZ{constructor(t){this._ascendingSourceBreadth=(t,e)=>KZ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>KZ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},JZ.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):qZ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return GZ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[$Z(s[t.source]),$Z(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=$(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(y(e)){const t=yt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*ZZ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(KZ),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(KZ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];QZ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),tJ);const s=_(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},eJ.defaultOpionts,t):Object.assign({},eJ.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Rt(this.options.center[0],t.width),s=t.y0+Rt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Rt(t,n))):Rt(r,n),h=_(a),c=this.options.gapRadius,d=h?a.map((t=>Rt(t,n))):Rt(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Rt(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(_(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=kZ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ce({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function iJ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,y=Math.max(v/x,x/m),y>_){f-=h;break}_=y}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:QZ,slice:iJ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?iJ:QZ)(t,e,i,s,n)}};class rJ{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},rJ.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?sJ(this.options.aspectRatio):null!==(e=nJ[this.options.splitType])&&void 0!==e?e:nJ.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=kZ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function aJ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ui?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=aJ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=oJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function gJ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*fJ({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},vJ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||hJ,s=e.lossFunction||lJ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];pi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:mJ(f),arcs:f})}))},yJ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:_J,triangle:_J,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 _J(){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 bJ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const xJ=t=>yJ[t]?yJ[t]():yJ.circle(),SJ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function AJ(t){return d(t)?t:function(){return t}}class kJ{constructor(t){var e,i;switch(this.options=H({},kJ.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=xJ(this.options.shape),this.getText=null!==(e=AJ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=AJ(this.options.fontWeight),this.getTextFontSize=AJ(this.options.fontSize),this.getTextFontStyle=AJ(this.options.fontStyle),this.getTextFontFamily=AJ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>SJ(10,50);break;case"random-light":this.getTextColor=()=>SJ(50,90);break;default:this.getTextColor=AJ(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return oe(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():Mt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class TJ extends kJ{constructor(t){var e;super(H({},TJ.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<=TJ.defaultOptions.minFontSize&&(this.options.minFontSize=TJ.defaultOptions.minFontSize),this.spiral=y(this.options.spiral)?null!==(e=CJ[this.options.spiral])&&void 0!==e?e:CJ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=AJ(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=bJ(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,y=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;y[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(BJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(EJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}BJ(p,this._size)&&(p=PJ(p,this._size))}else if(BJ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||wJ(p,i))&&(!i||!MJ(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function MJ(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function wJ(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,BJ=(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 PJ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},OJ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},IJ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},LJ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=bJ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=xJ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)IJ(n,OJ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)IJ(n,OJ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)IJ(n,OJ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)IJ(n,OJ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)IJ(n,OJ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=OJ({x:l,y:h},o,-Math.PI/2,5),e=OJ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);IJ(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let KG=class t extends FG{constructor(e){super(j({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)B(C,w,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?GG(t,o,l.width,l.height,h):"geometric"===t.type&&$G(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=RG(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};KG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class qG extends FG{constructor(t){super(j({},qG.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}qG.defaultOptions={enlarge:!1};const JG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},QG=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?tY(t.fontFamily):"sans-serif",d=t.fontStyle?tY(t.fontStyle):"normal",u=t.fontWeight?tY(t.fontWeight):"normal",p=t.rotate?tY(t.rotate):0,g=tY(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?tY(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},JG),t.as):JG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?tY(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=iY(sY(t,l),C);w=i=>e(t(i))}let E=jG;"fast"===t.layoutType?E=qG:"grid"===t.layoutType&&(E=KG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},tY=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],eY=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),iY=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=eY(t[0]),n=eY(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(eY(t)-r)/(a-r)*(e[1]-e[0])+e[0]},sY=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function nY(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{aO.registerGrammarTransform("wordcloud",{transform:QG}),$N(),aO.registerAnimation("wordCloud",((t,e)=>({appear:DW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:ZD.disappear.duration}}))),aO.registerSeries(rY.type,rY)},oY=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:f=!1,isCone:m=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(y*v)&&0!==v?y/v:0,S=k(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},lY=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},hY=`${BO}_FUNNEL_TRANSFORM_RATIO`,cY=`${BO}_FUNNEL_REACH_RATIO`,dY=`${BO}_FUNNEL_HEIGHT_RATIO`,uY=`${BO}_FUNNEL_VALUE_RATIO`,pY=`${BO}_FUNNEL_LAST_VALUE_RATIO`,gY=`${BO}_FUNNEL_NEXT_VALUE_RATIO`,fY=`${BO}_FUNNEL_LAST_VALUE`,mY=`${BO}_FUNNEL_CURRENT_VALUE`,vY=`${BO}_FUNNEL_NEXT_VALUE`,_Y=`${BO}_FUNNEL_TRANSFORM_LEVEL`;class yY extends EF{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[cY])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class bY extends ND{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class xY extends bY{constructor(){super(...arguments),this.type=xY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}xY.type="polygon";const SY=()=>{aO.registerMark(xY.type,xY),hM(),sM(),kw.registerBuiltInAnimate("growPointsOut",xC),aO.registerGraphicComponent("polygon",hf)},AY=Object.assign(Object.assign({},VF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class kY extends sz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class MY extends nz{constructor(){super(...arguments),this.type=xR.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=kY,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;LI(this._dataSet,"funnel",oY),LI(this._dataSet,"funnelTransform",lY);const t=new Ba(this._dataSet,{name:`${BO}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new FD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:mY,asTransformRatio:hY,asReachRatio:cY,asHeightRatio:dY,asValueRatio:uY,asNextValueRatio:gY,asLastValueRatio:pY,asLastValue:fY,asNextValue:vY,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:_Y}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},MY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:QF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},MY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(MY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(MY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new yY(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Ky(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&Ky(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*_R(cY).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(KF(null===(s=aO.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),qF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(KF(aO.getAnimationInKey("fadeInOut")(),qF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(KF(aO.getAnimationInKey("funnel")({},o),qF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(KF(null===(a=aO.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),qF("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[pY])/2:this._getSecondaryAxisLength(t[uY])/2,n=this._getSecondaryAxisLength(t[uY])/2):(s=this._getSecondaryAxisLength(t[uY])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[gY])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[_Y])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[IO]===t[IO]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{SY(),$N(),rN(),aO.registerSeries(MY.type,MY),aO.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},QD))),aO.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:sC,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),eF()},wY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},CY=t=>{const e=t.filter((t=>t.context.diffState===dD.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},EY=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=$(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},BY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=CY(i.parent.children),a=EY(r,s,n);return wY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=CY(i.parent.children),a=EY(r,s,n);return wY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),PY=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=$(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},LY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=CY(i.parent.children),a=PY(r);return wY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=CY(i.parent.children),a=PY(r);return wY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),RY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},OY=(t,e={})=>{if(!t)return[];const i=[];return HW(t,i,e),i},IY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new gG(i).layout(t,{width:s,height:n})};class DY extends EF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var FY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(FY||(FY={}));const zY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===FY.DrillDown){return Y(uI(t,n,s,"children"))}if(i.type===FY.DrillUp){const e=pI(t,n,s,"children");if(e)return Y(e)}return t};class jY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=NV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;LI(t,"drillFilter",zY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:FY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:FY.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:FY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:FY.DrillUp},model:this}),r}}const HY=Object.assign(Object.assign({},VF),{sunburst:{name:"sunburst",type:"arc"}}),VY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:OF,operations:["max","min","values"]}),t.push({key:IF,operations:["values"]}),t),NY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class UY extends hU{constructor(){super(...arguments),this.type=xR.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:IF),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:IO},getRawData:()=>this.getRawData()}),this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),LI(this._dataSet,"sunburstLayout",IY),LI(this._dataSet,"flatten",OY),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return VY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(LI(t.dataSet,"addVChartProperty",SF),t.transform({type:"addVChartProperty",options:{beforeCall:jF.bind(this),call:HF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(UY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(UY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new DY(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(KF(null===(e=aO.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),qF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(KF(null===(e=aO.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),qF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}UY.type=xR.sunburst,UY.mark=HY,UY.builtInTheme={sunburst:NY},G(UY,jY);const WY=()=>{aO.registerSeries(UY.type,UY),xU(),$N(),eF(),aO.registerAnimation("sunburst",((t,e)=>({appear:RY(0,e),enter:BY(t),exit:LY(t),disappear:{duration:ZD.disappear.duration}})))},GY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new iG(i).layout(t,{width:s,height:n})};class YY extends EF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const XY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},$Y=Object.assign(Object.assign({},VF),{circlePacking:{name:"circlePacking",type:"arc"}});class KY extends oz{constructor(){super(...arguments),this.type=xR.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:IF),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:IO},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),LI(this._dataSet,"circlePackingLayout",GY),LI(this._dataSet,"flatten",OY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(LI(t.dataSet,"addVChartProperty",SF),t.transform({type:"addVChartProperty",options:{beforeCall:jF.bind(this),call:HF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(KY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(KY.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return VY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new YY(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(KF(null===(i=aO.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),qF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(KF(null===(e=aO.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),qF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}KY.type=xR.circlePacking,KY.mark=$Y,KY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(KY,jY);const qY=()=>{aO.registerSeries(KY.type,KY),xU(),$N(),tF(),aO.registerAnimation("circlePacking",((t,e)=>({appear:XY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:ZD.disappear.duration}})))},ZY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&ZY(t,e.children,i)}))},JY=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},QY=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new dG(e),r=[];return r.push(n.layout(s,i)),r},tX=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},eX=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class iX extends EF{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const sX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),nX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:sX(t),rX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class aX extends Iw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class oX extends Iw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const lX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},hX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class cX extends EN{constructor(){super(...arguments),this.type=cX.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?hX:lX,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}cX.type="linkPath";const dX=Object.assign(Object.assign({},VF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class uX extends sz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const pX=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class gX extends oz{constructor(){super(...arguments),this.type=xR.sankey,this.transformerConstructor=uX,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new He,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=bI(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=bI(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=bI(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),pX(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=bI(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=bI(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=bI(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=bI(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=bI(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void pX(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void pX(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(bI(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=bI(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=bI(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void pX(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void pX(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void pX(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){LI(this._dataSet,"sankeyLayout",QY),LI(this._dataSet,"sankeyFormat",JY),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;LI(o,"sankeyNodes",tX),LI(o,"flatten",OY);const l=new Ba(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:FF.bind(this),call:zF}},!1),this._nodesSeriesData=l,LI(o,"sankeyLinks",eX);const h=new Ba(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:FF.bind(this),call:zF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(gX.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(gX.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=yF(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(KF(null===(i=aO.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),qF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(KF(null===(s=aO.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),qF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:wI.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(bI(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new iX(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new OR;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return ZY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}gX.type=xR.sankey,gX.transformerConstructor=uX,gX.mark=dX,gX.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const fX=()=>{uV(),BN(),eM(),aO.registerGraphicComponent("path",(t=>Qg(t))),aO.registerMark(cX.type,cX),$N(),aO.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:nX(t,e)},QD))),aO.registerAnimation("sankeyLinkPath",((t,e)=>({appear:rX(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:ZD.disappear.duration}}))),kw.registerBuiltInAnimate("linkPathGrowOut",oX),kw.registerBuiltInAnimate("linkPathGrowIn",aX),eF(),aO.registerSeries(gX.type,gX)},mX=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=OY(n);return i=PF([{latestData:r}],e),i};class vX extends EF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const _X=Object.assign(Object.assign({},VF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),yX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class bX extends sz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const xX=(t,e)=>{if(e.getViewBox()){const i=new _G(e).layout(t,e.getViewBox()),s=[];return HW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[IF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class SX extends oz{constructor(){super(...arguments),this.type=xR.treemap,this.transformerConstructor=bX,this._categoryField="name",this._valueField="value",this._viewBox=new He,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:IF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ue),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:IO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),LI(this._dataSet,"treemap",xX),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(LI(this._rawData.dataSet,"addVChartProperty",SF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:jF.bind(this),call:HF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=mX([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){LI(this._dataSet,"hierarchyDimensionStatistics",mX),LI(this._dataSet,"flatten",OY);const i=new Ba(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 VY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(SX.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(SX.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(KF(null===(e=aO.getAnimationInKey("treemap"))||void 0===e?void 0:e(),qF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new vX(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(AI.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(AI.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}SX.type=xR.treemap,SX.mark=_X,SX.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},SX.transformerConstructor=bX,G(SX,jY),G(SX,WV);const AX=()=>{aO.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),aO.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),uV(),$N(),aO.registerAnimation("treemap",((t,e)=>({appear:yX(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:ZD.disappear.duration}}))),eF(),aO.registerSeries(SX.type,SX)},kX=Object.assign(Object.assign({},cW),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),MX=Object.assign(Object.assign({},VF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),TX={type:"fadeIn"};function wX(t,e){return"fadeIn"===e?TX:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class CX extends sz{constructor(){super(...arguments),this._supportStack=!1}}class EX extends EF{enableByType(t){return"dimension"!==t}}const BX="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",PX={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:BX,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:BX,fill:"#ddd"}}};class LX extends dW{constructor(){super(...arguments),this.type=xR.gaugePointer,this.transformerConstructor=CX,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(LX.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},LX.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(LX.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new EX(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=$(e),s=K(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(KF(null===(i=aO.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),qF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}LX.type=xR.gaugePointer,LX.mark=MX,LX.builtInTheme={gaugePointer:PX},LX.transformerConstructor=CX;const RX=()=>{aO.registerSeries(LX.type,LX),FV(),uV(),aO.registerAnimation("gaugePointer",((t,e)=>{const i=wX(t,e);return{appear:i,enter:i,disappear:{duration:ZD.disappear.duration}}})),UU(),VU()};class OX extends sz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class IX extends dW{constructor(){super(...arguments),this.type=xR.gauge,this.transformerConstructor=OX,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=ae(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();LI(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[tI]=t[this._angleField[0]],t[QO]=e>0?i[e-1][tI]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(IX.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(IX.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?FR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?FR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[QO])?this.angleAxisHelper.dataToPosition([t[QO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[tI]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(KF(null===(i=aO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),qF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}IX.type=xR.gauge,IX.mark=kX,IX.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},IX.transformerConstructor=OX;class DX extends ND{constructor(){super(...arguments),this.type=DX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Cg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}DX.type="cell";function FX(t){return!1===t?{}:{type:"fadeIn"}}class zX extends EF{enableByType(t){return"dimension"!==t}}const jX=Object.assign(Object.assign({},VF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class HX extends sz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class VX extends oz{constructor(){super(...arguments),this.type=xR.heatmap,this.transformerConstructor=HX}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(VX.mark.cell,{isSeriesMark:!0},{morph:QF(this._spec,VX.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(VX.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ri(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=az(this);this._cellMark.setAnimationConfig(KF(null===(i=aO.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),qF("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new zX(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}VX.type=xR.heatmap,VX.mark=jX,VX.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},VX.transformerConstructor=HX;const NX=()=>{$N(),aO.registerMark(DX.type,DX),aO.registerGraphicComponent("symbol",Cg),hM(),dM(),IB(),aO.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},QD),{appear:FX(e)}))),Nj(),zj(),aO.registerSeries(VX.type,VX)},UX=Object.assign(Object.assign({},VF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),WX=`${BO}_CORRELATION_X`,GX=`${BO}_CORRELATION_Y`,YX=`${BO}_CORRELATION_SIZE`,XX=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=ae(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=ae(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Pt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Pt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Pt(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+Pt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Bt(e.field),C=t.map(w),[E,B]=Rt(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Bt(e.radiusField),R=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>R;if(L){const[i,s]=L!==w?Rt(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=$X(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),KX({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,a>D?a=I:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},KX=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[OO]:null==n?void 0:n[OO],[DO]:null==n?void 0:n[DO]}};class ZX extends EN{constructor(){super(...arguments),this.type=ZX.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=vt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}ZX.type="ripple";const JX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class QX extends sz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class t$ extends hU{constructor(){super(...arguments),this.type=xR.correlation,this.transformerConstructor=QX,this._viewBox=new He}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;LI(this._dataSet,"correlation",XX);const s=new Ea;RI(s,"dataview",Ta),LI(s,"correlationCenter",qX);const n=new Ba(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new FD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const e=this._createMark(t$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:OO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(t$.mark.ripplePoint,{key:OO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(t$.mark.centerPoint,{key:OO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[WX],y:t=>t[GX],size:t=>t[YX],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(KF(null===(e=aO.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),qF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}t$.type=xR.correlation,t$.mark=UX,t$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},t$.transformerConstructor=QX;const e$=()=>{Rz(),BN(),dM(),aO.registerMark(ZX.type,ZX),aO.registerGraphicComponent("symbol",(t=>Cg(t))),aO.registerSeries(t$.type,t$),aO.registerAnimation("correlation",((t,e)=>Object.assign({appear:JX(0,e)},JD)))},i$=Object.assign(Object.assign({},VF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class s$ extends EN{constructor(){super(...arguments),this.type=s$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}s$.type="liquid";const n$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class r$ extends EF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class a$ extends nz{constructor(){super(...arguments),this.type=xR.liquid,this.transformerConstructor=Oz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Ig({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Cg({x:s,y:n,size:r,symbolType:n$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=YR(this._spec.outlineMargin),this._paddingSpec=YR(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Gt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(a$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(a$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(a$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(a$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new r$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(KF(null===(i=aO.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),qF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(KF(null===(s=aO.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),qF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=IM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}a$.type=xR.liquid,a$.mark=i$,a$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},a$.transformerConstructor=Oz;const o$=t=>Y(t).join(",");class l$ extends EF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>o$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>o$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const h$=Object.assign(Object.assign({},VF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class c$ extends sz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const d$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?BG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class u$ extends nz{constructor(){super(...arguments),this.type=xR.venn,this.transformerConstructor=c$,this._viewBox=new He}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:IO)}initData(){var t;super.initData(),LI(this._dataSet,"venn",d$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(u$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(u$.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>o$(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>o$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new l$(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:o$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return o$(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[o$(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(o$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(KF(null===(e=aO.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),qF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(KF(null===(e=aO.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),qF(t.name,this._spec,this._markAttributeContext)))}))}}u$.type=xR.venn,u$.mark=h$,u$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},u$.transformerConstructor=c$;class p$ extends vV{constructor(){super(...arguments),this.type=xR.mosaic,this.transformerConstructor=mV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(qO),this.setFieldX2(KO)),this.setFieldY(JO),this.setFieldY2(ZO)):(t&&(this.setFieldY(qO),this.setFieldY2(KO)),this.setFieldX(JO),this.setFieldX2(ZO)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}p$.type=xR.mosaic,p$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},p$.transformerConstructor=mV;class g$ extends dH{_isValidSeries(t){return t===xR.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class f$ extends hH{constructor(){super(...arguments),this.transformerConstructor=g$,this.type="map",this.seriesType=xR.map}}f$.type="map",f$.seriesType=xR.map,f$.transformerConstructor=g$;class m$ extends dH{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class v$ extends m${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=Yz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,rO({},s,l)),n&&Object.assign(o,rO({},n,o))}}class _$ extends m${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class y$ extends m${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class b$ extends hH{constructor(){super(...arguments),this.transformerConstructor=y$}}b$.transformerConstructor=y$;class x$ extends b${constructor(){super(...arguments),this.transformerConstructor=y$,this.type="pie",this.seriesType=xR.pie}}x$.type="pie",x$.seriesType=xR.pie,x$.transformerConstructor=y$;class S$ extends _${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:lj,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:lj,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>rO({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const A$=(t,e)=>{if(!t)return null;const i=xz(t,(t=>"angle"===t.getOrient()),e),s=xz(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&tE(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=uR({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=$(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=pR(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=yz(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&tE(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=uR({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=pR(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=yz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class k$ extends hH{constructor(){super(...arguments),this.transformerConstructor=S$,this.type="rose",this.seriesType=xR.rose}_setModelOption(){this._modelOption.getDimensionInfo=A$}}k$.type="rose",k$.seriesType=xR.rose,k$.transformerConstructor=S$,G(k$,mH);class M$ extends _${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=rO({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>rO({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class T$ extends hH{constructor(){super(...arguments),this.transformerConstructor=M$,this.type="radar",this.seriesType=xR.radar}_setModelOption(){this._modelOption.getDimensionInfo=A$}}T$.type="radar",T$.seriesType=xR.radar,T$.transformerConstructor=M$,G(T$,mH);class w$ extends dH{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{L(e,"trimPadding")&&rO(e,oD(this.type,t))})),this._transformAxisSpec(t)}}class C$ extends hH{constructor(){super(...arguments),this.transformerConstructor=w$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=TH(t,e,i))&&void 0!==s?s:[],...null!==(n=A$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=CH,this._modelOption.getRectByDimensionData=OH}}C$.type="common",C$.transformerConstructor=w$,G(C$,mH);class E$ extends uH{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class B$ extends hH{constructor(){super(...arguments),this.transformerConstructor=E$}}B$.transformerConstructor=E$,G(B$,mH);class P$ extends E${transformSpec(t){super.transformSpec(t),nD(t)}}class L$ extends B${constructor(){super(...arguments),this.transformerConstructor=P$,this.type="histogram",this.seriesType=xR.bar}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=CH,this._modelOption.getRectByDimensionData=OH}}L$.type="histogram",L$.seriesType=xR.bar,L$.transformerConstructor=P$;class R$ extends v${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class O$ extends hH{constructor(){super(...arguments),this.transformerConstructor=R$,this.type="circularProgress",this.seriesType=xR.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=A$}}O$.type="circularProgress",O$.seriesType=xR.circularProgress,O$.transformerConstructor=R$,G(O$,mH);class I$ extends v${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=xR.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===xR.gauge||t.type===xR.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===xR.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class D$ extends hH{constructor(){super(...arguments),this.transformerConstructor=I$,this.type="gauge",this.seriesType=xR.gaugePointer}}D$.type="gauge",D$.seriesType=xR.gaugePointer,D$.transformerConstructor=I$;class F$ extends dH{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class z$ extends hH{constructor(){super(...arguments),this.transformerConstructor=F$,this.type="wordCloud",this.seriesType=xR.wordCloud}}z$.transformerConstructor=F$;class j$ extends z${constructor(){super(...arguments),this.transformerConstructor=F$,this.type="wordCloud",this.seriesType=xR.wordCloud}}j$.type="wordCloud",j$.seriesType=xR.wordCloud,j$.transformerConstructor=F$;class H$ extends dH{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class V$ extends hH{constructor(){super(...arguments),this.transformerConstructor=H$,this.type="funnel",this.seriesType=xR.funnel}}V$.type="funnel",V$.seriesType=xR.funnel,V$.transformerConstructor=H$;class N$ extends uH{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=Yz(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=Yz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class U$ extends hH{constructor(){super(...arguments),this.transformerConstructor=N$,this.type="linearProgress",this.seriesType=xR.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=CH,this._modelOption.getRectByDimensionData=OH}}U$.type="linearProgress",U$.seriesType=xR.linearProgress,U$.transformerConstructor=N$,G(U$,mH);class W$ extends uH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),nD(t)}}class G$ extends hH{constructor(){super(...arguments),this.transformerConstructor=W$,this.type="rangeColumn",this.seriesType=xR.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=CH,this._modelOption.getRectByDimensionData=OH}}G$.type="rangeColumn",G$.seriesType=xR.rangeColumn,G$.transformerConstructor=W$;class Y$ extends dH{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+oe(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class X$ extends hH{constructor(){super(...arguments),this.transformerConstructor=Y$,this.type="sunburst",this.seriesType=xR.sunburst}}X$.type="sunburst",X$.seriesType=xR.sunburst,X$.transformerConstructor=Y$;class $$ extends dH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class K$ extends hH{constructor(){super(...arguments),this.transformerConstructor=$$,this.type="circlePacking",this.seriesType=xR.circlePacking}}K$.type="circlePacking",K$.seriesType=xR.circlePacking,K$.transformerConstructor=$$;class q$ extends dH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class Z$ extends hH{constructor(){super(...arguments),this.transformerConstructor=q$,this.type="treemap",this.seriesType=xR.treemap}}Z$.type="treemap",Z$.seriesType=xR.treemap,Z$.transformerConstructor=q$;class J$ extends yV{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),nD(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class Q$ extends bV{constructor(){super(...arguments),this.transformerConstructor=J$,this.type="waterfall",this.seriesType=xR.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=CH,this._modelOption.getRectByDimensionData=OH}}Q$.type="waterfall",Q$.seriesType=xR.waterfall,Q$.transformerConstructor=J$;class tK extends uH{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),nD(t)}}class eK extends hH{constructor(){super(...arguments),this.transformerConstructor=tK,this.type="boxPlot",this.seriesType=xR.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=CH,this._modelOption.getRectByDimensionData=OH}}eK.type="boxPlot",eK.seriesType=xR.boxPlot,eK.transformerConstructor=tK;class iK extends dH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class sK extends hH{constructor(){super(...arguments),this.transformerConstructor=iK,this.type="sankey",this.seriesType=xR.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=bI(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}sK.type="sankey",sK.seriesType=xR.sankey,sK.transformerConstructor=iK;class nK extends uH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),nD(t)}}class rK extends hH{constructor(){super(...arguments),this.transformerConstructor=nK,this.type="rangeArea",this.seriesType=xR.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=CH,this._modelOption.getRectByDimensionData=OH}}rK.type="rangeArea",rK.seriesType=xR.rangeArea,rK.transformerConstructor=nK;class aK extends uH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class oK extends hH{constructor(){super(...arguments),this.transformerConstructor=aK,this.type="heatmap",this.seriesType=xR.heatmap}}oK.type="heatmap",oK.seriesType=xR.heatmap,oK.transformerConstructor=aK;class lK extends dH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class hK extends hH{constructor(){super(...arguments),this.transformerConstructor=lK,this.type="correlation",this.seriesType=xR.correlation}}hK.type="correlation",hK.seriesType=xR.correlation,hK.transformerConstructor=lK;function cK(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=_I(t.style)),P(t.textStyle)||rO(s.textStyle,_I(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&_I(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&_I(s.background.style),s}const dK=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},uK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:DO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class pK extends gj{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{fR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),fR(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=HR(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new FD(this._option,e),this._initSelectedData(),fR(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(fR(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(rO({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(rO({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(rO({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}pK.specKey="legends";class gK extends pK{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return bF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),fR(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){LI(this._option.dataSet,"discreteLegendFilter",uK),LI(this._option.dataSet,"discreteLegendDataMake",dK);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return fR(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!lb(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=rI(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=cK(n):l.title={visible:!1},P(r.focusIconStyle)||_I(r.focusIconStyle),r.shape&&(r.shape=fI(r.shape)),r.label&&(r.label=fI(r.label)),r.value&&(r.value=fI(r.value)),r.background&&(r.background=fI(r.background)),VR(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),VR(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),VR(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(P(a.railStyle)||_I(a.railStyle),P(a.sliderStyle)||_I(a.sliderStyle)):(P(a.textStyle)||_I(a.textStyle),a.handler&&fI(a.handler)),l.pager=a,o.visible&&!P(o.style)&&(rO(l,o.style),p(o.padding)&&(l.padding=o.padding)),l}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return AL}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(mL.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(mL.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(mL.legendItemUnHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=yF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=yF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}gK.specKey="legends",gK.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},gK.type=r.discreteLegend;const fK=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},mK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?gI(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function vK(t){const i=rO({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:_,data:y,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:M,seriesId:T,padding:w}=i,C=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?C.title=cK(s):C.title={visible:!1},C.showHandler=!1!==n.visible,P(n.style)||(C.handlerStyle=_I(n.style)),p(r.width)&&(C.railWidth=r.width),p(r.height)&&(C.railHeight=r.height),P(r.style)||(C.railStyle=_I(r.style)),P(a.style)||(C.trackStyle=_I(a.style)),C.startText=fI(o),C.endText=fI(l),C.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>_I(i(t,e,s)):P(i)||(e.style=_I(i)),e}(h),P(c)||(C.sizeBackground=_I(c)),u.visible&&!P(u.style)&&(rO(C,u.style),p(u.padding)&&(C.padding=u.padding)),C}const _K={color:CL,size:BL},yK={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},bK=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},yK),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},xK={horizontal:bK(!0),vertical:bK(!1)},SK=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},yK),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},AK={horizontal:SK(!0),vertical:SK(!1)},kK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],MK=[2,10];class TK extends pK{static getSpecInfo(t){const e=bF(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),fR(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){LI(this._option.dataSet,"continuousLegendFilter",mK),LI(this._option.dataSet,"continuousLegendDataMake",fK);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>mR(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=rI(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!lb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=rI(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?kK:MK);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 h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},vK(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return _K[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}TK.specKey="legends",TK.builtInTheme={colorLegend:xK,sizeLegend:AK},TK.type=r.continuousLegend;const wK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,CK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),EK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function BK(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=PK(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>CK(i,s)(t)&&CK(n,r)(t)&&(u(a)||CK([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:TI.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return gF.globalConfig.uniqueTooltip&&gF.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:TI.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return gF.globalConfig.uniqueTooltip&&gF.hideTooltip(a.id),m}return"none"}const PK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=wK(c,t);let _=wK(d,t);const y=EK(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(CK(c,v));if(!y&&(_=wK(d,i),!EK(_)))return;const n=e.type===xR.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=tE(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(CK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=wK(d,o),!EK(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(CK(c,n));if(!y&&(_=wK(d,r),!EK(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===xR.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(CK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=wK(d,i),!EK(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(CK(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=wK(d,a),h=_,!EK(_)&&!a)return;EK(_)||(_=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},LK=t=>p(t)&&!y(t),RK=t=>p(t)&&y(t),OK=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class IK extends pj{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=rO({},...OK.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=rO({},s);OK.forEach((t=>{delete r[t]})),delete r.style;const a=rO({},r,i);return a.style=rO({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:nb(this._option.mode)||!ib(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=O_.getElementById(t.parentElement)):ib(this._option.mode)&&(t.parentElement=null==eb?void 0:eb.body)}}const DK={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class FK extends gj{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=IK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=ib(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&LK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&gF.globalConfig.uniqueTooltip&&l&&gF.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:TI.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:TI.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?zH.canvas:zH.dom,n=aO.getComponentPluginInType(t);n||Jy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=aO.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(sb(s)||nb(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,St(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=BK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(RK(t)){if(LK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>vz(t,e[i])))}if(RK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}FK.type=r.tooltip,FK.transformerConstructor=IK,FK.builtInTheme={tooltip:DK},FK.specKey="tooltip";var zK,jK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(zK||(zK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(jK||(jK={}));const HK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class VK extends gj{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{tE(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:wI.chart}:{source:TI.chart};y(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:sb(e)||nb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:TI.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:TI.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:TI.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{HK[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}VK.specKey="crosshair";const NK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class UK extends VK{static getSpecInfo(t){return bF(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=lz(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){lz(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:hz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=vR(this._regions,"cartesian");e&&(EH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=LH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new yT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new bT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}UK.specKey="crosshair",UK.builtInTheme={crosshair:NK},UK.type=r.cartesianCrosshair;class WK extends VK{static getSpecInfo(t){return bF(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=vR(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Gz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=yF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:he(d,a.getInnerRadius(),o),end:he(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=de(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=he(t,o,r),d=he(t,o,h),m=ve([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=vt(re.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new yT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new ST(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new AT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new xT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=ue(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=ue(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?he(e,p[1]+m.offset,u):he(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}WK.specKey="crosshair",WK.builtInTheme={crosshair:NK},WK.type=r.polarCrosshair;const GK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},YK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},XK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},$K=(t,e,i)=>{const s=e.domain();if(JC(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},KK=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&JC(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},qK=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},ZK=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},JK=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),QK=(t,e,i)=>{if(JC(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class tq{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=vt(this.getState().start+f,0,1),_=vt(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Nt(s/n)>=.5:Nt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===uz(dz(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(tq,WV);class eq extends gj{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:KK(t,this._stateScale,this._isHorizontal),a="percent"===n?e:KK(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=qK(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=QK(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&ZK(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else fR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),fR(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=dz(t),this._isHorizontal="horizontal"===uz(this._orient),this._dataFilterEvent=new tq(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(JC(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>uz(t._orient)===uz(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!JC(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};fR(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=JC(d.getScale(0).type),p=JC(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else fR(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;RI(r,"dataview",Ta),LI(r,"dataFilterComputeDomain",XK);const a=new Ba(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new FD(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(LI(this._option.dataSet,"dataFilterWithNewDomain",YK),LI(this._option.dataSet,"lockStatisticsFilter",GK),fR(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>JC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>JC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(JC(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;JK("start",i,this._spec)&&JK("end",s,this._spec)&&(t="percent"===i?this._spec.start:KK(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:KK(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?KK(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?KK(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=$K(this._start,this._stateScale,qK(i,this._isHorizontal)),this._endValue=$K(this._end,this._stateScale,qK(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,JC(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=QK(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&fR(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new NE:new xE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),$(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=ZK(h);if(!this._dataUpdating&&tE(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,tE(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(eq,WV);class iq extends pj{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=rO({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const sq=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),nq={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:sq(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:sq(!0)};class rq extends eq{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=iq,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=$K(e,this._stateScale,qK(s,this._isHorizontal)),a=$K(i,this._stateScale,qK(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new NE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(qK(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=qK(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new NE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(qK(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),$(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!JC(t.type)||e[0]!==X(e))&&(!tE(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:qK(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>$K(t,this._stateScale,qK(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new vP(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>$K(t,this._stateScale,qK(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:_I(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:_I(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:_I(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:_I(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:_I(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:_I(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:_I(g.style)},selectedBackgroundStyle:_I(this._spec.selectedBackground.style),dragMaskStyle:_I(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:rO(_I(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},_I(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:rO(_I(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},_I(null===(d=m.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=yF(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(qK(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}rq.type=r.dataZoom,rq.transformerConstructor=iq,rq.builtInTheme={dataZoom:nq},rq.specKey="dataZoom";const aq={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class oq extends eq{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=aR(this._start,e)&&aR(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=qK(n,this._isHorizontal),a=$K(e,this._stateScale,r),o=$K(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new kM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=_I(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=_I(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}oq.type=r.scrollBar,oq.builtInTheme={scrollBar:aq},oq.specKey="scrollBar";const lq=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},hq=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),cq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:hq("l1FontSize","primaryFontColor")},content:{visible:!0,style:hq("l2FontSize","tertiaryFontColor")}};class dq extends gj{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return bF(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(bI(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(bI(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){LI(this._option.dataSet,"indicatorFilter",lq);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new FD(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=rO({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},vI(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?$R(l,this._computeLayoutRadius()):0,dy:h?$R(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},vI(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new RL(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}dq.type=r.indicator,dq.builtInTheme={indicator:cq},dq.specKey="indicator";const uq=["sum","average","min","max","variance","standardDeviation","median"];function pq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=$(s);return er}function gq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&pq(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=VR(t.x)?_q(t.x,n)+r.x:yq(l.getXAxisHelper(),[t.x])+r.x,h}function fq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&pq(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=VR(t.y)?_q(t.y,n)+r.y:yq(l.getYAxisHelper(),[t.y])+r.y,h}function mq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&pq(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),yq(a.angleAxisHelper,[t.angle])}function vq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&pq(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),yq(a.radiusAxisHelper,[t.radius])}function _q(t,e){return Number(t.substring(0,t.length-1))*e/100}function yq(t,e){const i=t.getScale(0);return JC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function bq(t){return uq.includes(t)}function xq(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=gq(t,_,n,u,c,o),r=fq(t,y,n,u,d,o),Sq(s,b,S,g.length),Sq(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=gq(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);Sq(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=fq(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);Sq(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function Sq(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=mq(t,l,n,r),i=vq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=mq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=vq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function kq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=VR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=VR(i)?Number(i.substring(0,i.length-1))*f/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&pq(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&pq(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:yq(d.getXAxisHelper(),b)+p.x+m,y:yq(d.getYAxisHelper(),x)+p.y+v})})),n}function Mq(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&pq(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&pq(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:yq(l.angleAxisHelper,d),radius:yq(l.radiusAxisHelper,u)})})),s}function Tq(t,e,i){let{x:s,y:n}=t;return VR(s)&&(s=_q(s,e)),VR(n)&&(n=_q(n,i)),{x:s,y:n}}function wq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=Tq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>Tq(t,n,r)))}function Cq(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function Eq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},_I(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Pq(_I(n.style),i,s)),p(n.padding)&&(t.padding=ri(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Pq(_I(r),i,s)),t}return{visible:!1}}function Bq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function Pq(t,e,i){return d(t)?t(e,i):t}function Lq(t,e){return d(t)?t(e):t}function Rq(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function Oq(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function Iq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=Oq(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function Dq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=Oq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function Fq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function zq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&bq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&bq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&bq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&bq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Hq(i,t,e))):i.x=Hq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Hq(i,t,e))):i.y=Hq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Hq(i,t,e))):i.angle=Hq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Hq(i,t,e))):i.radius=Hq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Hq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const jq={min:(t,e)=>oR(t[0].latestData,e.field),max:(t,e)=>lR(t[0].latestData,e.field),sum:function(t,e){return hR(t[0].latestData,e.field)},average:function(t,e){return cR(t[0].latestData,e.field)},variance:function(t,e){return dR(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(dR(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Hq(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(m(t)){const{aggrType:i,field:s}=t;return jq[i](e,{field:s})}return t}function Vq(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class Nq extends gj{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return bF(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&bq(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ea;return e.registerParser("array",s),new Ba(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=vR(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=UR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=UR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();LI(this._option.dataSet,"markerAggregation",zq),LI(this._option.dataSet,"markerFilter",Vq);const i=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function Uq(t,e){return function(t,e,i){const{predict:s}=Dt(t,(t=>t[e]),(t=>t[i])),n=oR(t,e),r=lR(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Wq extends Nq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=Iq(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Pq(_I(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>Eq(t,this._markerData,this._markAttributeContext))),state:{line:Bq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return Bq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return Bq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:Pq(_I(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:Pq(_I(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=Cq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=Iq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;LI(this._option.dataSet,"markerAggregation",zq),LI(this._option.dataSet,"markerRegression",Uq),LI(this._option.dataSet,"markerFilter",Vq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Ba(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}Wq.specKey="markLine";const Gq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Yq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},Xq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:Gq(!1),endSymbol:Gq(!0),label:Yq};class $q extends Wq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new iL(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=Iq(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=xq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=kq(i,r,d,e.coordinatesOffset):c&&(y=wq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(VR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=Iq(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}$q.type=r.markLine,$q.coordinateType="cartesian",$q.builtInTheme={markLine:Xq};class Kq extends Wq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=Iq(this._spec);return e||i?new rL(t):new iL(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=Iq(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=Aq(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>he(f,t.radius,t.angle)))}}else u&&(p=Mq(i,r,a),g={points:p.map((t=>he(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=Iq(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}Kq.type=r.polarMarkLine,Kq.coordinateType="polar",Kq.builtInTheme={polarMarkLine:Xq};class qq extends gj{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=HR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return bF(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=UR(this._spec.width,a.width,null,a.width),l=UR(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new PL(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}qq.type=r.title,qq.specKey=r.title,qq.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class Zq extends Nq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=Dq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:Pq(_I(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>Eq(t,this._markerData,this._markAttributeContext))),state:{area:Bq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>Bq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return Bq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=Cq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=Dq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}Zq.specKey="markArea";const Jq={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class Qq extends Zq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new nL(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=Dq(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=xq(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=xq(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=kq(s,a,u,i.coordinatesOffset):d&&(f=wq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=Dq(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Qq.type=r.markArea,Qq.coordinateType="cartesian",Qq.builtInTheme={markArea:Jq};class tZ extends Zq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=Dq(this._spec);return i||e||s?new aL(t):new nL(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=Dq(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=Aq(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=Mq(i,r,c),u={points:d.map((t=>he(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=Dq(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}tZ.type=r.polarMarkArea,tZ.coordinateType="polar",tZ.builtInTheme={polarMarkArea:Jq};const eZ=t=>_I(Object.assign({},t)),iZ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},_I(t.style))}),sZ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=eZ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=eZ(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},_I(Object.assign({},y)));var y;const b=iZ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=iZ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=iZ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=iZ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},nZ=t=>"left"===t||"right"===t,rZ=t=>"top"===t||"bottom"===t,aZ={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class oZ extends gj{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},sZ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},sZ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new XL(t):this._playerComponent=new qL(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=nZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=nZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(VL.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(VL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(VL.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(VL.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(VL.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(VL.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=nZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=rZ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):nZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):rZ(this._orient)?this._maxSize():t.height}_computeDx(t){return nZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return rZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}oZ.builtInTheme={player:aZ},oZ.specKey="player",oZ.type=r.player;class lZ extends gj{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=ER({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==dD.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}lZ.type=r.label;class hZ extends XN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}hZ.type="text",hZ.constructorType="label";const cZ=()=>{$N(),aO.registerMark(hZ.constructorType,hZ)};class dZ extends pj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class uZ extends lZ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=dZ,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(AI.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(AI.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),fR(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=rO({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},uN(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[$O])):t=>t.filter((t=>t.data[XO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?pN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}uZ.type=r.label,uZ.specKey="label",uZ.transformerConstructor=dZ;class pZ extends lZ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[GO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return rO({textStyle:{pickable:!0===this._spec.interactive},position:gZ(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[$O]:t.data[XO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>pN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function gZ(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}pZ.type=r.totalLabel,pZ.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},pZ.specKey="totalLabel";class fZ extends Nq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Fq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R,O;const{itemContent:I={},itemLine:D={},targetSymbol:F={}}=this._spec,z=I,{type:H="text",text:V,symbol:N,image:U,richText:W,customMark:G,textStyle:Y,symbolStyle:X,imageStyle:$,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=z,Q=e(z,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:J,it={dx:0,dy:0},et=Eq(Object.assign(Object.assign({},V),{style:j(it,null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==W?void 0:W.state)&&void 0!==r?r:J,it={width:100,height:100},et=Pq(j(it,null!==(o=null!==(a=null==W?void 0:W.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==N?void 0:N.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=_I(Pq(j(it,null!==(c=null!==(h=null==N?void 0:N.style)&&void 0!==h?h:X)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==U?void 0:U.state)&&void 0!==d?d:J,it={width:80,height:80},et=Pq(j(it,null!==(p=null!==(u=null==U?void 0:U.style)&&void 0!==u?u:$)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=Pq(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:Lq(I.offsetX,this._relativeSeries.getRegion()),offsetY:Lq(I.offsetX,this._relativeSeries.getRegion())},Q),{style:Pq(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(A=F.size)&&void 0!==A?A:20,style:Pq(F.style,this._markerData,this._markAttributeContext)},state:{line:Bq(null!==(M=null===(k=this._spec.itemLine.line)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(w=null===(T=this._spec.itemLine.startSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(E=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext),itemContent:Bq(tt,this._markerData,this._markAttributeContext),textBackground:Bq(null===(P=null===(B=this._spec.itemContent.text)||void 0===B?void 0:B.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:Bq(null!==(R=null===(L=this._spec.targetSymbol)||void 0===L?void 0:L.state)&&void 0!==R?R:{},this._markerData,this._markAttributeContext)},animation:null!==(O=this._spec.animation)&&void 0!==O&&O,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=e(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:_I(rt.style)}):{visible:!1};return new lL(st)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Cq([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:Rq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:Rq(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=Fq(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}fZ.specKey="markPoint";const mZ={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class vZ extends fZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=xq(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=kq(n,r,h,s.coordinatesOffset)[0]:l&&(c=wq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Fq(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}vZ.type=r.markPoint,vZ.coordinateType="cartesian",vZ.builtInTheme={markPoint:mZ};class _Z extends fZ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=Aq(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:he({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}_Z.type=r.polarMarkPoint,_Z.coordinateType="polar",_Z.builtInTheme={polarMarkPoint:mZ};class yZ extends fZ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}yZ.type=r.geoMarkPoint,yZ.coordinateType="geo",yZ.builtInTheme={geoMarkPoint:mZ};const bZ="inBrush",xZ="outOfBrush";class SZ extends gj{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return bF(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),bZ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),xZ,t.AttributeLevel.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new tR(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:_I(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener($L.brushActive,(s=>{this._initMarkBrushState(i,xZ),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener($L.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($L.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($L.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($L.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($L.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener($L.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener($L.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},_I(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(bZ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(bZ),i.addState(xZ,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(bZ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(bZ),i.addState(xZ,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Be(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(bZ),s.removeState(xZ),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}SZ.type=r.brush,SZ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},SZ.specKey="brush";class AZ extends gj{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${BO}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=KF({},qF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new He).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new He;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}AZ.type=r.customMark,AZ.specKey="customMark";class kZ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>MZ(t))),a=n.filter((t=>!MZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>MZ(t))),h=o.filter((t=>!MZ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function MZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}kZ.type="grid";const TZ="vchart-tooltip",wZ=`${TZ}-container`,CZ=`${TZ}-title`,EZ=`${TZ}-content-box`,BZ={offsetX:10,offsetY:10},PZ="99999999999999";function LZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const RZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,OZ=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?LZ(t):"",IZ=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},DZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},FZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=DZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class zZ extends Nz{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=kF(null==T?void 0:T.position,b,e),C=null!==(r=kF(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:PO,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:LO;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=ib(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=RZ(e,F),V=RZ(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(FZ(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},$=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=IZ(t,_),W.top=IZ(i,_),W.right=IZ(e,_),W.bottom=IZ(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&$.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=IZ(e,_):X(e,t)}));else p(w)&&(X({orient:w,mode:C},"x"),X({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=FZ(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",HZ=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=jZ(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=jZ(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},VZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?UR(e,t.fontSize):0},NZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=ri(r),a.padding=jZ(o)),{panelStyle:a,panelPadding:o}};function UZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const WZ=t=>{aO.registerComponentPlugin(t.type,t)};class GZ extends zZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(GZ.type),this.type=zH.dom,this._tooltipContainer=null==eb?void 0:eb.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(eb&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=NZ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:jZ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=HZ(h),x=HZ(d),S=HZ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=jZ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=jZ(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=jZ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(VZ(p),VZ(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(CZ))),l=a.find((t=>t.className.includes(EZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(CZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(UZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${TZ}-column`),e.classList.add(`${TZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(EZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];UZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));UZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${TZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=OZ(e.key),e.keyStyle&&HZ(e.keyStyle,l)):"value"===i?(o.innerHTML=OZ(e.value),e.valueStyle&&HZ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?LZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?LZ(c):m,y=p,b=t=>new wg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new He));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=mh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?LZ(u):"currentColor",`\n \n \n \n `;const w=T?mh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),UZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(EZ))),h=[...o.children].find((t=>t.className.includes(CZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(CZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=UR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,UZ(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},gf||(gf=uf.CreateGraphic("richtext",{})),gf.setAttributes(a),gf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function $Z(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:YZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const KZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class qZ extends zZ{constructor(){super(qZ.type),this.type=zH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new rR({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ri(d.padding),b=YR(d.padding),x=$Z(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=$Z(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=$Z(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},M={panel:KZ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=rO({},S,$Z(b,void 0,{})),{width:s,height:n,text:r}=XZ(h,i);T.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(m)){const t=rO({},A,$Z(x,void 0,{})),{width:e,height:s,text:n}=XZ(m,t);T.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=rO({},x,$Z(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=XZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-I-L-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}qZ.type=zH.canvas;const ZZ=()=>{WZ(qZ)},JZ=(t="chart",e,i)=>{var s,n,a,o,l,h,c,d,u,p,g;const f={modelInfo:[]};if("chart"===t)f.isChart=!0,f.modelInfo.push({spec:e,type:"chart"});else if("region"===t)f.modelType="region",f.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(xR).includes(t))f.modelType="series",f.specKey="series",f.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&f.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=aO.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=Y(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=Y(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=aO.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=Y(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);Y(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},QZ=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=JZ(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||Y(e).some((e=>d(e)?e(t,i,s):eO(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=rO({},i),m=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:rO(f,m),hasChanged:!0};const i=rO({},t,m);iO(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);y(f[c])?f[c].push(t):u(f[c])?f[c]="component"===h?t:[t]:f[c]=[f[c],t]}return{chartSpec:f,hasChanged:!0}},tJ=t=>{aO.registerChartPlugin(t.type,t)};class eJ extends Nz{constructor(){super(eJ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[eJ.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[eJ.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=nO(this._option.globalInstance.getSpec(),["data",eJ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=nO(this._baseChartSpec,["data",eJ.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(p(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(p(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(p(t.minWidth)&&e.width{const n=QZ(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=nO(i,["data",eJ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}eJ.pluginType="chart",eJ.specKey="media",eJ.type="MediaQueryPlugin";const iJ=/\{([^}]+)\}/,sJ=/\{([^}]+)\}/g,nJ=/:/;class rJ extends Nz{constructor(){super(rJ.type),this.type="formatterPlugin",this._timeModeFormat={utc:fi.getInstance().timeUTCFormat,local:fi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ai.getInstance().format,this._numericSpecifier=Ai.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[rJ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),aO.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=iJ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(sJ,((t,i)=>{if(!nJ.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(bi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}rJ.pluginType="chart",rJ.specKey="formatter",rJ.type="formatterPlugin";class aJ extends Nz{constructor(){super(aJ.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[aJ.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=NV(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom{UH(),GH(),XH(),bH(),yH(),nH(),Kj(),Pz(),Rz(),sF(),tF(),Nj(),zj(),aO.registerSeries(rH.type,rH),aO.registerChart($H.type,$H)},()=>{UH(),GH(),XH(),yH(),nH(),Kj(),Pz(),ZH(),Rz(),tV(),Nj(),zj(),aO.registerSeries(iV.type,iV),bH(),aO.registerChart(nV.type,nV)},()=>{UH(),GH(),XH(),yH(),_V(),bH(),aO.registerChart(bV.type,bV)},()=>{UH(),GH(),bH(),yH(),BV(),aO.registerChart(LV.type,LV)},()=>{GH(),wU(),aO.registerChart(x$.type,x$)},()=>{UH(),GH(),bH(),yH(),GU(),aO.registerChart(k$.type,k$)},()=>{UH(),GH(),XH(),bH(),yH(),tW(),aO.registerChart(T$.type,T$)},()=>{UH(),GH(),XH(),bH(),yH(),_V(),aO.registerTransform("bin",$r),aO.registerChart(L$.type,L$)},()=>{GH(),XV(),FV(),aO.registerSeries(KV.type,KV),aO.registerImplement("registerMap",FI),aO.registerImplement("unregisterMap",zI),eF(),aO.registerChart(f$.type,f$)},()=>{GH(),RX(),aO.registerSeries(IX.type,IX),xU(),fW(),VU(),_W(),aO.registerChart(D$.type,D$)},()=>{GH(),aY(),aO.registerChart(j$.type,j$)},()=>{GH(),TY(),aO.registerChart(V$.type,V$)},()=>{UH(),GH(),XH(),bH(),yH(),kN(),aO.registerChart(Q$.type,Q$)},()=>{UH(),GH(),bH(),yH(),YN(),aO.registerTransform("boxplot",Kr),aO.registerChart(eK.type,eK)},()=>{UH(),GH(),bH(),yH(),_W(),aO.registerChart(O$.type,O$)},()=>{UH(),GH(),bH(),yH(),MW(),aO.registerChart(U$.type,U$)},()=>{UH(),GH(),bH(),yH(),sU(),aO.registerChart(G$.type,G$)},()=>{UH(),GH(),XH(),bH(),yH(),ZH(),Nj(),zj(),aO.registerSeries(lU.type,lU),aO.registerChart(rK.type,rK)},()=>{GH(),WY(),aO.registerChart(X$.type,X$)},()=>{GH(),qY(),aO.registerChart(K$.type,K$)},()=>{GH(),AX(),aO.registerChart(Z$.type,Z$)},()=>{GH(),bo.load(CM),fX(),aO.registerChart(sK.type,sK)},()=>{GH(),NX(),aO.registerChart(oK.type,oK)},()=>{GH(),e$(),aO.registerChart(hK.type,hK)},()=>{UH(),GH(),XH(),bH(),aO.registerChart(C$.type,C$),yH()},zj,Nj,()=>{aO.registerGraphicComponent(fj.lineAxis,((t,e)=>new jC(t,e))),aO.registerGraphicComponent(mj.lineAxisGrid,((t,e)=>new KB(t,e))),xj(),aO.registerComponent(Uj.type,Uj)},()=>{aO.registerGraphicComponent(fj.lineAxis,((t,e)=>new jC(t,e))),aO.registerGraphicComponent(mj.lineAxisGrid,((t,e)=>new KB(t,e))),xj(),aO.registerComponent(Wj.type,Wj)},()=>{aO.registerGraphicComponent(fj.lineAxis,((t,e)=>new jC(t,e))),aO.registerGraphicComponent(mj.lineAxisGrid,((t,e)=>new KB(t,e))),xj(),aO.registerComponent(Gj.type,Gj)},UU,VU,()=>{aO.registerComponent(gK.type,gK)},()=>{aO.registerComponent(TK.type,TK)},()=>{aO.registerComponent(FK.type,FK)},()=>{aO.registerComponent(UK.type,UK)},()=>{aO.registerComponent(WK.type,WK)},()=>{aO.registerComponent(rq.type,rq)},()=>{aO.registerComponent(oq.type,oq)},()=>{aO.registerComponent(dq.type,dq)},XV,()=>{aO.registerComponent($q.type,$q),eL()},()=>{aO.registerComponent(Qq.type,Qq),sL()},()=>{aO.registerComponent(vZ.type,vZ),oL()},()=>{aO.registerComponent(Kq.type,Kq),rL._animate=DP,eL()},()=>{aO.registerComponent(tZ.type,tZ),aL._animate=zP,sL()},()=>{aO.registerComponent(_Z.type,_Z),oL()},()=>{aO.registerComponent(yZ.type,yZ),oL()},()=>{aO.registerComponent(qq.type,qq)},()=>{aO.registerComponent(oZ.type,oZ)},()=>{aO.registerGraphicComponent(uZ.type,(t=>new GB(t))),cZ(),_j(),aO.registerComponent(uZ.type,uZ,!0,1/0)},()=>{aO.registerGraphicComponent(pZ.type,(t=>new GB(t))),cZ(),_j(),aO.registerComponent(pZ.type,pZ,!0)},()=>{aO.registerComponent(SZ.type,SZ)},()=>{aO.registerComponent(AZ.type,AZ)},()=>{bo.load(vT)},()=>{aO.registerLayout(kZ.type,kZ)},ZZ,hF,uF]),gF.useRegisters([()=>{_A(bo)}]),t.AxisSyncPlugin=Uz,t.CanvasTooltipHandler=qZ,t.ChartResizeZoomPlugin=aJ,t.DEFAULT_CHART_HEIGHT=LO,t.DEFAULT_CHART_WIDTH=PO,t.DEFAULT_CLOSE_STROKE_JOIN=vF,t.DEFAULT_DATA_INDEX=OO,t.DEFAULT_DATA_KEY=IO,t.DEFAULT_DATA_SERIES_FIELD=DO,t.DEFAULT_KEY=eI,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=mF,t.DEFAULT_MAP_LOOK_UP_KEY=iI,t.DEFAULT_MEASURE_CANVAS_ID=RO,t.DEFAULT_SERIES_STYLE_NAME=FO,t.DEFAULT_SMOOTH_INTERPOLATE=fF,t.DomTooltipHandler=GZ,t.Factory=aO,t.FormatterPlugin=rJ,t.MOSAIC_CAT_END_PERCENT=JO,t.MOSAIC_CAT_START_PERCENT=ZO,t.MOSAIC_VALUE_END_PERCENT=qO,t.MOSAIC_VALUE_START_PERCENT=KO,t.ManualTicker=class extends bw{constructor(t){super(t),this.lastFrameTime=0,this.status=Lo.RUNNING}setupTickHandler(){const t=new xw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Lo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Lo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Lo.RUNNING,!0}},t.MediaQuery=eJ,t.PREFIX=BO,t.SEGMENT_FIELD_END=tI,t.SEGMENT_FIELD_START=QO,t.STACK_FIELD_END=HO,t.STACK_FIELD_END_OffsetSilhouette=WO,t.STACK_FIELD_END_PERCENT=NO,t.STACK_FIELD_KEY=zO,t.STACK_FIELD_START=jO,t.STACK_FIELD_START_OffsetSilhouette=UO,t.STACK_FIELD_START_PERCENT=VO,t.STACK_FIELD_TOTAL=GO,t.STACK_FIELD_TOTAL_BOTTOM=$O,t.STACK_FIELD_TOTAL_PERCENT=YO,t.STACK_FIELD_TOTAL_TOP=XO,t.StreamLight=class extends Iw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=So.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Ul,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=So.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Ko.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Ko.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=hl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=hl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{tJ(aJ)},t.registerDataSetInstanceParser=RI,t.registerDataSetInstanceTransform=LI,t.registerDomTooltipHandler=()=>{WZ(GZ)},t.registerFormatPlugin=()=>{tJ(rJ)},t.registerMediaQuery=()=>{tJ(eJ)},t.registerTheme=mO,t.removeTheme=_O,t.themeExist=yO,t.themes=pO,t.token=JR,t.transformColorSchemeToStandardStruct=LR,t.transformToGraphic=_I,t.version="2.0.22",t.vglobal=O_,t.warn=Zy,Object.defineProperty(t,"__esModule",{value:!0})})); +let DJ=class t extends kJ{constructor(e){super(H({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),y=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=y*this.gridSize;const _=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,_,b);const C=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let M,w=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;w--;)for(M=x;M--;)B(w,M,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:_,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?RJ(t,o,l.width,l.height,h):"geometric"===t.type&&LJ(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=bJ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};DJ.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class FJ extends kJ{constructor(t){super(H({},FJ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}FJ.defaultOptions={enlarge:!1};const HJ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},jJ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.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?NJ(t.fontFamily):"sans-serif",d=t.fontStyle?NJ(t.fontStyle):"normal",u=t.fontWeight?NJ(t.fontWeight):"normal",p=t.rotate?NJ(t.rotate):0,g=NJ(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?NJ(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",y=null!==(r=t.shrink)&&void 0!==r&&r,_=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},HJ),t.as):HJ,C=t.depth_3d,T=t.postProjection;let M=t.fontSize?NJ(t.fontSize):14;const w=t.fontSizeRange;if(w&&!S(M)){const t=M,e=VJ(WJ(t,l),w);M=i=>e(t(i))}let E=TJ;"fast"===t.layoutType?E=FJ:"grid"===t.layoutType&&(E=DJ);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:M,shrink:y,clip:b,enlarge:_,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},NJ=t=>y(t)||S(t)||d(t)||_(t)?t:e=>e[t.field],UJ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),VJ=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=UJ(t[0]),n=UJ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(UJ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},WJ=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function GJ(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{cT.registerGrammarTransform("wordcloud",{transform:jJ}),T$(),cT.registerAnimation("wordCloud",((t,e)=>({appear:AZ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:Rz.disappear.duration}}))),cT.registerSeries(YJ.type,YJ)},KJ=t=>d(t)?t():t,$J=(t,e)=>{var i,s,n,r;const a=t.map((t=>Object.assign({},t)));if(!a||0===a.length)return a;const{asTransformRatio:o,asReachRatio:l,asHeightRatio:h,asValueRatio:c,asNextValueRatio:d,asLastValueRatio:u,asLastValue:p,asCurrentValue:g,asNextValue:f}=e,m=KJ(e.valueField),v=null!==(i=KJ(e.heightVisual))&&void 0!==i&&i,y=null===(s=KJ(e.isCone))||void 0===s||s,_=KJ(e.range),b=a.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[m])||-1/0)),-1/0),x=a.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[m])||1/0)),1/0),S=[null!==(n=null==_?void 0:_.min)&&void 0!==n?n:x,null!==(r=null==_?void 0:_.max)&&void 0!==r?r:b];return a.forEach(((t,e)=>{var i,s;const n=Number.parseFloat(t[m]),r=Number.parseFloat(null===(i=a[e-1])||void 0===i?void 0:i[m]),_=Number.parseFloat(null===(s=a[e+1])||void 0===s?void 0:s[m]),b=k(_*n)&&0!==n?_/n:0,x=k(n*r)&&0!==r?n/r:0;p&&(t[p]=r),f&&(t[f]=_),o&&(t[o]=b),l&&(t[l]=0===e?1:x),h&&(t[h]=!0===v?b:1/a.length),c&&(t[c]=n/S[1]),d&&(t[d]=e===a.length-1?y?0:t[c]:_/S[1]),u&&(t[u]=0===e?1:r/S[1]),g&&(t[g]=n)})),a},qJ=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},ZJ=`${IT}_FUNNEL_TRANSFORM_RATIO`,JJ=`${IT}_FUNNEL_REACH_RATIO`,QJ=`${IT}_FUNNEL_HEIGHT_RATIO`,tQ=`${IT}_FUNNEL_VALUE_RATIO`,eQ=`${IT}_FUNNEL_LAST_VALUE_RATIO`,iQ=`${IT}_FUNNEL_NEXT_VALUE_RATIO`,sQ=`${IT}_FUNNEL_LAST_VALUE`,nQ=`${IT}_FUNNEL_CURRENT_VALUE`,rQ=`${IT}_FUNNEL_NEXT_VALUE`,aQ=`${IT}_FUNNEL_TRANSFORM_LEVEL`;class oQ extends gH{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[JJ])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class lQ extends mz{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class hQ extends lQ{constructor(){super(...arguments),this.type=hQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}hQ.type="polygon";const cQ=()=>{cT.registerMark(hQ.type,hQ),qO(),jO(),aI.registerBuiltInAnimate("growPointsOut",XI),cT.registerGraphicComponent("polygon",af)},dQ=Object.assign(Object.assign({},TH),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class uQ extends UH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class pQ extends $H{constructor(){super(...arguments),this.type=CC.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=uQ,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;HM(this._dataSet,"funnel",$J),HM(this._dataSet,"funnelTransform",qJ);const t=new Oa(this._dataSet,{name:`${IT}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new YF(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:()=>this.getValueField(),isCone:()=>this._spec.isCone,asCurrentValue:nQ,asTransformRatio:ZJ,asReachRatio:JJ,asHeightRatio:QJ,asValueRatio:tQ,asNextValueRatio:iQ,asLastValueRatio:eQ,asLastValue:sQ,asNextValue:rQ,range:()=>this._spec.range}}),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.transform({type:"funnelTransform",options:{asIsTransformLevel:aQ}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},pQ.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:zH(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},pQ.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(pQ.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(pQ.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new oQ(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&oA(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&oA(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*Ak(JJ).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(IH(null===(s=cT.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),LH("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(IH(cT.getAnimationInKey("fadeInOut")(),LH(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(IH(cT.getAnimationInKey("funnel")({},o),LH(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(IH(null===(a=cT.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),LH("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[eQ])/2:this._getSecondaryAxisLength(t[tQ])/2,n=this._getSecondaryAxisLength(t[tQ])/2):(s=this._getSecondaryAxisLength(t[tQ])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[iQ])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[aQ])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[HT]===t[HT]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_{cQ(),T$(),IK(),cT.registerSeries(pQ.type,pQ),cT.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},Iz))),cT.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:wz,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),Dz()},fQ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},mQ=t=>{const e=t.filter((t=>t.context.diffState===bF.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},vQ=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},yQ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=mQ(i.parent.children),a=vQ(r,s,n);return fQ(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=mQ(i.parent.children),a=vQ(r,s,n);return fQ(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),_Q=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},bQ=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=mQ(i.parent.children),a=_Q(r);return fQ(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=mQ(i.parent.children),a=_Q(r);return fQ(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),xQ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},SQ=(t,e={})=>{if(!t)return[];const i=[];return MZ(t,i,e),i},AQ=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new eJ(i).layout(t,{width:s,height:n})};class kQ extends gH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var CQ;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(CQ||(CQ={}));const TQ=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===CQ.DrillDown){return Y(mM(t,n,s,"children"))}if(i.type===CQ.DrillUp){const e=vM(t,n,s,"children");if(e)return Y(e)}return t};class MQ{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=yK(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;HM(t,"drillFilter",TQ),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!_(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:CQ.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:CQ.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!_(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:CQ.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:CQ.DrillUp},model:this}),r}}const wQ=Object.assign(Object.assign({},TH),{sunburst:{name:"sunburst",type:"arc"}}),EQ=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:_H,operations:["max","min","values"]}),t.push({key:bH,operations:["values"]}),t),BQ={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class PQ extends N${constructor(){super(...arguments),this.type=CC.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:bH),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:HT},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(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),HM(this._dataSet,"sunburstLayout",AQ),HM(this._dataSet,"flatten",SQ),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return EQ(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(HM(t.dataSet,"addVChartProperty",oH),t.transform({type:"addVChartProperty",options:{beforeCall:kH.bind(this),call:CH}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(PQ.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(PQ.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new kQ(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(IH(null===(e=cT.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),LH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(IH(null===(e=cT.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),LH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}PQ.type=CC.sunburst,PQ.mark=wQ,PQ.builtInTheme={sunburst:BQ},G(PQ,MQ);const RQ=()=>{cT.registerSeries(PQ.type,PQ),Q$(),T$(),Dz(),cT.registerAnimation("sunburst",((t,e)=>({appear:xQ(0,e),enter:yQ(t),exit:bQ(t),disappear:{duration:Rz.disappear.duration}})))},OQ=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new VZ(i).layout(t,{width:s,height:n})};class IQ extends gH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const LQ=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},DQ=Object.assign(Object.assign({},TH),{circlePacking:{name:"circlePacking",type:"arc"}});class FQ extends JH{constructor(){super(...arguments),this.type=CC.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:bH),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:HT},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),HM(this._dataSet,"circlePackingLayout",OQ),HM(this._dataSet,"flatten",SQ),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(HM(t.dataSet,"addVChartProperty",oH),t.transform({type:"addVChartProperty",options:{beforeCall:kH.bind(this),call:CH}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(FQ.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(FQ.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return EQ(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new IQ(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(IH(null===(i=cT.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),LH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(IH(null===(e=cT.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),LH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}FQ.type=CC.circlePacking,FQ.mark=DQ,FQ.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(FQ,MQ);const zQ=()=>{cT.registerSeries(FQ.type,FQ),Q$(),T$(),Lz(),cT.registerAnimation("circlePacking",((t,e)=>({appear:LQ(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:Rz.disappear.duration}})))},HQ=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&HQ(t,e.children,i)}))},jQ=t=>{var e;if(!t||!_(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},NQ=(t,e)=>{const i=d(e)?e():e;if(!t||!(null==i?void 0:i.view)||!t.length)return[];const s=i.view();if(s.x1-s.x0==0||s.y1-s.y0==0||s.x1-s.x0==-1/0||s.x1-s.x0==1/0||s.y1-s.y0==-1/0||s.y1-s.y0==1/0)return[];const n=t[0],r=UQ(n,i),a=new JZ(i),o=[];return o.push(a.layout(r,s)),o},UQ=(t,e)=>{if("source"===e.sourceField&&"target"===e.targetField&&"value"===e.valueField)return t;const i=t.links;return i?Object.assign(Object.assign({},t),{links:i.map((t=>{const i={};return Object.keys(t).forEach((s=>{s===e.sourceField?i.source=t[e.sourceField]:s===e.targetField?i.target=t[e.targetField]:s===e.valueField?i.value=t[e.valueField]:i[s]=t[s]})),i}))}):t},VQ=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},WQ=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class GQ extends gH{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const YQ=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),XQ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:YQ(t),KQ=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class $Q extends CI{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class qQ extends CI{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const ZQ=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},JQ=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class QQ extends a${constructor(){super(...arguments),this.type=QQ.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?JQ:ZQ,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}QQ.type="linkPath";const t0=Object.assign(Object.assign({},TH),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class e0 extends UH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const i0=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&gz(t,e),pz(t,e,s,n)};class s0 extends JH{constructor(){super(...arguments),this.type=CC.sankey,this.transformerConstructor=e0,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ue,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{gz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),n.forEach((e=>{gz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=MM(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=MM(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),gz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),pz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),gz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),pz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(gz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),pz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=MM(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(gz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),i0(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(gz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),pz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=MM(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=MM(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=MM(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=MM(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(gz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),pz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(gz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),pz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=MM(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return gz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void i0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),gz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void i0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});gz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),pz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(MM(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{gz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._nodeMark&&i.forEach((e=>{gz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])}));else{const n=MM(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=MM(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return gz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void i0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return gz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void i0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),gz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void i0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});gz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),pz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){super.initData();const e=this.getViewData(),i=this.getRawData();if(i&&e){HM(this._dataSet,"sankeyLayout",NQ),HM(this._dataSet,"sankeyFormat",jQ),i.transform({type:"sankeyFormat"},!1),e.transform({type:"sankeyLayout",options:()=>{var t,e,i,s;return{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse}},level:t.TransformLevel.sankeyLayout});const{dataSet:s}=this._option;HM(s,"sankeyNodes",VQ),HM(s,"flatten",SQ);const n=new Oa(s,{name:`sankey-node-${this.id}-data`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyNodes"}),n.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),n.transform({type:"addVChartProperty",options:{beforeCall:SH.bind(this),call:AH}},!1),this._nodesSeriesData=n,HM(s,"sankeyLinks",WQ);const r=new Oa(s,{name:`sankey-link-${this.id}-data`});r.parse([this.getViewData()],{type:"dataview"}),r.transform({type:"sankeyLinks"}),r.transform({type:"addVChartProperty",options:{beforeCall:SH.bind(this),call:AH}},!1),this._linksSeriesData=r}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(s0.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(s0.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=nH(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(IH(null===(i=cT.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),LH("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(IH(null===(s=cT.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),LH("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:IM.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{gz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(MM(e).key)?pz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):pz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new GQ(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new zC;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return HQ(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}s0.type=CC.sankey,s0.transformerConstructor=e0,s0.mark=t0,s0.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const n0=()=>{jX(),o$(),zO(),cT.registerGraphicComponent("path",(t=>Ug(t))),cT.registerMark(QQ.type,QQ),T$(),cT.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:XQ(t,e)},Iz))),cT.registerAnimation("sankeyLinkPath",((t,e)=>({appear:KQ(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:Rz.disappear.duration}}))),aI.registerBuiltInAnimate("linkPathGrowOut",qQ),aI.registerBuiltInAnimate("linkPathGrowIn",$Q),Dz(),cT.registerSeries(s0.type,s0)},r0=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=SQ(n);return i=mH([{latestData:r}],e),i};class a0 extends gH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const o0=Object.assign(Object.assign({},TH),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),l0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class h0 extends UH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const c0=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();if(s){const e=new rJ(i).layout(t,s),n=[];return MZ(e,n,{maxDepth:null==i?void 0:i.maxDepth}),n.forEach((t=>{t&&[bH,"name"].forEach((e=>{t[e]=t.datum[t.depth][i.nameField]}))})),n}return[]};class d0 extends JH{constructor(){super(...arguments),this.type=CC.treemap,this.transformerConstructor=h0,this._categoryField="name",this._valueField="value",this._viewBox=new Ue,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:bH),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ge),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:HT},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t;super.initData(),HM(this._dataSet,"treemap",c0),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:()=>{var t,e,i,s;return{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(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!==(s=this._spec.minVisibleArea)&&void 0!==s?s:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(HM(this._rawData.dataSet,"addVChartProperty",oH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:kH.bind(this),call:CH}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=r0([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=H(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){HM(this._dataSet,"hierarchyDimensionStatistics",r0),HM(this._dataSet,"flatten",SQ);const i=new Oa(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 EQ(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(d0.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(d0.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(IH(null===(e=cT.getAnimationInKey("treemap"))||void 0===e?void 0:e(),LH(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new a0(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(BM.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(BM.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}d0.type=CC.treemap,d0.mark=o0,d0.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},d0.transformerConstructor=h0,G(d0,MQ),G(d0,bK);const u0=()=>{cT.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),cT.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),jX(),T$(),cT.registerAnimation("treemap",((t,e)=>({appear:l0(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:Rz.disappear.duration}}))),Dz(),cT.registerSeries(d0.type,d0)},p0=Object.assign(Object.assign({},Xq),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),g0=Object.assign(Object.assign({},TH),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),f0={type:"fadeIn"};function m0(t,e){return"fadeIn"===e?f0:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class v0 extends UH{constructor(){super(...arguments),this._supportStack=!1}}class y0 extends gH{enableByType(t){return"dimension"!==t}}const _0="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",b0={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:_0,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:_0,fill:"#ddd"}}};class x0 extends $q{constructor(){super(...arguments),this.type=CC.gaugePointer,this.transformerConstructor=v0,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(x0.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},x0.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(x0.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new y0(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=K(e),s=$(e),n=yt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(IH(null===(i=cT.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),LH("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}x0.type=CC.gaugePointer,x0.mark=g0,x0.builtInTheme={gaugePointer:b0},x0.transformerConstructor=v0;const S0=()=>{cT.registerSeries(x0.type,x0),pK(),jX(),cT.registerAnimation("gaugePointer",((t,e)=>{const i=m0(t,e);return{appear:i,enter:i,disappear:{duration:Rz.disappear.duration}}})),kq(),Sq()};class A0 extends UH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class k0 extends $q{constructor(){super(...arguments),this.type=CC.gauge,this.transformerConstructor=A0,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();HM(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[nM]=t[this._angleField[0]],t[sM]=e>0?i[e-1][nM]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(k0.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(k0.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?NC(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?NC(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[sM])?this.angleAxisHelper.dataToPosition([t[sM]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[nM]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(IH(null===(i=cT.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),LH("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}k0.type=CC.gauge,k0.mark=p0,k0.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},k0.transformerConstructor=A0;class C0 extends mz{constructor(){super(...arguments),this.type=C0.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return tg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}C0.type="cell";function T0(t){return!1===t?{}:{type:"fadeIn"}}class M0 extends gH{enableByType(t){return"dimension"!==t}}const w0=Object.assign(Object.assign({},TH),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class E0 extends UH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}const B0={valueField:!0};class P0 extends JH{constructor(){super(...arguments),this.type=CC.heatmap,this.transformerConstructor=E0}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),B0)})}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(P0.mark.cell,{isSeriesMark:!0},{morph:zH(this._spec,P0.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(P0.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=oi(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=ZH(this);this._cellMark.setAnimationConfig(IH(null===(i=cT.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),LH("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new M0(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}P0.type=CC.heatmap,P0.mark=w0,P0.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},P0.transformerConstructor=E0;const R0=()=>{T$(),cT.registerMark(C0.type,C0),cT.registerGraphicComponent("symbol",tg),qO(),tI(),aN(),cT.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},Iz),{appear:T0(e)}))),QU(),fV(),cT.registerSeries(P0.type,P0)},O0=Object.assign(Object.assign({},TH),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),I0=`${IT}_CORRELATION_X`,L0=`${IT}_CORRELATION_Y`,D0=`${IT}_CORRELATION_SIZE`,F0=t=>d(t)?t():t,z0=(t,e)=>{var i,s,n,r,a,o,l,h;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const c=t,d=e.view();if(d.x1-d.x0==0||d.y1-d.y0==0||d.x1-d.x0==-1/0||d.x1-d.x0==1/0||d.y1-d.y0==-1/0||d.y1-d.y0==1/0)return t;const p=oe(null!==(i=F0(e.startAngle))&&void 0!==i?i:-90),g=oe(null!==(s=F0(e.endAngle))&&void 0!==s?s:270),f=Math.max((d.x1-d.x0)/2,(d.y1-d.y0)/2),m=Rt(null!==(n=F0(e.innerRadius))&&void 0!==n?n:0,f),v=Rt(F0(e.outerRadius),f),y=F0(e.center),b=[S(null==y?void 0:y[0])?y[0]:d.x0+Rt(null!==(r=null==y?void 0:y[0])&&void 0!==r?r:"50%",d.x1-d.x0),S(null==y?void 0:y[1])?y[1]:d.y0+Rt(null!==(a=null==y?void 0:y[1])&&void 0!==a?a:"50%",d.y1-d.y0)],x=Pt(F0(e.field)),A=c.map(x),[k,C]=It(A),T=k===C?t=>(m+v)/2:t=>m+(v-m)*(t-k)/(C-k),M=F0(e.radiusField),w=F0(e.radiusRange),E=u(M)?x:Pt(M),B=null!==(o=null==w?void 0:w[1])&&void 0!==o?o:5;let P=t=>B;if(E){const[t,e]=E!==x?It(c.map(E)):[k,C],i=null!==(l=null==w?void 0:w[0])&&void 0!==l?l:5,s=null!==(h=null==w?void 0:w[1])&&void 0!==h?h:5;t!==e&&(P=n=>i+(s-i)*(E(n)-t)/(e-t))}const R=Math.min(p,g),O=Math.max(p,g),I=H0(R,O,c.length),L=[],D=(O-R)/60;return c.forEach(((t,e)=>{const i=T(A[e]),s=P(t);let n,r,a=I[e];for(let t=0;t<60&&(n=b[0]+i*Math.cos(a),r=b[1]+i*Math.sin(a),j0({x:n,y:r,size:s},L)||n-sd.x1||r-sd.y1);t++)t<59&&(a+=D,a>O?a=R:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},j0=(t,e)=>!(!e||!e.length)&&e.some((e=>{const i=e.x,s=e.y,n=e.size;return Math.pow(t.x-i,2)+Math.pow(t.y-s,2)d(t)?t():t,U0=(t,e)=>{if(!t||!_(t))return[];const i=N0(e.keyword),s=N0(e.categoryField),n=t[0].latestData[0];return{[s]:i,[zT]:null==n?void 0:n[zT],[jT]:null==n?void 0:n[jT]}};class V0 extends a${constructor(){super(...arguments),this.type=V0.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=yt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}V0.type="ripple";const W0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class G0 extends UH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class Y0 extends N${constructor(){super(...arguments),this.type=CC.correlation,this.transformerConstructor=G0,this._viewBox=new Ue}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){if(super.initData(),!this._data)return;HM(this._dataSet,"correlation",z0);const t=new Ra;jM(t,"dataview",Ea),HM(t,"correlationCenter",U0);const e=new Oa(t,{name:`${this.type}_${this.id}_center`});e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"correlationCenter",options:{keyword:()=>{var t,e,i;return null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:""},categoryField:()=>this._spec.categoryField}}),this._centerSeriesData=new YF(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:()=>this._spec.valueField,radiusRange:()=>this._spec.sizeRange,radiusField:()=>this._spec.sizeField,center:()=>[this._spec.centerX,this._spec.centerY],innerRadius:()=>this._spec.innerRadius,outerRadius:()=>this._spec.outerRadius,startAngle:()=>this._spec.startAngle,endAngle:()=>this._spec.endAngle}})}initMark(){const e=this._createMark(Y0.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:zT});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(Y0.mark.ripplePoint,{key:zT,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(Y0.mark.centerPoint,{key:zT,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[I0],y:t=>t[L0],size:t=>t[D0],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(IH(null===(e=cT.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),LH("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}Y0.type=CC.correlation,Y0.mark=O0,Y0.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},Y0.transformerConstructor=G0;const X0=()=>{cN(),o$(),tI(),cT.registerMark(V0.type,V0),cT.registerGraphicComponent("symbol",(t=>tg(t))),cT.registerSeries(Y0.type,Y0),cT.registerAnimation("correlation",((t,e)=>Object.assign({appear:W0(0,e)},Oz)))},K0=Object.assign(Object.assign({},TH),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class $0 extends a${constructor(){super(...arguments),this.type=$0.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}$0.type="liquid";const q0=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class Z0 extends gH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class J0 extends $H{constructor(){super(...arguments),this.type=CC.liquid,this.transformerConstructor=dN,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=og({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=tg({x:s,y:n,size:r,symbolType:q0(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=qC(this._spec.outlineMargin),this._paddingSpec=qC(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(J0.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(J0.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(J0.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(J0.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Z0(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(IH(null===(i=cT.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),LH("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(IH(null===(s=cT.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),LH("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=MA(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}J0.type=CC.liquid,J0.mark=K0,J0.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},J0.transformerConstructor=dN;const Q0=t=>Y(t).join(",");class t1 extends gH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>Q0(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>Q0(null==t?void 0:t[this.series.getDimensionField()[0]])}}const e1=Object.assign(Object.assign({},TH),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class i1 extends UH{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const s1=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();return s&&(null==t?void 0:t.length)?vJ(Object.assign({setField:i.setField,valueField:i.valueField},s),t):[]};class n1 extends $H{constructor(){super(...arguments),this.type=CC.venn,this.transformerConstructor=i1,this._viewBox=new Ue}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:HT)}initData(){var t;super.initData(),HM(this._dataSet,"venn",s1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:()=>({getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField})})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(n1.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(n1.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Q0(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Q0(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new t1(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:Q0(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return Q0(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[Q0(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(Q0(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(IH(null===(e=cT.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),LH(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(IH(null===(e=cT.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),LH(t.name,this._spec,this._markAttributeContext)))}))}}n1.type=CC.venn,n1.mark=e1,n1.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},n1.transformerConstructor=i1;class r1 extends YX{constructor(){super(...arguments),this.type=CC.mosaic,this.transformerConstructor=WX}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(tM),this.setFieldX2(QT)),this.setFieldY(iM),this.setFieldY2(eM)):(t&&(this.setFieldY(tM),this.setFieldY2(QT)),this.setFieldX(iM),this.setFieldX2(eM)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}r1.type=CC.mosaic,r1.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},r1.transformerConstructor=WX;class a1 extends zV{_isValidSeries(t){return t===CC.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class o1 extends LV{constructor(){super(...arguments),this.transformerConstructor=a1,this.type="map",this.seriesType=CC.map}}o1.type="map",o1.seriesType=CC.map,o1.transformerConstructor=a1;class l1 extends zV{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class h1 extends l1{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY","clamp"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=MN(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,hT({},s,l)),n&&Object.assign(o,hT({},n,o))}}class c1 extends l1{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class d1 extends l1{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class u1 extends LV{constructor(){super(...arguments),this.transformerConstructor=d1}}u1.transformerConstructor=d1;class p1 extends u1{constructor(){super(...arguments),this.transformerConstructor=d1,this.type="pie",this.seriesType=CC.pie}}p1.type="pie",p1.seriesType=CC.pie,p1.transformerConstructor=d1;class g1 extends c1{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["radius","outerRadius","innerRadius"]),n.radius=null!==(e=t.radius)&&void 0!==e?e:VN,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:VN,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>hT({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const f1=(t,e)=>{if(!t)return null;const i=uj(t,(t=>"angle"===t.getOrient()),e),s=uj(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Ek(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=vk({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=K(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=yk(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=cj(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Ek(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=vk({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=yk(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=cj(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class m1 extends LV{constructor(){super(...arguments),this.transformerConstructor=g1,this.type="rose",this.seriesType=CC.rose}_setModelOption(){this._modelOption.getDimensionInfo=f1}}m1.type="rose",m1.seriesType=CC.rose,m1.transformerConstructor=g1,G(m1,VV);class v1 extends c1{_getDefaultSeriesSpec(t){var e,i,s,n;const r=super._getDefaultSeriesSpec(t),a=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e,"series","radar","area");return this._addSeriesRelatedSpecKeys(["line","point","area"]),r.line=t.line,r.point=t.point,r.stack=t.stack,r.percent=t.percent,r.area=hT({visible:null!==(s=null==a?void 0:a.visible)&&void 0!==s&&s},t.area),r.seriesMark=null!==(n=t.seriesMark)&&void 0!==n?n:"area",r.activePoint=t.activePoint,r.pointDis=t.pointDis,r.pointDisMul=t.pointDisMul,r.markOverlap=t.markOverlap,r}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>hT({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class y1 extends LV{constructor(){super(...arguments),this.transformerConstructor=v1,this.type="radar",this.seriesType=CC.radar}_setModelOption(){this._modelOption.getDimensionInfo=f1}}y1.type="radar",y1.seriesType=CC.radar,y1.transformerConstructor=v1,G(y1,VV);class _1 extends zV{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&hT(e,mF(this.type,t))})),this._transformAxisSpec(t)}}class b1 extends LV{constructor(){super(...arguments),this.transformerConstructor=_1,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=QV(t,e,i))&&void 0!==s?s:[],...null!==(n=f1(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=eW,this._modelOption.getRectByDimensionData=oW}}b1.type="common",b1.transformerConstructor=_1,G(b1,VV);class x1 extends HV{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class S1 extends LV{constructor(){super(...arguments),this.transformerConstructor=x1}}S1.transformerConstructor=x1,G(S1,VV);class A1 extends x1{transformSpec(t){super.transformSpec(t),cF(t)}}class k1 extends S1{constructor(){super(...arguments),this.transformerConstructor=A1,this.type="histogram",this.seriesType=CC.bar}_setModelOption(){this._modelOption.getDimensionInfo=QV,this._modelOption.getDimensionInfoByValue=eW,this._modelOption.getRectByDimensionData=oW}}k1.type="histogram",k1.seriesType=CC.bar,k1.transformerConstructor=A1;class C1 extends h1{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["cornerRadius","progress","track","roundCap"]),s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class T1 extends LV{constructor(){super(...arguments),this.transformerConstructor=C1,this.type="circularProgress",this.seriesType=CC.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=f1}}T1.type="circularProgress",T1.seriesType=CC.circularProgress,T1.transformerConstructor=C1,G(T1,VV);class M1 extends h1{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["pin","pinBackground","pointer"]),e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=CC.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===CC.gauge||t.type===CC.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===CC.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class w1 extends LV{constructor(){super(...arguments),this.transformerConstructor=M1,this.type="gauge",this.seriesType=CC.gaugePointer}}w1.type="gauge",w1.seriesType=CC.gaugePointer,w1.transformerConstructor=M1;class E1 extends zV{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class B1 extends LV{constructor(){super(...arguments),this.transformerConstructor=E1,this.type="wordCloud",this.seriesType=CC.wordCloud}}B1.transformerConstructor=E1;class P1 extends B1{constructor(){super(...arguments),this.transformerConstructor=E1,this.type="wordCloud",this.seriesType=CC.wordCloud}}P1.type="wordCloud",P1.seriesType=CC.wordCloud,P1.transformerConstructor=E1;class R1 extends zV{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class O1 extends LV{constructor(){super(...arguments),this.transformerConstructor=R1,this.type="funnel",this.seriesType=CC.funnel}}O1.type="funnel",O1.seriesType=CC.funnel,O1.transformerConstructor=R1;class I1 extends HV{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",this._addSeriesRelatedSpecKeys(["cornerRadius"]),s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=MN(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=MN(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class L1 extends LV{constructor(){super(...arguments),this.transformerConstructor=I1,this.type="linearProgress",this.seriesType=CC.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=QV,this._modelOption.getDimensionInfoByValue=eW,this._modelOption.getRectByDimensionData=oW}}L1.type="linearProgress",L1.seriesType=CC.linearProgress,L1.transformerConstructor=I1,G(L1,VV);class D1 extends HV{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),cF(t)}}class F1 extends LV{constructor(){super(...arguments),this.transformerConstructor=D1,this.type="rangeColumn",this.seriesType=CC.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=QV,this._modelOption.getDimensionInfoByValue=eW,this._modelOption.getRectByDimensionData=oW}}F1.type="rangeColumn",F1.seriesType=CC.rangeColumn,F1.transformerConstructor=D1;class z1 extends zV{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class H1 extends LV{constructor(){super(...arguments),this.transformerConstructor=z1,this.type="sunburst",this.seriesType=CC.sunburst}}H1.type="sunburst",H1.seriesType=CC.sunburst,H1.transformerConstructor=z1;class j1 extends zV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class N1 extends LV{constructor(){super(...arguments),this.transformerConstructor=j1,this.type="circlePacking",this.seriesType=CC.circlePacking}}N1.type="circlePacking",N1.seriesType=CC.circlePacking,N1.transformerConstructor=j1;class U1 extends zV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class V1 extends LV{constructor(){super(...arguments),this.transformerConstructor=U1,this.type="treemap",this.seriesType=CC.treemap}}V1.type="treemap",V1.seriesType=CC.treemap,V1.transformerConstructor=U1;class W1 extends KX{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),cF(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["bar","stackLabel","leaderLine","total","calculationMode"]),e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class G1 extends $X{constructor(){super(...arguments),this.transformerConstructor=W1,this.type="waterfall",this.seriesType=CC.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=QV,this._modelOption.getDimensionInfoByValue=eW,this._modelOption.getRectByDimensionData=oW}}G1.type="waterfall",G1.seriesType=CC.waterfall,G1.transformerConstructor=W1;class Y1 extends HV{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),cF(t)}}class X1 extends LV{constructor(){super(...arguments),this.transformerConstructor=Y1,this.type="boxPlot",this.seriesType=CC.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=QV,this._modelOption.getDimensionInfoByValue=eW,this._modelOption.getRectByDimensionData=oW}}X1.type="boxPlot",X1.seriesType=CC.boxPlot,X1.transformerConstructor=Y1;class K1 extends zV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class $1 extends LV{constructor(){super(...arguments),this.transformerConstructor=K1,this.type="sankey",this.seriesType=CC.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=MM(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}$1.type="sankey",$1.seriesType=CC.sankey,$1.transformerConstructor=K1;class q1 extends HV{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["area","point","line"]),s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),cF(t)}}class Z1 extends LV{constructor(){super(...arguments),this.transformerConstructor=q1,this.type="rangeArea",this.seriesType=CC.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=QV,this._modelOption.getDimensionInfoByValue=eW,this._modelOption.getRectByDimensionData=oW}}Z1.type="rangeArea",Z1.seriesType=CC.rangeArea,Z1.transformerConstructor=q1;class J1 extends HV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class Q1 extends LV{constructor(){super(...arguments),this.transformerConstructor=J1,this.type="heatmap",this.seriesType=CC.heatmap}}Q1.type="heatmap",Q1.seriesType=CC.heatmap,Q1.transformerConstructor=J1;class t2 extends zV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class e2 extends LV{constructor(){super(...arguments),this.transformerConstructor=t2,this.type="correlation",this.seriesType=CC.correlation}}e2.type="correlation",e2.seriesType=CC.correlation,e2.transformerConstructor=t2;function i2(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=kM(t.style)),P(t.textStyle)||hT(s.textStyle,kM(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&kM(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&kM(s.background.style),s}function s2(t){const e=t=>function(t){return p(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:p(t.texturePadding)?t.texturePadding:1,textureSize:p(t.textureSize)?t.textureSize:4}):t}(t);if(d(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else P(t.style)||(t.style=e(t.style));return P(t.state)||Object.keys(t.state).forEach((i=>{if(d(t.state[i])){const s=t.state[i];t.state[i]=(...t)=>e(s(...t))}else P(t.state[i])||(t.state[i]=e(t.state[i]))})),t}const n2=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},r2=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:jT;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)},a2={position:!0,item:!0,title:!0,pager:!0,background:!0};class o2 extends $N{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{bk(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),bk(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=WC(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const s=!V(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):s&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(s&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,s=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>V(null==i?void 0:i[t],null==s?void 0:s[t])||a2[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new YF(this._option,e),this._initSelectedData(),bk(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(bk(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(hT({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(hT({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(hT({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}o2.specKey="legends";class l2 extends o2{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return rH(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),bk(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){HM(this._option.dataSet,"discreteLegendFilter",r2),HM(this._option.dataSet,"discreteLegendDataMake",n2);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return bk(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!bA(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=hM(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i,s){const{title:n={},item:r={},pager:a={},background:o={},type:l,id:h,visible:c,orient:u,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=t,S=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:k={},pager:C={},background:T={}}=t;A=L(A),k=L(k),C=L(C),T=L(T);const M=S;if(d(M.maxRow)||d(M.maxCol)){const t=WC(s)?s:WC(u)?u:"left";d(M.maxRow)&&(M.maxRow=M.maxRow({rect:i,orient:t,id:h})),d(M.maxCol)&&(M.maxCol=M.maxCol({rect:i,orient:t,id:h}))}return A.visible?M.title=i2(A):M.title={visible:!1},P(k.focusIconStyle)||kM(k.focusIconStyle),k.shape&&(k.shape=s2(xM(k.shape))),k.label&&(k.label=xM(k.label)),k.value&&(k.value=xM(k.value)),k.background&&(k.background=xM(k.background)),GC(k.maxWidth)&&(k.maxWidth=Number(k.maxWidth.substring(0,k.maxWidth.length-1))*i.width/100),GC(k.width)&&(k.width=Number(k.width.substring(0,k.width.length-1))*i.width/100),GC(k.height)&&(k.height=Number(k.height.substring(0,k.height.length-1))*i.width/100),M.item=k,"scrollbar"===C.type?(P(C.railStyle)||kM(C.railStyle),P(C.sliderStyle)||kM(C.sliderStyle)):(P(C.textStyle)||kM(C.textStyle),C.handler&&xM(C.handler)),M.pager=C,T.visible&&!P(T.style)&&(hT(M,T.style),p(T.padding)&&(M.padding=T.padding)),M}(this._spec,t,this.layoutOrient)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return WY}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(FY.legendItemClick,(i=>{const s=R(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(FY.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(FY.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,datum:t.datum,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=nH(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=nH(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}l2.specKey="legends",l2.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},l2.type=r.discreteLegend;const h2=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},c2=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?yM(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function d2(t){const i=hT({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:y,data:_,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:C,seriesId:T,padding:M}=i,w=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?w.title=i2(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=kM(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=kM(r.style)),P(a.style)||(w.trackStyle=kM(a.style)),w.startText=xM(o),w.endText=xM(l),w.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>kM(i(t,e,s)):P(i)||(e.style=kM(i)),e}(h),P(c)||(w.sizeBackground=kM(c)),u.visible&&!P(u.style)&&(hT(w,u.style),p(u.padding)&&(w.padding=u.padding)),w}const u2={color:$Y,size:ZY},p2={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},g2=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},p2),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},f2={horizontal:g2(!0),vertical:g2(!1)},m2=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},p2),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},v2={horizontal:m2(!0),vertical:m2(!1)},y2=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],_2=[2,10];class b2 extends o2{static getSpecInfo(t){const e=rH(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),bk(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){HM(this._option.dataSet,"continuousLegendFilter",c2),HM(this._option.dataSet,"continuousLegendDataMake",h2);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>xk(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=hM(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!bA(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=hM(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?y2:_2);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 h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},d2(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return u2[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}b2.specKey="legends",b2.builtInTheme={colorLegend:f2,sizeLegend:v2},b2.type=r.continuousLegend;const x2=(t,e)=>p(e)?t.map((t=>e[t])):void 0,S2=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),A2=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function k2(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=C2(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>S2(i,s)(t)&&S2(n,r)(t)&&(u(a)||S2([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:OM.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return Jz.globalConfig.uniqueTooltip&&Jz.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:OM.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return Jz.globalConfig.uniqueTooltip&&Jz.hideTooltip(a.id),m}return"none"}const C2=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=x2(c,t);let y=x2(d,t);const _=A2(y),b=!_&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(S2(c,v));if(!_&&(y=x2(d,i),!A2(y)))return;const n=e.type===CC.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=Ek(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(S2(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=x2(d,o),!A2(y))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(S2(c,n));if(!_&&(y=x2(d,r),!A2(y)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===CC.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(S2(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=x2(d,i),!A2(y))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(S2(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=x2(d,a),h=y,!A2(y)&&!a)return;A2(y)||(y=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},T2=t=>p(t)&&!_(t),M2=t=>p(t)&&_(t),w2=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class E2 extends KN{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=hT({},...w2.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=hT({},s);w2.forEach((t=>{delete r[t]})),delete r.style;const a=hT({},r,i);return a.style=hT({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:mA(this._option.mode)||!gA(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=e_.getElementById(t.parentElement)):gA(this._option.mode)&&(t.parentElement=null==pA?void 0:pA.body)}}const B2={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class P2 extends $N{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=E2,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=gA(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&T2(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&Jz.globalConfig.uniqueTooltip&&l&&Jz.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:OM.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:OM.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?dW.canvas:dW.dom,n=cT.getComponentPluginInType(t);n||cA("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=cT.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(fA(s)||mA(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=k2(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(M2(t)){if(T2(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>lj(t,e[i])))}if(M2(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}P2.type=r.tooltip,P2.transformerConstructor=E2,P2.builtInTheme={tooltip:B2},P2.specKey="tooltip";var R2,O2;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(R2||(R2={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(O2||(O2={}));const I2={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},L2={labelZIndex:!0,gridZIndex:!0},D2={xField:!0,yField:!0,categoryField:!0,valueField:!0},F2={visible:!0,width:!0,style:!0};class z2 extends $N{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Ek(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!V(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||L2[i]||D2[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||F2[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:IM.chart}:{source:OM.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:fA(e)||mA(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:OM.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:OM.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:OM.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{I2[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}z2.specKey="crosshair";const H2={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class j2 extends z2{static getSpecInfo(t){return rH(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=QH(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){QH(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:tj(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=Sk(this._regions,"cartesian");e&&(iW(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=rW(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new $W(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new qW(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}j2.specKey="crosshair",j2.builtInTheme={crosshair:H2},j2.type=r.cartesianCrosshair;class N2 extends z2{static getSpecInfo(t){return rH(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=Sk(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=TN(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=nH(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=ye([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=yt(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new $W(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new JW(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new QW(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new ZW(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}N2.specKey="crosshair",N2.builtInTheme={crosshair:H2},N2.type=r.polarCrosshair;const U2=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},V2=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},W2=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},G2=(t,e,i)=>{const s=e.domain();if(Mk(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},Y2=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&Mk(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},X2=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},K2=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},$2=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),q2=(t,e,i)=>{if(Mk(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class Z2{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=yt(this.getState().start+f,0,1),y=yt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===sj(ij(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=H({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=H({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=H({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(Z2,bK);class J2 extends $N{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:Y2(t,this._stateScale,this._isHorizontal),a="percent"===n?e:Y2(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=X2(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=q2(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&K2(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else bk(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),bk(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=ij(t),this._isHorizontal="horizontal"===sj(this._orient),this._dataFilterEvent=new Z2(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.change=!0,i.reRender=!0,!i.reCompile&&this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0),i}_getComponentOnlySpecKeys(){return null}_isComponentOnlySpecChange(t,e){const i=this._getComponentOnlySpecKeys();if(!i)return!1;return Object.keys(Object.assign(Object.assign({},e),t)).every((s=>V(null==e?void 0:e[s],null==t?void 0:t[s])||i[s]))}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(Mk(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>sj(t._orient)===sj(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Mk(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};bk(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=Mk(d.getScale(0).type),p=Mk(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else bk(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;jM(r,"dataview",Ea),HM(r,"dataFilterComputeDomain",W2);const a=new Oa(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new YF(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(HM(this._option.dataSet,"dataFilterWithNewDomain",V2),HM(this._option.dataSet,"lockStatisticsFilter",U2),bk(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Mk(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Mk(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(Mk(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!V(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;$2("start",i,this._spec)&&$2("end",s,this._spec)&&(t="percent"===i?this._spec.start:Y2(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:Y2(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?Y2(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?Y2(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=G2(this._start,this._stateScale,X2(i,this._isHorizontal)),this._endValue=G2(this._end,this._stateScale,X2(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Mk(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=q2(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&bk(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new vC:new qk,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),K(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=K2(h);if(!this._dataUpdating&&Ek(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,Ek(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(J2,bK);class Q2 extends KN{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=hT({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const t5=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),e5={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:t5(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:t5(!0)},i5={width:!0,height:!0,showDetail:!0,middleHandler:!0,background:!0,startHandler:!0,endHandler:!0,startText:!0,endText:!0,dragMask:!0,selectedBackground:!0,backgroundChart:!0,selectedBackgroundChart:!0,showBackgroundChart:!0};class s5 extends J2{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=Q2,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=G2(e,this._stateScale,X2(s,this._isHorizontal)),a=G2(i,this._stateScale,X2(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new vC),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(X2(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=X2(t,this._isHorizontal),this.effect.onZoomChange())}_getComponentOnlySpecKeys(){return i5}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new vC;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(X2(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),K(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Mk(t.type)||e[0]!==X(e))&&(!Ek(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:X2(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>G2(t,this._stateScale,X2(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new FG(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>G2(t,this._stateScale,X2(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:kM(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:kM(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:kM(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:kM(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:kM(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:kM(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:kM(g.style)},selectedBackgroundStyle:kM(this._spec.selectedBackground.style),dragMaskStyle:kM(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:hT(kM(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},kM(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:hT(kM(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},kM(null===(d=m.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=nH(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(X2(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}s5.type=r.dataZoom,s5.transformerConstructor=Q2,s5.builtInTheme={dataZoom:e5},s5.specKey="dataZoom";const n5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},r5={width:!0,height:!0,rail:!0,slider:!0,round:!0,innerPadding:!0,minSliderSize:!0};class a5 extends J2{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=dk(this._start,e)&&dk(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=X2(n,this._isHorizontal),a=G2(e,this._stateScale,r),o=G2(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentOnlySpecKeys(){return r5}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new RW(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=kM(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=kM(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}a5.type=r.scrollBar,a5.builtInTheme={scrollBar:n5},a5.specKey="scrollBar";const o5=(t,e)=>{const{datum:i,title:s,content:n}=d(e)?e():e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},l5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),h5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:l5("l1FontSize","primaryFontColor")},content:{visible:!0,style:l5("l2FontSize","tertiaryFontColor")}};class c5 extends $N{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return rH(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(MM(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(MM(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){HM(this._option.dataSet,"indicatorFilter",o5);const t=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:()=>({title:this._title,content:this._content,datum:()=>this._activeDatum})}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new YF(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=hT({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},AM(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?JC(l,this._computeLayoutRadius()):0,dy:h?JC(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},AM(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)V(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new tX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}c5.type=r.indicator,c5.builtInTheme={indicator:h5},c5.specKey="indicator";const d5=["sum","average","min","max","variance","standardDeviation","median"];function u5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=K(s);return er}function p5(t,e){return t?`${t}_${e}_extend`:`marker_${e}_extend`}function g5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.x)&&u5(e,t.x,i)&&(null===(l=null==h?void 0:(o=h.getXAxisHelper()).setExtendDomain)||void 0===l||l.call(o,p5(a,"xAxis"),t.x)),c=GC(t.x)?y5(t.x,n)+r.x:_5(h.getXAxisHelper(),[t.x])+r.x,c}function f5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.y)&&u5(e,t.y,i)&&(null===(l=null===(o=h.getYAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,p5(a,"yAxis"),t.y)),c=GC(t.y)?y5(t.y,n)+r.y:_5(h.getYAxisHelper(),[t.y])+r.y,c}function m5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.angle)&&u5(e,t.angle,i)&&(null===(a=null===(r=o.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,p5(n,"angleAxis"),t.angle)),_5(o.angleAxisHelper,[t.angle])}function v5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.radius)&&u5(e,t.radius,i)&&(null===(a=null===(r=o.radiusAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,p5(n,"radiusAxis"),t.radius)),_5(o.radiusAxisHelper,[t.radius])}function y5(t,e){return Number(t.substring(0,t.length-1))*e/100}function _5(t,e){const i=t.getScale(0);return Mk(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function b5(t){return d5.includes(t)}function x5(t,e,i,s,n,r=!1,a){const o=e.getRegion(),l=o.getLayoutStartPoint(),h=i.getRegion(),c=h.getLayoutStartPoint(),d=Math.abs(Math.min(l.x,c.x)-Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width)),u=Math.abs(Math.min(l.y,c.y)-Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height)),g={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},f=[],m=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,v=s.getXAxisHelper(),y=s.getYAxisHelper(),_=v.getScale(0).domain(),b=y.getScale(0).domain(),x=r&&!v.isContinuous&&!!v.getBandwidth,S=r&&!y.isContinuous&&!!y.getBandwidth,A={min:null,max:null},k={min:null,max:null};return m.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=g5(t,_,n,g,d,l,a),r=f5(t,b,n,g,u,l,a),S5(s,x,A,f.length),S5(r,S,k,f.length),f.push([{x:s,y:r}]);else if(e){s=g5(t,_,n,g,d,l,a),r=Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height);const e=Math.min(l.y,c.y);S5(s,x,A,f.length),f.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(l.x,c.x),r=f5(t,b,n,g,u,l,a);const e=Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width);S5(r,S,k,f.length),f.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(f,v,y,A,k),f}function S5(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=m5(t,h,n,a,r),i=v5(t,c,n,a,r);o.push([{angle:e,radius:i}])}else if(e){const e=m5(t,h,n,a,r);o.push([{angle:e,radius:-d},{angle:e,radius:d}])}else if(i){const e=v5(t,c,n,a,r);o.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),o}function k5(t,e){return(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e}function C5(t,e,i,s,n){const r=[],a=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,o=_(s);return i&&a.forEach((t=>{!function(t,e,i,s){var n,r,a,o;const l=e.getXAxisHelper().getScale(0).domain(),h=e.getYAxisHelper().getScale(0).domain(),c=Y(t.x),d=Y(t.y);1===c.length&&S(c[0])&&u5(l,c[0],i)&&(null===(r=null===(n=e.getXAxisHelper())||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,p5(s,"xAxis"),c[0])),1===d.length&&S(d[0])&&u5(h,d[0],i)&&(null===(o=null===(a=e.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,p5(s,"yAxis"),d[0]))}(t,k5(t,e),i,n)})),a.forEach(((t,i)=>{const n=k5(t,e),a=n.getRegion(),l=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();let d=0,u=0;if(s){const t=o?s[i]:s,e=t.x,n=t.y;e&&(d=GC(e)?Number(e.substring(0,e.length-1))*h/100:e),n&&(u=GC(n)?Number(n.substring(0,n.length-1))*c/100:n)}const p=Y(t.x),g=Y(t.y);r.push({x:_5(n.getXAxisHelper(),p)+l.x+d,y:_5(n.getYAxisHelper(),g)+l.y+u})})),r}function T5(t,e,i,s){const n=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var r,a,o,l;const h=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,c=h.angleAxisHelper.getScale(0).domain(),d=h.radiusAxisHelper.getScale(0).domain(),u=Y(t.angle),p=Y(t.radius);1===u.length&&S(u[0])&&u5(c,u[0],i)&&(null===(a=null===(r=h.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,p5(s,"angleAxis"),u[0])),1===p.length&&S(p[0])&&u5(d,p[0],i)&&(null===(l=null===(o=h.radiusAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,p5(s,"radiusAxis"),p[0])),n.push({angle:_5(h.angleAxisHelper,u),radius:_5(h.radiusAxisHelper,p)})})),n}function M5(t,e,i){let{x:s,y:n}=t;return GC(s)&&(s=y5(s,e)),GC(n)&&(n=y5(n,i)),{x:s,y:n}}function w5(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=M5(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>M5(t,n,r)))}function E5(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function B5(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},kM(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},R5(kM(n.style),i,s)),p(n.padding)&&(t.padding=oi(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=R5(kM(r),i,s)),t}return{visible:!1}}function P5(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function R5(t,e,i){return d(t)?t(e,i):t}function O5(t,e){return d(t)?t(e):t}function I5(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function L5(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function D5(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=L5(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function F5(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=L5(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function z5(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function H5(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),y(t[c])&&b5(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),y(t[d])&&b5(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),y(t[a])&&b5(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),y(t[l])&&b5(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;_(s)?i.x=s.map((i=>N5(i,t,e))):i.x=N5(s,t,e)}if(p(e.y)){const s=e.y;_(s)?i.y=s.map((i=>N5(i,t,e))):i.y=N5(s,t,e)}if(p(e.angle)){const s=e.angle;_(s)?i.angle=s.map((i=>N5(i,t,e))):i.angle=N5(s,t,e)}if(p(e.radius)){const s=e.radius;_(s)?i.radius=s.map((i=>N5(i,t,e))):i.radius=N5(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=N5(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const j5={min:(t,e)=>uk(t[0].latestData,e.field),max:(t,e)=>pk(t[0].latestData,e.field),sum:function(t,e){return gk(t[0].latestData,e.field)},average:function(t,e){return fk(t[0].latestData,e.field)},variance:function(t,e){return mk(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(mk(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function N5(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(m(t)){const{aggrType:i,field:s}=t;return j5[i](e,{field:s})}return t}function U5(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}const V5=t=>{var e;const i=null===(e=null==t?void 0:t.dataSet)||void 0===e?void 0:e.dataViewMap;return i?Object.values(i).filter(Boolean):[]},W5=(t,e)=>{var i,s;null===(i=null==t?void 0:t.target)||void 0===i||i.removeListener("change",e.reRunAllTransform),null===(s=null==t?void 0:t.target)||void 0===s||s.removeListener("markRunning",e.markRunning)},G5=t=>{if(!t)return;V5(t).forEach((e=>{W5(e,t)}));const e=null==t?void 0:t.rawData;Array.isArray(e)&&e.forEach((e=>{W5(e,t)}))},Y5=(t,e)=>{if(!t)return;const i=new Set(V5(t)),s=[],n=t=>{const r=null==t?void 0:t.rawData;Array.isArray(r)&&r.forEach((t=>{i.has(t)&&e(t)&&!s.includes(t)&&(s.push(t),n(t))}))};n(t),(t=>{const e=Array.from(new Set(t.filter(Boolean)));e.length&&(e.forEach(G5),e.forEach((t=>{var e;null===(e=t.destroy)||void 0===e||e.call(t)})))})([t,...s])},X5="__vchart_marker_coordinate__",K5=["coordinate","coordinates","x","y","x1","y1","angle","angle1","radius","radius1"],$5=["position","positions","coordinatesOffset","regionRelative"],q5=["offsetX","offsetY","confine"],Z5=t=>Array.isArray(t)?t.map(Z5):t&&"object"==typeof t?"function"!=typeof t.formatMethod?t:Object.assign(Object.assign({},t),{formatMethod:"__vchart_marker_format_method__"}):t,J5=t=>{if(Array.isArray(t))return t.map(J5);if(!t||"object"!=typeof t)return t;const e=Object.assign({},t);return Object.keys(e).forEach((t=>{"style"===t||t.endsWith("Style")?e[t]="__vchart_marker_style__":e[t]=J5(e[t])})),e},Q5=(t,e)=>{if(!t||"object"!=typeof t)return t;const i=Object.assign({},t);e.normalizeDomainPosition&&K5.forEach((t=>{i[t]=X5})),e.normalizeAutoRange&&"autoRange"in i&&(i.autoRange="__vchart_marker_auto_range__"),$5.forEach((t=>{t in i&&(i[t]=X5)})),"label"in i&&(i.label=Z5(i.label)),Object.keys(i).forEach((t=>{i[t]=J5(i[t])}));const s=i.itemContent;if(s&&"object"==typeof s){i.itemContent=Object.assign({},s),q5.forEach((t=>{t in i.itemContent&&(i.itemContent[t]=X5)}));const t=i.itemContent.text;t&&"object"==typeof t&&(i.itemContent.text=Object.assign(Object.assign({},Z5(t)),{text:"__vchart_marker_text__"}))}return i};class t3 extends $N{constructor(){super(...arguments),this.layoutType="none",this._markerDataChangeHandler=null,this._markerDataOwned=!1,this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return rH(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getAutoRangeExtendDomainKeyPrefix(){return`marker_${this.type}_${this.id}`}_getAutoRangeExtendDomainKey(t){return`${this._getAutoRangeExtendDomainKeyPrefix()}_${t}_extend`}_clearAutoRangeExtendDomain(){var t,e;Y(null===(e=(t=this._option).getAllSeries)||void 0===e?void 0:e.call(t)).forEach((t=>{var e,i,s,n,r,a,o,l,h,c;null===(s=null===(i=null===(e=null==t?void 0:t.getXAxisHelper)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.setExtendDomain)||void 0===s||s.call(i,this._getAutoRangeExtendDomainKey("xAxis"),void 0),null===(a=null===(r=null===(n=null==t?void 0:t.getYAxisHelper)||void 0===n?void 0:n.call(t))||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,this._getAutoRangeExtendDomainKey("yAxis"),void 0),null===(l=null===(o=null==t?void 0:t.angleAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,this._getAutoRangeExtendDomainKey("angleAxis"),void 0),null===(c=null===(h=null==t?void 0:t.radiusAxisHelper)||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,this._getAutoRangeExtendDomainKey("radiusAxis"),void 0)}))}_updateMarkerLayout(){this._clearAutoRangeExtendDomain(),this._markerLayout()}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return y(e)&&b5(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ra;return e.registerParser("array",s),new Oa(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}_setMarkerData(t,e=!1){this._releaseMarkerData(),this._markerData=t,this._markerDataOwned=e}_bindMarkerDataChange(){var t;(null===(t=this._markerData)||void 0===t?void 0:t.target)&&(this._markerDataChangeHandler=()=>{this._updateMarkerLayout()},this._markerData.target.on("change",this._markerDataChangeHandler))}_releaseMarkerData(){const t=this._markerData;(null==t?void 0:t.target)&&this._markerDataChangeHandler&&t.target.removeListener("change",this._markerDataChangeHandler),this._markerDataChangeHandler=null,this._markerDataOwned&&Y5(t,(t=>t.name===`${this.type}_${this.id}_data`)),this._markerData=null,this._markerDataOwned=!1}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._updateMarkerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._updateMarkerLayout.bind(this)))}clear(){super.clear(),this._markerComponent=null,this._firstSeries=null}release(){this._releaseMarkerData(),super.release()}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=Sk(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=XC(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=XC(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reRender=!0,i.change=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake||i.reCompile||!this._isAutoRangeSpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,scaleDomain:!0,layout:!0,render:!0}):i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){const i=!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange);return V(Q5(e,{normalizeDomainPosition:i}),Q5(t,{normalizeDomainPosition:i}))}_isAutoRangeSpecChange(t,e){return!(!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange))&&V(Q5(e,{normalizeDomainPosition:!0,normalizeAutoRange:!0}),Q5(t,{normalizeDomainPosition:!0,normalizeAutoRange:!0}))}reInit(t){super.reInit(t),this._releaseMarkerData(),this._bindSeries(),this._initDataView(),this._buildMarkerAttributeContext(),this._markerComponent&&this._updateMarkerLayout()}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();HM(this._option.dataSet,"markerAggregation",H5),HM(this._option.dataSet,"markerFilter",U5),this._releaseMarkerData();const i=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(i,!0),this._bindMarkerDataChange()}}function e3(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=uk(t,e),r=pk(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class i3 extends t3{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=D5(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:R5(kM(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>B5(t,this._markerData,this._markAttributeContext))),state:{line:P5(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:P5(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:P5(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return P5(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return P5(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:R5(kM(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:R5(kM(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=E5([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=D5(t);if(this._setMarkerData(this._getRelativeDataView()),!(i||s||n||r||a||o||l||h||c||d||e))return;HM(this._option.dataSet,"markerAggregation",H5),HM(this._option.dataSet,"markerRegression",e3),HM(this._option.dataSet,"markerFilter",U5);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Oa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(m,!0),this._bindMarkerDataChange()}}i3.specKey="markLine";const s3=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),n3={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},r3={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:s3(!1),endSymbol:s3(!0),label:n3};class a3 extends i3{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new AY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:y}=D5(e);let _=[];if(u||f||g||m||v||a&&l||a&&h){const t=x5(i,s,n,r,d,!1,this._getAutoRangeExtendDomainKeyPrefix());_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=C5(i,r,d,e.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):c&&(_=w5(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n,r,a,o,l;const h=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const l=this._startRelativeSeries,c=this._endRelativeSeries,{multiSegment:u,mainSegmentIndex:g}=this._spec.line||{},{connectDirection:f}=this._spec;let{expandDistance:m=0}=this._spec;const{points:v,limitRect:y}=h,_=Y(v).filter(Boolean);if(d(m)){const n=null===(t=null==l?void 0:l.getRegion)||void 0===t?void 0:t.call(l),r=null===(e=null==c?void 0:c.getRegion)||void 0===e?void 0:e.call(c);m=m(this._markerData,Object.assign(Object.assign({},this.getMarkAttributeContext()),{region:null===(s=null===(i=this._relativeSeries)||void 0===i?void 0:i.getRegion)||void 0===s?void 0:s.call(i),startRegion:n,endRegion:r,coordinatePoints:_}))}let b;if(GC(m)){const t=l.getRegion(),e=t.getLayoutStartPoint(),i=c.getRegion(),s=i.getLayoutStartPoint();if("bottom"===f||"top"===f){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));b=Number(m.substring(0,m.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));b=Number(m.substring(0,m.length-1))*n/100}}else b=m;if(!v||v.length<2)return void(null===(n=this._markerComponent)||void 0===n||n.setAttributes(h));const x=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(v[0],v[1],f,b);let S;S=u&&p(g)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(v[0],v[1],f,b));const A=Y((null!==(a=null===(r=this._markerComponent)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{}).label),C=Y(h.label),T=Y(this._spec.label);null===(o=this._markerComponent)||void 0===o||o.setAttributes({points:u?[[x[0],x[1]],[x[1],x[2]],[x[2],x[3]]]:x,label:C.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=S.dx)&&void 0!==i?i:0,h=null!==(s=S.dy)&&void 0!==s?s:0;const c=null!==(n=T[e])&&void 0!==n?n:T[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),S),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=A[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:y,multiSegment:u,mainSegmentIndex:g,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(l=this._markerComponent)||void 0===l||l.setAttributes(h)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=D5(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new Oa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}a3.type=r.markLine,a3.coordinateType="cartesian",a3.builtInTheme={markLine:r3};class o3 extends i3{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=D5(this._spec);return e||i?new TY(t):new AY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=D5(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=A5(i,s,n,r,a,this._getAutoRangeExtendDomainKeyPrefix());p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=T5(i,r,a,this._getAutoRangeExtendDomainKeyPrefix()),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=D5(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}o3.type=r.polarMarkLine,o3.coordinateType="polar",o3.builtInTheme={polarMarkLine:r3};class l3 extends $N{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=WC(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return rH(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,s&&!i.reMake&&(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=XC(this._spec.width,a.width,null,a.width),l=XC(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)V(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new JY(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}l3.type=r.title,l3.specKey=r.title,l3.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class h3 extends t3{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=F5(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:R5(kM(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>B5(t,this._markerData,this._markAttributeContext))),state:{area:P5(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>P5(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return P5(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=E5([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=F5(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}h3.specKey="markArea";const c3={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class d3 extends h3{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new CY(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=F5(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=x5(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=x5(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=C5(s,a,u,i.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):d&&(f=w5(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=F5(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}d3.type=r.markArea,d3.coordinateType="cartesian",d3.builtInTheme={markArea:c3};class u3 extends h3{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=F5(this._spec);return i||e||s?new MY(t):new CY(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=F5(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=A5(i,s,n,r,c,this._getAutoRangeExtendDomainKeyPrefix());l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=T5(i,r,c,this._getAutoRangeExtendDomainKeyPrefix()),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=F5(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}u3.type=r.polarMarkArea,u3.coordinateType="polar",u3.builtInTheme={polarMarkArea:c3};const p3=t=>kM(Object.assign({},t)),g3=t=>Object.assign(Object.assign({},t),{style:Object.assign({},kM(t.style))}),f3=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=p3(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=p3(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),y=(_=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},kM(Object.assign({},_)));var _;const b=g3(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=g3(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=g3(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=g3(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:y}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},m3=t=>"left"===t||"right"===t,v3=t=>"top"===t||"bottom"===t,y3={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class _3 extends $N{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},f3(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},f3(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?V(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new gX(t):this._playerComponent=new vX(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=m3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=m3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(lX.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(lX.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(lX.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(lX.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(lX.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(lX.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.type)!==(null==t?void 0:t.type)?(i.reMake=!0,i):(!s||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i)}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=m3(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=v3(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):m3(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):v3(this._orient)?this._maxSize():t.height}_computeDx(t){return m3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return v3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}_3.builtInTheme={player:y3},_3.specKey="player",_3.type=r.player;class b3 extends $N{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,V(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=OC({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==bF.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}b3.type=r.label;class x3 extends C${constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}x3.type="text",x3.constructorType="label";const S3=()=>{T$(),cT.registerMark(x3.constructorType,x3)};class A3 extends KN{_initTheme(t,e){return{spec:t,theme:this._theme}}}class k3 extends b3{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=A3,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(BM.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(BM.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),bk(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=hT({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},NK(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[JT])):t=>t.filter((t=>t.data[ZT]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?UK(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}k3.type=r.label,k3.specKey="label",k3.transformerConstructor=A3;class C3 extends b3{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[$T]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return hT({textStyle:{pickable:!0===this._spec.interactive},position:T3(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[JT]:t.data[ZT]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>UK({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function T3(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}C3.type=r.totalLabel,C3.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},C3.specKey="totalLabel";class M3 extends t3{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=z5(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b,x,S,A,k,C,T,M,w,E,B,P,R,O,I,L;const{itemContent:D={},itemLine:F={},targetSymbol:z={}}=this._spec,j=this._relativeSeries.getRegion(),N=D,{type:U="text",text:V,symbol:W,image:G,richText:Y,customMark:X,textStyle:K,symbolStyle:$,imageStyle:q,richTextStyle:Z,customMarkStyle:J,style:Q={},state:tt={}}=N,et=e(N,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let it=null,st=null,nt=U,rt={};if("text"===U){it=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:tt;const r=null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:K)&&void 0!==n?n:Q;(t=>"rich"===(null==t?void 0:t.type))(r)?(nt="richText",rt={width:100,height:100},st=R5(H(rt,(t=>{if(!t)return t;const{type:i,text:s,textConfig:n}=t,r=e(t,["type","text","textConfig"]),a=Object.assign({},r),o=p(n)?n:s;return p(o)&&(a.textConfig=o),a})(r)),this._markerData,this._markAttributeContext)):(rt={dx:0,dy:0},st=B5(Object.assign(Object.assign({},V),{style:H(rt,r)}),this._markerData,this._markAttributeContext))}else"richText"===U?(it=null!==(r=null==Y?void 0:Y.state)&&void 0!==r?r:tt,rt={width:100,height:100},st=R5(H(rt,null!==(o=null!==(a=null==Y?void 0:Y.style)&&void 0!==a?a:Z)&&void 0!==o?o:Q),this._markerData,this._markAttributeContext)):"symbol"===U?(it=null!==(l=null==W?void 0:W.state)&&void 0!==l?l:tt,rt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},st=kM(R5(H(rt,null!==(c=null!==(h=null==W?void 0:W.style)&&void 0!==h?h:$)&&void 0!==c?c:Q),this._markerData,this._markAttributeContext))):"image"===U?(it=null!==(d=null==G?void 0:G.state)&&void 0!==d?d:tt,rt={width:80,height:80},st=R5(H(rt,null!==(g=null!==(u=null==G?void 0:G.style)&&void 0!==u?u:q)&&void 0!==g?g:Q),this._markerData,this._markAttributeContext)):"custom"===U&&(it=null!==(f=null==X?void 0:X.state)&&void 0!==f?f:tt,st=R5(null!==(v=null!==(m=null==X?void 0:X.style)&&void 0!==m?m:J)&&void 0!==v?v:Q,this._markerData,this._markAttributeContext));const at={zIndex:this.layoutZIndex,interactive:null===(y=this._spec.interactive)||void 0===y||y,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(b=this._spec.interactive)||void 0===b||b,position:{x:0,y:0},clipInRange:null!==(x=this._spec.clip)&&void 0!==x&&x,itemContent:Object.assign(Object.assign({type:nt,offsetX:O5(D.offsetX,j),offsetY:O5(D.offsetY,j)},et),{style:R5(st,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(S=z.offset)&&void 0!==S?S:0,visible:null!==(A=z.visible)&&void 0!==A&&A,size:null!==(k=z.size)&&void 0!==k?k:20,style:R5(z.style,this._markerData,this._markAttributeContext)},state:{line:P5(null!==(T=null===(C=this._spec.itemLine.line)||void 0===C?void 0:C.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineStartSymbol:P5(null!==(w=null===(M=this._spec.itemLine.startSymbol)||void 0===M?void 0:M.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:P5(null!==(B=null===(E=this._spec.itemLine.endSymbol)||void 0===E?void 0:E.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:P5(it,this._markerData,this._markAttributeContext),textBackground:P5(null===(R=null===(P=this._spec.itemContent.text)||void 0===P?void 0:P.labelBackground)||void 0===R?void 0:R.state,this._markerData,this._markAttributeContext),targetItem:P5(null!==(I=null===(O=this._spec.targetSymbol)||void 0===O?void 0:O.state)&&void 0!==I?I:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:ot,line:lt={}}=F,ht=e(F,["visible","line"]);at.itemLine=!1!==ot?Object.assign(Object.assign({},ht),{visible:!0,lineStyle:kM(lt.style)}):{visible:!1};return new EY(at)}_markerLayout(){var t,i,s,n,r,a,o,l,h,c,d,u,g;const f=this._spec,m=this._markerData,v=this._relativeSeries,{point:y}=this._computePointsAttr(),_=this._getRelativeDataView().latestData,b=m?m.latestData[0]&&m.latestData[0].latestData?m.latestData[0].latestData:m.latestData:_,{itemLine:x={},itemContent:S={}}=this._spec,A=this._relativeSeries.getRegion(),{visible:k,line:C={}}=x,T=e(x,["visible","line"]),M=!1!==k?Object.assign(Object.assign({},T),{visible:!0,lineStyle:kM(C.style)}):{visible:!1},w=B5(Object.assign(Object.assign({},S.text),{style:H({dx:0,dy:0},null!==(i=null===(t=S.text)||void 0===t?void 0:t.style)&&void 0!==i?i:S.style)}),m,this._markAttributeContext);let E;if(f.clip||(null===(s=f.itemContent)||void 0===s?void 0:s.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=E5([v.getRegion()]);E={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(n=this._markerComponent.attribute)&&void 0!==n?n:{},e=null!==(a=null===(r=t.itemContent)||void 0===r?void 0:r.textStyle)&&void 0!==a?a:{},i=null===(o=this._spec.itemContent.text)||void 0===o?void 0:o.text,s=O5(S.offsetX,A),f=O5(S.offsetY,A);this._markerComponent.setAttributes({position:void 0===y?{x:null,y:null}:y,itemContent:Object.assign(Object.assign({},t.itemContent),{panel:null!==(l=w.panel)&&void 0!==l?l:null===(h=t.itemContent)||void 0===h?void 0:h.panel,padding:null!==(c=w.padding)&&void 0!==c?c:null===(d=t.itemContent)||void 0===d?void 0:d.padding,textStyle:Object.assign(Object.assign(Object.assign({},e),null!==(u=w.textStyle)&&void 0!==u?u:{}),{text:(null===(g=this._spec.itemContent.text)||void 0===g?void 0:g.formatMethod)?this._spec.itemContent.text.formatMethod(b,_):p(i)?i:e.text}),offsetX:I5(y,s,A),offsetY:I5(y,f,A)}),itemLine:M,limitRect:E,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=z5(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}M3.specKey="markPoint";const w3={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class E3 extends M3{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=x5(n,r,r,r,h,!1,this._getAutoRangeExtendDomainKeyPrefix()))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=C5(n,r,h,s.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix())[0]:l&&(c=w5(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=z5(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}E3.type=r.markPoint,E3.coordinateType="cartesian",E3.builtInTheme={markPoint:w3};class B3 extends M3{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=A5(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e,this._getAutoRangeExtendDomainKeyPrefix())[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}B3.type=r.polarMarkPoint,B3.coordinateType="polar",B3.builtInTheme={polarMarkPoint:w3};class P3 extends M3{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}P3.type=r.geoMarkPoint,P3.coordinateType="geo",P3.builtInTheme={geoMarkPoint:w3};const R3="inBrush",O3="outOfBrush",I3={style:!0,inBrush:!0,outOfBrush:!0};class L3 extends $N{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return rH(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),R3,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),O3,t.AttributeLevel.Series))}))}))}reInit(t){super.reInit(t),this.init()}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return V(e,t)||(i.change=!0,i.reRender=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||I3[i]))}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){var i;const s=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(Object.assign({brushStyle:kM(null===(i=this._spec)||void 0===i?void 0:i.style)},s)),this._initMarkBrushState(e,""),n.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new xX(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:kM(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(fX.brushActive,(s=>{this._initMarkBrushState(i,O3),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(fX.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(fX.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(fX.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(fX.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(fX.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(fX.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(a&&this._handleBrushChange(e,s),null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(fX.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec;n&&this._handleBrushChange(e,i);const r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},kM(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_setBrushState(t,e){var i;const s=null!==(i=t.currentStates)&&void 0!==i?i:[];uz(t,[...s.filter((t=>t!==R3&&t!==O3)),e])}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(this._setBrushState(i,R3),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(this._setBrushState(i,O3),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(this._setBrushState(i,R3),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(this._setBrushState(i,O3),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;gz(s,[R3,O3]),i&&pz(s,i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}L3.type=r.brush,L3.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},L3.specKey="brush";const D3={style:!0,state:!0};class F3 extends $N{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${IT}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=IH({},LH(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i.change=!0,i.reRender=!0,i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||D3[i]))}reInit(t){super.reInit(t),this._updateMarkStyleWithSpec(this._spec,this.getMarks()[0]),this.getMarks().forEach((t=>{t.commit(!1,!0)}))}_updateMarkStyleWithSpec(t,e){var i,s,n,r;if(t&&e&&(this.initMarkStyleWithSpec(e,t),"group"===t.type)){const a=null!==(n=null===(s=(i=e).getMarks)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[];null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._updateMarkStyleWithSpec(t,a[e])}))}}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ue).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ue;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}F3.type=r.customMark,F3.specKey="customMark";class z3{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>H3(t))),a=n.filter((t=>!H3(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>H3(t))),h=o.filter((t=>!H3(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function H3(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}z3.type="grid";const j3="vchart-tooltip",N3=`${j3}-container`,U3=`${j3}-title`,V3=`${j3}-content-box`,W3={offsetX:10,offsetY:10},G3="99999999999999";function Y3(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const X3=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,K3=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?Y3(t):"",$3=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},q3={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},Z3=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=q3[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class J3 extends AN{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:C}=this._option,T=m[_],M=hH(null==T?void 0:T.position,b,e),w=null!==(r=hH(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:LT,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:DT;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},H={x:0,y:0},j=1,N=1;const U=gA(this._env);if(U&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),U&&!P){const t=this._getParentElement(m);H=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-H.x,y:F.y-H.y},j=X3(e,F),N=X3(t,H)}const V=N/j,W={},G={x:M,y:M},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:C;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?E:B;switch(Z3(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},K=["x","y"];if(g(M))if((t=>g(t)&&(p(t.left)||p(t.right)||p(t.top)||p(t.bottom)))(M)){const{left:t,right:e,top:i,bottom:s}=M;W.left=$3(t,y),W.top=$3(i,y),W.right=$3(e,y),W.bottom=$3(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(M)&&K.forEach((t=>{const e=M[t];S(e)||d(e)?W[Y[t][0]]=$3(e,y):X(e,t)}));else p(M)&&(X({orient:M,mode:w},"x"),X({orient:M,mode:w},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?O:I,n="x"===t?A:C,r=Z3(G[t],t);if(k(W[Y[t][0]]))$[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))$[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}$[t]*=j,U&&($[t]+=z[t]),$[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(H[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/N:-H[t]/N,l=a/N+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(L?$[t]=l:($[t]-=0===r?n+i/2:2*n+i,$[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",t4=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=Q3(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=Q3(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},e4=(t={})=>{const{lineHeight:e}=t;return t.fontSize?XC(e,t.fontSize):0},i4=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=oi(r),a.padding=Q3(o)),{panelStyle:a,panelPadding:o}};function s4(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const n4=t=>{cT.registerComponentPlugin(t.type,t)};class r4 extends J3{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(r4.type),this.type=dW.dom,this._tooltipContainer=null==pA?void 0:pA.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(pA&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=i4(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(y.marginBottom=`${g}px`);const _={width:Q3(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=t4(h),x=t4(d),S=t4(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[A]=Q3(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=Q3(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=Q3(null!==(n=p.spacing)&&void 0!==n?n:0);const C=Math.max(e4(p),e4(d));return y.lineHeight=C>0?`${C}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(U3))),l=a.find((t=>t.className.includes(V3)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(U3),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(s4(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${j3}-column`),e.classList.add(`${j3}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(V3),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];s4(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));s4(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${j3}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=K3(e.key),e.keyStyle&&t4(e.keyStyle,l)):"value"===i?(o.innerHTML=K3(e.value),e.valueStyle&&t4(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?Y3(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?Y3(c):m,_=p,b=t=>new Qp({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ue));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=nu.IsGradientStr(u);if(!u||y(u)&&!T||d)return m=d?"none":u?Y3(u):"currentColor",`\n \n \n \n `;const M=T?nu.Parse(u):g(u)?u:null;if(M){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=M.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===M.gradient?t=`\n ${i}\n `:"linear"===M.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),s4(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(V3))),h=[...o.children].find((t=>t.className.includes(U3)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(U3)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=XC(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,s4(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=Sf({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n});return{width:r.width(),height:r.height(),text:s}};function l4(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:a4),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const h4=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class c4 extends J3{constructor(){super(c4.type),this.type=dW.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new TX({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=oi(d.padding),b=qC(d.padding),x=l4(Object.assign({textAlign:"right"===y?"right":"left"},u),i),S=l4(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=l4(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},C={panel:h4(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:M=[]}=t;let w=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!M.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;C.content=M.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:C}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=hT({},S,l4(b,void 0,{})),{width:s,height:n,text:r}=o4(h,i);T.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),y?e.push(s):t.push(s),o=Math.max(o,n)}if(p(m)){const t=hT({},A,l4(x,void 0,{})),{width:e,height:s,text:n}=o4(m,t);T.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};C?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(H){V=hT({},x,l4(N,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=o4(j,V);C.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=C.title.value.width,F=C.title.value.height,z=F+(P?C.title.spaceRow:0)}return E+=z,C.title.width=D,C.title.height=F,W()?w+=B||D:w+=Math.max(D,B),P&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=w-b.left-b.right-L-R-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=w,C.panel.height=E,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}c4.type=dW.canvas;const d4=()=>{n4(c4)},u4=(t="chart",e,i)=>{var s,n,a,o,l,h,c,d,u,p,g;const f={modelInfo:[]};if("chart"===t)f.isChart=!0,f.modelInfo.push({spec:e,type:"chart"});else if("region"===t)f.modelType="region",f.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(CC).includes(t))f.modelType="series",f.specKey="series",f.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&f.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=cT.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=Y(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=Y(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=cT.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=Y(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);Y(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},p4=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=u4(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||Y(e).some((e=>d(e)?e(t,i,s):rT(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=hT({},i),m=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:hT(f,m),hasChanged:!0};const i=hT({},t,m);aT(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[c])?f[c].push(t):u(f[c])?f[c]="component"===h?t:[t]:f[c]=[f[c],t]}return{chartSpec:f,hasChanged:!0}},g4=t=>{cT.registerChartPlugin(t.type,t)};class f4 extends AN{constructor(){super(f4.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[f4.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[f4.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=lT(this._option.globalInstance.getSpec(),["data",f4.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=lT(this._baseChartSpec,["data",f4.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(p(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(p(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(p(t.minWidth)&&e.width{const n=p4(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=lT(i,["data",f4.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}f4.pluginType="chart",f4.specKey="media",f4.type="MediaQueryPlugin";const m4=/\{([^}]+)\}/,v4=/\{([^}]+)\}/g,y4=/:/;class _4 extends AN{constructor(){super(_4.type),this.type="formatterPlugin",this._timeModeFormat={utc:yi.getInstance().timeUTCFormat,local:yi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ti.getInstance().format,this._numericSpecifier=Ti.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[_4.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),cT.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=m4.test(i),this._isNumericFormatterCache.set(i,s))),s){return i.replace(v4,((t,i)=>{if(!y4.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}))}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ai.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}_4.pluginType="chart",_4.specKey="formatter",_4.type="formatterPlugin";class b4 extends AN{constructor(){super(b4.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[b4.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=yK(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom{mW(),yW(),bW(),XV(),YV(),wV(),_V(),lN(),cN(),zz(),Lz(),QU(),fV(),cT.registerSeries(EV.type,EV),cT.registerChart(xW.type,xW)},()=>{mW(),yW(),bW(),YV(),wV(),_V(),lN(),kW(),cN(),MW(),QU(),fV(),cT.registerSeries(BX.type,BX),XV(),cT.registerChart(RX.type,RX)},()=>{mW(),yW(),bW(),YV(),XX(),XV(),cT.registerChart($X.type,$X)},()=>{mW(),yW(),XV(),YV(),aK(),cT.registerChart(lK.type,lK)},()=>{yW(),oq(),cT.registerChart(p1.type,p1)},()=>{mW(),yW(),XV(),YV(),Tq(),cT.registerChart(m1.type,m1)},()=>{mW(),yW(),bW(),XV(),YV(),Lq(),cT.registerChart(y1.type,y1)},()=>{mW(),yW(),bW(),XV(),YV(),XX(),cT.registerTransform("bin",Zr),cT.registerChart(k1.type,k1)},()=>{yW(),SK(),pK(),cT.registerSeries(kK.type,kK),cT.registerImplement("registerMap",WM),cT.registerImplement("unregisterMap",GM),Dz(),cT.registerChart(o1.type,o1)},()=>{yW(),S0(),cT.registerSeries(k0.type,k0),Q$(),Qq(),Sq(),sZ(),cT.registerChart(w1.type,w1)},()=>{yW(),XJ(),cT.registerChart(P1.type,P1)},()=>{yW(),gQ(),cT.registerChart(O1.type,O1)},()=>{mW(),yW(),bW(),XV(),YV(),t$(),cT.registerChart(G1.type,G1)},()=>{mW(),yW(),XV(),YV(),k$(),cT.registerTransform("boxplot",Jr),cT.registerChart(X1.type,X1)},()=>{mW(),yW(),XV(),YV(),sZ(),cT.registerChart(T1.type,T1)},()=>{mW(),yW(),XV(),YV(),uZ(),cT.registerChart(L1.type,L1)},()=>{mW(),yW(),XV(),YV(),L$(),cT.registerChart(F1.type,F1)},()=>{mW(),yW(),bW(),XV(),YV(),kW(),QU(),fV(),cT.registerSeries(j$.type,j$),cT.registerChart(Z1.type,Z1)},()=>{yW(),RQ(),cT.registerChart(H1.type,H1)},()=>{yW(),zQ(),cT.registerChart(N1.type,N1)},()=>{yW(),u0(),cT.registerChart(V1.type,V1)},()=>{yW(),IW(),n0(),cT.registerChart($1.type,$1)},()=>{yW(),R0(),cT.registerChart(Q1.type,Q1)},()=>{yW(),X0(),cT.registerChart(e2.type,e2)},()=>{mW(),yW(),bW(),XV(),cT.registerChart(b1.type,b1),YV()},fV,QU,()=>{cT.registerGraphicComponent(qN.lineAxis,((t,e)=>new XU(t,e))),cT.registerGraphicComponent(ZN.lineAxisGrid,((t,e)=>new SU(t,e))),aU(),cT.registerComponent(MX.type,MX)},()=>{cT.registerGraphicComponent(qN.lineAxis,((t,e)=>new XU(t,e))),cT.registerGraphicComponent(ZN.lineAxisGrid,((t,e)=>new SU(t,e))),aU(),cT.registerComponent(wX.type,wX)},()=>{cT.registerGraphicComponent(qN.lineAxis,((t,e)=>new XU(t,e))),cT.registerGraphicComponent(ZN.lineAxisGrid,((t,e)=>new SU(t,e))),aU(),cT.registerComponent(EX.type,EX)},kq,Sq,()=>{cT.registerComponent(l2.type,l2)},()=>{cT.registerComponent(b2.type,b2)},()=>{cT.registerComponent(P2.type,P2)},()=>{cT.registerComponent(j2.type,j2)},()=>{cT.registerComponent(N2.type,N2)},()=>{cT.registerComponent(s5.type,s5)},()=>{cT.registerComponent(a5.type,a5)},()=>{cT.registerComponent(c5.type,c5)},SK,()=>{cT.registerComponent(a3.type,a3),SY()},()=>{cT.registerComponent(d3.type,d3),kY()},()=>{cT.registerComponent(E3.type,E3),wY()},()=>{cT.registerComponent(o3.type,o3),TY._animate=sY,SY()},()=>{cT.registerComponent(u3.type,u3),MY._animate=rY,kY()},()=>{cT.registerComponent(B3.type,B3),wY()},()=>{cT.registerComponent(P3.type,P3),wY()},()=>{cT.registerComponent(l3.type,l3)},()=>{cT.registerComponent(_3.type,_3)},()=>{cT.registerGraphicComponent(k3.type,(t=>new fG(t))),S3(),QN(),cT.registerComponent(k3.type,k3,!0,1/0)},()=>{cT.registerGraphicComponent(C3.type,(t=>new fG(t))),S3(),QN(),cT.registerComponent(C3.type,C3,!0)},()=>{cT.registerComponent(L3.type,L3)},()=>{cT.registerComponent(F3.type,F3)},()=>{XW(Zy()),XW(vb()),yb()},()=>{cT.registerLayout(z3.type,z3)},d4,Wz,Xz]),Jz.useRegisters([()=>{DR(i_)}]),t.AxisSyncPlugin=kN,t.CanvasTooltipHandler=c4,t.ChartResizeZoomPlugin=b4,t.DEFAULT_CHART_HEIGHT=DT,t.DEFAULT_CHART_WIDTH=LT,t.DEFAULT_CLOSE_STROKE_JOIN=eH,t.DEFAULT_DATA_INDEX=zT,t.DEFAULT_DATA_KEY=HT,t.DEFAULT_DATA_SERIES_FIELD=jT,t.DEFAULT_KEY=rM,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=tH,t.DEFAULT_MAP_LOOK_UP_KEY=aM,t.DEFAULT_MEASURE_CANVAS_ID=FT,t.DEFAULT_SERIES_STYLE_NAME=NT,t.DEFAULT_SMOOTH_INTERPOLATE=Qz,t.DomTooltipHandler=r4,t.Factory=cT,t.FormatterPlugin=_4,t.MOSAIC_CAT_END_PERCENT=iM,t.MOSAIC_CAT_START_PERCENT=eM,t.MOSAIC_VALUE_END_PERCENT=tM,t.MOSAIC_VALUE_START_PERCENT=QT,t.ManualTicker=class extends AD{constructor(t){super(t),this.lastFrameTime=0,this.status=Rl.RUNNING}setupTickHandler(){const t=new iH;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Rl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Rl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Rl.RUNNING,!0}},t.MediaQuery=f4,t.PREFIX=IT,t.SEGMENT_FIELD_END=nM,t.SEGMENT_FIELD_START=sM,t.STACK_FIELD_END=WT,t.STACK_FIELD_END_OffsetSilhouette=KT,t.STACK_FIELD_END_PERCENT=YT,t.STACK_FIELD_KEY=UT,t.STACK_FIELD_START=VT,t.STACK_FIELD_START_OffsetSilhouette=XT,t.STACK_FIELD_START_PERCENT=GT,t.STACK_FIELD_TOTAL=$T,t.STACK_FIELD_TOTAL_BOTTOM=JT,t.STACK_FIELD_TOTAL_PERCENT=qT,t.STACK_FIELD_TOTAL_TOP=ZT,t.StreamLight=aD,t.ThemeManager=TT,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=Jz,t.boundsInRect=$C,t.builtinThemes=fT,t.calcLayoutNumber=XC,t.calcPadding=KC,t.computeActualDataScheme=PC,t.convertPoint=ZC,t.createArc=Kg,t.createArea=Gg,t.createGroup=sf,t.createLine=sg,t.createRect=og,t.createRichText=Hg,t.createSymbol=tg,t.createText=Kp,t.darkTheme=nT,t.dataScheme=QC,t.default=Jz,t.defaultThemeName=mT,t.getActualColor=OC,t.getActualNumValue=JC,t.getColorSchemeBySeries=FC,t.getDataScheme=BC,t.getFunnelTheme=pT,t.getMergedTheme=kT,t.getSpecInfo=rH,t.getTheme=xT,t.hasThemeMerged=_T,t.isColorKey=IC,t.isPercent=GC,t.isPercentOffset=YC,t.isProgressiveDataColorScheme=LC,t.isTokenKey=eT,t.isValidOrient=WC,t.lightTheme=sT,t.lookup=aH,t.measureText=OT,t.normalizeLayoutPaddingSpec=qC,t.queryColorFromColorScheme=RC,t.queryToken=tT,t.registerCanvasTooltipHandler=d4,t.registerChartPlugin=g4,t.registerChartResizeZoomPlugin=()=>{g4(b4)},t.registerDataSetInstanceParser=jM,t.registerDataSetInstanceTransform=HM,t.registerDomTooltipHandler=()=>{n4(r4)},t.registerFormatPlugin=()=>{g4(_4)},t.registerMediaQuery=()=>{g4(f4)},t.registerTheme=bT,t.removeTheme=ST,t.themeExist=AT,t.themes=vT,t.token=iT,t.transformColorSchemeToStandardStruct=DC,t.transformToGraphic=kM,t.version="2.1.0",t.vglobal=e_,t.warn=hA,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/wx-vchart/package.json b/packages/wx-vchart/package.json index 279bf6478f..50b649ced9 100644 --- a/packages/wx-vchart/package.json +++ b/packages/wx-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/wx-vchart", - "version": "2.0.22", + "version": "2.1.0", "description": "", "main": "index.js", "miniprogram": ".", @@ -46,4 +46,4 @@ "access": "public", "registry": "https://registry.npmjs.org/" } -} \ No newline at end of file +} diff --git a/tools/bugserver-trigger/package.json b/tools/bugserver-trigger/package.json index 37a4731fcb..4b20980598 100644 --- a/tools/bugserver-trigger/package.json +++ b/tools/bugserver-trigger/package.json @@ -8,8 +8,8 @@ "ci": "ts-node --transpileOnly --skipProject ./scripts/trigger-test.ts" }, "dependencies": { - "@visactor/vchart": "workspace:2.0.22", - "@visactor/vchart-extension": "workspace:2.0.22" + "@visactor/vchart": "workspace:2.1.0", + "@visactor/vchart-extension": "workspace:2.1.0" }, "devDependencies": { "@rushstack/eslint-patch": "~1.1.4", diff --git a/tools/story-player/package.json b/tools/story-player/package.json index f0169f785f..7eb8815a34 100644 --- a/tools/story-player/package.json +++ b/tools/story-player/package.json @@ -58,8 +58,8 @@ "dependencies": { "@visactor/vrender-core": "1.1.0", "@visactor/vrender-kits": "1.1.0", - "@visactor/vchart": "workspace:2.0.22", + "@visactor/vchart": "workspace:2.1.0", "@visactor/vrender": "1.1.0", "@visactor/vutils": "~1.0.23" } -} \ No newline at end of file +}